@firebase/auth-compat 0.2.20 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/esm/index.node.esm.js +1 -1
- package/dist/firebase-auth.js +1 -1
- package/dist/firebase-auth.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm2017.js +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/package.json +5 -5
package/dist/firebase-auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(mi,vi){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n,t,i=e(mi);const r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const s=[];for(let n=0;n<r.length;n+=3){var o=r[n],a=n+1<r.length,u=a?r[n+1]:0,c=n+2<r.length,l=c?r[n+2]:0;let e=(15&u)<<2|l>>6,t=63&l;c||(t=64,a||(e=64)),s.push(i[o>>2],i[(3&o)<<4|u>>4],i[e],i[t])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(n){const r=[];let i=0;for(let t=0;t<n.length;t++){let e=n.charCodeAt(t);e<128?r[i++]=e:(e<2048?r[i++]=e>>6|192:(55296==(64512&e)&&t+1<n.length&&56320==(64512&n.charCodeAt(t+1))?(e=65536+((1023&e)<<10)+(1023&n.charCodeAt(++t)),r[i++]=e>>18|240,r[i++]=e>>12&63|128):r[i++]=e>>12|224,r[i++]=e>>6&63|128),r[i++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){var i,s,o=e[n++];o<128?t[r++]=String.fromCharCode(o):191<o&&o<224?(i=e[n++],t[r++]=String.fromCharCode((31&o)<<6|63&i)):239<o&&o<365?(s=((7&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))):(i=e[n++],s=e[n++],t[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(t,e){this.init_();var n=e?this.charToByteMapWebSafe_:this.charToByteMap_;const r=[];for(let e=0;e<t.length;){var i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;var o=e<t.length?n[t.charAt(e)]:64;++e;var a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();r.push(i<<2|s>>4),64!==o&&(r.push(s<<4&240|o>>2),64!==a&&r.push(o<<6&192|a))}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},s=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function o(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function a(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function u(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function c(){const e=d();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function l(){return"object"==typeof indexedDB}class h extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,p.prototype.create)}}class p{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var r,n=t[0]||{},t=`${this.service}/${e}`,e=this.errors[e],e=e?(r=n,e.replace(f,(e,t)=>{var n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",e=`${this.serviceName}: ${e} (${t}).`;return new h(t,e,n)}}const f=/\{\$([^}]+)}/g;function m(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function v(e){const n={},t=e.replace(/^\?/,"").split("&");return t.forEach(e=>{var t;e&&([t,e]=e.split("="),n[decodeURIComponent(t)]=decodeURIComponent(e))}),n}function g(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,0<n?n:void 0)}class y{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=_),void 0===r.error&&(r.error=_),void 0===r.complete&&(r.complete=_);n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),n}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function _(){}function I(e){return e&&e._delegate?e._delegate:e}function w(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}function b(e,o,a,u){return new(a=a||Promise)(function(n,t){function r(e){try{s(u.next(e))}catch(e){t(e)}}function i(e){try{s(u.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(r,i)}s((u=u.apply(e,o||[])).next())})}function T(n,r){var i,s,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,s&&(o=2&t[0]?s.return:t[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,t[1])).done)return o;switch(s=0,(t=o?[2&t[0],o.value]:t)[0]){case 0:case 1:o=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(o=0<(o=a.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){a.label=t[1];break}if(6===t[0]&&a.label<o[1]){a.label=o[1],o=t;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(t);break}o[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{i=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}(t=n=n||{})[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT";const k={debug:n.DEBUG,verbose:n.VERBOSE,info:n.INFO,warn:n.WARN,error:n.ERROR,silent:n.SILENT},E=n.INFO,R={[n.DEBUG]:"log",[n.VERBOSE]:"log",[n.INFO]:"info",[n.WARN]:"warn",[n.ERROR]:"error"},S=(e,t,...n)=>{if(!(t<e.logLevel)){var r=(new Date).toISOString(),i=R[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)}};class A{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const O={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},P={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"};function N(){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."}}function C(){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 registed 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 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-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."}}const L=N,D=new p("auth","Firebase",N()),M=new class{constructor(e){this.name=e,this._logLevel=E,this._logHandler=S,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?k[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.DEBUG,...e),this._logHandler(this,n.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.VERBOSE,...e),this._logHandler(this,n.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.INFO,...e),this._logHandler(this,n.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.WARN,...e),this._logHandler(this,n.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.ERROR,...e),this._logHandler(this,n.ERROR,...e)}}("@firebase/auth");function U(e,...t){M.logLevel<=n.ERROR&&M.error(`Auth (${vi.SDK_VERSION}): ${e}`,...t)}function F(e,...t){throw W(e,...t)}function x(e,...t){return W(e,...t)}function V(e,t,n){n=Object.assign(Object.assign({},L()),{[t]:n});const r=new p("auth","Firebase",n);return r.create(t,{appName:e.name})}function j(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&F(e,"argument-error"),V(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function W(e,...t){if("string"==typeof e)return D.create(e,...t);{var n=t[0];const r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}}function H(e,t,...n){if(!e)throw W(t,...n)}function q(e){e="INTERNAL ASSERTION FAILED: "+e;throw U(e),new Error(e)}function z(e,t){e||q(t)}const B=new Map;function G(e){z(e instanceof Function,"Expected a class definition");let t=B.get(e);return t?z(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,B.set(e,t)),t}function K(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function $(){return"http:"===J()||"https:"===J()}function J(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class Y{constructor(e,t){z((this.shortDelay=e)<(this.longDelay=t),"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())||u()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&($()||a()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function X(e,t){z(e.emulator,"Emulator should always be set here");var e=e.emulator["url"];return t?`${e}${t.startsWith("/")?t.slice(1):t}`:e}class Z{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl||("undefined"!=typeof self&&"fetch"in self?self.fetch:void q("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static headers(){return this.headersImpl||("undefined"!=typeof self&&"Headers"in self?self.Headers:void q("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static response(){return this.responseImpl||("undefined"!=typeof self&&"Response"in self?self.Response:void q("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}const Q={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:"internal-error",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",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"},ee=new Y(3e4,6e4);function te(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function ne(i,s,o,a,e={}){return re(i,e,async()=>{let e={},t={};a&&("GET"===s?t=a:e={body:JSON.stringify(a)});var n=m(Object.assign({key:i.config.apiKey},t)).slice(1);const r=await i._getAdditionalHeaders();return r["Content-Type"]="application/json",i.languageCode&&(r["X-Firebase-Locale"]=i.languageCode),Z.fetch()(se(i,i.config.apiHost,o,n),Object.assign({method:s,headers:r,referrerPolicy:"no-referrer"},e))})}async function re(t,e,n){t._canInitEmulator=!1;e=Object.assign(Object.assign({},Q),e);try{const s=new oe(t),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();var r=await o.json();if("needConfirmation"in r)throw ae(t,"account-exists-with-different-credential",r);if(o.ok&&!("errorMessage"in r))return r;{const a=o.ok?r.errorMessage:r.error.message,[u,c]=a.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===u)throw ae(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===u)throw ae(t,"email-already-in-use",r);if("USER_DISABLED"===u)throw ae(t,"user-disabled",r);var i=e[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw V(t,i,c);F(t,i)}}catch(e){if(e instanceof h)throw e;F(t,"network-request-failed")}}async function ie(e,t,n,r,i={}){i=await ne(e,t,n,r,i);return"mfaPendingCredential"in i&&F(e,"multi-factor-auth-required",{_serverResponse:i}),i}function se(e,t,n,r){r=`${t}${n}?${r}`;return e.config.emulator?X(e.config,r):`${e.config.apiScheme}://${r}`}class oe{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(x(this.auth,"network-request-failed")),ee.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function ae(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=x(e,t,r);return i.customData._tokenResponse=n,i}function ue(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ce(e){return 1e3*Number(e)}function le(e){var[t,n,e]=e.split(".");if(void 0===t||void 0===n||void 0===e)return U("JWT malformed, contained fewer than 3 sections"),null;try{var r=s(n);return r?JSON.parse(r):(U("Failed to decode base64 JWT payload"),null)}catch(e){return U("Caught error parsing JWT payload as JSON",null===e||void 0===e?void 0:e.toString()),null}}async function de(t,n,e=!1){if(e)return n;try{return n}catch(e){throw e instanceof h&&(n=[e["code"]][0],"auth/user-disabled"===n||"auth/user-token-expired"===n)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class he{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,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(e){var t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}this.errorBackoff=3e4;t=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,t)}schedule(e=!1){this.isRunning&&(e=this.getInterval(e),this.timerId=setTimeout(async()=>{await this.iteration()},e))}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null===e||void 0===e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class pe{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ue(this.lastLoginAt),this.creationTime=ue(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function fe(e){var t=e.auth,n=await e.getIdToken(),r=await de(e,async function(e,t){return ne(e,"POST","/v1/accounts:lookup",t)}(t,{idToken:n}));H(null==r?void 0:r.users.length,t,"internal-error");var i=r.users[0];e._notifyReloadListener(i);t=null!==(n=i.providerUserInfo)&&void 0!==n&&n.length?i.providerUserInfo.map(e=>{var t=e["providerId"],e=w(e,["providerId"]);return{providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}}):[],r=function(e,n){e=e.filter(t=>!n.some(e=>e.providerId===t.providerId));return[...e,...n]}(e.providerData,t),n=e.isAnonymous,t=!(e.email&&i.passwordHash||null!=r&&r.length),t=!!n&&t,t={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:r,metadata:new pe(i.createdAt,i.lastLoginAt),isAnonymous:t};Object.assign(e,t)}class me{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){H(e.idToken,"internal-error"),H(void 0!==e.idToken,"internal-error"),H(void 0!==e.refreshToken,"internal-error");var t,t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):(H(t=le(t=e.idToken),"internal-error"),H(void 0!==t.exp,"internal-error"),H(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat));this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return H(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){var i,s,{accessToken:t,refreshToken:e,expiresIn:n}=(s=t,await{accessToken:(n=await re(i=e,{},async()=>{var e=m({grant_type:"refresh_token",refresh_token:s}).slice(1),{tokenApiHost:t,apiKey:n}=i.config,n=se(i,t,"/v1/token",`key=${n}`);const r=await i._getAdditionalHeaders();return r["Content-Type"]="application/x-www-form-urlencoded",Z.fetch()(n,{method:"POST",headers:r,body:e})})).access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token});this.updateTokensAndExpiration(t,e,Number(n))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){var{refreshToken:n,accessToken:r,expirationTime:t}=t;const i=new me;return n&&(H("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(H("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),t&&(H("number"==typeof t,"internal-error",{appName:e}),i.expirationTime=t),i}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 me,this.toJSON())}_performRefresh(){return q("not implemented")}}function ve(e,t){H("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ge{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,e=w(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new he(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=e.displayName||null,this.email=e.email||null,this.emailVerified=e.emailVerified||!1,this.phoneNumber=e.phoneNumber||null,this.photoURL=e.photoURL||null,this.isAnonymous=e.isAnonymous||!1,this.tenantId=e.tenantId||null,this.providerData=e.providerData?[...e.providerData]:[],this.metadata=new pe(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await de(this,this.stsTokenManager.getToken(this.auth,e));return H(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(e){return async function(e,t=!1){const n=I(e);var r=await n.getIdToken(t),i=le(r);return H(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error"),e="object"==typeof i.firebase?i.firebase:void 0,t=null==e?void 0:e.sign_in_provider,{claims:i,token:r,authTime:ue(ce(i.auth_time)),issuedAtTime:ue(ce(i.iat)),expirationTime:ue(ce(i.exp)),signInProvider:t||null,signInSecondFactor:(null==e?void 0:e.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=I(e);await fe(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(H(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(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new ge(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){H(!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 n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await fe(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e=await this.getIdToken();return await de(this,async function(e,t){return ne(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({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=>Object.assign({},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){var n=null!==(c=t.displayName)&&void 0!==c?c:void 0,r=null!==(o=t.email)&&void 0!==o?o:void 0,i=null!==(u=t.phoneNumber)&&void 0!==u?u:void 0,s=null!==(a=t.photoURL)&&void 0!==a?a:void 0,o=null!==(c=t.tenantId)&&void 0!==c?c:void 0,a=null!==(u=t._redirectEventId)&&void 0!==u?u:void 0,u=null!==(c=t.createdAt)&&void 0!==c?c:void 0,c=null!==(c=t.lastLoginAt)&&void 0!==c?c:void 0;const{uid:l,emailVerified:d,isAnonymous:h,providerData:p,stsTokenManager:f}=t;H(l&&f,e,"internal-error");t=me.fromJSON(this.name,f);H("string"==typeof l,e,"internal-error"),ve(n,e.name),ve(r,e.name),H("boolean"==typeof d,e,"internal-error"),H("boolean"==typeof h,e,"internal-error"),ve(i,e.name),ve(s,e.name),ve(o,e.name),ve(a,e.name),ve(u,e.name),ve(c,e.name);const m=new ge({uid:l,auth:e,email:r,emailVerified:d,displayName:n,isAnonymous:h,photoURL:s,phoneNumber:i,tenantId:o,stsTokenManager:t,createdAt:u,lastLoginAt:c});return p&&Array.isArray(p)&&(m.providerData=p.map(e=>Object.assign({},e))),a&&(m._redirectEventId=a),m}static async _fromIdTokenResponse(e,t,n=!1){const r=new me;r.updateFromServerResponse(t);n=new ge({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await fe(n),n}}class ye{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){e=this.storage[e];return void 0===e?null:e}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}ye.type="NONE";const _e=ye;function Ie(e,t,n){return`firebase:${e}:${t}:${n}`}class we{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;var{config:e,name:n}=this.auth;this.fullUserKey=Ie(this.userKey,e.apiKey,n),this.fullPersistenceKey=Ie("persistence",e.apiKey,n),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){var e=await this.persistence._get(this.fullUserKey);return e?ge._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence!==e){var t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new we(G(_e),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let i=r[0]||G(_e);const s=Ie(n,e.config.apiKey,e.name);let o=null;for(const l of t)try{var a=await l._get(s);if(a){var u=ge._fromJSON(e,a);l!==i&&(o=u),i=l;break}}catch(e){}var c=r.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&c.length&&(i=c[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch(e){}}))),new we(i,e,n)}}function be(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Re(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Te(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ae(t))return"Blackberry";if(Oe(t))return"Webos";if(ke(t))return"Safari";if((t.includes("chrome/")||Ee(t))&&!t.includes("edge/"))return"Chrome";if(Se(t))return"Android";e=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);return 2===(null==e?void 0:e.length)?e[1]:"Other"}function Te(e=d()){return/firefox\//i.test(e)}function ke(e=d()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ee(e=d()){return/crios\//i.test(e)}function Re(e=d()){return/iemobile/i.test(e)}function Se(e=d()){return/android/i.test(e)}function Ae(e=d()){return/blackberry/i.test(e)}function Oe(e=d()){return/webos/i.test(e)}function Pe(e=d()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Ne(e=d()){return Pe(e)||Se(e)||Oe(e)||Ae(e)||/windows phone/i.test(e)||Re(e)}function Ce(e,t=[]){let n;switch(e){case"Browser":n=be(d());break;case"Worker":n=`${be(d())}-${e}`;break;default:n=e}t=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${vi.SDK_VERSION}/${t}`}class Le{constructor(e){this.auth=e,this.queue=[]}pushCallback(r,e){var t=n=>new Promise((e,t)=>{try{e(r(n))}catch(e){t(e)}});t.onAbort=e,this.queue.push(t);const n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser!==e){const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const r of t)try{r()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===e||void 0===e?void 0:e.message})}}}}class De{constructor(e,t,n){this.app=e,this.heartbeatServiceProvider=t,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ue(this),this.idTokenSubscription=new Ue(this),this.beforeStateQueue=new Le(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=D,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=G(n)),this._initializationPromise=this.queue(async()=>{var e;if(!this._deleted&&(this.persistenceManager=await we.create(this,t),!this._deleted)){if(null!==(e=this._popupRedirectResolver)&&void 0!==e&&e._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(n),this.lastNotifiedUid=(null===(e=this.currentUser)||void 0===e?void 0:e.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(!this._deleted){var e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e)return this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t,n,r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,n=null===i||void 0===i?void 0:i._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==n||null==e||!e.user||(i=e.user,s=!0)),!i)return this.directlySetCurrentUser(null);if(i._redirectEventId)return H(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i);if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await fe(e)}catch(e){if("auth/network-request-failed"!==(null===e||void 0===e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;var e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?I(e):null;return t&&H(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&&H(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 await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(G(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new p("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){return this.redirectPersistenceManager||(H(e=e&&G(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await we.create(this,[G(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()),this.redirectPersistenceManager}async _redirectUserForId(e){var t;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(t=this.redirectUser)||void 0===t?void 0:t._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 e;this._isInitialized&&(this.idTokenSubscription.next(this.currentUser),e=null!==(e=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==e?e:null,this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser)))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return H(s,this,"internal-error"),s.then(()=>i(this.currentUser)),"function"==typeof t?e.addObserver(t,n,r):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),(this.currentUser=e)?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return H(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ce(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);var t=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return t&&(e["X-Firebase-Client"]=t),e}}function Me(e){return I(e)}class Ue{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new y(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return H(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Fe(e,t,n){const r=Me(e);H(r._canInitEmulator,r,"emulator-config-failed"),H(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");e=!(null==n||!n.disableWarnings);const i=xe(t);var{host:n,port:t}=function(e){const t=xe(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);{if(i){var s=i[1];return{host:s,port:Ve(r.substr(s.length+1))}}var[e,s]=r.split(":");return{host:e,port:Ve(s)}}}(t);r.config.emulator={url:`${i}//${n}${null===t?"":`:${t}`}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:n,port:t,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:e})}),e||function(){function e(){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)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function xe(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Ve(e){if(!e)return null;e=Number(e);return isNaN(e)?null:e}class je{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return q("not implemented")}_getIdTokenResponse(e){return q("not implemented")}_linkToIdToken(e,t){return q("not implemented")}_getReauthenticationResolver(e){return q("not implemented")}}async function We(e,t){return ne(e,"POST","/v1/accounts:resetPassword",te(e,t))}async function He(e,t){return ne(e,"POST","/v1/accounts:update",t)}async function qe(e,t){return ne(e,"POST","/v1/accounts:sendOobCode",te(e,t))}class ze extends je{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new ze(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new ze(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){e="string"==typeof e?JSON.parse(e):e;if(null!=e&&e.email&&null!=e&&e.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return async function(e,t){return ie(e,"POST","/v1/accounts:signInWithPassword",te(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return ie(e,"POST","/v1/accounts:signInWithEmailLink",te(e,t))}(e,{email:this._email,oobCode:this._password});default:F(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return He(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return ie(e,"POST","/v1/accounts:signInWithEmailLink",te(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:F(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Be(e,t){return ie(e,"POST","/v1/accounts:signInWithIdp",te(e,t))}class Ge extends je{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Ge(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):F("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){var t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:e}=t,t=w(t,["providerId","signInMethod"]);if(!n||!e)return null;const r=new Ge(n,e);return r.idToken=t.idToken||void 0,r.accessToken=t.accessToken||void 0,r.secret=t.secret,r.nonce=t.nonce,r.pendingToken=t.pendingToken||null,r}_getIdTokenResponse(e){return Be(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Be(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Be(e,t)}buildRequest(){const e={requestUri:"http://localhost",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=m(t)}return e}}const Ke={USER_NOT_FOUND:"user-not-found"};class $e extends je{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new $e({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new $e({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return ie(e,"POST","/v1/accounts:signInWithPhoneNumber",te(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){if((t=await ie(e,"POST","/v1/accounts:signInWithPhoneNumber",te(e,t))).temporaryProof)throw ae(e,"account-exists-with-different-credential",t);return t}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return ie(e,"POST","/v1/accounts:signInWithPhoneNumber",te(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Ke)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){var{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,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){var{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}=e="string"==typeof e?JSON.parse(e):e;return n||t||r||e?new $e({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}):null}}class Je{constructor(e){var t=v(g(e)),n=null!==(r=t.apiKey)&&void 0!==r?r:null,r=null!==(e=t.oobCode)&&void 0!==e?e:null,e=function(e){switch(e){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}}(null!==(e=t.mode)&&void 0!==e?e:null);H(n&&r&&e,"argument-error"),this.apiKey=n,this.operation=e,this.code=r,this.continueUrl=null!==(r=t.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(r=t.languageCode)&&void 0!==r?r:null,this.tenantId=null!==(t=t.tenantId)&&void 0!==t?t:null}static parseLink(e){var t,n,r,t=(n=v(g(t=e)).link,r=n?v(g(n)).deep_link_id:null,((e=v(g(t)).deep_link_id)?v(g(e)).link:null)||e||r||n||t);try{return new Je(t)}catch(e){return null}}}class Ye{constructor(){this.providerId=Ye.PROVIDER_ID}static credential(e,t){return ze._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=Je.parseLink(t);return H(t,"argument-error"),ze._fromEmailAndCode(e,t.code,t.tenantId)}}Ye.PROVIDER_ID="password",Ye.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Ye.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Xe{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}}class Ze extends Xe{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Qe extends Ze{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return H("providerId"in e&&"signInMethod"in e,"argument-error"),Ge._fromParams(e)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return H(e.idToken||e.accessToken,"argument-error"),Ge._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return Qe.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Qe.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:r,pendingToken:i,nonce:s,providerId:e}=e;if(!(n||r||t||i))return null;if(!e)return null;try{return new Qe(e)._credential({idToken:t,accessToken:n,nonce:s,pendingToken:i})}catch(e){return null}}}class et extends Ze{constructor(){super("facebook.com")}static credential(e){return Ge._fromParams({providerId:et.PROVIDER_ID,signInMethod:et.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return et.credentialFromTaggedObject(e)}static credentialFromError(e){return et.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return et.credential(e.oauthAccessToken)}catch(e){return null}}}et.FACEBOOK_SIGN_IN_METHOD="facebook.com",et.PROVIDER_ID="facebook.com";class tt extends Ze{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Ge._fromParams({providerId:tt.PROVIDER_ID,signInMethod:tt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return tt.credentialFromTaggedObject(e)}static credentialFromError(e){return tt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:t,oauthAccessToken:e}=e;if(!t&&!e)return null;try{return tt.credential(t,e)}catch(e){return null}}}tt.GOOGLE_SIGN_IN_METHOD="google.com",tt.PROVIDER_ID="google.com";class nt extends Ze{constructor(){super("github.com")}static credential(e){return Ge._fromParams({providerId:nt.PROVIDER_ID,signInMethod:nt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return nt.credentialFromTaggedObject(e)}static credentialFromError(e){return nt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return nt.credential(e.oauthAccessToken)}catch(e){return null}}}nt.GITHUB_SIGN_IN_METHOD="github.com",nt.PROVIDER_ID="github.com";class rt extends je{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return Be(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Be(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Be(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){var{providerId:t,signInMethod:n,pendingToken:e}="string"==typeof e?JSON.parse(e):e;return t&&n&&e&&t===n?new rt(t,e):null}static _create(e,t){return new rt(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class it extends Xe{constructor(e){H(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return it.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return it.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){e=rt.fromJSON(e);return H(e,"argument-error"),e}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{pendingToken:t,providerId:e}=e;if(!t||!e)return null;try{return rt._create(e,t)}catch(e){return null}}}class st extends Ze{constructor(){super("twitter.com")}static credential(e,t){return Ge._fromParams({providerId:st.PROVIDER_ID,signInMethod:st.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return st.credentialFromTaggedObject(e)}static credentialFromError(e){return st.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:t,oauthTokenSecret:e}=e;if(!t||!e)return null;try{return st.credential(t,e)}catch(e){return null}}}async function ot(e,t){return ie(e,"POST","/v1/accounts:signUp",te(e,t))}st.TWITTER_SIGN_IN_METHOD="twitter.com",st.PROVIDER_ID="twitter.com";class at{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){e=await ge._fromIdTokenResponse(e,n,r),r=ut(n);return new at({user:e,providerId:r,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);var r=ut(n);return new at({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function ut(e){return e.providerId||("phoneNumber"in e?"phone":null)}class ct extends h{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ct.prototype),this.customData={appName:e.name,tenantId:null!==(e=e.tenantId)&&void 0!==e?e:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new ct(e,t,n,r)}}function lt(t,n,e,r){const i="reauthenticate"===n?e._getReauthenticationResolver(t):e._getIdTokenResponse(t);return i.catch(e=>{if("auth/multi-factor-auth-required"===e.code)throw ct._fromErrorAndOperation(t,e,n,r);throw e})}function dt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function ht(e,t){const n=I(e);await ft(!0,n,t);var t=(e=n.auth,t={idToken:await n.getIdToken(),deleteProvider:[t]},await ne(e,"POST","/v1/accounts:update",t))["providerUserInfo"];const r=dt(t||[]);return n.providerData=n.providerData.filter(e=>r.has(e.providerId)),r.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function pt(e,t,n=!1){n=await de(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return at._forOperation(e,"link",n)}async function ft(e,t,n){await fe(t);const r=dt(t.providerData);var i=!1===e?"provider-already-linked":"no-such-provider";H(r.has(n)===e,t.auth,i)}async function mt(e,t,n=!1){var r=e["auth"],i="reauthenticate";try{var s=await de(e,lt(r,i,t,e),n);H(s.idToken,r,"internal-error");var o=le(s.idToken);H(o,r,"internal-error");var a=o["sub"];return H(e.uid===a,r,"user-mismatch"),at._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===(null===e||void 0===e?void 0:e.code)&&F(r,"user-mismatch"),e}}async function vt(e,t,n=!1){t=await lt(e,"signIn",t),t=await at._fromIdTokenResponse(e,"signIn",t);return n||await e._updateCurrentUser(t.user),t}async function gt(e,t){return vt(Me(e),t)}async function yt(e,t){e=I(e);return await ft(!1,e,t.providerId),pt(e,t)}async function _t(e,t){return mt(I(e),t)}async function It(e,t){const n=Me(e);t=await ie(n,"POST","/v1/accounts:signInWithCustomToken",te(n,{token:t,returnSecureToken:!0})),t=await at._fromIdTokenResponse(n,"signIn",t);return await n._updateCurrentUser(t.user),t}class wt{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?bt._fromServerResponse(e,t):F(e,"internal-error")}}class bt extends wt{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new bt(t)}}function Tt(e,t,n){var r;H(0<(null===(r=n.url)||void 0===r?void 0:r.length),e,"invalid-continue-uri"),H(void 0===n.dynamicLinkDomain||0<n.dynamicLinkDomain.length,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(H(0<n.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(H(0<n.android.packageName.length,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function kt(e,t,n){e=I(e),t={requestType:"PASSWORD_RESET",email:t};n&&Tt(e,t,n),await qe(e,t)}async function Et(e,t){await ne(e=I(e),"POST","/v1/accounts:update",te(e,{oobCode:t}))}async function Rt(e,t){var n=I(e),r=await We(n,{oobCode:t}),t=r.requestType;switch(H(t,n,"internal-error"),t){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":H(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":H(r.mfaInfo,n,"internal-error");default:H(r.email,n,"internal-error")}let i=null;return r.mfaInfo&&(i=wt._fromServerResponse(Me(n),r.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.newEmail:r.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.email:r.newEmail)||null,multiFactorInfo:i},operation:t}}async function St(e,t,n){e=I(e),t={requestType:"EMAIL_SIGNIN",email:t};H(n.handleCodeInApp,e,"argument-error"),n&&Tt(e,t,n),await qe(e,t)}async function At(e,t){var n=$()?K():"http://localhost",n=(await ne(e=I(e),"POST","/v1/accounts:createAuthUri",te(e,{identifier:t,continueUri:n})))["signinMethods"];return n||[]}async function Ot(e,t){var n=I(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Tt(n.auth,r,t);var r=(await qe(n.auth,r))["email"];r!==e.email&&await e.reload()}async function Pt(e,t,n){var r=I(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&Tt(r.auth,t,n);var t=(await qe(r.auth,t))["email"];t!==e.email&&await e.reload()}async function Nt(e,{displayName:t,photoURL:n}){if(void 0!==t||void 0!==n){const r=I(e);e=await r.getIdToken(),n=await de(r,async function(e,t){return ne(e,"POST","/v1/accounts:update",t)}(r.auth,{idToken:e,displayName:t,photoUrl:n,returnSecureToken:!0}));r.displayName=n.displayName||null,r.photoURL=n.photoUrl||null;const i=r.providerData.find(({providerId:e})=>"password"===e);i&&(i.displayName=r.displayName,i.photoURL=r.photoURL),await r._updateTokensIfNecessary(n)}}async function Ct(e,t,n){var r=e["auth"];const i={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(i.email=t),n&&(i.password=n);r=await de(e,He(r,i));await e._updateTokensIfNecessary(r,!0)}class Lt{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class Dt extends Lt{constructor(e,t,n,r){super(e,t,n),this.username=r}}class Mt extends Lt{constructor(e,t){super(e,"facebook.com",t)}}class Ut extends Dt{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class Ft extends Lt{constructor(e,t){super(e,"google.com",t)}}class xt extends Dt{constructor(e,t,n){super(e,"twitter.com",t,n)}}function Vt(e){var{user:t,_tokenResponse:e}=e;return t.isAnonymous&&!e?{providerId:null,isNewUser:!1,profile:null}:function(e){if(!e)return null;var t=e["providerId"],n=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},r=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!t&&null!=e&&e.idToken){var i=null===(i=null===(i=le(e.idToken))||void 0===i?void 0:i.firebase)||void 0===i?void 0:i.sign_in_provider;if(i){i="anonymous"!==i&&"custom"!==i?i:null;return new Lt(r,i)}}if(!t)return null;switch(t){case"facebook.com":return new Mt(r,n);case"github.com":return new Ut(r,n);case"google.com":return new Ft(r,n);case"twitter.com":return new xt(r,n,e.screenName||null);case"custom":case"anonymous":return new Lt(r,null);default:return new Lt(r,t,n)}}(e)}class jt{constructor(e,t,n){this.type=e,this.credential=t,this.auth=n}static _fromIdtoken(e,t){return new jt("enroll",e,t)}static _fromMfaPendingCredential(e){return new jt("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t;if(null!=e&&e.multiFactorSession){if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.pendingCredential)return jt._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.idToken)return jt._fromIdtoken(e.multiFactorSession.idToken)}return null}}class Wt{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,r){const i=Me(e),s=r.customData._serverResponse;e=(s.mfaInfo||[]).map(e=>wt._fromServerResponse(i,e));H(s.mfaPendingCredential,i,"internal-error");const o=jt._fromMfaPendingCredential(s.mfaPendingCredential);return new Wt(o,e,async e=>{e=await e._process(i,o);delete s.mfaInfo,delete s.mfaPendingCredential;var t=Object.assign(Object.assign({},s),{idToken:e.idToken,refreshToken:e.refreshToken});switch(r.operationType){case"signIn":var n=await at._fromIdTokenResponse(i,r.operationType,t);return await i._updateCurrentUser(n.user),n;case"reauthenticate":return H(r.user,i,"internal-error"),at._forOperation(r.user,r.operationType,t);default:F(i,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}class Ht{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>wt._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new Ht(e)}async getSession(){return jt._fromIdtoken(await this.user.getIdToken(),this.user.auth)}async enroll(e,t){const n=e;e=await this.getSession(),t=await de(this.user,n._process(this.user.auth,e,t));return await this.user._updateTokensIfNecessary(t),this.user.reload()}async unenroll(e){const t="string"==typeof e?e:e.uid;var n=await this.user.getIdToken(),n=await de(this.user,(e=this.user.auth,n={idToken:n,mfaEnrollmentId:t},ne(e,"POST","/v2/accounts/mfaEnrollment:withdraw",te(e,n))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(n);try{await this.user.reload()}catch(e){if("auth/user-token-expired"!==(null===e||void 0===e?void 0:e.code))throw e}}}const qt=new WeakMap;const zt="__sak";class Bt{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(zt,"1"),this.storage.removeItem(zt),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){e=this.storage.getItem(e);return Promise.resolve(e?JSON.parse(e):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Gt extends Bt{constructor(){var e;super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=(ke(e=d())||Pe(e))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=Ne(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const r of Object.keys(this.listeners)){var t=this.storage.getItem(r),n=this.localCache[r];t!==n&&e(r,n,t)}}onStorageEvent(e,t=!1){if(e.key){const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const i=this.storage.getItem(r);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}var n=()=>{var e=this.storage.getItem(r);!t&&this.localCache[r]===e||this.notifyListeners(r,e)};const i=this.storage.getItem(r);c()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}else this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)})}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(const n of Array.from(e))n(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(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),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){var t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Gt.type="LOCAL";const Kt=Gt;class $t extends Bt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}$t.type="SESSION";const Jt=$t;class Yt{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){var e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;e=new Yt(t);return this.receivers.push(e),e}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data;e=this.handlersMap[r];null!=e&&e.size&&(t.ports[0].postMessage({status:"ack",eventId:n,eventType:r}),e=Array.from(e).map(async e=>e(t.origin,i)),e=await Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})),t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:e}))}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&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&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Xt(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Yt.receivers=[];class Zt{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,o=50){const a="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!a)throw new Error("connection_unavailable");let u,c;return new Promise((n,r)=>{const i=Xt("",20);a.port1.start();const s=setTimeout(()=>{r(new Error("unsupported_event"))},o);c={messageChannel:a,onMessage(e){var t=e;if(t.data.eventId===i)switch(t.data.status){case"ack":clearTimeout(s),u=setTimeout(()=>{r(new Error("timeout"))},3e3);break;case"done":clearTimeout(u),n(t.data.response);break;default:clearTimeout(s),clearTimeout(u),r(new Error("invalid_response"))}}},this.handlers.add(c),a.port1.addEventListener("message",c.onMessage),this.target.postMessage({eventType:e,eventId:i,data:t},[a.port2])}).finally(()=>{c&&this.removeMessageHandler(c)})}}function Qt(){return window}function en(){return void 0!==Qt().WorkerGlobalScope&&"function"==typeof Qt().importScripts}const tn="firebaseLocalStorageDb",nn="firebaseLocalStorage",rn="fbase_key";class sn{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 on(e,t){return e.transaction([nn],t?"readwrite":"readonly").objectStore(nn)}function an(){const r=indexedDB.open(tn,1);return new Promise((n,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const e=r.result;try{e.createObjectStore(nn,{keyPath:rn})}catch(e){t(e)}}),r.addEventListener("success",async()=>{const e=r.result;var t;e.objectStoreNames.contains(nn)?n(e):(e.close(),t=indexedDB.deleteDatabase(tn),await new sn(t).toPromise(),n(await an()))})})}async function un(e,t,n){n=on(e,!0).put({fbase_key:t,value:n});return new sn(n).toPromise()}function cn(e,t){t=on(e,!0).delete(t);return new sn(t).toPromise()}class ln{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await an(),this.db)}async _withRetries(e){let t=0;for(;;)try{return e(await this._openDb())}catch(e){if(3<t++)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return en()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Yt._getInstance(en()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>{const n=await this._poll();return{keyProcessed:n.includes(t.key)}}),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t,n;this.activeServiceWorker=await async function(){if(null===navigator||void 0===navigator||!navigator.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),this.activeServiceWorker&&(this.sender=new Zt(this.activeServiceWorker),(n=await this.sender._send("ping",{},800))&&null!==(e=n[0])&&void 0!==e&&e.fulfilled&&null!==(t=n[0])&&void 0!==t&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0))}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;var e=await an();return await un(e,zt,"1"),await cn(e,zt),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(e=>un(e,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){var e=await this._withRetries(e=>async function(e,t){return t=on(e,!1).get(t),void 0===(t=await new sn(t).toPromise())?null:t.value}(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>cn(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e,t,n=await this._withRetries(e=>{e=on(e,!1).getAll();return new sn(e).toPromise()});if(!n)return[];if(0!==this.pendingWrites)return[];const r=[],i=new Set;for({fbase_key:e,value:t}of n)i.add(e),JSON.stringify(this.localCache[e])!==JSON.stringify(t)&&(this.notifyListeners(e,t),r.push(e));for(const s of Object.keys(this.localCache))this.localCache[s]&&!i.has(s)&&(this.notifyListeners(s,null),r.push(s));return r}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(const n of Array.from(e))n(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),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),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}ln.type="LOCAL";const dn=ln;function hn(r){return new Promise((e,n)=>{const t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=e=>{const t=x("internal-error");t.customData=e,n(t)},t.type="text/javascript",t.charset="UTF-8",(null!==(e=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==e?e:document).appendChild(t)})}function pn(e){return`__${e}${Math.floor(1e6*Math.random())}`}class fn{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){var n=this.counter;return this._widgets.set(n,new mn(e,this.auth.name,t||{})),this.counter++,n}reset(e){var t=e||1e12;null===(e=this._widgets.get(t))||void 0===e||e.delete(),this._widgets.delete(t)}getResponse(e){return(null===(e=this._widgets.get(e||1e12))||void 0===e?void 0:e.getResponse())||""}async execute(e){return null===(e=this._widgets.get(e||1e12))||void 0===e||e.execute(),""}}class mn{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};e="string"==typeof e?document.getElementById(e):e;H(e,"argument-error",{appName:t}),this.container=e,this.isVisible="invisible"!==this.params.size,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=function(t){const n=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<t;e++)n.push(r.charAt(Math.floor(Math.random()*r.length)));return n.join("")}(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}const vn=pn("rcb"),gn=new Y(3e4,6e4);class yn{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!(null===(e=Qt().grecaptcha)||void 0===e||!e.render)}load(s,o=""){var e;return H((e=o).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),s,"argument-error"),this.shouldResolveImmediately(o)?Promise.resolve(Qt().grecaptcha):new Promise((t,r)=>{const i=Qt().setTimeout(()=>{r(x(s,"network-request-failed"))},gn.get());Qt()[vn]=()=>{Qt().clearTimeout(i),delete Qt()[vn];const e=Qt().grecaptcha;if(e){const n=e.render;e.render=(e,t)=>{t=n(e,t);return this.counter++,t},this.hostLanguage=o,t(e)}else r(x(s,"internal-error"))},hn(`https://www.google.com/recaptcha/api.js??${m({onload:vn,render:"explicit",hl:o})}`).catch(()=>{clearTimeout(i),r(x(s,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!(null===(t=Qt().grecaptcha)||void 0===t||!t.render)&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class _n{async load(e){return new fn(e)}clearedOneInstance(){}}const In="recaptcha",wn={theme:"light",type:"image"};class bn{constructor(e,t=Object.assign({},wn),n){this.parameters=t,this.type=In,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=Me(n),this.isInvisible="invisible"===this.parameters.size,H("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");e="string"==typeof e?document.getElementById(e):e;H(e,this.auth,"argument-error"),this.container=e,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?_n:yn),this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),r=this.getAssertedRecaptcha();var t=r.getResponse(e);return t||new Promise(t=>{const n=e=>{e&&(this.tokenChangeListeners.delete(n),t(e))};this.tokenChangeListeners.add(n),this.isInvisible&&r.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&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(){H(!this.parameters.sitekey,this.auth,"argument-error"),H(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),H("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(n){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof n)n(t);else if("string"==typeof n){const e=Qt()[n];"function"==typeof e&&e(t)}}}assertNotDestroyed(){H(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;var t;this.isInvisible||(t=document.createElement("div"),e.appendChild(t),e=t),this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){H($()&&!en(),this.auth,"internal-error"),await function(){let t=null;return new Promise(e=>{"complete"!==document.readyState?(t=()=>e(),window.addEventListener("load",t)):e()}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);var e=await((await ne(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");H(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return H(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class Tn{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=$e._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function kn(t,n,r){var i,s,o,a,u,c,l=await r.verify();try{H("string"==typeof l,t,"argument-error"),H(r.type===In,t,"argument-error");let e;if(e="string"==typeof n?{phoneNumber:n}:n,"session"in e){var d=e.session;if("phoneNumber"in e)return H("enroll"===d.type,t,"internal-error"),(u=t,c={idToken:d.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,recaptchaToken:l}},await ne(u,"POST","/v2/accounts/mfaEnrollment:start",te(u,c))).phoneSessionInfo.sessionInfo;H("signin"===d.type,t,"internal-error");var h=(null===(i=e.multiFactorHint)||void 0===i?void 0:i.uid)||e.multiFactorUid;return H(h,t,"missing-multi-factor-info"),(a={mfaPendingCredential:d.credential,mfaEnrollmentId:h,phoneSignInInfo:{recaptchaToken:l}},await ne(t,"POST","/v2/accounts/mfaSignIn:start",te(t,a))).phoneResponseInfo.sessionInfo}var p=(s=t,o={phoneNumber:e.phoneNumber,recaptchaToken:l},await ne(s,"POST","/v1/accounts:sendVerificationCode",te(s,o)))["sessionInfo"];return p}finally{r._reset()}}class En{constructor(e){this.providerId=En.PROVIDER_ID,this.auth=Me(e)}verifyPhoneNumber(e,t){return kn(this.auth,e,I(t))}static credential(e,t){return $e._fromVerification(e,t)}static credentialFromResult(e){return En.credentialFromTaggedObject(e)}static credentialFromError(e){return En.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{phoneNumber:t,temporaryProof:e}=e;return t&&e?$e._fromTokenResponse(t,e):null}}function Rn(e,t){return t?G(t):(H(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}En.PROVIDER_ID="phone",En.PHONE_SIGN_IN_METHOD="phone";class Sn extends je{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Be(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Be(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Be(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 An(e){return vt(e.auth,new Sn(e),e.bypassAuthState)}function On(e){var{auth:t,user:n}=e;return H(n,t,"internal-error"),mt(n,new Sn(e),e.bypassAuthState)}async function Pn(e){var{auth:t,user:n}=e;return H(n,t,"internal-error"),pt(n,new Sn(e),e.bypassAuthState)}class Nn{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,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(e){this.reject(e)}})}async onAuthEvent(e){var{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:s,type:e}=e;if(s)this.reject(s);else{r={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(e)(r))}catch(e){this.reject(e)}}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return An;case"linkViaPopup":case"linkViaRedirect":return Pn;case"reauthViaPopup":case"reauthViaRedirect":return On;default:F(this.auth,"internal-error")}}resolve(e){z(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){z(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()}}const Cn=new Y(2e3,1e4);class Ln extends Nn{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Ln.currentPopupAction&&Ln.currentPopupAction.cancel(),Ln.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return H(e,this.auth,"internal-error"),e}async onExecution(){z(1===this.filter.length,"Popup operations only handle one event");var e=Xt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(x(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(x(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ln.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e;null!==(e=null===(e=this.authWindow)||void 0===e?void 0:e.window)&&void 0!==e&&e.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(x(this.auth,"popup-closed-by-user"))},2e3):this.pollId=window.setTimeout(t,Cn.get())};t()}}Ln.currentPopupAction=null;const Dn="pendingRedirect",Mn=new Map;class Un extends Nn{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let t=Mn.get(this.auth._key());if(!t){try{const e=await async function(e,t){const n=jn(t),r=Vn(e);if(!await r._isAvailable())return!1;e="true"===await r._get(n);return await r._remove(n),e}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}Mn.set(this.auth._key(),t)}return this.bypassAuthState||Mn.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){var t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}async function Fn(e,t){return Vn(e)._set(jn(t),"true")}function xn(e,t){Mn.set(e._key(),t)}function Vn(e){return G(e._redirectPersistence)}function jn(e){return Ie(Dn,e.config.apiKey,e.name)}function Wn(e,t,n){return async function(e,t,n){var r=Me(e);j(e,t,Xe);const i=Rn(r,n);return await Fn(i,r),i._openRedirect(r,t,"signInViaRedirect")}(e,t,n)}function Hn(e,t,n){return async function(e,t,n){e=I(e);j(e.auth,t,Xe);const r=Rn(e.auth,n);await Fn(r,e.auth);n=await Bn(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",n)}(e,t,n)}function qn(e,t,n){return async function(e,t,n){e=I(e);j(e.auth,t,Xe);const r=Rn(e.auth,n);await ft(!1,e,t.providerId),await Fn(r,e.auth);n=await Bn(e);return r._openRedirect(e.auth,t,"linkViaRedirect",n)}(e,t,n)}async function zn(e,t,n=!1){const r=Me(e);e=Rn(r,t);const i=new Un(r,e,n),s=await i.execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}async function Bn(e){var t=Xt(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Gn{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(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(e=>{this.isEventForConsumer(t,e)&&(n=!0,this.sendToConsumer(t,e),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return $n(e);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(e,t){var n;e.error&&!$n(e)?(n=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error",t.onError(x(this.auth,n))):t.onAuthEvent(e)}isEventForConsumer(e,t){var n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return 6e5<=Date.now()-this.lastProcessedEventTime&&this.cachedEventUids.clear(),this.cachedEventUids.has(Kn(e))}saveEventToCache(e){this.cachedEventUids.add(Kn(e)),this.lastProcessedEventTime=Date.now()}}function Kn(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function $n({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function Jn(e,t={}){return ne(e,"GET","/v1/projects",t)}const Yn=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Xn=/^https?/;async function Zn(e){if(!e.config.emulator){var t=(await Jn(e))["authorizedDomains"];for(const n of t)try{if(function(e){const t=K(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){var i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!Xn.test(n))return!1;if(Yn.test(e))return r===e;const s=e.replace(/\./g,"\\."),o=new RegExp("^(.+\\."+s+"|"+s+")$","i");return o.test(r)}(n))return}catch(e){}F(e,"unauthorized-domain")}}const Qn=new Y(3e4,6e4);function er(){const t=Qt().___jsl;if(null!==t&&void 0!==t&&t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}let tr=null;function nr(e){var i;return tr=tr||(i=e,new Promise((e,t)=>{function n(){er(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{er(),t(x(i,"network-request-failed"))},timeout:Qn.get()})}if(null!==(r=null===(r=Qt().gapi)||void 0===r?void 0:r.iframes)&&void 0!==r&&r.Iframe)e(gapi.iframes.getContext());else{if(null===(r=Qt().gapi)||void 0===r||!r.load){var r=pn("iframefcb");return Qt()[r]=()=>{gapi.load?n():t(x(i,"network-request-failed"))},hn(`https://apis.google.com/js/api.js?onload=${r}`).catch(e=>t(e))}n()}}).catch(e=>{throw tr=null,e})),tr}const rr=new Y(5e3,15e3),ir="__/auth/iframe",sr="emulator/auth/iframe",or={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ar=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function ur(o){const e=await nr(o);var t=Qt().gapi;return H(t,o,"internal-error"),e.open({where:document.body,url:function(e){var t=e.config;H(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?X(t,sr):`https://${e.config.authDomain}/${ir}`;const r={apiKey:t.apiKey,appName:e.name,v:vi.SDK_VERSION};(t=ar.get(e.config.apiHost))&&(r.eid=t);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${m(r).slice(1)}`}(o),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:or,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});const n=x(o,"network-request-failed"),r=Qt().setTimeout(()=>{t(n)},rr.get());function i(){Qt().clearTimeout(r),e(s)}s.ping(i).then(i,()=>{t(n)})}))}const cr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class lr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function dr(e,t,n,r=500,i=600){var s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const u=Object.assign(Object.assign({},cr),{width:r.toString(),height:i.toString(),top:s,left:o});o=d().toLowerCase();n&&(a=Ee(o)?"_blank":n),Te(o)&&(t=t||"http://localhost",u.scrollbars="yes");var c,n=Object.entries(u).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if([o=d()]=[o],Pe(o)&&null!==(c=window.navigator)&&void 0!==c&&c.standalone&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new lr(null);const l=window.open(t||"",a,n);H(l,e,"popup-blocked");try{l.focus()}catch(e){}return new lr(l)}const hr="__/auth/handler",pr="emulator/auth/handler";function fr(e,t,n,r,i,s){H(e.config.authDomain,e,"auth-domain-config-required"),H(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:vi.SDK_VERSION,eventId:i};if(t instanceof Xe){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return;return 1}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(var[a,u]of Object.entries(s||{}))o[a]=u}if(t instanceof Ze){const l=t.getScopes().filter(e=>""!==e);0<l.length&&(o.scopes=l.join(","))}e.tenantId&&(o.tid=e.tenantId);const c=o;for(const d of Object.keys(c))void 0===c[d]&&delete c[d];return`${e=[e["config"]][0],e.emulator?X(e,pr):`https://${e.authDomain}/${hr}`}?${m(c).slice(1)}`}const mr="webStorageSupport";const vr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Jt,this._completeRedirectFn=zn,this._overrideRedirectResult=xn}async _openPopup(e,t,n,r){var i;return z(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),dr(e,fr(e,t,n,K(),r),Xt())}async _openRedirect(e,t,n,r){return await this._originValidation(e),r=fr(e,t,n,K(),r),Qt().location.href=r,new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:n}=this.eventManagers[t];return r?Promise.resolve(r):(z(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(t){const e=await ur(t),n=new Gn(t);return e.register("authEvent",e=>{return H(null==e?void 0:e.authEvent,t,"invalid-auth-event"),{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,n){const e=this.iframes[t._key()];e.send(mr,{type:mr},e=>{e=null===(e=null==e?void 0:e[0])||void 0===e?void 0:e[mr];void 0!==e&&n(!!e),F(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Zn(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ne()||ke()||Pe()}};class gr extends class{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return q("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new gr(e)}_finalizeEnroll(e,t,n){return e=e,n={idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()},ne(e,"POST","/v2/accounts/mfaEnrollment:finalize",te(e,n))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},ne(e,"POST","/v2/accounts/mfaSignIn:finalize",te(e,t))}}class yr{constructor(){}static assertion(e){return gr._fromCredential(e)}}yr.FACTOR_ID="phone";var _r,Ir="@firebase/auth";class wr{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?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(t){var e;this.assertAuthConfigured(),this.internalListeners.has(t)||(e=this.auth.onIdTokenChanged(e=>{t((null===e||void 0===e?void 0:e.stsTokenManager.accessToken)||null)}),this.internalListeners.set(t,e),this.updateProactiveRefresh())}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){H(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function br(){return window}_r="Browser",vi._registerComponent(new A("auth",(e,{options:r})=>{var t=e.getProvider("app").getImmediate(),e=e.getProvider("heartbeat");const{apiKey:i,authDomain:s}=t.options;return((e,t)=>{H(i&&!i.includes(":"),"invalid-api-key",{appName:e.name}),H(!(null!==s&&void 0!==s&&s.includes(":")),"argument-error",{appName:e.name});var n={apiKey:i,authDomain:s,clientPlatform:_r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ce(_r)},n=new De(e,t,n);return function(e,t){const n=(null==t?void 0:t.persistence)||[];var r=(Array.isArray(n)?n:[n]).map(G);null!=t&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(n,r),n})(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{const r=e.getProvider("auth-internal");r.initialize()})),vi._registerComponent(new A("auth-internal",e=>{e=Me(e.getProvider("auth").getImmediate());return e=e,new wr(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),vi.registerVersion(Ir,"0.20.7",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(_r)),vi.registerVersion(Ir,"0.20.7","esm2017");async function Tr(e,t,n){var r=br()["BuildInfo"];z(t.sessionId,"AuthEvent did not contain a session ID");var i=await async function(e){const t=function(t){if(z(/[0-9a-zA-Z]+/.test(t),"Can only convert alpha-numeric strings"),"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}(e),n=await crypto.subtle.digest("SHA-256",t),r=Array.from(new Uint8Array(n));return r.map(e=>e.toString(16).padStart(2,"0")).join("")}(t.sessionId);const s={};return Pe()?s.ibi=r.packageName:Se()?s.apn=r.packageName:F(e,"operation-not-supported-in-this-environment"),r.displayName&&(s.appDisplayName=r.displayName),s.sessionId=i,fr(e,n,t.type,void 0,null!==(t=t.eventId)&&void 0!==t?t:void 0,s)}function kr(r){const i=br()["cordova"];return new Promise(n=>{i.plugins.browsertab.isAvailable(e=>{let t=null;e?i.plugins.browsertab.openUrl(r):t=i.InAppBrowser.open(r,(e=d(),/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)?"_blank":"_system"),"location=yes"),n(t)})})}const Er=20;class Rr extends Gn{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(t){return this.resolveInialized(),this.passiveListeners.forEach(e=>e(t)),super.onEvent(t)}async initialized(){await this.initPromise}}function Sr(e,t,n=null){return{type:t,eventId:n,urlResponse:null,sessionId:function(){const t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<Er;e++){var r=Math.floor(Math.random()*n.length);t.push(n.charAt(r))}return t.join("")}(),postBody:null,tenantId:e.tenantId,error:x(e,"no-auth-event")}}async function Ar(e){var t=await Pr()._get(Nr(e));return t&&await Pr()._remove(Nr(e)),t}function Or(e,t){var n,r,i;const s=(n=Cr(o=t),r=n.link?decodeURIComponent(n.link):void 0,i=Cr(r).link,t=n.deep_link_id?decodeURIComponent(n.deep_link_id):void 0,(n=Cr(t).link)||t||i||r||o);if(s.includes("/__/auth/callback")){var o=Cr(s),o=o.firebaseError?function(e){try{return JSON.parse(e)}catch(e){return null}}(decodeURIComponent(o.firebaseError)):null,o=null===(o=null===(o=null==o?void 0:o.code)||void 0===o?void 0:o.split("auth/"))||void 0===o?void 0:o[1],o=o?x(o):null;return o?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:o,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:s,postBody:null}}return null}function Pr(){return G(Kt)}function Nr(e){return Ie("authEvent",e.config.apiKey,e.name)}function Cr(e){if(null==e||!e.includes("?"))return{};const[,...t]=e.split("?");return v(t.join("?"))}const Lr=class{constructor(){this._redirectPersistence=Jt,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=zn,this._overrideRedirectResult=xn}async _initialize(e){var t=e._key();let n=this.eventManagers.get(t);return n||(n=new Rr(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),n}_openPopup(e){F(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,n,r){var i,s;a=e,s=br(),H("function"==typeof(null===(i=null==s?void 0:s.universalLinks)||void 0===i?void 0:i.subscribe),a,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),H(void 0!==(null===(i=null==s?void 0:s.BuildInfo)||void 0===i?void 0:i.packageName),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),H("function"==typeof(null===(i=null===(i=null===(i=null==s?void 0:s.cordova)||void 0===i?void 0:i.plugins)||void 0===i?void 0:i.browsertab)||void 0===i?void 0:i.openUrl),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),H("function"==typeof(null===(i=null===(i=null===(i=null==s?void 0:s.cordova)||void 0===i?void 0:i.plugins)||void 0===i?void 0:i.browsertab)||void 0===i?void 0:i.isAvailable),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),H("function"==typeof(null===(s=null===(s=null==s?void 0:s.cordova)||void 0===s?void 0:s.InAppBrowser)||void 0===s?void 0:s.open),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"});const o=await this._initialize(e);await o.initialized(),o.resetRedirect(),Mn.clear(),await this._originValidation(e);var a=Sr(e,n,r);n=e,r=a,await Pr()._set(Nr(n),r);t=await kr(await Tr(e,a,t));return async function(o,a,u){const c=br()["cordova"];let l=()=>{};try{await new Promise((n,e)=>{let t=null;function r(){var e;n();const t=null===(e=c.plugins.browsertab)||void 0===e?void 0:e.close;"function"==typeof t&&t(),"function"==typeof(null==u?void 0:u.close)&&u.close()}function i(){t=t||window.setTimeout(()=>{e(x(o,"redirect-cancelled-by-user"))},2e3)}function s(){"visible"===(null===document||void 0===document?void 0:document.visibilityState)&&i()}a.addPassiveListener(r),document.addEventListener("resume",i,!1),Se()&&document.addEventListener("visibilitychange",s,!1),l=()=>{a.removePassiveListener(r),document.removeEventListener("resume",i,!1),document.removeEventListener("visibilitychange",s,!1),t&&window.clearTimeout(t)}})}finally{l()}}(e,o,t)}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){var t=br()["BuildInfo"];const n={};Pe()?n.iosBundleId=t.packageName:Se()?n.androidPackageName=t.packageName:F(e,"operation-not-supported-in-this-environment"),await Jn(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(r,i){const{universalLinks:e,handleOpenURL:t,BuildInfo:n}=br(),s=setTimeout(async()=>{await Ar(r),i.onEvent(Dr())},500),o=async e=>{clearTimeout(s);var t=await Ar(r);let n=null;t&&null!=e&&e.url&&(n=Or(t,e.url)),i.onEvent(n||Dr())};void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,o);const a=t,u=`${n.packageName.toLowerCase()}://`;br().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(u)&&o({url:e}),"function"==typeof a)try{a(e)}catch(e){console.error(e)}}}};function Dr(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:x("no-auth-event")}}function Mr(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function Ur(e){return void 0===e&&(e=d()),!("file:"!==Mr()&&"ionic:"!==Mr()&&"capacitor:"!==Mr()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function Fr(e){return void 0===e&&(e=d()),c()&&11===(null===document||void 0===document?void 0:document.documentMode)||(void 0===(e=e)&&(e=d()),/Edge\/\d+/.test(e))}function xr(){try{var e=self.localStorage,t=Xt();if(e)return e.setItem(t,"1"),e.removeItem(t),!Fr()||l()}catch(e){return Vr()&&l()}return!1}function Vr(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function jr(){return("http:"===Mr()||"https:"===Mr()||a()||Ur())&&!(u()||o())&&xr()&&!Vr()}function Wr(){return Ur()&&"undefined"!=typeof document}var Hr={LOCAL:"local",NONE:"none",SESSION:"session"},qr=H,zr="persistence";function Br(r){return b(this,void 0,void 0,function(){var t,n;return T(this,function(e){switch(e.label){case 0:return[4,r._initializationPromise];case 1:return e.sent(),t=Gr(),n=Ie(zr,r.config.apiKey,r.name),t&&t.setItem(n,r._getPersistence()),[2]}})})}function Gr(){var e;try{return(null===(e="undefined"!=typeof window?window:null)?void 0:e.sessionStorage)||null}catch(e){return null}}var Kr=H,$r=(Jr.prototype._initialize=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._initialize(t)]}})})},Jr.prototype._openPopup=function(t,n,r,i){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openPopup(t,n,r,i)]}})})},Jr.prototype._openRedirect=function(t,n,r,i){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openRedirect(t,n,r,i)]}})})},Jr.prototype._isIframeWebStorageSupported=function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)},Jr.prototype._originValidation=function(e){return this.assertedUnderlyingResolver._originValidation(e)},Object.defineProperty(Jr.prototype,"_shouldInitProactively",{get:function(){return Wr()||this.browserResolver._shouldInitProactively},enumerable:!1,configurable:!0}),Object.defineProperty(Jr.prototype,"assertedUnderlyingResolver",{get:function(){return Kr(this.underlyingResolver,"internal-error"),this.underlyingResolver},enumerable:!1,configurable:!0}),Jr.prototype.selectUnderlyingResolver=function(){return b(this,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return this.underlyingResolver?[2]:[4,function(){return b(this,void 0,void 0,function(){return T(this,function(e){return Wr()?[2,new Promise(function(e){var t=setTimeout(function(){e(!1)},1e3);document.addEventListener("deviceready",function(){clearTimeout(t),e(!0)})})]:[2,!1]})})}()];case 1:return t=e.sent(),this.underlyingResolver=t?this.cordovaResolver:this.browserResolver,[2]}})})},Jr);function Jr(){this.browserResolver=G(vr),this.cordovaResolver=G(Lr),this.underlyingResolver=null,this._redirectPersistence=Jt,this._completeRedirectFn=zn,this._overrideRedirectResult=xn}function Yr(e){return e.unwrap()}function Xr(e,t){var n,r,i=null===(r=t.customData)||void 0===r?void 0:r._tokenResponse;"auth/multi-factor-auth-required"===(null===t||void 0===t?void 0:t.code)?t.resolver=new ti(e,(r=t,e=I(n=e),H((n=r).customData.operationType,e,"argument-error"),H(null===(r=n.customData._serverResponse)||void 0===r?void 0:r.mfaPendingCredential,e,"argument-error"),Wt._fromError(e,n))):!i||(t=Zr(n=t))&&(n.credential=t,n.tenantId=i.tenantId||void 0,n.email=i.email||void 0,n.phoneNumber=i.phoneNumber||void 0)}function Zr(e){var t=(e instanceof h?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof h)&&"temporaryProof"in t&&"phoneNumber"in t)return En.credentialFromResult(e);var n,r=t.providerId;if(!r||r===O.PASSWORD)return null;switch(r){case O.GOOGLE:n=tt;break;case O.FACEBOOK:n=et;break;case O.GITHUB:n=nt;break;case O.TWITTER:n=st;break;default:var i=t.oauthIdToken,s=t.oauthAccessToken,o=t.oauthTokenSecret,a=t.pendingToken,u=t.nonce;return s||o||i||a?a?r.startsWith("saml.")?rt._create(r,a):Ge._fromParams({providerId:r,signInMethod:r,pendingToken:a,idToken:i,accessToken:s}):new Qe(r).credential({idToken:i,accessToken:s,rawNonce:u}):null}return e instanceof h?n.credentialFromError(e):n.credentialFromResult(e)}function Qr(t,e){return e.catch(function(e){throw e instanceof h&&Xr(t,e),e}).then(function(e){var t=e.operationType,n=e.user;return{operationType:t,credential:Zr(e),additionalUserInfo:Vt(e),user:ri.getOrCreate(n)}})}function ei(n,r){return b(this,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return[4,r];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return Qr(n,t.confirm(e))}}]}})})}var ti=(Object.defineProperty(ni.prototype,"session",{get:function(){return this.resolver.session},enumerable:!1,configurable:!0}),Object.defineProperty(ni.prototype,"hints",{get:function(){return this.resolver.hints},enumerable:!1,configurable:!0}),ni.prototype.resolveSignIn=function(e){return Qr(Yr(this.auth),this.resolver.resolveSignIn(e))},ni);function ni(e,t){this.resolver=t,this.auth=e.wrapped()}var ri=(ii.getOrCreate=function(e){return ii.USER_MAP.has(e)||ii.USER_MAP.set(e,new ii(e)),ii.USER_MAP.get(e)},ii.prototype.delete=function(){return this._delegate.delete()},ii.prototype.reload=function(){return this._delegate.reload()},ii.prototype.toJSON=function(){return this._delegate.toJSON()},ii.prototype.getIdTokenResult=function(e){return this._delegate.getIdTokenResult(e)},ii.prototype.getIdToken=function(e){return this._delegate.getIdToken(e)},ii.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},ii.prototype.linkWithCredential=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){return[2,Qr(this.auth,yt(this._delegate,t))]})})},ii.prototype.linkWithPhoneNumber=function(t,n){return b(this,void 0,void 0,function(){return T(this,function(e){return[2,ei(this.auth,async function(e,t,n){const r=I(e);return await ft(!1,r,"phone"),n=await kn(r.auth,t,I(n)),new Tn(n,e=>yt(r,e))}(this._delegate,t,n))]})})},ii.prototype.linkWithPopup=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){return[2,Qr(this.auth,async function(e,t,n){j((e=I(e)).auth,t,Xe),n=Rn(e.auth,n);const r=new Ln(e.auth,"linkViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,t,$r))]})})},ii.prototype.linkWithRedirect=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,Br(Me(this.auth))];case 1:return e.sent(),[2,qn(this._delegate,t,$r)]}})})},ii.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},ii.prototype.reauthenticateWithCredential=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){return[2,Qr(this.auth,_t(this._delegate,t))]})})},ii.prototype.reauthenticateWithPhoneNumber=function(e,t){return ei(this.auth,async function(e,t,n){const r=I(e);return n=await kn(r.auth,t,I(n)),new Tn(n,e=>_t(r,e))}(this._delegate,e,t))},ii.prototype.reauthenticateWithPopup=function(e){return Qr(this.auth,async function(e,t,n){j((e=I(e)).auth,t,Xe),n=Rn(e.auth,n);const r=new Ln(e.auth,"reauthViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,e,$r))},ii.prototype.reauthenticateWithRedirect=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,Br(Me(this.auth))];case 1:return e.sent(),[2,Hn(this._delegate,t,$r)]}})})},ii.prototype.sendEmailVerification=function(e){return Ot(this._delegate,e)},ii.prototype.unlink=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,ht(this._delegate,t)];case 1:return e.sent(),[2,this]}})})},ii.prototype.updateEmail=function(e){return Ct(I(this._delegate),e,null)},ii.prototype.updatePassword=function(e){return Ct(I(this._delegate),null,e)},ii.prototype.updatePhoneNumber=function(e){return async function(e,t){await pt(I(e),t)}(this._delegate,e)},ii.prototype.updateProfile=function(e){return Nt(this._delegate,e)},ii.prototype.verifyBeforeUpdateEmail=function(e,t){return Pt(this._delegate,e,t)},Object.defineProperty(ii.prototype,"emailVerified",{get:function(){return this._delegate.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"isAnonymous",{get:function(){return this._delegate.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"phoneNumber",{get:function(){return this._delegate.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"providerData",{get:function(){return this._delegate.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"refreshToken",{get:function(){return this._delegate.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"displayName",{get:function(){return this._delegate.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"email",{get:function(){return this._delegate.email},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"photoURL",{get:function(){return this._delegate.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"providerId",{get:function(){return this._delegate.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"uid",{get:function(){return this._delegate.uid},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"auth",{get:function(){return this._delegate.auth},enumerable:!1,configurable:!0}),ii.USER_MAP=new WeakMap,ii);function ii(e){this._delegate=e,this.multiFactor=(e=I(e=e),qt.has(e)||qt.set(e,Ht._fromUser(e)),qt.get(e))}var si=H,oi=(Object.defineProperty(ai.prototype,"emulatorConfig",{get:function(){return this._delegate.emulatorConfig},enumerable:!1,configurable:!0}),Object.defineProperty(ai.prototype,"currentUser",{get:function(){return this._delegate.currentUser?ri.getOrCreate(this._delegate.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(ai.prototype,"languageCode",{get:function(){return this._delegate.languageCode},set:function(e){this._delegate.languageCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(ai.prototype,"settings",{get:function(){return this._delegate.settings},enumerable:!1,configurable:!0}),Object.defineProperty(ai.prototype,"tenantId",{get:function(){return this._delegate.tenantId},set:function(e){this._delegate.tenantId=e},enumerable:!1,configurable:!0}),ai.prototype.useDeviceLanguage=function(){this._delegate.useDeviceLanguage()},ai.prototype.signOut=function(){return this._delegate.signOut()},ai.prototype.useEmulator=function(e,t){Fe(this._delegate,e,t)},ai.prototype.applyActionCode=function(e){return Et(this._delegate,e)},ai.prototype.checkActionCode=function(e){return Rt(this._delegate,e)},ai.prototype.confirmPasswordReset=function(e,t){return async function(e,t,n){await We(I(e),{oobCode:t,newPassword:n})}(this._delegate,e,t)},ai.prototype.createUserWithEmailAndPassword=function(t,n){return b(this,void 0,void 0,function(){return T(this,function(e){return[2,Qr(this._delegate,async function(e,t,n){const r=Me(e);return n=await ot(r,{returnSecureToken:!0,email:t,password:n}),n=await at._fromIdTokenResponse(r,"signIn",n),await r._updateCurrentUser(n.user),n}(this._delegate,t,n))]})})},ai.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},ai.prototype.fetchSignInMethodsForEmail=function(e){return At(this._delegate,e)},ai.prototype.isSignInWithEmailLink=function(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=Je.parseLink(e))?void 0:e.operation)},ai.prototype.getRedirectResult=function(){return b(this,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return si(jr(),this._delegate,"operation-not-supported-in-this-environment"),[4,async function(e,t){return await Me(e)._initializationPromise,zn(e,t,!1)}(this._delegate,$r)];case 1:return(t=e.sent())?[2,Qr(this._delegate,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},ai.prototype.addFrameworkForLogging=function(e){Me(this._delegate)._logFramework(e)},ai.prototype.onAuthStateChanged=function(e,t,n){e=ui(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onAuthStateChanged(t,n,e)},ai.prototype.onIdTokenChanged=function(e,t,n){e=ui(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onIdTokenChanged(t,n,e)},ai.prototype.sendSignInLinkToEmail=function(e,t){return St(this._delegate,e,t)},ai.prototype.sendPasswordResetEmail=function(e,t){return kt(this._delegate,e,t||void 0)},ai.prototype.setPersistence=function(s){return b(this,void 0,void 0,function(){var r,i;return T(this,function(e){switch(e.label){case 0:switch(t=this._delegate,n=s,qr(Object.values(Hr).includes(n),t,"invalid-persistence-type"),u()?qr(n!==Hr.SESSION,t,"unsupported-persistence-type"):o()?qr(n===Hr.NONE,t,"unsupported-persistence-type"):Vr()?qr(n===Hr.NONE||n===Hr.LOCAL&&l(),t,"unsupported-persistence-type"):qr(n===Hr.NONE||xr(),t,"unsupported-persistence-type"),s){case Hr.SESSION:return[3,1];case Hr.LOCAL:return[3,2];case Hr.NONE:return[3,4]}return[3,5];case 1:return r=Jt,[3,6];case 2:return[4,G(dn)._isAvailable()];case 3:return i=e.sent(),r=i?dn:Kt,[3,6];case 4:return r=_e,[3,6];case 5:return[2,F("argument-error",{appName:this._delegate.name})];case 6:return[2,this._delegate.setPersistence(r)]}var t,n})})},ai.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},ai.prototype.signInAnonymously=function(){return Qr(this._delegate,async function(e){const t=Me(e);return await t._initializationPromise,null!==(e=t.currentUser)&&void 0!==e&&e.isAnonymous?new at({user:t.currentUser,providerId:null,operationType:"signIn"}):(e=await ot(t,{returnSecureToken:!0}),e=await at._fromIdTokenResponse(t,"signIn",e,!0),await t._updateCurrentUser(e.user),e)}(this._delegate))},ai.prototype.signInWithCredential=function(e){return Qr(this._delegate,gt(this._delegate,e))},ai.prototype.signInWithCustomToken=function(e){return Qr(this._delegate,It(this._delegate,e))},ai.prototype.signInWithEmailAndPassword=function(e,t){return Qr(this._delegate,(n=this._delegate,e=e,t=t,gt(I(n),Ye.credential(e,t))));var n},ai.prototype.signInWithEmailLink=function(e,t){return Qr(this._delegate,async function(e,t,n){return e=I(e),H((n=Ye.credentialWithLink(t,n||K()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),gt(e,n)}(this._delegate,e,t))},ai.prototype.signInWithPhoneNumber=function(e,t){return ei(this._delegate,async function(e,t,n){const r=Me(e);return n=await kn(r,t,I(n)),new Tn(n,e=>gt(r,e))}(this._delegate,e,t))},ai.prototype.signInWithPopup=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){return si(jr(),this._delegate,"operation-not-supported-in-this-environment"),[2,Qr(this._delegate,async function(e,t,n){var r=Me(e);j(e,t,Xe),n=Rn(r,n);const i=new Ln(r,"signInViaPopup",t,n);return i.executeNotNull()}(this._delegate,t,$r))]})})},ai.prototype.signInWithRedirect=function(t){return b(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return si(jr(),this._delegate,"operation-not-supported-in-this-environment"),[4,Br(this._delegate)];case 1:return e.sent(),[2,Wn(this._delegate,t,$r)]}})})},ai.prototype.updateCurrentUser=function(e){return this._delegate.updateCurrentUser(e)},ai.prototype.verifyPasswordResetCode=function(e){return async function(e,t){return(t=(await Rt(I(e),t))["data"]).email}(this._delegate,e)},ai.prototype.unwrap=function(){return this._delegate},ai.prototype._delete=function(){return this._delegate._delete()},ai.prototype.linkUnderlyingAuth=function(){var e=this;this._delegate.wrapped=function(){return e}},ai.Persistence=Hr,ai);function ai(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();var n=e.options.apiKey;si(n,"invalid-api-key",{appName:e.name}),si(n,"invalid-api-key",{appName:e.name});var r="undefined"!=typeof window?$r:void 0;this._delegate=t.initialize({options:{persistence:function(e,t){var n=function(e,t){var n=Gr();if(!n)return[];switch(t=Ie(zr,e,t),n.getItem(t)){case Hr.NONE:return[_e];case Hr.LOCAL:return[dn,Jt];case Hr.SESSION:return[Jt];default:return[]}}(e,t);"undefined"==typeof self||n.includes(dn)||n.push(dn);if("undefined"!=typeof window)for(var r=0,i=[Kt,Jt];r<i.length;r++){var s=i[r];n.includes(s)||n.push(s)}n.includes(_e)||n.push(_e);return n}(n,e.name),popupRedirectResolver:r}}),this._delegate._updateErrorMap(C),this.linkUnderlyingAuth()}function ui(e,t,n){var r=e;"function"!=typeof e&&(r=e.next,t=e.error,n=e.complete);var i=r;return{next:function(e){return i(e&&ri.getOrCreate(e))},error:t,complete:n}}var ci=(li.credential=function(e,t){return En.credential(e,t)},li.prototype.verifyPhoneNumber=function(e,t){return this._delegate.verifyPhoneNumber(e,t)},li.prototype.unwrap=function(){return this._delegate},li.PHONE_SIGN_IN_METHOD=En.PHONE_SIGN_IN_METHOD,li.PROVIDER_ID=En.PROVIDER_ID,li);function li(){this.providerId="phone",this._delegate=new En(Yr(i.default.auth()))}var di=H,hi=(pi.prototype.clear=function(){this._delegate.clear()},pi.prototype.render=function(){return this._delegate.render()},pi.prototype.verify=function(){return this._delegate.verify()},pi);function pi(e,t,n){var r;void 0===n&&(n=i.default.app()),di(null===(r=n.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new bn(e,t,n.auth()),this.type=this._delegate.type}var fi;(fi=i.default).INTERNAL.registerComponent(new A("auth-compat",function(e){var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new oi(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:P.EMAIL_SIGNIN,PASSWORD_RESET:P.PASSWORD_RESET,RECOVER_EMAIL:P.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:P.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:P.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:P.VERIFY_EMAIL}},EmailAuthProvider:Ye,FacebookAuthProvider:et,GithubAuthProvider:nt,GoogleAuthProvider:tt,OAuthProvider:Qe,SAMLAuthProvider:it,PhoneAuthProvider:ci,PhoneMultiFactorGenerator:yr,RecaptchaVerifier:hi,TwitterAuthProvider:st,Auth:oi,AuthCredential:je,Error:h}).setInstantiationMode("LAZY").setMultipleInstances(!1)),fi.registerVersion("@firebase/auth-compat","0.2.20")}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(Ii,wi){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=e(Ii);const t={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const s=[];for(let n=0;n<r.length;n+=3){var o=r[n],a=n+1<r.length,u=a?r[n+1]:0,c=n+2<r.length,l=c?r[n+2]:0;let e=(15&u)<<2|l>>6,t=63&l;c||(t=64,a||(e=64)),s.push(i[o>>2],i[(3&o)<<4|u>>4],i[e],i[t])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(n){const r=[];let i=0;for(let t=0;t<n.length;t++){let e=n.charCodeAt(t);e<128?r[i++]=e:(e<2048?r[i++]=e>>6|192:(55296==(64512&e)&&t+1<n.length&&56320==(64512&n.charCodeAt(t+1))?(e=65536+((1023&e)<<10)+(1023&n.charCodeAt(++t)),r[i++]=e>>18|240,r[i++]=e>>12&63|128):r[i++]=e>>12|224,r[i++]=e>>6&63|128),r[i++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){var i,s,o=e[n++];o<128?t[r++]=String.fromCharCode(o):191<o&&o<224?(i=e[n++],t[r++]=String.fromCharCode((31&o)<<6|63&i)):239<o&&o<365?(s=((7&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))):(i=e[n++],s=e[n++],t[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(t,e){this.init_();var n=e?this.charToByteMapWebSafe_:this.charToByteMap_;const r=[];for(let e=0;e<t.length;){var i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;var o=e<t.length?n[t.charAt(e)]:64;++e;var a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();r.push(i<<2|s>>4),64!==o&&(r.push(s<<4&240|o>>2),64!==a&&r.push(o<<6&192|a))}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},s=function(e){try{return t.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function o(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function n(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function a(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function u(){const e=d();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function c(){return"object"==typeof indexedDB}const r=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,l=()=>{if("undefined"!=typeof process){var e=process.env.__FIREBASE_DEFAULTS__,t=process.env.__FIREBASE_DEFAULTS_PATH__;if(e)return t&&console.warn("Values were provided for both __FIREBASE_DEFAULTS__ and __FIREBASE_DEFAULTS_PATH__. __FIREBASE_DEFAULTS_PATH__ will be ignored."),JSON.parse(e);if(t&&"undefined"!=typeof require)try{return require(t)}catch(e){console.warn("Unable to read defaults from file provided to "+`__FIREBASE_DEFAULTS_PATH__: ${t}`)}}},h=()=>{if("undefined"!=typeof document){var e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/),e=e&&s(e[1]);return e&&JSON.parse(e)}};var p,f;class m extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,m.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,v.prototype.create)}}class v{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var r,n=t[0]||{},t=`${this.service}/${e}`,e=this.errors[e],e=e?(r=n,e.replace(g,(e,t)=>{var n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",e=`${this.serviceName}: ${e} (${t}).`;return new m(t,e,n)}}const g=/\{\$([^}]+)}/g;function y(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function _(e){const n={},t=e.replace(/^\?/,"").split("&");return t.forEach(e=>{var t;e&&([t,e]=e.split("="),n[decodeURIComponent(t)]=decodeURIComponent(e))}),n}function I(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,0<n?n:void 0)}class w{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=b),void 0===r.error&&(r.error=b),void 0===r.complete&&(r.complete=b);n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),n}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function b(){}function T(e){return e&&e._delegate?e._delegate:e}(f=p=p||{})[f.DEBUG=0]="DEBUG",f[f.VERBOSE=1]="VERBOSE",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.SILENT=5]="SILENT";const k={debug:p.DEBUG,verbose:p.VERBOSE,info:p.INFO,warn:p.WARN,error:p.ERROR,silent:p.SILENT},E=p.INFO,R={[p.DEBUG]:"log",[p.VERBOSE]:"log",[p.INFO]:"info",[p.WARN]:"warn",[p.ERROR]:"error"},S=(e,t,...n)=>{if(!(t<e.logLevel)){var r=(new Date).toISOString(),i=R[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)}};function A(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}function O(e,o,a,u){return new(a=a||Promise)(function(n,t){function r(e){try{s(u.next(e))}catch(e){t(e)}}function i(e){try{s(u.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(r,i)}s((u=u.apply(e,o||[])).next())})}function P(n,r){var i,s,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,s&&(o=2&t[0]?s.return:t[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,t[1])).done)return o;switch(s=0,(t=o?[2&t[0],o.value]:t)[0]){case 0:case 1:o=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(o=0<(o=a.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){a.label=t[1];break}if(6===t[0]&&a.label<o[1]){a.label=o[1],o=t;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(t);break}o[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{i=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}class N{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const C={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},L={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"};function D(){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."}}function M(){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 registed 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 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-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."}}const U=D,F=new v("auth","Firebase",D()),x=new class{constructor(e){this.name=e,this._logLevel=E,this._logHandler=S,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in p))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?k[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,p.DEBUG,...e),this._logHandler(this,p.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,p.VERBOSE,...e),this._logHandler(this,p.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,p.INFO,...e),this._logHandler(this,p.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,p.WARN,...e),this._logHandler(this,p.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,p.ERROR,...e),this._logHandler(this,p.ERROR,...e)}}("@firebase/auth");function V(e,...t){x.logLevel<=p.ERROR&&x.error(`Auth (${wi.SDK_VERSION}): ${e}`,...t)}function j(e,...t){throw z(e,...t)}function W(e,...t){return z(e,...t)}function H(e,t,n){n=Object.assign(Object.assign({},U()),{[t]:n});const r=new v("auth","Firebase",n);return r.create(t,{appName:e.name})}function q(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&j(e,"argument-error"),H(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function z(e,...t){if("string"==typeof e)return F.create(e,...t);{var n=t[0];const r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}}function B(e,t,...n){if(!e)throw z(t,...n)}function G(e){e="INTERNAL ASSERTION FAILED: "+e;throw V(e),new Error(e)}function K(e,t){e||G(t)}const $=new Map;function J(e){K(e instanceof Function,"Expected a class definition");let t=$.get(e);return t?K(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,$.set(e,t)),t}function Y(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function X(){return"http:"===Z()||"https:"===Z()}function Z(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class Q{constructor(e,t){K((this.shortDelay=e)<(this.longDelay=t),"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())||a()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(X()||n()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function ee(e,t){K(e.emulator,"Emulator should always be set here");var e=e.emulator["url"];return t?`${e}${t.startsWith("/")?t.slice(1):t}`:e}class te{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl||("undefined"!=typeof self&&"fetch"in self?self.fetch:void G("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static headers(){return this.headersImpl||("undefined"!=typeof self&&"Headers"in self?self.Headers:void G("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static response(){return this.responseImpl||("undefined"!=typeof self&&"Response"in self?self.Response:void G("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}const ne={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:"internal-error",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",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"},re=new Q(3e4,6e4);function ie(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function se(i,s,o,a,e={}){return oe(i,e,async()=>{let e={},t={};a&&("GET"===s?t=a:e={body:JSON.stringify(a)});var n=y(Object.assign({key:i.config.apiKey},t)).slice(1);const r=await i._getAdditionalHeaders();return r["Content-Type"]="application/json",i.languageCode&&(r["X-Firebase-Locale"]=i.languageCode),te.fetch()(ue(i,i.config.apiHost,o,n),Object.assign({method:s,headers:r,referrerPolicy:"no-referrer"},e))})}async function oe(t,e,n){t._canInitEmulator=!1;e=Object.assign(Object.assign({},ne),e);try{const s=new ce(t),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();var r=await o.json();if("needConfirmation"in r)throw le(t,"account-exists-with-different-credential",r);if(o.ok&&!("errorMessage"in r))return r;{const a=o.ok?r.errorMessage:r.error.message,[u,c]=a.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===u)throw le(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===u)throw le(t,"email-already-in-use",r);if("USER_DISABLED"===u)throw le(t,"user-disabled",r);var i=e[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw H(t,i,c);j(t,i)}}catch(e){if(e instanceof m)throw e;j(t,"network-request-failed")}}async function ae(e,t,n,r,i={}){i=await se(e,t,n,r,i);return"mfaPendingCredential"in i&&j(e,"multi-factor-auth-required",{_serverResponse:i}),i}function ue(e,t,n,r){r=`${t}${n}?${r}`;return e.config.emulator?ee(e.config,r):`${e.config.apiScheme}://${r}`}class ce{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(W(this.auth,"network-request-failed")),re.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function le(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=W(e,t,r);return i.customData._tokenResponse=n,i}function de(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function he(e){return 1e3*Number(e)}function pe(e){var[t,n,e]=e.split(".");if(void 0===t||void 0===n||void 0===e)return V("JWT malformed, contained fewer than 3 sections"),null;try{var r=s(n);return r?JSON.parse(r):(V("Failed to decode base64 JWT payload"),null)}catch(e){return V("Caught error parsing JWT payload as JSON",null===e||void 0===e?void 0:e.toString()),null}}async function fe(t,n,e=!1){if(e)return n;try{return n}catch(e){throw e instanceof m&&(n=[e["code"]][0],"auth/user-disabled"===n||"auth/user-token-expired"===n)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class me{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,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){if(e){var t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}this.errorBackoff=3e4;t=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,t)}schedule(e=!1){this.isRunning&&(e=this.getInterval(e),this.timerId=setTimeout(async()=>{await this.iteration()},e))}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null===e||void 0===e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class ve{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=de(this.lastLoginAt),this.creationTime=de(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ge(e){var t=e.auth,n=await e.getIdToken(),r=await fe(e,async function(e,t){return se(e,"POST","/v1/accounts:lookup",t)}(t,{idToken:n}));B(null==r?void 0:r.users.length,t,"internal-error");var i=r.users[0];e._notifyReloadListener(i);t=null!==(n=i.providerUserInfo)&&void 0!==n&&n.length?i.providerUserInfo.map(e=>{var t=e["providerId"],e=A(e,["providerId"]);return{providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}}):[],r=function(e,n){e=e.filter(t=>!n.some(e=>e.providerId===t.providerId));return[...e,...n]}(e.providerData,t),n=e.isAnonymous,t=!(e.email&&i.passwordHash||null!=r&&r.length),t=!!n&&t,t={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:r,metadata:new ve(i.createdAt,i.lastLoginAt),isAnonymous:t};Object.assign(e,t)}class ye{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){B(e.idToken,"internal-error"),B(void 0!==e.idToken,"internal-error"),B(void 0!==e.refreshToken,"internal-error");var t,t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):(B(t=pe(t=e.idToken),"internal-error"),B(void 0!==t.exp,"internal-error"),B(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat));this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return B(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){var i,s,{accessToken:t,refreshToken:e,expiresIn:n}=(s=t,await{accessToken:(n=await oe(i=e,{},async()=>{var e=y({grant_type:"refresh_token",refresh_token:s}).slice(1),{tokenApiHost:t,apiKey:n}=i.config,n=ue(i,t,"/v1/token",`key=${n}`);const r=await i._getAdditionalHeaders();return r["Content-Type"]="application/x-www-form-urlencoded",te.fetch()(n,{method:"POST",headers:r,body:e})})).access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token});this.updateTokensAndExpiration(t,e,Number(n))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){var{refreshToken:n,accessToken:r,expirationTime:t}=t;const i=new ye;return n&&(B("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(B("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),t&&(B("number"==typeof t,"internal-error",{appName:e}),i.expirationTime=t),i}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 ye,this.toJSON())}_performRefresh(){return G("not implemented")}}function _e(e,t){B("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Ie{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,e=A(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new me(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=e.displayName||null,this.email=e.email||null,this.emailVerified=e.emailVerified||!1,this.phoneNumber=e.phoneNumber||null,this.photoURL=e.photoURL||null,this.isAnonymous=e.isAnonymous||!1,this.tenantId=e.tenantId||null,this.providerData=e.providerData?[...e.providerData]:[],this.metadata=new ve(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await fe(this,this.stsTokenManager.getToken(this.auth,e));return B(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(e){return async function(e,t=!1){const n=T(e);var r=await n.getIdToken(t),i=pe(r);return B(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error"),e="object"==typeof i.firebase?i.firebase:void 0,t=null==e?void 0:e.sign_in_provider,{claims:i,token:r,authTime:de(he(i.auth_time)),issuedAtTime:de(he(i.iat)),expirationTime:de(he(i.exp)),signInProvider:t||null,signInSecondFactor:(null==e?void 0:e.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=T(e);await ge(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(B(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(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new Ie(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){B(!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 n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await ge(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e=await this.getIdToken();return await fe(this,async function(e,t){return se(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({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=>Object.assign({},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){var n=null!==(c=t.displayName)&&void 0!==c?c:void 0,r=null!==(o=t.email)&&void 0!==o?o:void 0,i=null!==(u=t.phoneNumber)&&void 0!==u?u:void 0,s=null!==(a=t.photoURL)&&void 0!==a?a:void 0,o=null!==(c=t.tenantId)&&void 0!==c?c:void 0,a=null!==(u=t._redirectEventId)&&void 0!==u?u:void 0,u=null!==(c=t.createdAt)&&void 0!==c?c:void 0,c=null!==(c=t.lastLoginAt)&&void 0!==c?c:void 0;const{uid:l,emailVerified:d,isAnonymous:h,providerData:p,stsTokenManager:f}=t;B(l&&f,e,"internal-error");t=ye.fromJSON(this.name,f);B("string"==typeof l,e,"internal-error"),_e(n,e.name),_e(r,e.name),B("boolean"==typeof d,e,"internal-error"),B("boolean"==typeof h,e,"internal-error"),_e(i,e.name),_e(s,e.name),_e(o,e.name),_e(a,e.name),_e(u,e.name),_e(c,e.name);const m=new Ie({uid:l,auth:e,email:r,emailVerified:d,displayName:n,isAnonymous:h,photoURL:s,phoneNumber:i,tenantId:o,stsTokenManager:t,createdAt:u,lastLoginAt:c});return p&&Array.isArray(p)&&(m.providerData=p.map(e=>Object.assign({},e))),a&&(m._redirectEventId=a),m}static async _fromIdTokenResponse(e,t,n=!1){const r=new ye;r.updateFromServerResponse(t);n=new Ie({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await ge(n),n}}class we{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){e=this.storage[e];return void 0===e?null:e}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}we.type="NONE";const be=we;function Te(e,t,n){return`firebase:${e}:${t}:${n}`}class ke{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;var{config:e,name:n}=this.auth;this.fullUserKey=Te(this.userKey,e.apiKey,n),this.fullPersistenceKey=Te("persistence",e.apiKey,n),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){var e=await this.persistence._get(this.fullUserKey);return e?Ie._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence!==e){var t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new ke(J(be),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let i=r[0]||J(be);const s=Te(n,e.config.apiKey,e.name);let o=null;for(const l of t)try{var a=await l._get(s);if(a){var u=Ie._fromJSON(e,a);l!==i&&(o=u),i=l;break}}catch(e){}var c=r.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&c.length&&(i=c[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch(e){}}))),new ke(i,e,n)}}function Ee(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Oe(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Re(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ne(t))return"Blackberry";if(Ce(t))return"Webos";if(Se(t))return"Safari";if((t.includes("chrome/")||Ae(t))&&!t.includes("edge/"))return"Chrome";if(Pe(t))return"Android";e=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);return 2===(null==e?void 0:e.length)?e[1]:"Other"}function Re(e=d()){return/firefox\//i.test(e)}function Se(e=d()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ae(e=d()){return/crios\//i.test(e)}function Oe(e=d()){return/iemobile/i.test(e)}function Pe(e=d()){return/android/i.test(e)}function Ne(e=d()){return/blackberry/i.test(e)}function Ce(e=d()){return/webos/i.test(e)}function Le(e=d()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function De(e=d()){return Le(e)||Pe(e)||Ce(e)||Ne(e)||/windows phone/i.test(e)||Oe(e)}function Me(e,t=[]){let n;switch(e){case"Browser":n=Ee(d());break;case"Worker":n=`${Ee(d())}-${e}`;break;default:n=e}t=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${wi.SDK_VERSION}/${t}`}class Ue{constructor(e){this.auth=e,this.queue=[]}pushCallback(r,e){var t=n=>new Promise((e,t)=>{try{e(r(n))}catch(e){t(e)}});t.onAbort=e,this.queue.push(t);const n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser!==e){const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const r of t)try{r()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===e||void 0===e?void 0:e.message})}}}}class Fe{constructor(e,t,n){this.app=e,this.heartbeatServiceProvider=t,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ve(this),this.idTokenSubscription=new Ve(this),this.beforeStateQueue=new Ue(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=F,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=J(n)),this._initializationPromise=this.queue(async()=>{var e;if(!this._deleted&&(this.persistenceManager=await ke.create(this,t),!this._deleted)){if(null!==(e=this._popupRedirectResolver)&&void 0!==e&&e._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(n),this.lastNotifiedUid=(null===(e=this.currentUser)||void 0===e?void 0:e.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(!this._deleted){var e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e)return this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t,n,r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,n=null===i||void 0===i?void 0:i._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==n||null==e||!e.user||(i=e.user,s=!0)),!i)return this.directlySetCurrentUser(null);if(i._redirectEventId)return B(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i);if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ge(e)}catch(e){if("auth/network-request-failed"!==(null===e||void 0===e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;var e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?T(e):null;return t&&B(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&&B(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 await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(J(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new v("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){return this.redirectPersistenceManager||(B(e=e&&J(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await ke.create(this,[J(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()),this.redirectPersistenceManager}async _redirectUserForId(e){var t;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(t=this.redirectUser)||void 0===t?void 0:t._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 e;this._isInitialized&&(this.idTokenSubscription.next(this.currentUser),e=null!==(e=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==e?e:null,this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser)))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return B(s,this,"internal-error"),s.then(()=>i(this.currentUser)),"function"==typeof t?e.addObserver(t,n,r):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),(this.currentUser=e)?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return B(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Me(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);var t=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return t&&(e["X-Firebase-Client"]=t),e}}function xe(e){return T(e)}class Ve{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new w(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return B(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function je(e,t,n){const r=xe(e);B(r._canInitEmulator,r,"emulator-config-failed"),B(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");e=!(null==n||!n.disableWarnings);const i=We(t);var{host:n,port:t}=function(e){const t=We(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);{if(i){var s=i[1];return{host:s,port:He(r.substr(s.length+1))}}var[e,s]=r.split(":");return{host:e,port:He(s)}}}(t);r.config.emulator={url:`${i}//${n}${null===t?"":`:${t}`}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:n,port:t,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:e})}),e||function(){function e(){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)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function We(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function He(e){if(!e)return null;e=Number(e);return isNaN(e)?null:e}class qe{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return G("not implemented")}_getIdTokenResponse(e){return G("not implemented")}_linkToIdToken(e,t){return G("not implemented")}_getReauthenticationResolver(e){return G("not implemented")}}async function ze(e,t){return se(e,"POST","/v1/accounts:resetPassword",ie(e,t))}async function Be(e,t){return se(e,"POST","/v1/accounts:update",t)}async function Ge(e,t){return se(e,"POST","/v1/accounts:sendOobCode",ie(e,t))}class Ke extends qe{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Ke(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new Ke(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){e="string"==typeof e?JSON.parse(e):e;if(null!=e&&e.email&&null!=e&&e.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return async function(e,t){return ae(e,"POST","/v1/accounts:signInWithPassword",ie(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return ae(e,"POST","/v1/accounts:signInWithEmailLink",ie(e,t))}(e,{email:this._email,oobCode:this._password});default:j(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Be(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return ae(e,"POST","/v1/accounts:signInWithEmailLink",ie(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:j(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function $e(e,t){return ae(e,"POST","/v1/accounts:signInWithIdp",ie(e,t))}class Je extends qe{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Je(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):j("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){var t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:e}=t,t=A(t,["providerId","signInMethod"]);if(!n||!e)return null;const r=new Je(n,e);return r.idToken=t.idToken||void 0,r.accessToken=t.accessToken||void 0,r.secret=t.secret,r.nonce=t.nonce,r.pendingToken=t.pendingToken||null,r}_getIdTokenResponse(e){return $e(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,$e(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,$e(e,t)}buildRequest(){const e={requestUri:"http://localhost",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=y(t)}return e}}const Ye={USER_NOT_FOUND:"user-not-found"};class Xe extends qe{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Xe({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Xe({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return ae(e,"POST","/v1/accounts:signInWithPhoneNumber",ie(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){if((t=await ae(e,"POST","/v1/accounts:signInWithPhoneNumber",ie(e,t))).temporaryProof)throw le(e,"account-exists-with-different-credential",t);return t}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return ae(e,"POST","/v1/accounts:signInWithPhoneNumber",ie(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Ye)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){var{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,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){var{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}=e="string"==typeof e?JSON.parse(e):e;return n||t||r||e?new Xe({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}):null}}class Ze{constructor(e){var t=_(I(e)),n=null!==(r=t.apiKey)&&void 0!==r?r:null,r=null!==(e=t.oobCode)&&void 0!==e?e:null,e=function(e){switch(e){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}}(null!==(e=t.mode)&&void 0!==e?e:null);B(n&&r&&e,"argument-error"),this.apiKey=n,this.operation=e,this.code=r,this.continueUrl=null!==(r=t.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(r=t.languageCode)&&void 0!==r?r:null,this.tenantId=null!==(t=t.tenantId)&&void 0!==t?t:null}static parseLink(e){var t,n,r,t=(n=_(I(t=e)).link,r=n?_(I(n)).deep_link_id:null,((e=_(I(t)).deep_link_id)?_(I(e)).link:null)||e||r||n||t);try{return new Ze(t)}catch(e){return null}}}class Qe{constructor(){this.providerId=Qe.PROVIDER_ID}static credential(e,t){return Ke._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=Ze.parseLink(t);return B(t,"argument-error"),Ke._fromEmailAndCode(e,t.code,t.tenantId)}}Qe.PROVIDER_ID="password",Qe.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Qe.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class et{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}}class tt extends et{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class nt extends tt{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return B("providerId"in e&&"signInMethod"in e,"argument-error"),Je._fromParams(e)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return B(e.idToken||e.accessToken,"argument-error"),Je._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return nt.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return nt.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:r,pendingToken:i,nonce:s,providerId:e}=e;if(!(n||r||t||i))return null;if(!e)return null;try{return new nt(e)._credential({idToken:t,accessToken:n,nonce:s,pendingToken:i})}catch(e){return null}}}class rt extends tt{constructor(){super("facebook.com")}static credential(e){return Je._fromParams({providerId:rt.PROVIDER_ID,signInMethod:rt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return rt.credentialFromTaggedObject(e)}static credentialFromError(e){return rt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return rt.credential(e.oauthAccessToken)}catch(e){return null}}}rt.FACEBOOK_SIGN_IN_METHOD="facebook.com",rt.PROVIDER_ID="facebook.com";class it extends tt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Je._fromParams({providerId:it.PROVIDER_ID,signInMethod:it.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return it.credentialFromTaggedObject(e)}static credentialFromError(e){return it.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:t,oauthAccessToken:e}=e;if(!t&&!e)return null;try{return it.credential(t,e)}catch(e){return null}}}it.GOOGLE_SIGN_IN_METHOD="google.com",it.PROVIDER_ID="google.com";class st extends tt{constructor(){super("github.com")}static credential(e){return Je._fromParams({providerId:st.PROVIDER_ID,signInMethod:st.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return st.credentialFromTaggedObject(e)}static credentialFromError(e){return st.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return st.credential(e.oauthAccessToken)}catch(e){return null}}}st.GITHUB_SIGN_IN_METHOD="github.com",st.PROVIDER_ID="github.com";class ot extends qe{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return $e(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,$e(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,$e(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){var{providerId:t,signInMethod:n,pendingToken:e}="string"==typeof e?JSON.parse(e):e;return t&&n&&e&&t===n?new ot(t,e):null}static _create(e,t){return new ot(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class at extends et{constructor(e){B(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return at.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return at.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){e=ot.fromJSON(e);return B(e,"argument-error"),e}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{pendingToken:t,providerId:e}=e;if(!t||!e)return null;try{return ot._create(e,t)}catch(e){return null}}}class ut extends tt{constructor(){super("twitter.com")}static credential(e,t){return Je._fromParams({providerId:ut.PROVIDER_ID,signInMethod:ut.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return ut.credentialFromTaggedObject(e)}static credentialFromError(e){return ut.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:t,oauthTokenSecret:e}=e;if(!t||!e)return null;try{return ut.credential(t,e)}catch(e){return null}}}async function ct(e,t){return ae(e,"POST","/v1/accounts:signUp",ie(e,t))}ut.TWITTER_SIGN_IN_METHOD="twitter.com",ut.PROVIDER_ID="twitter.com";class lt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){e=await Ie._fromIdTokenResponse(e,n,r),r=dt(n);return new lt({user:e,providerId:r,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);var r=dt(n);return new lt({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function dt(e){return e.providerId||("phoneNumber"in e?"phone":null)}class ht extends m{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ht.prototype),this.customData={appName:e.name,tenantId:null!==(e=e.tenantId)&&void 0!==e?e:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new ht(e,t,n,r)}}function pt(t,n,e,r){const i="reauthenticate"===n?e._getReauthenticationResolver(t):e._getIdTokenResponse(t);return i.catch(e=>{if("auth/multi-factor-auth-required"===e.code)throw ht._fromErrorAndOperation(t,e,n,r);throw e})}function ft(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function mt(e,t){const n=T(e);await gt(!0,n,t);var t=(e=n.auth,t={idToken:await n.getIdToken(),deleteProvider:[t]},await se(e,"POST","/v1/accounts:update",t))["providerUserInfo"];const r=ft(t||[]);return n.providerData=n.providerData.filter(e=>r.has(e.providerId)),r.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function vt(e,t,n=!1){n=await fe(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return lt._forOperation(e,"link",n)}async function gt(e,t,n){await ge(t);const r=ft(t.providerData);var i=!1===e?"provider-already-linked":"no-such-provider";B(r.has(n)===e,t.auth,i)}async function yt(e,t,n=!1){var r=e["auth"],i="reauthenticate";try{var s=await fe(e,pt(r,i,t,e),n);B(s.idToken,r,"internal-error");var o=pe(s.idToken);B(o,r,"internal-error");var a=o["sub"];return B(e.uid===a,r,"user-mismatch"),lt._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===(null===e||void 0===e?void 0:e.code)&&j(r,"user-mismatch"),e}}async function _t(e,t,n=!1){t=await pt(e,"signIn",t),t=await lt._fromIdTokenResponse(e,"signIn",t);return n||await e._updateCurrentUser(t.user),t}async function It(e,t){return _t(xe(e),t)}async function wt(e,t){e=T(e);return await gt(!1,e,t.providerId),vt(e,t)}async function bt(e,t){return yt(T(e),t)}async function Tt(e,t){const n=xe(e);t=await ae(n,"POST","/v1/accounts:signInWithCustomToken",ie(n,{token:t,returnSecureToken:!0})),t=await lt._fromIdTokenResponse(n,"signIn",t);return await n._updateCurrentUser(t.user),t}class kt{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?Et._fromServerResponse(e,t):j(e,"internal-error")}}class Et extends kt{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new Et(t)}}function Rt(e,t,n){var r;B(0<(null===(r=n.url)||void 0===r?void 0:r.length),e,"invalid-continue-uri"),B(void 0===n.dynamicLinkDomain||0<n.dynamicLinkDomain.length,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(B(0<n.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(B(0<n.android.packageName.length,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function St(e,t,n){e=T(e),t={requestType:"PASSWORD_RESET",email:t};n&&Rt(e,t,n),await Ge(e,t)}async function At(e,t){await se(e=T(e),"POST","/v1/accounts:update",ie(e,{oobCode:t}))}async function Ot(e,t){var n=T(e),r=await ze(n,{oobCode:t}),t=r.requestType;switch(B(t,n,"internal-error"),t){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":B(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":B(r.mfaInfo,n,"internal-error");default:B(r.email,n,"internal-error")}let i=null;return r.mfaInfo&&(i=kt._fromServerResponse(xe(n),r.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.newEmail:r.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===r.requestType?r.email:r.newEmail)||null,multiFactorInfo:i},operation:t}}async function Pt(e,t,n){e=T(e),t={requestType:"EMAIL_SIGNIN",email:t};B(n.handleCodeInApp,e,"argument-error"),n&&Rt(e,t,n),await Ge(e,t)}async function Nt(e,t){var n=X()?Y():"http://localhost",n=(await se(e=T(e),"POST","/v1/accounts:createAuthUri",ie(e,{identifier:t,continueUri:n})))["signinMethods"];return n||[]}async function Ct(e,t){var n=T(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Rt(n.auth,r,t);var r=(await Ge(n.auth,r))["email"];r!==e.email&&await e.reload()}async function Lt(e,t,n){var r=T(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&Rt(r.auth,t,n);var t=(await Ge(r.auth,t))["email"];t!==e.email&&await e.reload()}async function Dt(e,{displayName:t,photoURL:n}){if(void 0!==t||void 0!==n){const r=T(e);e=await r.getIdToken(),n=await fe(r,async function(e,t){return se(e,"POST","/v1/accounts:update",t)}(r.auth,{idToken:e,displayName:t,photoUrl:n,returnSecureToken:!0}));r.displayName=n.displayName||null,r.photoURL=n.photoUrl||null;const i=r.providerData.find(({providerId:e})=>"password"===e);i&&(i.displayName=r.displayName,i.photoURL=r.photoURL),await r._updateTokensIfNecessary(n)}}async function Mt(e,t,n){var r=e["auth"];const i={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(i.email=t),n&&(i.password=n);r=await fe(e,Be(r,i));await e._updateTokensIfNecessary(r,!0)}class Ut{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class Ft extends Ut{constructor(e,t,n,r){super(e,t,n),this.username=r}}class xt extends Ut{constructor(e,t){super(e,"facebook.com",t)}}class Vt extends Ft{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class jt extends Ut{constructor(e,t){super(e,"google.com",t)}}class Wt extends Ft{constructor(e,t,n){super(e,"twitter.com",t,n)}}function Ht(e){var{user:t,_tokenResponse:e}=e;return t.isAnonymous&&!e?{providerId:null,isNewUser:!1,profile:null}:function(e){if(!e)return null;var t=e["providerId"],n=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},r=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!t&&null!=e&&e.idToken){var i=null===(i=null===(i=pe(e.idToken))||void 0===i?void 0:i.firebase)||void 0===i?void 0:i.sign_in_provider;if(i){i="anonymous"!==i&&"custom"!==i?i:null;return new Ut(r,i)}}if(!t)return null;switch(t){case"facebook.com":return new xt(r,n);case"github.com":return new Vt(r,n);case"google.com":return new jt(r,n);case"twitter.com":return new Wt(r,n,e.screenName||null);case"custom":case"anonymous":return new Ut(r,null);default:return new Ut(r,t,n)}}(e)}class qt{constructor(e,t,n){this.type=e,this.credential=t,this.auth=n}static _fromIdtoken(e,t){return new qt("enroll",e,t)}static _fromMfaPendingCredential(e){return new qt("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t;if(null!=e&&e.multiFactorSession){if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.pendingCredential)return qt._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.idToken)return qt._fromIdtoken(e.multiFactorSession.idToken)}return null}}class zt{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,r){const i=xe(e),s=r.customData._serverResponse;e=(s.mfaInfo||[]).map(e=>kt._fromServerResponse(i,e));B(s.mfaPendingCredential,i,"internal-error");const o=qt._fromMfaPendingCredential(s.mfaPendingCredential);return new zt(o,e,async e=>{e=await e._process(i,o);delete s.mfaInfo,delete s.mfaPendingCredential;var t=Object.assign(Object.assign({},s),{idToken:e.idToken,refreshToken:e.refreshToken});switch(r.operationType){case"signIn":var n=await lt._fromIdTokenResponse(i,r.operationType,t);return await i._updateCurrentUser(n.user),n;case"reauthenticate":return B(r.user,i,"internal-error"),lt._forOperation(r.user,r.operationType,t);default:j(i,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}class Bt{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>kt._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new Bt(e)}async getSession(){return qt._fromIdtoken(await this.user.getIdToken(),this.user.auth)}async enroll(e,t){const n=e;e=await this.getSession(),t=await fe(this.user,n._process(this.user.auth,e,t));return await this.user._updateTokensIfNecessary(t),this.user.reload()}async unenroll(e){const t="string"==typeof e?e:e.uid;var n=await this.user.getIdToken(),n=await fe(this.user,(e=this.user.auth,n={idToken:n,mfaEnrollmentId:t},se(e,"POST","/v2/accounts/mfaEnrollment:withdraw",ie(e,n))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(n);try{await this.user.reload()}catch(e){if("auth/user-token-expired"!==(null===e||void 0===e?void 0:e.code))throw e}}}const Gt=new WeakMap;const Kt="__sak";class $t{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Kt,"1"),this.storage.removeItem(Kt),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){e=this.storage.getItem(e);return Promise.resolve(e?JSON.parse(e):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Jt extends $t{constructor(){var e;super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=(Se(e=d())||Le(e))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=De(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const r of Object.keys(this.listeners)){var t=this.storage.getItem(r),n=this.localCache[r];t!==n&&e(r,n,t)}}onStorageEvent(e,t=!1){if(e.key){const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const i=this.storage.getItem(r);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}var n=()=>{var e=this.storage.getItem(r);!t&&this.localCache[r]===e||this.notifyListeners(r,e)};const i=this.storage.getItem(r);u()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}else this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)})}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(const n of Array.from(e))n(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(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),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){var t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Jt.type="LOCAL";const Yt=Jt;class Xt extends $t{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Xt.type="SESSION";const Zt=Xt;class Qt{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){var e=this.receivers.find(e=>e.isListeningto(t));if(e)return e;e=new Qt(t);return this.receivers.push(e),e}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data;e=this.handlersMap[r];null!=e&&e.size&&(t.ports[0].postMessage({status:"ack",eventId:n,eventType:r}),e=Array.from(e).map(async e=>e(t.origin,i)),e=await Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})),t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:e}))}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&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&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function en(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}Qt.receivers=[];class tn{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,o=50){const a="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!a)throw new Error("connection_unavailable");let u,c;return new Promise((n,r)=>{const i=en("",20);a.port1.start();const s=setTimeout(()=>{r(new Error("unsupported_event"))},o);c={messageChannel:a,onMessage(e){var t=e;if(t.data.eventId===i)switch(t.data.status){case"ack":clearTimeout(s),u=setTimeout(()=>{r(new Error("timeout"))},3e3);break;case"done":clearTimeout(u),n(t.data.response);break;default:clearTimeout(s),clearTimeout(u),r(new Error("invalid_response"))}}},this.handlers.add(c),a.port1.addEventListener("message",c.onMessage),this.target.postMessage({eventType:e,eventId:i,data:t},[a.port2])}).finally(()=>{c&&this.removeMessageHandler(c)})}}function nn(){return window}function rn(){return void 0!==nn().WorkerGlobalScope&&"function"==typeof nn().importScripts}const sn="firebaseLocalStorageDb",on="firebaseLocalStorage",an="fbase_key";class un{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 cn(e,t){return e.transaction([on],t?"readwrite":"readonly").objectStore(on)}function ln(){const r=indexedDB.open(sn,1);return new Promise((n,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const e=r.result;try{e.createObjectStore(on,{keyPath:an})}catch(e){t(e)}}),r.addEventListener("success",async()=>{const e=r.result;var t;e.objectStoreNames.contains(on)?n(e):(e.close(),t=indexedDB.deleteDatabase(sn),await new un(t).toPromise(),n(await ln()))})})}async function dn(e,t,n){n=cn(e,!0).put({fbase_key:t,value:n});return new un(n).toPromise()}function hn(e,t){t=cn(e,!0).delete(t);return new un(t).toPromise()}class pn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await ln(),this.db)}async _withRetries(e){let t=0;for(;;)try{return e(await this._openDb())}catch(e){if(3<t++)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return rn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Qt._getInstance(rn()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>{const n=await this._poll();return{keyProcessed:n.includes(t.key)}}),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t,n;this.activeServiceWorker=await async function(){if(null===navigator||void 0===navigator||!navigator.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),this.activeServiceWorker&&(this.sender=new tn(this.activeServiceWorker),(n=await this.sender._send("ping",{},800))&&null!==(e=n[0])&&void 0!==e&&e.fulfilled&&null!==(t=n[0])&&void 0!==t&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0))}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;var e=await ln();return await dn(e,Kt,"1"),await hn(e,Kt),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(e=>dn(e,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){var e=await this._withRetries(e=>async function(e,t){return t=cn(e,!1).get(t),void 0===(t=await new un(t).toPromise())?null:t.value}(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>hn(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e,t,n=await this._withRetries(e=>{e=cn(e,!1).getAll();return new un(e).toPromise()});if(!n)return[];if(0!==this.pendingWrites)return[];const r=[],i=new Set;for({fbase_key:e,value:t}of n)i.add(e),JSON.stringify(this.localCache[e])!==JSON.stringify(t)&&(this.notifyListeners(e,t),r.push(e));for(const s of Object.keys(this.localCache))this.localCache[s]&&!i.has(s)&&(this.notifyListeners(s,null),r.push(s));return r}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(const n of Array.from(e))n(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),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),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}pn.type="LOCAL";const fn=pn;function mn(r){return new Promise((e,n)=>{const t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=e=>{const t=W("internal-error");t.customData=e,n(t)},t.type="text/javascript",t.charset="UTF-8",(null!==(e=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==e?e:document).appendChild(t)})}function vn(e){return`__${e}${Math.floor(1e6*Math.random())}`}class gn{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){var n=this.counter;return this._widgets.set(n,new yn(e,this.auth.name,t||{})),this.counter++,n}reset(e){var t=e||1e12;null===(e=this._widgets.get(t))||void 0===e||e.delete(),this._widgets.delete(t)}getResponse(e){return(null===(e=this._widgets.get(e||1e12))||void 0===e?void 0:e.getResponse())||""}async execute(e){return null===(e=this._widgets.get(e||1e12))||void 0===e||e.execute(),""}}class yn{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};e="string"==typeof e?document.getElementById(e):e;B(e,"argument-error",{appName:t}),this.container=e,this.isVisible="invisible"!==this.params.size,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=function(t){const n=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<t;e++)n.push(r.charAt(Math.floor(Math.random()*r.length)));return n.join("")}(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}const _n=vn("rcb"),In=new Q(3e4,6e4);class wn{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!(null===(e=nn().grecaptcha)||void 0===e||!e.render)}load(s,o=""){var e;return B((e=o).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),s,"argument-error"),this.shouldResolveImmediately(o)?Promise.resolve(nn().grecaptcha):new Promise((t,r)=>{const i=nn().setTimeout(()=>{r(W(s,"network-request-failed"))},In.get());nn()[_n]=()=>{nn().clearTimeout(i),delete nn()[_n];const e=nn().grecaptcha;if(e){const n=e.render;e.render=(e,t)=>{t=n(e,t);return this.counter++,t},this.hostLanguage=o,t(e)}else r(W(s,"internal-error"))},mn(`https://www.google.com/recaptcha/api.js??${y({onload:_n,render:"explicit",hl:o})}`).catch(()=>{clearTimeout(i),r(W(s,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!(null===(t=nn().grecaptcha)||void 0===t||!t.render)&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class bn{async load(e){return new gn(e)}clearedOneInstance(){}}const Tn="recaptcha",kn={theme:"light",type:"image"};class En{constructor(e,t=Object.assign({},kn),n){this.parameters=t,this.type=Tn,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=xe(n),this.isInvisible="invisible"===this.parameters.size,B("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");e="string"==typeof e?document.getElementById(e):e;B(e,this.auth,"argument-error"),this.container=e,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?bn:wn),this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),r=this.getAssertedRecaptcha();var t=r.getResponse(e);return t||new Promise(t=>{const n=e=>{e&&(this.tokenChangeListeners.delete(n),t(e))};this.tokenChangeListeners.add(n),this.isInvisible&&r.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&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(){B(!this.parameters.sitekey,this.auth,"argument-error"),B(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),B("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(n){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof n)n(t);else if("string"==typeof n){const e=nn()[n];"function"==typeof e&&e(t)}}}assertNotDestroyed(){B(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;var t;this.isInvisible||(t=document.createElement("div"),e.appendChild(t),e=t),this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){B(X()&&!rn(),this.auth,"internal-error"),await function(){let t=null;return new Promise(e=>{"complete"!==document.readyState?(t=()=>e(),window.addEventListener("load",t)):e()}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);var e=await((await se(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");B(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return B(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class Rn{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=Xe._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function Sn(t,n,r){var i,s,o,a,u,c,l=await r.verify();try{B("string"==typeof l,t,"argument-error"),B(r.type===Tn,t,"argument-error");let e;if(e="string"==typeof n?{phoneNumber:n}:n,"session"in e){var d=e.session;if("phoneNumber"in e)return B("enroll"===d.type,t,"internal-error"),(u=t,c={idToken:d.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,recaptchaToken:l}},await se(u,"POST","/v2/accounts/mfaEnrollment:start",ie(u,c))).phoneSessionInfo.sessionInfo;B("signin"===d.type,t,"internal-error");var h=(null===(i=e.multiFactorHint)||void 0===i?void 0:i.uid)||e.multiFactorUid;return B(h,t,"missing-multi-factor-info"),(a={mfaPendingCredential:d.credential,mfaEnrollmentId:h,phoneSignInInfo:{recaptchaToken:l}},await se(t,"POST","/v2/accounts/mfaSignIn:start",ie(t,a))).phoneResponseInfo.sessionInfo}var p=(s=t,o={phoneNumber:e.phoneNumber,recaptchaToken:l},await se(s,"POST","/v1/accounts:sendVerificationCode",ie(s,o)))["sessionInfo"];return p}finally{r._reset()}}class An{constructor(e){this.providerId=An.PROVIDER_ID,this.auth=xe(e)}verifyPhoneNumber(e,t){return Sn(this.auth,e,T(t))}static credential(e,t){return Xe._fromVerification(e,t)}static credentialFromResult(e){return An.credentialFromTaggedObject(e)}static credentialFromError(e){return An.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{phoneNumber:t,temporaryProof:e}=e;return t&&e?Xe._fromTokenResponse(t,e):null}}function On(e,t){return t?J(t):(B(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}An.PROVIDER_ID="phone",An.PHONE_SIGN_IN_METHOD="phone";class Pn extends qe{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return $e(e,this._buildIdpRequest())}_linkToIdToken(e,t){return $e(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return $e(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 Nn(e){return _t(e.auth,new Pn(e),e.bypassAuthState)}function Cn(e){var{auth:t,user:n}=e;return B(n,t,"internal-error"),yt(n,new Pn(e),e.bypassAuthState)}async function Ln(e){var{auth:t,user:n}=e;return B(n,t,"internal-error"),vt(n,new Pn(e),e.bypassAuthState)}class Dn{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,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(e){this.reject(e)}})}async onAuthEvent(e){var{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:s,type:e}=e;if(s)this.reject(s);else{r={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(e)(r))}catch(e){this.reject(e)}}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Nn;case"linkViaPopup":case"linkViaRedirect":return Ln;case"reauthViaPopup":case"reauthViaRedirect":return Cn;default:j(this.auth,"internal-error")}}resolve(e){K(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){K(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()}}const Mn=new Q(2e3,1e4);class Un extends Dn{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Un.currentPopupAction&&Un.currentPopupAction.cancel(),Un.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return B(e,this.auth,"internal-error"),e}async onExecution(){K(1===this.filter.length,"Popup operations only handle one event");var e=en();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(W(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?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,Un.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e;null!==(e=null===(e=this.authWindow)||void 0===e?void 0:e.window)&&void 0!==e&&e.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(W(this.auth,"popup-closed-by-user"))},2e3):this.pollId=window.setTimeout(t,Mn.get())};t()}}Un.currentPopupAction=null;const Fn="pendingRedirect",xn=new Map;class Vn extends Dn{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let t=xn.get(this.auth._key());if(!t){try{const e=await async function(e,t){const n=qn(t),r=Hn(e);if(!await r._isAvailable())return!1;e="true"===await r._get(n);return await r._remove(n),e}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}xn.set(this.auth._key(),t)}return this.bypassAuthState||xn.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){var t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}async function jn(e,t){return Hn(e)._set(qn(t),"true")}function Wn(e,t){xn.set(e._key(),t)}function Hn(e){return J(e._redirectPersistence)}function qn(e){return Te(Fn,e.config.apiKey,e.name)}function zn(e,t,n){return async function(e,t,n){var r=xe(e);q(e,t,et);const i=On(r,n);return await jn(i,r),i._openRedirect(r,t,"signInViaRedirect")}(e,t,n)}function Bn(e,t,n){return async function(e,t,n){e=T(e);q(e.auth,t,et);const r=On(e.auth,n);await jn(r,e.auth);n=await $n(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",n)}(e,t,n)}function Gn(e,t,n){return async function(e,t,n){e=T(e);q(e.auth,t,et);const r=On(e.auth,n);await gt(!1,e,t.providerId),await jn(r,e.auth);n=await $n(e);return r._openRedirect(e.auth,t,"linkViaRedirect",n)}(e,t,n)}async function Kn(e,t,n=!1){const r=xe(e);e=On(r,t);const i=new Vn(r,e,n),s=await i.execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}async function $n(e){var t=en(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Jn{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(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(e=>{this.isEventForConsumer(t,e)&&(n=!0,this.sendToConsumer(t,e),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Xn(e);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(e,t){var n;e.error&&!Xn(e)?(n=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error",t.onError(W(this.auth,n))):t.onAuthEvent(e)}isEventForConsumer(e,t){var n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return 6e5<=Date.now()-this.lastProcessedEventTime&&this.cachedEventUids.clear(),this.cachedEventUids.has(Yn(e))}saveEventToCache(e){this.cachedEventUids.add(Yn(e)),this.lastProcessedEventTime=Date.now()}}function Yn(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function Xn({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function Zn(e,t={}){return se(e,"GET","/v1/projects",t)}const Qn=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,er=/^https?/;async function tr(e){if(!e.config.emulator){var t=(await Zn(e))["authorizedDomains"];for(const n of t)try{if(function(e){const t=Y(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){var i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!er.test(n))return!1;if(Qn.test(e))return r===e;const s=e.replace(/\./g,"\\."),o=new RegExp("^(.+\\."+s+"|"+s+")$","i");return o.test(r)}(n))return}catch(e){}j(e,"unauthorized-domain")}}const nr=new Q(3e4,6e4);function rr(){const t=nn().___jsl;if(null!==t&&void 0!==t&&t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}let ir=null;function sr(e){var i;return ir=ir||(i=e,new Promise((e,t)=>{function n(){rr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{rr(),t(W(i,"network-request-failed"))},timeout:nr.get()})}if(null!==(r=null===(r=nn().gapi)||void 0===r?void 0:r.iframes)&&void 0!==r&&r.Iframe)e(gapi.iframes.getContext());else{if(null===(r=nn().gapi)||void 0===r||!r.load){var r=vn("iframefcb");return nn()[r]=()=>{gapi.load?n():t(W(i,"network-request-failed"))},mn(`https://apis.google.com/js/api.js?onload=${r}`).catch(e=>t(e))}n()}}).catch(e=>{throw ir=null,e})),ir}const or=new Q(5e3,15e3),ar="__/auth/iframe",ur="emulator/auth/iframe",cr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},lr=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function dr(o){const e=await sr(o);var t=nn().gapi;return B(t,o,"internal-error"),e.open({where:document.body,url:function(e){var t=e.config;B(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?ee(t,ur):`https://${e.config.authDomain}/${ar}`;const r={apiKey:t.apiKey,appName:e.name,v:wi.SDK_VERSION};(t=lr.get(e.config.apiHost))&&(r.eid=t);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${y(r).slice(1)}`}(o),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:cr,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});const n=W(o,"network-request-failed"),r=nn().setTimeout(()=>{t(n)},or.get());function i(){nn().clearTimeout(r),e(s)}s.ping(i).then(i,()=>{t(n)})}))}const hr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class pr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function fr(e,t,n,r=500,i=600){var s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const u=Object.assign(Object.assign({},hr),{width:r.toString(),height:i.toString(),top:s,left:o});o=d().toLowerCase();n&&(a=Ae(o)?"_blank":n),Re(o)&&(t=t||"http://localhost",u.scrollbars="yes");var c,n=Object.entries(u).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if([o=d()]=[o],Le(o)&&null!==(c=window.navigator)&&void 0!==c&&c.standalone&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new pr(null);const l=window.open(t||"",a,n);B(l,e,"popup-blocked");try{l.focus()}catch(e){}return new pr(l)}const mr="__/auth/handler",vr="emulator/auth/handler";function gr(e,t,n,r,i,s){B(e.config.authDomain,e,"auth-domain-config-required"),B(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:wi.SDK_VERSION,eventId:i};if(t instanceof et){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return;return 1}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(var[a,u]of Object.entries(s||{}))o[a]=u}if(t instanceof tt){const l=t.getScopes().filter(e=>""!==e);0<l.length&&(o.scopes=l.join(","))}e.tenantId&&(o.tid=e.tenantId);const c=o;for(const d of Object.keys(c))void 0===c[d]&&delete c[d];return`${e=[e["config"]][0],e.emulator?ee(e,vr):`https://${e.authDomain}/${mr}`}?${y(c).slice(1)}`}const yr="webStorageSupport";const _r=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Zt,this._completeRedirectFn=Kn,this._overrideRedirectResult=Wn}async _openPopup(e,t,n,r){var i;return K(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),fr(e,gr(e,t,n,Y(),r),en())}async _openRedirect(e,t,n,r){return await this._originValidation(e),r=gr(e,t,n,Y(),r),nn().location.href=r,new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:n}=this.eventManagers[t];return r?Promise.resolve(r):(K(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(t){const e=await dr(t),n=new Jn(t);return e.register("authEvent",e=>{return B(null==e?void 0:e.authEvent,t,"invalid-auth-event"),{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,n){const e=this.iframes[t._key()];e.send(yr,{type:yr},e=>{e=null===(e=null==e?void 0:e[0])||void 0===e?void 0:e[yr];void 0!==e&&n(!!e),j(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=tr(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return De()||Se()||Le()}};class Ir extends class{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return G("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new Ir(e)}_finalizeEnroll(e,t,n){return e=e,n={idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()},se(e,"POST","/v2/accounts/mfaEnrollment:finalize",ie(e,n))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},se(e,"POST","/v2/accounts/mfaSignIn:finalize",ie(e,t))}}class wr{constructor(){}static assertion(e){return Ir._fromCredential(e)}}wr.FACTOR_ID="phone";var br="@firebase/auth";class Tr{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?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(t){var e;this.assertAuthConfigured(),this.internalListeners.has(t)||(e=this.auth.onIdTokenChanged(e=>{t((null===e||void 0===e?void 0:e.stsTokenManager.accessToken)||null)}),this.internalListeners.set(t,e),this.updateProactiveRefresh())}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){B(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}var kr,Er,Rr;function Sr(){return window}kr="authIdTokenMaxAge",null===(Er=r()||l()||h())||void 0===Er||Er[`_${kr}`],Rr="Browser",wi._registerComponent(new N("auth",(e,{options:r})=>{var t=e.getProvider("app").getImmediate(),e=e.getProvider("heartbeat");const{apiKey:i,authDomain:s}=t.options;return((e,t)=>{B(i&&!i.includes(":"),"invalid-api-key",{appName:e.name}),B(!(null!==s&&void 0!==s&&s.includes(":")),"argument-error",{appName:e.name});var n={apiKey:i,authDomain:s,clientPlatform:Rr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Me(Rr)},n=new Fe(e,t,n);return function(e,t){const n=(null==t?void 0:t.persistence)||[];var r=(Array.isArray(n)?n:[n]).map(J);null!=t&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(n,r),n})(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{const r=e.getProvider("auth-internal");r.initialize()})),wi._registerComponent(new N("auth-internal",e=>{e=xe(e.getProvider("auth").getImmediate());return e=e,new Tr(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),wi.registerVersion(br,"0.20.8",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Rr)),wi.registerVersion(br,"0.20.8","esm2017");async function Ar(e,t,n){var r=Sr()["BuildInfo"];K(t.sessionId,"AuthEvent did not contain a session ID");var i=await async function(e){const t=function(t){if(K(/[0-9a-zA-Z]+/.test(t),"Can only convert alpha-numeric strings"),"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}(e),n=await crypto.subtle.digest("SHA-256",t),r=Array.from(new Uint8Array(n));return r.map(e=>e.toString(16).padStart(2,"0")).join("")}(t.sessionId);const s={};return Le()?s.ibi=r.packageName:Pe()?s.apn=r.packageName:j(e,"operation-not-supported-in-this-environment"),r.displayName&&(s.appDisplayName=r.displayName),s.sessionId=i,gr(e,n,t.type,void 0,null!==(t=t.eventId)&&void 0!==t?t:void 0,s)}function Or(r){const i=Sr()["cordova"];return new Promise(n=>{i.plugins.browsertab.isAvailable(e=>{let t=null;e?i.plugins.browsertab.openUrl(r):t=i.InAppBrowser.open(r,(e=d(),/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)?"_blank":"_system"),"location=yes"),n(t)})})}const Pr=20;class Nr extends Jn{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(t){return this.resolveInialized(),this.passiveListeners.forEach(e=>e(t)),super.onEvent(t)}async initialized(){await this.initPromise}}function Cr(e,t,n=null){return{type:t,eventId:n,urlResponse:null,sessionId:function(){const t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<Pr;e++){var r=Math.floor(Math.random()*n.length);t.push(n.charAt(r))}return t.join("")}(),postBody:null,tenantId:e.tenantId,error:W(e,"no-auth-event")}}async function Lr(e){var t=await Mr()._get(Ur(e));return t&&await Mr()._remove(Ur(e)),t}function Dr(e,t){var n,r,i;const s=(n=Fr(o=t),r=n.link?decodeURIComponent(n.link):void 0,i=Fr(r).link,t=n.deep_link_id?decodeURIComponent(n.deep_link_id):void 0,(n=Fr(t).link)||t||i||r||o);if(s.includes("/__/auth/callback")){var o=Fr(s),o=o.firebaseError?function(e){try{return JSON.parse(e)}catch(e){return null}}(decodeURIComponent(o.firebaseError)):null,o=null===(o=null===(o=null==o?void 0:o.code)||void 0===o?void 0:o.split("auth/"))||void 0===o?void 0:o[1],o=o?W(o):null;return o?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:o,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:s,postBody:null}}return null}function Mr(){return J(Yt)}function Ur(e){return Te("authEvent",e.config.apiKey,e.name)}function Fr(e){if(null==e||!e.includes("?"))return{};const[,...t]=e.split("?");return _(t.join("?"))}const xr=class{constructor(){this._redirectPersistence=Zt,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=Kn,this._overrideRedirectResult=Wn}async _initialize(e){var t=e._key();let n=this.eventManagers.get(t);return n||(n=new Nr(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),n}_openPopup(e){j(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,n,r){var i,s;a=e,s=Sr(),B("function"==typeof(null===(i=null==s?void 0:s.universalLinks)||void 0===i?void 0:i.subscribe),a,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),B(void 0!==(null===(i=null==s?void 0:s.BuildInfo)||void 0===i?void 0:i.packageName),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),B("function"==typeof(null===(i=null===(i=null===(i=null==s?void 0:s.cordova)||void 0===i?void 0:i.plugins)||void 0===i?void 0:i.browsertab)||void 0===i?void 0:i.openUrl),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),B("function"==typeof(null===(i=null===(i=null===(i=null==s?void 0:s.cordova)||void 0===i?void 0:i.plugins)||void 0===i?void 0:i.browsertab)||void 0===i?void 0:i.isAvailable),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),B("function"==typeof(null===(s=null===(s=null==s?void 0:s.cordova)||void 0===s?void 0:s.InAppBrowser)||void 0===s?void 0:s.open),a,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"});const o=await this._initialize(e);await o.initialized(),o.resetRedirect(),xn.clear(),await this._originValidation(e);var a=Cr(e,n,r);n=e,r=a,await Mr()._set(Ur(n),r);t=await Or(await Ar(e,a,t));return async function(o,a,u){const c=Sr()["cordova"];let l=()=>{};try{await new Promise((n,e)=>{let t=null;function r(){var e;n();const t=null===(e=c.plugins.browsertab)||void 0===e?void 0:e.close;"function"==typeof t&&t(),"function"==typeof(null==u?void 0:u.close)&&u.close()}function i(){t=t||window.setTimeout(()=>{e(W(o,"redirect-cancelled-by-user"))},2e3)}function s(){"visible"===(null===document||void 0===document?void 0:document.visibilityState)&&i()}a.addPassiveListener(r),document.addEventListener("resume",i,!1),Pe()&&document.addEventListener("visibilitychange",s,!1),l=()=>{a.removePassiveListener(r),document.removeEventListener("resume",i,!1),document.removeEventListener("visibilitychange",s,!1),t&&window.clearTimeout(t)}})}finally{l()}}(e,o,t)}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){var t=Sr()["BuildInfo"];const n={};Le()?n.iosBundleId=t.packageName:Pe()?n.androidPackageName=t.packageName:j(e,"operation-not-supported-in-this-environment"),await Zn(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(r,i){const{universalLinks:e,handleOpenURL:t,BuildInfo:n}=Sr(),s=setTimeout(async()=>{await Lr(r),i.onEvent(Vr())},500),o=async e=>{clearTimeout(s);var t=await Lr(r);let n=null;t&&null!=e&&e.url&&(n=Dr(t,e.url)),i.onEvent(n||Vr())};void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,o);const a=t,u=`${n.packageName.toLowerCase()}://`;Sr().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(u)&&o({url:e}),"function"==typeof a)try{a(e)}catch(e){console.error(e)}}}};function Vr(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:W("no-auth-event")}}function jr(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function Wr(e){return void 0===e&&(e=d()),!("file:"!==jr()&&"ionic:"!==jr()&&"capacitor:"!==jr()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function Hr(e){return void 0===e&&(e=d()),u()&&11===(null===document||void 0===document?void 0:document.documentMode)||(void 0===(e=e)&&(e=d()),/Edge\/\d+/.test(e))}function qr(){try{var e=self.localStorage,t=en();if(e)return e.setItem(t,"1"),e.removeItem(t),!Hr()||c()}catch(e){return zr()&&c()}return!1}function zr(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function Br(){return("http:"===jr()||"https:"===jr()||n()||Wr())&&!(a()||o())&&qr()&&!zr()}function Gr(){return Wr()&&"undefined"!=typeof document}var Kr={LOCAL:"local",NONE:"none",SESSION:"session"},$r=B,Jr="persistence";function Yr(r){return O(this,void 0,void 0,function(){var t,n;return P(this,function(e){switch(e.label){case 0:return[4,r._initializationPromise];case 1:return e.sent(),t=Xr(),n=Te(Jr,r.config.apiKey,r.name),t&&t.setItem(n,r._getPersistence()),[2]}})})}function Xr(){var e;try{return(null===(e="undefined"!=typeof window?window:null)?void 0:e.sessionStorage)||null}catch(e){return null}}var Zr=B,Qr=(ei.prototype._initialize=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._initialize(t)]}})})},ei.prototype._openPopup=function(t,n,r,i){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openPopup(t,n,r,i)]}})})},ei.prototype._openRedirect=function(t,n,r,i){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._openRedirect(t,n,r,i)]}})})},ei.prototype._isIframeWebStorageSupported=function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)},ei.prototype._originValidation=function(e){return this.assertedUnderlyingResolver._originValidation(e)},Object.defineProperty(ei.prototype,"_shouldInitProactively",{get:function(){return Gr()||this.browserResolver._shouldInitProactively},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"assertedUnderlyingResolver",{get:function(){return Zr(this.underlyingResolver,"internal-error"),this.underlyingResolver},enumerable:!1,configurable:!0}),ei.prototype.selectUnderlyingResolver=function(){return O(this,void 0,void 0,function(){var t;return P(this,function(e){switch(e.label){case 0:return this.underlyingResolver?[2]:[4,function(){return O(this,void 0,void 0,function(){return P(this,function(e){return Gr()?[2,new Promise(function(e){var t=setTimeout(function(){e(!1)},1e3);document.addEventListener("deviceready",function(){clearTimeout(t),e(!0)})})]:[2,!1]})})}()];case 1:return t=e.sent(),this.underlyingResolver=t?this.cordovaResolver:this.browserResolver,[2]}})})},ei);function ei(){this.browserResolver=J(_r),this.cordovaResolver=J(xr),this.underlyingResolver=null,this._redirectPersistence=Zt,this._completeRedirectFn=Kn,this._overrideRedirectResult=Wn}function ti(e){return e.unwrap()}function ni(e,t){var n,r,i=null===(r=t.customData)||void 0===r?void 0:r._tokenResponse;"auth/multi-factor-auth-required"===(null===t||void 0===t?void 0:t.code)?t.resolver=new oi(e,(r=t,e=T(n=e),B((n=r).customData.operationType,e,"argument-error"),B(null===(r=n.customData._serverResponse)||void 0===r?void 0:r.mfaPendingCredential,e,"argument-error"),zt._fromError(e,n))):!i||(t=ri(n=t))&&(n.credential=t,n.tenantId=i.tenantId||void 0,n.email=i.email||void 0,n.phoneNumber=i.phoneNumber||void 0)}function ri(e){var t=(e instanceof m?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof m)&&"temporaryProof"in t&&"phoneNumber"in t)return An.credentialFromResult(e);var n,r=t.providerId;if(!r||r===C.PASSWORD)return null;switch(r){case C.GOOGLE:n=it;break;case C.FACEBOOK:n=rt;break;case C.GITHUB:n=st;break;case C.TWITTER:n=ut;break;default:var i=t.oauthIdToken,s=t.oauthAccessToken,o=t.oauthTokenSecret,a=t.pendingToken,u=t.nonce;return s||o||i||a?a?r.startsWith("saml.")?ot._create(r,a):Je._fromParams({providerId:r,signInMethod:r,pendingToken:a,idToken:i,accessToken:s}):new nt(r).credential({idToken:i,accessToken:s,rawNonce:u}):null}return e instanceof m?n.credentialFromError(e):n.credentialFromResult(e)}function ii(t,e){return e.catch(function(e){throw e instanceof m&&ni(t,e),e}).then(function(e){var t=e.operationType,n=e.user;return{operationType:t,credential:ri(e),additionalUserInfo:Ht(e),user:ui.getOrCreate(n)}})}function si(n,r){return O(this,void 0,void 0,function(){var t;return P(this,function(e){switch(e.label){case 0:return[4,r];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return ii(n,t.confirm(e))}}]}})})}var oi=(Object.defineProperty(ai.prototype,"session",{get:function(){return this.resolver.session},enumerable:!1,configurable:!0}),Object.defineProperty(ai.prototype,"hints",{get:function(){return this.resolver.hints},enumerable:!1,configurable:!0}),ai.prototype.resolveSignIn=function(e){return ii(ti(this.auth),this.resolver.resolveSignIn(e))},ai);function ai(e,t){this.resolver=t,this.auth=e.wrapped()}var ui=(ci.getOrCreate=function(e){return ci.USER_MAP.has(e)||ci.USER_MAP.set(e,new ci(e)),ci.USER_MAP.get(e)},ci.prototype.delete=function(){return this._delegate.delete()},ci.prototype.reload=function(){return this._delegate.reload()},ci.prototype.toJSON=function(){return this._delegate.toJSON()},ci.prototype.getIdTokenResult=function(e){return this._delegate.getIdTokenResult(e)},ci.prototype.getIdToken=function(e){return this._delegate.getIdToken(e)},ci.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},ci.prototype.linkWithCredential=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){return[2,ii(this.auth,wt(this._delegate,t))]})})},ci.prototype.linkWithPhoneNumber=function(t,n){return O(this,void 0,void 0,function(){return P(this,function(e){return[2,si(this.auth,async function(e,t,n){const r=T(e);return await gt(!1,r,"phone"),n=await Sn(r.auth,t,T(n)),new Rn(n,e=>wt(r,e))}(this._delegate,t,n))]})})},ci.prototype.linkWithPopup=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){return[2,ii(this.auth,async function(e,t,n){q((e=T(e)).auth,t,et),n=On(e.auth,n);const r=new Un(e.auth,"linkViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,t,Qr))]})})},ci.prototype.linkWithRedirect=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,Yr(xe(this.auth))];case 1:return e.sent(),[2,Gn(this._delegate,t,Qr)]}})})},ci.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},ci.prototype.reauthenticateWithCredential=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){return[2,ii(this.auth,bt(this._delegate,t))]})})},ci.prototype.reauthenticateWithPhoneNumber=function(e,t){return si(this.auth,async function(e,t,n){const r=T(e);return n=await Sn(r.auth,t,T(n)),new Rn(n,e=>bt(r,e))}(this._delegate,e,t))},ci.prototype.reauthenticateWithPopup=function(e){return ii(this.auth,async function(e,t,n){q((e=T(e)).auth,t,et),n=On(e.auth,n);const r=new Un(e.auth,"reauthViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,e,Qr))},ci.prototype.reauthenticateWithRedirect=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,Yr(xe(this.auth))];case 1:return e.sent(),[2,Bn(this._delegate,t,Qr)]}})})},ci.prototype.sendEmailVerification=function(e){return Ct(this._delegate,e)},ci.prototype.unlink=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,mt(this._delegate,t)];case 1:return e.sent(),[2,this]}})})},ci.prototype.updateEmail=function(e){return Mt(T(this._delegate),e,null)},ci.prototype.updatePassword=function(e){return Mt(T(this._delegate),null,e)},ci.prototype.updatePhoneNumber=function(e){return async function(e,t){await vt(T(e),t)}(this._delegate,e)},ci.prototype.updateProfile=function(e){return Dt(this._delegate,e)},ci.prototype.verifyBeforeUpdateEmail=function(e,t){return Lt(this._delegate,e,t)},Object.defineProperty(ci.prototype,"emailVerified",{get:function(){return this._delegate.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"isAnonymous",{get:function(){return this._delegate.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"phoneNumber",{get:function(){return this._delegate.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"providerData",{get:function(){return this._delegate.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"refreshToken",{get:function(){return this._delegate.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"displayName",{get:function(){return this._delegate.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"email",{get:function(){return this._delegate.email},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"photoURL",{get:function(){return this._delegate.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"providerId",{get:function(){return this._delegate.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"uid",{get:function(){return this._delegate.uid},enumerable:!1,configurable:!0}),Object.defineProperty(ci.prototype,"auth",{get:function(){return this._delegate.auth},enumerable:!1,configurable:!0}),ci.USER_MAP=new WeakMap,ci);function ci(e){this._delegate=e,this.multiFactor=(e=T(e=e),Gt.has(e)||Gt.set(e,Bt._fromUser(e)),Gt.get(e))}var li=B,di=(Object.defineProperty(hi.prototype,"emulatorConfig",{get:function(){return this._delegate.emulatorConfig},enumerable:!1,configurable:!0}),Object.defineProperty(hi.prototype,"currentUser",{get:function(){return this._delegate.currentUser?ui.getOrCreate(this._delegate.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(hi.prototype,"languageCode",{get:function(){return this._delegate.languageCode},set:function(e){this._delegate.languageCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(hi.prototype,"settings",{get:function(){return this._delegate.settings},enumerable:!1,configurable:!0}),Object.defineProperty(hi.prototype,"tenantId",{get:function(){return this._delegate.tenantId},set:function(e){this._delegate.tenantId=e},enumerable:!1,configurable:!0}),hi.prototype.useDeviceLanguage=function(){this._delegate.useDeviceLanguage()},hi.prototype.signOut=function(){return this._delegate.signOut()},hi.prototype.useEmulator=function(e,t){je(this._delegate,e,t)},hi.prototype.applyActionCode=function(e){return At(this._delegate,e)},hi.prototype.checkActionCode=function(e){return Ot(this._delegate,e)},hi.prototype.confirmPasswordReset=function(e,t){return async function(e,t,n){await ze(T(e),{oobCode:t,newPassword:n})}(this._delegate,e,t)},hi.prototype.createUserWithEmailAndPassword=function(t,n){return O(this,void 0,void 0,function(){return P(this,function(e){return[2,ii(this._delegate,async function(e,t,n){const r=xe(e);return n=await ct(r,{returnSecureToken:!0,email:t,password:n}),n=await lt._fromIdTokenResponse(r,"signIn",n),await r._updateCurrentUser(n.user),n}(this._delegate,t,n))]})})},hi.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},hi.prototype.fetchSignInMethodsForEmail=function(e){return Nt(this._delegate,e)},hi.prototype.isSignInWithEmailLink=function(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=Ze.parseLink(e))?void 0:e.operation)},hi.prototype.getRedirectResult=function(){return O(this,void 0,void 0,function(){var t;return P(this,function(e){switch(e.label){case 0:return li(Br(),this._delegate,"operation-not-supported-in-this-environment"),[4,async function(e,t){return await xe(e)._initializationPromise,Kn(e,t,!1)}(this._delegate,Qr)];case 1:return(t=e.sent())?[2,ii(this._delegate,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},hi.prototype.addFrameworkForLogging=function(e){xe(this._delegate)._logFramework(e)},hi.prototype.onAuthStateChanged=function(e,t,n){e=pi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onAuthStateChanged(t,n,e)},hi.prototype.onIdTokenChanged=function(e,t,n){e=pi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onIdTokenChanged(t,n,e)},hi.prototype.sendSignInLinkToEmail=function(e,t){return Pt(this._delegate,e,t)},hi.prototype.sendPasswordResetEmail=function(e,t){return St(this._delegate,e,t||void 0)},hi.prototype.setPersistence=function(s){return O(this,void 0,void 0,function(){var r,i;return P(this,function(e){switch(e.label){case 0:switch(t=this._delegate,n=s,$r(Object.values(Kr).includes(n),t,"invalid-persistence-type"),a()?$r(n!==Kr.SESSION,t,"unsupported-persistence-type"):o()?$r(n===Kr.NONE,t,"unsupported-persistence-type"):zr()?$r(n===Kr.NONE||n===Kr.LOCAL&&c(),t,"unsupported-persistence-type"):$r(n===Kr.NONE||qr(),t,"unsupported-persistence-type"),s){case Kr.SESSION:return[3,1];case Kr.LOCAL:return[3,2];case Kr.NONE:return[3,4]}return[3,5];case 1:return r=Zt,[3,6];case 2:return[4,J(fn)._isAvailable()];case 3:return i=e.sent(),r=i?fn:Yt,[3,6];case 4:return r=be,[3,6];case 5:return[2,j("argument-error",{appName:this._delegate.name})];case 6:return[2,this._delegate.setPersistence(r)]}var t,n})})},hi.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},hi.prototype.signInAnonymously=function(){return ii(this._delegate,async function(e){const t=xe(e);return await t._initializationPromise,null!==(e=t.currentUser)&&void 0!==e&&e.isAnonymous?new lt({user:t.currentUser,providerId:null,operationType:"signIn"}):(e=await ct(t,{returnSecureToken:!0}),e=await lt._fromIdTokenResponse(t,"signIn",e,!0),await t._updateCurrentUser(e.user),e)}(this._delegate))},hi.prototype.signInWithCredential=function(e){return ii(this._delegate,It(this._delegate,e))},hi.prototype.signInWithCustomToken=function(e){return ii(this._delegate,Tt(this._delegate,e))},hi.prototype.signInWithEmailAndPassword=function(e,t){return ii(this._delegate,(n=this._delegate,e=e,t=t,It(T(n),Qe.credential(e,t))));var n},hi.prototype.signInWithEmailLink=function(e,t){return ii(this._delegate,async function(e,t,n){return e=T(e),B((n=Qe.credentialWithLink(t,n||Y()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),It(e,n)}(this._delegate,e,t))},hi.prototype.signInWithPhoneNumber=function(e,t){return si(this._delegate,async function(e,t,n){const r=xe(e);return n=await Sn(r,t,T(n)),new Rn(n,e=>It(r,e))}(this._delegate,e,t))},hi.prototype.signInWithPopup=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){return li(Br(),this._delegate,"operation-not-supported-in-this-environment"),[2,ii(this._delegate,async function(e,t,n){var r=xe(e);q(e,t,et),n=On(r,n);const i=new Un(r,"signInViaPopup",t,n);return i.executeNotNull()}(this._delegate,t,Qr))]})})},hi.prototype.signInWithRedirect=function(t){return O(this,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return li(Br(),this._delegate,"operation-not-supported-in-this-environment"),[4,Yr(this._delegate)];case 1:return e.sent(),[2,zn(this._delegate,t,Qr)]}})})},hi.prototype.updateCurrentUser=function(e){return this._delegate.updateCurrentUser(e)},hi.prototype.verifyPasswordResetCode=function(e){return async function(e,t){return(t=(await Ot(T(e),t))["data"]).email}(this._delegate,e)},hi.prototype.unwrap=function(){return this._delegate},hi.prototype._delete=function(){return this._delegate._delete()},hi.prototype.linkUnderlyingAuth=function(){var e=this;this._delegate.wrapped=function(){return e}},hi.Persistence=Kr,hi);function hi(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();var n=e.options.apiKey;li(n,"invalid-api-key",{appName:e.name}),li(n,"invalid-api-key",{appName:e.name});var r="undefined"!=typeof window?Qr:void 0;this._delegate=t.initialize({options:{persistence:function(e,t){var n=function(e,t){var n=Xr();if(!n)return[];switch(t=Te(Jr,e,t),n.getItem(t)){case Kr.NONE:return[be];case Kr.LOCAL:return[fn,Zt];case Kr.SESSION:return[Zt];default:return[]}}(e,t);"undefined"==typeof self||n.includes(fn)||n.push(fn);if("undefined"!=typeof window)for(var r=0,i=[Yt,Zt];r<i.length;r++){var s=i[r];n.includes(s)||n.push(s)}n.includes(be)||n.push(be);return n}(n,e.name),popupRedirectResolver:r}}),this._delegate._updateErrorMap(M),this.linkUnderlyingAuth()}function pi(e,t,n){var r=e;"function"!=typeof e&&(r=e.next,t=e.error,n=e.complete);var i=r;return{next:function(e){return i(e&&ui.getOrCreate(e))},error:t,complete:n}}var fi=(mi.credential=function(e,t){return An.credential(e,t)},mi.prototype.verifyPhoneNumber=function(e,t){return this._delegate.verifyPhoneNumber(e,t)},mi.prototype.unwrap=function(){return this._delegate},mi.PHONE_SIGN_IN_METHOD=An.PHONE_SIGN_IN_METHOD,mi.PROVIDER_ID=An.PROVIDER_ID,mi);function mi(){this.providerId="phone",this._delegate=new An(ti(i.default.auth()))}var vi=B,gi=(yi.prototype.clear=function(){this._delegate.clear()},yi.prototype.render=function(){return this._delegate.render()},yi.prototype.verify=function(){return this._delegate.verify()},yi);function yi(e,t,n){var r;void 0===n&&(n=i.default.app()),vi(null===(r=n.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new En(e,t,n.auth()),this.type=this._delegate.type}var _i;(_i=i.default).INTERNAL.registerComponent(new N("auth-compat",function(e){var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new di(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:L.EMAIL_SIGNIN,PASSWORD_RESET:L.PASSWORD_RESET,RECOVER_EMAIL:L.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:L.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:L.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:L.VERIFY_EMAIL}},EmailAuthProvider:Qe,FacebookAuthProvider:rt,GithubAuthProvider:st,GoogleAuthProvider:it,OAuthProvider:nt,SAMLAuthProvider:at,PhoneAuthProvider:fi,PhoneMultiFactorGenerator:wr,RecaptchaVerifier:gi,TwitterAuthProvider:ut,Auth:di,AuthCredential:qe,Error:m}).setInstantiationMode("LAZY").setMultipleInstances(!1)),_i.registerVersion("@firebase/auth-compat","0.2.21")}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
|