@firebase/auth-compat 0.1.2 → 0.1.3-2021823172527
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 +10 -0
- 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 +8 -8
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(wi,bi){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=e(wi),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function s(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 a(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])}}}function u(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}var 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:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var s=e[i],o=i+1<e.length,a=o?e[i+1]:0,u=i+2<e.length,c=u?e[i+2]:0,l=(15&a)<<2|c>>6,c=63&c;u||(c=64,o||(l=64)),r.push(n[s>>2],n[(3&s)<<4|a>>4],n[l],n[c])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t}(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i,s,o,a=e[n++];a<128?t[r++]=String.fromCharCode(a):191<a&&a<224?(s=e[n++],t[r++]=String.fromCharCode((31&a)<<6|63&s)):239<a&&a<365?(i=((7&a)<<18|(63&(s=e[n++]))<<12|(63&(o=e[n++]))<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))):(s=e[n++],o=e[n++],t[r++]=String.fromCharCode((15&a)<<12|(63&s)<<6|63&o))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var s=n[e.charAt(i++)],o=i<e.length?n[e.charAt(i)]:0,a=++i<e.length?n[e.charAt(i)]:64,u=++i<e.length?n[e.charAt(i)]:64;if(++i,null==s||null==o||null==a||null==u)throw Error();r.push(s<<2|o>>4),64!==a&&(r.push(o<<4&240|a>>2),64!==u&&r.push(a<<6&192|u))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var 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)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},c=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 l(){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 h(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function p(){var e=d();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function f(){return"indexedDB"in self&&null!=indexedDB}var m,v="FirebaseError",g=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(y,m=Error),y);function y(e,t,n){t=m.call(this,t)||this;return t.code=e,t.customData=n,t.name=v,Object.setPrototypeOf(t,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,_.prototype.create),t}var _=(I.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,i=t[0]||{},s=this.service+"/"+e,e=this.errors[e],e=e?(r=i,e.replace(w,function(e,t){var n=r[t];return null!=n?String(n):"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+s+").";return new g(s,e,i)},I);function I(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var w=/\{\$([^}]+)}/g;function b(e){for(var n=[],t=0,r=Object.entries(e);t<r.length;t++){var i=r[t];!function(t,e){Array.isArray(e)?e.forEach(function(e){n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}):n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}(i[0],i[1])}return n.length?"&"+n.join("&"):""}function T(e){var n={};return e.replace(/^\?/,"").split("&").forEach(function(e){var t;e&&(e=(t=e.split("="))[0],t=t[1],n[decodeURIComponent(e)]=decodeURIComponent(t))}),n}function k(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,0<n?n:void 0)}var E,R=(S.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},S.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},S.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},S.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=O),void 0===r.error&&(r.error=O),void 0===r.complete&&(r.complete=O);n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),n},S.prototype.unsubscribeOne=function(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))},S.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},S.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},S.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},S);function S(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}function O(){}function A(e){return e&&e._delegate?e._delegate:e}(D=E=E||{})[D.DEBUG=0]="DEBUG",D[D.VERBOSE=1]="VERBOSE",D[D.INFO=2]="INFO",D[D.WARN=3]="WARN",D[D.ERROR=4]="ERROR",D[D.SILENT=5]="SILENT";function P(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString(),s=L[t];if(!s)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[s].apply(console,u(["["+i+"] "+e.name+":"],n))}}var N={debug:E.DEBUG,verbose:E.VERBOSE,info:E.INFO,warn:E.WARN,error:E.ERROR,silent:E.SILENT},C=E.INFO,L=((D={})[E.DEBUG]="log",D[E.VERBOSE]="log",D[E.INFO]="info",D[E.WARN]="warn",D[E.ERROR]="error",D),D=(Object.defineProperty(M.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in E))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),M.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?N[e]:e},Object.defineProperty(M.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),M.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,E.DEBUG],e)),this._logHandler.apply(this,u([this,E.DEBUG],e))},M.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,E.VERBOSE],e)),this._logHandler.apply(this,u([this,E.VERBOSE],e))},M.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,E.INFO],e)),this._logHandler.apply(this,u([this,E.INFO],e))},M.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,E.WARN],e)),this._logHandler.apply(this,u([this,E.WARN],e))},M.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,E.ERROR],e)),this._logHandler.apply(this,u([this,E.ERROR],e))},M);function M(e){this.name=e,this._logLevel=C,this._logHandler=P,this._userLogHandler=null}var U=(x.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},x.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},x.prototype.setServiceProps=function(e){return this.serviceProps=e,this},x.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},x);function x(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}const F={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},V={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 j(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const W=function(){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.","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."}},H=j,z=new _("auth","Firebase",j()),q=new D("@firebase/auth");function B(e,...t){q.logLevel<=E.ERROR&&q.error(`Auth (${bi.SDK_VERSION}): ${e}`,...t)}function G(e,...t){throw Y(e,...t)}function K(e,...t){return Y(e,...t)}function J(e,t,n){n=Object.assign(Object.assign({},H()),{[t]:n});const r=new _("auth","Firebase",n);return r.create(t,{appName:e.name})}function $(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&G(e,"argument-error"),J(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function Y(e,...t){if("string"==typeof e)return z.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 X(e,t,...n){if(!e)throw Y(t,...n)}function Z(e){e="INTERNAL ASSERTION FAILED: "+e;throw B(e),new Error(e)}function Q(e,t){e||Z(t)}const ee=new Map;function te(e){Q(e instanceof Function,"Expected a class definition");let t=ee.get(e);return t?Q(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,ee.set(e,t)),t}function ne(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function re(){return"http:"===ie()||"https:"===ie()}function ie(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class se{constructor(e,t){Q((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())||h()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(re()||n()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function oe(e,t){Q(e.emulator,"Emulator should always be set here");var{url:e}=e.emulator;return t?`${e}${t.startsWith("/")?t.slice(1):t}`:e}class ae{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 Z("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 Z("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 Z("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}const ue={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"},ce=new se(3e4,6e4);function le(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function de(i,s,o,a,e={}){return he(i,e,()=>{let e={},t={};a&&("GET"===s?t=a:e={body:JSON.stringify(a)});var n=b(Object.assign({key:i.config.apiKey},t)).slice(1);const r=new(ae.headers());return r.set("Content-Type","application/json"),r.set("X-Client-Version",i._getSdkClientVersion()),i.languageCode&&r.set("X-Firebase-Locale",i.languageCode),ae.fetch()(fe(i,i.config.apiHost,o,n),Object.assign({method:s,headers:r,referrerPolicy:"no-referrer"},e))})}async function he(t,e,n){t._canInitEmulator=!1;e=Object.assign(Object.assign({},ue),e);try{const s=new me(t),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();var r=await o.json();if("needConfirmation"in r)throw ve(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 ve(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===u)throw ve(t,"email-already-in-use",r);var i=e[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw J(t,i,c);G(t,i)}}catch(e){if(e instanceof g)throw e;G(t,"network-request-failed")}}async function pe(e,t,n,r,i={}){i=await de(e,t,n,r,i);return"mfaPendingCredential"in i&&G(e,"multi-factor-auth-required",{serverResponse:i}),i}function fe(e,t,n,r){r=`${t}${n}?${r}`;return e.config.emulator?oe(e.config,r):`${e.config.apiScheme}://${r}`}class me{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(K(this.auth,"timeout")),ce.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function ve(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=K(e,t,r);return i.customData._tokenResponse=n,i}function ge(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ye(e){return 1e3*Number(e)}function _e(e){var[t,n,e]=e.split(".");if(void 0===t||void 0===n||void 0===e)return B("JWT malformed, contained fewer than 3 sections"),null;try{var r=c(n);return r?JSON.parse(r):(B("Failed to decode base64 JWT payload"),null)}catch(e){return B("Caught error parsing JWT payload as JSON",e),null}}async function Ie(t,n,e=!1){if(e)return n;try{return await n}catch(e){throw e instanceof g&&([{code:n}]=[e],"auth/user-disabled"===n||"auth/user-token-expired"===n)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class we{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"===e.code&&this.schedule(!0))}this.schedule()}}class be{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ge(this.lastLoginAt),this.creationTime=ge(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Te(e){var t=e.auth,n=await e.getIdToken(),r=await Ie(e,async function(e,t){return de(e,"POST","/v1/accounts:lookup",t)}(t,{idToken:n}));X(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{providerId:t}=e,e=s(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 be(i.createdAt,i.lastLoginAt),isAnonymous:t};Object.assign(e,t)}class ke{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){X(e.idToken,"internal-error"),X(void 0!==e.idToken,"internal-error"),X(void 0!==e.refreshToken,"internal-error");var t,t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):(X(t=_e(t=e.idToken),"internal-error"),X(void 0!==t.exp,"internal-error"),X(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 X(!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 r,i,{accessToken:t,refreshToken:e,expiresIn:n}=(i=t,await{accessToken:(n=await he(r=e,{},()=>{var e=b({grant_type:"refresh_token",refresh_token:i}).slice(1),{tokenApiHost:t,apiKey:n}=r.config,n=fe(r,t,"/v1/token",`key=${n}`);return ae.fetch()(n,{method:"POST",headers:{"X-Client-Version":r._getSdkClientVersion(),"Content-Type":"application/x-www-form-urlencoded"},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 ke;return n&&(X("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(X("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),t&&(X("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 ke,this.toJSON())}_performRefresh(){return Z("not implemented")}}function Ee(e,t){X("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Re{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,e=s(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.emailVerified=!1,this.isAnonymous=!1,this.tenantId=null,this.providerData=[],this.proactiveRefresh=new we(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.phoneNumber=e.phoneNumber||null,this.photoURL=e.photoURL||null,this.isAnonymous=e.isAnonymous||!1,this.metadata=new be(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await Ie(this,this.stsTokenManager.getToken(this.auth,e));return X(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=A(e);var r=await n.getIdToken(t),i=_e(r);return X(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:ge(ye(i.auth_time)),issuedAtTime:ge(ye(i.iat)),expirationTime:ge(ye(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=A(e);await Te(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(X(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 Re(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){X(!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 Te(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e=await this.getIdToken();return await Ie(this,async function(e,t){return de(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;X(l&&f,e,"internal-error");t=ke.fromJSON(this.name,f);X("string"==typeof l,e,"internal-error"),Ee(n,e.name),Ee(r,e.name),X("boolean"==typeof d,e,"internal-error"),X("boolean"==typeof h,e,"internal-error"),Ee(i,e.name),Ee(s,e.name),Ee(o,e.name),Ee(a,e.name),Ee(u,e.name),Ee(c,e.name);const m=new Re({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 ke;r.updateFromServerResponse(t);n=new Re({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await Te(n),n}}class Se{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){}}Se.type="NONE";const Oe=Se;function Ae(e,t,n){return`firebase:${e}:${t}:${n}`}class Pe{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;var{config:e,name:n}=this.auth;this.fullUserKey=Ae(this.userKey,e.apiKey,n),this.fullPersistenceKey=Ae("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?Re._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 Pe(te(Oe),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let i=r[0]||te(Oe);const s=Ae(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=Re._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 Pe(i,e,n)}}function Ne(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Me(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ce(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(xe(t))return"Blackberry";if(Fe(t))return"Webos";if(Le(t))return"Safari";if((t.includes("chrome/")||De(t))&&!t.includes("edge/"))return"Chrome";if(Ue(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 Ce(e=d()){return/firefox\//i.test(e)}function Le(e=d()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function De(e=d()){return/crios\//i.test(e)}function Me(e=d()){return/iemobile/i.test(e)}function Ue(e=d()){return/android/i.test(e)}function xe(e=d()){return/blackberry/i.test(e)}function Fe(e=d()){return/webos/i.test(e)}function Ve(e=d()){return/iphone|ipad|ipod/i.test(e)}function je(e=d()){return Ve(e)||Ue(e)||Fe(e)||xe(e)||/windows phone/i.test(e)||Me(e)}function We(e,t=[]){let n;switch(e){case"Browser":n=Ne(d());break;case"Worker":n=`${Ne(d())}-${e}`;break;default:n=e}t=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${bi.SDK_VERSION}/${t}`}class He{constructor(e,t){this.app=e,this.config=t,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new qe(this),this.idTokenSubscription=new qe(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=z,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=t.sdkClientVersion}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=te(n)),this._initializationPromise=this.queue(async()=>{var e;this._deleted||(this.persistenceManager=await Pe.create(this,t),this._deleted||(null!==(e=this._popupRedirectResolver)&&void 0!==e&&e._shouldInitProactively&&await this._popupRedirectResolver._initialize(this),await this.initializeCurrentUser(n),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)}}async initializeCurrentUser(e){var t,n;let r=await this.assertedPersistence.getCurrentUser();return e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,n=null===r||void 0===r?void 0:r._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==n||null==e||!e.user||(r=e.user)),r?r._redirectEventId?(X(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)):this.reloadAndSetCurrentUserOrClear(r):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 Te(e)}catch(e){if("auth/network-request-failed"!==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?A(e):null;return t&&X(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){if(!this._deleted)return e&&X(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(te(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new _("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}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||(X(e=e&&te(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await Pe.create(this,[te(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 X(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 X(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=We(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getSdkClientVersion(){return this.clientVersion}}function ze(e){return A(e)}class qe{constructor(e){var t;this.auth=e,this.observer=null,this.addObserver=(t=new R(e=>this.observer=e,t)).subscribe.bind(t)}get next(){return X(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Be(e,t,n){const r=ze(e);X(r._canInitEmulator,r,"emulator-config-failed"),X(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");e=!(null==n||!n.disableWarnings);const i=Ge(t);var{host:n,port:t}=function(e){const t=Ge(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:Ke(r.substr(s.length+1))}}var[e,s]=r.split(":");return{host:e,port:Ke(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})}),function(e){function t(){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||e||("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}(e)}function Ge(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Ke(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 Z("not implemented")}_getIdTokenResponse(e){return Z("not implemented")}_linkToIdToken(e,t){return Z("not implemented")}_getReauthenticationResolver(e){return Z("not implemented")}}async function $e(e,t){return de(e,"POST","/v1/accounts:resetPassword",le(e,t))}async function Ye(e,t){return de(e,"POST","/v1/accounts:update",t)}async function Xe(e,t){return de(e,"POST","/v1/accounts:sendOobCode",le(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 pe(e,"POST","/v1/accounts:signInWithPassword",le(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return pe(e,"POST","/v1/accounts:signInWithEmailLink",le(e,t))}(e,{email:this._email,oobCode:this._password});default:G(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Ye(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return pe(e,"POST","/v1/accounts:signInWithEmailLink",le(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:G(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Qe(e,t){return pe(e,"POST","/v1/accounts:signInWithIdp",le(e,t))}class et extends Je{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new et(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):G("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=s(t,["providerId","signInMethod"]);if(!n||!e)return null;e=new et(n,e);return Object.assign(e,t),e}_getIdTokenResponse(e){return Qe(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Qe(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Qe(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=b(t)}return e}}const tt={USER_NOT_FOUND:"user-not-found"};class nt extends Je{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new nt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new nt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return pe(e,"POST","/v1/accounts:signInWithPhoneNumber",le(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){if((t=await pe(e,"POST","/v1/accounts:signInWithPhoneNumber",le(e,t))).temporaryProof)throw ve(e,"account-exists-with-different-credential",t);return t}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return pe(e,"POST","/v1/accounts:signInWithPhoneNumber",le(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),tt)}(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 nt({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}):null}}class rt{constructor(e){var t=T(k(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);X(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=T(k(t=e)).link,r=n?T(k(n)).deep_link_id:null,((e=T(k(t)).deep_link_id)?T(k(e)).link:null)||e||r||n||t);try{return new rt(t)}catch(e){return null}}}class it{constructor(){this.providerId=it.PROVIDER_ID}static credential(e,t){return Ze._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=rt.parseLink(t);return X(t,"argument-error"),Ze._fromEmailAndCode(e,t.code,t.tenantId)}}it.PROVIDER_ID="password",it.EMAIL_PASSWORD_SIGN_IN_METHOD="password",it.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class st{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 ot extends st{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class at extends ot{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return X("providerId"in e&&"signInMethod"in e,"argument-error"),et._fromParams(e)}credential(e){return this._credential(e)}_credential(e){return X(e.idToken||e.accessToken,"argument-error"),et._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return at.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return at.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 at(e)._credential({idToken:t,accessToken:n,rawNonce:s,pendingToken:i})}catch(e){return null}}}class ut extends ot{constructor(){super("facebook.com")}static credential(e){return et._fromParams({providerId:ut.PROVIDER_ID,signInMethod:ut.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ut.credentialFromTaggedObject(e)}static credentialFromError(e){return ut.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ut.credential(e.oauthAccessToken)}catch(e){return null}}}ut.FACEBOOK_SIGN_IN_METHOD="facebook.com",ut.PROVIDER_ID="facebook.com";class ct extends ot{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return et._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:t,oauthAccessToken:e}=e;if(!t&&!e)return null;try{return ct.credential(t,e)}catch(e){return null}}}ct.GOOGLE_SIGN_IN_METHOD="google.com",ct.PROVIDER_ID="google.com";class lt extends ot{constructor(){super("github.com")}static credential(e){return et._fromParams({providerId:lt.PROVIDER_ID,signInMethod:lt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return lt.credentialFromTaggedObject(e)}static credentialFromError(e){return lt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return lt.credential(e.oauthAccessToken)}catch(e){return null}}}lt.GITHUB_SIGN_IN_METHOD="github.com",lt.PROVIDER_ID="github.com";class dt extends Je{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return Qe(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Qe(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Qe(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 dt(t,e):null}static _create(e,t){return new dt(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class ht extends ot{constructor(){super("twitter.com")}static credential(e,t){return et._fromParams({providerId:ht.PROVIDER_ID,signInMethod:ht.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return ht.credentialFromTaggedObject(e)}static credentialFromError(e){return ht.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:t,oauthTokenSecret:e}=e;if(!t||!e)return null;try{return ht.credential(t,e)}catch(e){return null}}}ht.TWITTER_SIGN_IN_METHOD="twitter.com",ht.PROVIDER_ID="twitter.com";async function pt(e,t){return pe(e,"POST","/v1/accounts:signUp",le(e,t))}class ft{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 Re._fromIdTokenResponse(e,n,r),r=mt(n);return new ft({user:e,providerId:r,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);var r=mt(n);return new ft({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function mt(e){return e.providerId||("phoneNumber"in e?"phone":null)}class vt extends g{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,this.name="FirebaseError",Object.setPrototypeOf(this,vt.prototype),this.appName=e.name,this.code=t.code,this.tenantId=null!==(e=e.tenantId)&&void 0!==e?e:void 0,this.serverResponse=t.customData.serverResponse}static _fromErrorAndOperation(e,t,n,r){return new vt(e,t,n,r)}}function gt(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 vt._fromErrorAndOperation(t,e,n,r);throw e})}function yt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function _t(e,t){const n=A(e);await wt(!0,n,t);var{providerUserInfo:t}=(e=n.auth,t={idToken:await n.getIdToken(),deleteProvider:[t]},await de(e,"POST","/v1/accounts:update",t));const r=yt(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 It(e,t,n=!1){n=await Ie(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ft._forOperation(e,"link",n)}async function wt(e,t,n){await Te(t);const r=yt(t.providerData);var i=!1===e?"provider-already-linked":"no-such-provider";X(r.has(n)===e,t.auth,i)}async function bt(e,t,n=!1){var{auth:r}=e,i="reauthenticate";try{var s=await Ie(e,gt(r,i,t,e),n);X(s.idToken,r,"internal-error");var o=_e(s.idToken);X(o,r,"internal-error");var{sub:a}=o;return X(e.uid===a,r,"user-mismatch"),ft._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&G(r,"user-mismatch"),e}}async function Tt(e,t,n=!1){t=await gt(e,"signIn",t),t=await ft._fromIdTokenResponse(e,"signIn",t);return n||await e._updateCurrentUser(t.user),t}async function kt(e,t){return Tt(ze(e),t)}async function Et(e,t){e=A(e);return await wt(!1,e,t.providerId),It(e,t)}async function Rt(e,t){return bt(A(e),t)}async function St(e,t){const n=ze(e);t=await pe(n,"POST","/v1/accounts:signInWithCustomToken",le(n,{token:t,returnSecureToken:!0})),t=await ft._fromIdTokenResponse(n,"signIn",t);return await n._updateCurrentUser(t.user),t}class Ot{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?At._fromServerResponse(e,t):G(e,"internal-error")}}class At extends Ot{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new At(t)}}function Pt(e,t,n){var r;X(0<(null===(r=n.url)||void 0===r?void 0:r.length),e,"invalid-continue-uri"),X(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&&(X(0<n.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iosBundleId=n.iOS.bundleId),n.android&&(X(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 Nt(e,t,n){e=A(e),t={requestType:"PASSWORD_RESET",email:t};n&&Pt(e,t,n),await Xe(e,t)}async function Ct(e,t){await de(e=A(e),"POST","/v1/accounts:update",le(e,{oobCode:t}))}async function Lt(e,t){var n=A(e),r=await $e(n,{oobCode:t}),t=r.requestType;switch(X(t,n,"internal-error"),t){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":X(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":X(r.mfaInfo,n,"internal-error");default:X(r.email,n,"internal-error")}let i=null;return r.mfaInfo&&(i=Ot._fromServerResponse(ze(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 Dt(e,t,n){e=A(e),t={requestType:"EMAIL_SIGNIN",email:t};X(n.handleCodeInApp,e,"argument-error"),n&&Pt(e,t,n),await Xe(e,t)}async function Mt(e,t){var n=re()?ne():"http://localhost",{signinMethods:n}=await de(e=A(e),"POST","/v1/accounts:createAuthUri",le(e,{identifier:t,continueUri:n}));return n||[]}async function Ut(e,t){var n=A(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Pt(n.auth,r,t);var{email:r}=await Xe(n.auth,r);r!==e.email&&await e.reload()}async function xt(e,t,n){var r=A(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&Pt(r.auth,t,n);var{email:t}=await Xe(r.auth,t);t!==e.email&&await e.reload()}async function Ft(e,{displayName:t,photoURL:n}){if(void 0!==t||void 0!==n){const r=A(e);e=await r.getIdToken(),n=await Ie(r,async function(e,t){return de(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 Vt(e,t,n){var{auth:r}=e;const i={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(i.email=t),n&&(i.password=n);r=await Ie(e,Ye(r,i));await e._updateTokensIfNecessary(r,!0)}class jt{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class Wt extends jt{constructor(e,t,n,r){super(e,t,n),this.username=r}}class Ht extends jt{constructor(e,t){super(e,"facebook.com",t)}}class zt extends Wt{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class qt extends jt{constructor(e,t){super(e,"google.com",t)}}class Bt extends Wt{constructor(e,t,n){super(e,"twitter.com",t,n)}}function Gt(e){var{user:t,_tokenResponse:e}=e;return t.isAnonymous&&!e?{providerId:null,isNewUser:!1,profile:null}:function(e){if(!e)return null;var{providerId:t}=e,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=_e(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 jt(r,i)}}if(!t)return null;switch(t){case"facebook.com":return new Ht(r,n);case"github.com":return new zt(r,n);case"google.com":return new qt(r,n);case"twitter.com":return new Bt(r,n,e.screenName||null);case"custom":case"anonymous":return new jt(r,null);default:return new jt(r,t,n)}}(e)}class Kt{constructor(e,t){this.type=e,this.credential=t}static _fromIdtoken(e){return new Kt("enroll",e)}static _fromMfaPendingCredential(e){return new Kt("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 Kt._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.idToken)return Kt._fromIdtoken(e.multiFactorSession.idToken)}return null}}class Jt{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,r){const i=ze(e);e=(r.serverResponse.mfaInfo||[]).map(e=>Ot._fromServerResponse(i,e));X(r.serverResponse.mfaPendingCredential,i,"internal-error");const s=Kt._fromMfaPendingCredential(r.serverResponse.mfaPendingCredential);return new Jt(s,e,async e=>{e=await e._process(i,s);delete r.serverResponse.mfaInfo,delete r.serverResponse.mfaPendingCredential;var t=Object.assign(Object.assign({},r.serverResponse),{idToken:e.idToken,refreshToken:e.refreshToken});switch(r.operationType){case"signIn":var n=await ft._fromIdTokenResponse(i,r.operationType,t);return await i._updateCurrentUser(n.user),n;case"reauthenticate":return X(r.user,i,"internal-error"),ft._forOperation(r.user,r.operationType,t);default:G(i,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}class $t{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>Ot._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new $t(e)}async getSession(){return Kt._fromIdtoken(await this.user.getIdToken())}async enroll(e,t){const n=e;e=await this.getSession(),t=await Ie(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 Ie(this.user,(e=this.user.auth,n={idToken:n,mfaEnrollmentId:t},de(e,"POST","/v2/accounts/mfaEnrollment:withdraw",Object.assign({tenantId:e.tenantId},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"!==e.code)throw e}}}const Yt=new WeakMap;const Xt="__sak";class Zt{constructor(e,t){this.storage=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Xt,"1"),this.storage.removeItem(Xt),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()}}class Qt extends Zt{constructor(){var e;super(window.localStorage,"LOCAL"),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=(Le(e=d())||Ve(e))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=je(),this._shouldAllowMigration=!0,this.boundEventHandler=this.onStorageEvent.bind(this)}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);p()&&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]}}Qt.type="LOCAL";const en=Qt;class tn extends Zt{constructor(){super(window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}tn.type="SESSION";const nn=tn;class rn{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 rn(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 sn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}rn.receivers=[];class on{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=sn("",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 an(){return window}function un(){return void 0!==an().WorkerGlobalScope&&"function"==typeof an().importScripts}const cn="firebaseLocalStorageDb",ln=1,dn="firebaseLocalStorage",hn="fbase_key";class pn{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 fn(e,t){return e.transaction([dn],t?"readwrite":"readonly").objectStore(dn)}function mn(){const r=indexedDB.open(cn,ln);return new Promise((n,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const e=r.result;try{e.createObjectStore(dn,{keyPath:hn})}catch(e){t(e)}}),r.addEventListener("success",async()=>{const e=r.result;var t;e.objectStoreNames.contains(dn)?n(e):(e.close(),t=indexedDB.deleteDatabase(cn),await new pn(t).toPromise(),n(await mn()))})})}async function vn(e,t,n){n=fn(e,!0).put({[hn]:t,value:n});return new pn(n).toPromise()}function gn(e,t){t=fn(e,!0).delete(t);return new pn(t).toPromise()}class yn{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 mn(),this.db)}async _withRetries(e){let t=0;for(;;)try{return await e(await this._openDb())}catch(e){if(3<t++)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return un()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=rn._getInstance(un()?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 on(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 mn();return await vn(e,Xt,"1"),await gn(e,Xt),!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=>vn(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=fn(e,!1).get(t),void 0===(t=await new pn(t).toPromise())?null:t.value}(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>gn(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e,t,n=await this._withRetries(e=>{e=fn(e,!1).getAll();return new pn(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()}}yn.type="LOCAL";const _n=yn;function In(r){return new Promise((e,n)=>{const t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=e=>{const t=K("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 wn(e){return`__${e}${Math.floor(1e6*Math.random())}`}class bn{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 Tn(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 Tn{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;X(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 kn=wn("rcb"),En=new se(3e4,6e4);class Rn{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!an().grecaptcha}load(s,o=""){var e;return X((e=o).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),s,"argument-error"),this.shouldResolveImmediately(o)?Promise.resolve(an().grecaptcha):new Promise((t,r)=>{const i=an().setTimeout(()=>{r(K(s,"network-request-failed"))},En.get());an()[kn]=()=>{an().clearTimeout(i),delete an()[kn];const e=an().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(K(s,"internal-error"))},In(`https://www.google.com/recaptcha/api.js??${b({onload:kn,render:"explicit",hl:o})}`).catch(()=>{clearTimeout(i),r(K(s,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!an().grecaptcha&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class Sn{async load(e){return new bn(e)}clearedOneInstance(){}}const On="recaptcha",An={theme:"light",type:"image"};class Pn{constructor(e,t=Object.assign({},An),n){this.parameters=t,this.type=On,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=ze(n),this.isInvisible="invisible"===this.parameters.size,X("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");e="string"==typeof e?document.getElementById(e):e;X(e,this.auth,"argument-error"),this.container=e,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?Sn:Rn),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(){X(!this.parameters.sitekey,this.auth,"argument-error"),X(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),X("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=an()[n];"function"==typeof e&&e(t)}}}assertNotDestroyed(){X(!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(){X(re()&&!un(),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 de(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");X(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return X(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class Nn{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=nt._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function Cn(t,n,r){var i,s,o,a,u,c,l=await r.verify();try{X("string"==typeof l,t,"argument-error"),X(r.type===On,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 X("enroll"===d.type,t,"internal-error"),(u=t,c={idToken:d.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,recaptchaToken:l}},await de(u,"POST","/v2/accounts/mfaEnrollment:start",Object.assign({tenantId:u.tenantId},c))).phoneSessionInfo.sessionInfo;X("signin"===d.type,t,"internal-error");var h=(null===(i=e.multiFactorHint)||void 0===i?void 0:i.uid)||e.multiFactorUid;return X(h,t,"missing-multi-factor-info"),(a={mfaPendingCredential:d.credential,mfaEnrollmentId:h,phoneSignInInfo:{recaptchaToken:l}},await de(t,"POST","/v2/accounts/mfaSignIn:start",Object.assign({tenantId:t.tenantId},a))).phoneResponseInfo.sessionInfo}var{sessionInfo:p}=(s=t,o={phoneNumber:e.phoneNumber,recaptchaToken:l},await de(s,"POST","/v1/accounts:sendVerificationCode",le(s,o)));return p}finally{r._reset()}}class Ln{constructor(e){this.providerId=Ln.PROVIDER_ID,this.auth=ze(e)}verifyPhoneNumber(e,t){return Cn(this.auth,e,A(t))}static credential(e,t){return nt._fromVerification(e,t)}static credentialFromResult(e){return Ln.credentialFromTaggedObject(e)}static credentialFromError(e){return Ln.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{phoneNumber:t,temporaryProof:e}=e;return t&&e?nt._fromTokenResponse(t,e):null}}function Dn(e,t){return t?te(t):(X(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Ln.PROVIDER_ID="phone",Ln.PHONE_SIGN_IN_METHOD="phone";class Mn extends Je{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Qe(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Qe(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Qe(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 Un(e){return Tt(e.auth,new Mn(e),e.bypassAuthState)}function xn(e){var{auth:t,user:n}=e;return X(n,t,"internal-error"),bt(n,new Mn(e),e.bypassAuthState)}async function Fn(e){var{auth:t,user:n}=e;return X(n,t,"internal-error"),It(n,new Mn(e),e.bypassAuthState)}class Vn{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 Un;case"linkViaPopup":case"linkViaRedirect":return Fn;case"reauthViaPopup":case"reauthViaRedirect":return xn;default:G(this.auth,"internal-error")}}resolve(e){Q(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Q(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 jn=new se(2e3,1e4);class Wn extends Vn{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Wn.currentPopupAction&&Wn.currentPopupAction.cancel(),Wn.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return X(e,this.auth,"internal-error"),e}async onExecution(){Q(1===this.filter.length,"Popup operations only handle one event");var e=sn();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(K(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(K(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Wn.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(K(this.auth,"popup-closed-by-user"))},2e3):this.pollId=window.setTimeout(t,jn.get())};t()}}Wn.currentPopupAction=null;const Hn="pendingRedirect",zn=new Map;class qn extends Vn{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let t=zn.get(this.auth._key());if(!t){try{const i=(e=this.resolver,n=this.auth,r=Kn(n),n="true"===await Gn(e)._get(r),await Gn(e)._remove(r),await n)?await super.execute():null;t=()=>Promise.resolve(i)}catch(e){t=()=>Promise.reject(e)}zn.set(this.auth._key(),t)}var e,n,r;return 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 Bn(e,t){return Gn(e)._set(Kn(t),"true")}function Gn(e){return te(e._redirectPersistence)}function Kn(e){return Ae(Hn,e.config.apiKey,e.name)}function Jn(e,t,n){return async function(e,t,n){var r=ze(e);$(e,t,st);const i=Dn(r,n);return await Bn(i,r),i._openRedirect(r,t,"signInViaRedirect")}(e,t,n)}function $n(e,t,n){return async function(e,t,n){e=A(e);$(e.auth,t,st);const r=Dn(e.auth,n);await Bn(r,e.auth);n=await Zn(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",n)}(e,t,n)}function Yn(e,t,n){return async function(e,t,n){e=A(e);$(e.auth,t,st);const r=Dn(e.auth,n);await wt(!1,e,t.providerId),await Bn(r,e.auth);n=await Zn(e);return r._openRedirect(e.auth,t,"linkViaRedirect",n)}(e,t,n)}async function Xn(e,t,n=!1){const r=ze(e);e=Dn(r,t);const i=new qn(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 Zn(e){var t=sn(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Qn{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 tr(e);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(e,t){var n;e.error&&!tr(e)?(n=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error",t.onError(K(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(er(e))}saveEventToCache(e){this.cachedEventUids.add(er(e)),this.lastProcessedEventTime=Date.now()}}function er(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function tr({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function nr(e,t={}){return de(e,"GET","/v1/projects",t)}const rr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ir=/^https?/;async function sr(e){if(!e.config.emulator){var{authorizedDomains:t}=await nr(e);for(const n of t)try{if(function(e){const t=ne(),{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(!ir.test(n))return!1;if(rr.test(e))return r===e;const s=e.replace(/\./g,"\\."),o=new RegExp("^(.+\\."+s+"|"+s+")$","i");return o.test(r)}(n))return}catch(e){}G(e,"unauthorized-domain")}}const or=new se(3e4,6e4);function ar(){const t=an().___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 ur=null;function cr(e){var i;return ur=ur||(i=e,new Promise((e,t)=>{function n(){ar(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ar(),t(K(i,"network-request-failed"))},timeout:or.get()})}if(null!==(r=null===(r=an().gapi)||void 0===r?void 0:r.iframes)&&void 0!==r&&r.Iframe)e(gapi.iframes.getContext());else{if(null===(r=an().gapi)||void 0===r||!r.load){var r=wn("iframefcb");return an()[r]=()=>{gapi.load?n():t(K(i,"network-request-failed"))},In(`https://apis.google.com/js/api.js?onload=${r}`)}n()}}).catch(e=>{throw ur=null,e})),ur}const lr=new se(5e3,15e3),dr="__/auth/iframe",hr="emulator/auth/iframe",pr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},fr=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function mr(o){const e=await cr(o);var t=an().gapi;return X(t,o,"internal-error"),e.open({where:document.body,url:function(e){var t=e.config;X(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?oe(t,hr):`https://${e.config.authDomain}/${dr}`;const r={apiKey:t.apiKey,appName:e.name,v:bi.SDK_VERSION};(t=fr.get(e.config.apiHost))&&(r.eid=t);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${b(r).slice(1)}`}(o),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pr,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});const n=K(o,"network-request-failed"),r=an().setTimeout(()=>{t(n)},lr.get());function i(){an().clearTimeout(r),e(s)}s.ping(i).then(i,()=>{t(n)})}))}const vr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class gr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function yr(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({},vr),{width:r.toString(),height:i.toString(),top:s,left:o});o=d().toLowerCase();n&&(a=De(o)?"_blank":n),Ce(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],Ve(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 gr(null);const l=window.open(t||"",a,n);X(l,e,"popup-blocked");try{l.focus()}catch(e){}return new gr(l)}const _r="__/auth/handler",Ir="emulator/auth/handler";function wr(e,t,n,r,i,s){X(e.config.authDomain,e,"auth-domain-config-required"),X(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:bi.SDK_VERSION,eventId:i};if(t instanceof st){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(var 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 ot){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`${[{config:e}]=[e],e.emulator?oe(e,Ir):`https://${e.authDomain}/${_r}`}?${b(c).slice(1)}`}const br="webStorageSupport";const Tr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=nn,this._completeRedirectFn=Xn}async _openPopup(e,t,n,r){var i;return Q(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),yr(e,wr(e,t,n,ne(),r),sn())}async _openRedirect(e,t,n,r){return await this._originValidation(e),r=wr(e,t,n,ne(),r),an().location.href=r,new Promise(()=>{})}_initialize(e){var t=e._key();if(this.eventManagers[t]){const{manager:r,promise:n}=this.eventManagers[t];return r?Promise.resolve(r):(Q(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n}async initAndGetManager(t){const e=await mr(t),n=new Qn(t);return e.register("authEvent",e=>{return X(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(br,{type:br},e=>{e=null===(e=null==e?void 0:e[0])||void 0===e?void 0:e[br];void 0!==e&&n(!!e),G(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=sr(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return je()||Le()||Ve()}};class kr 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 Z("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new kr(e)}_finalizeEnroll(e,t,n){return e=e,n={idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()},de(e,"POST","/v2/accounts/mfaEnrollment:finalize",Object.assign({tenantId:e.tenantId},n))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},de(e,"POST","/v2/accounts/mfaSignIn:finalize",Object.assign({tenantId:e.tenantId},t))}}class Er{constructor(){}static assertion(e){return kr._fromCredential(e)}}var Rr;class Sr{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(){X(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function Or(){return window}Rr="Browser",bi._registerComponent(new U("auth",(e,{options:n})=>{e=e.getProvider("app").getImmediate();const{apiKey:r,authDomain:i}=e.options;return(e=>{X(r&&!r.includes(":"),"invalid-api-key",{appName:e.name}),X(!(null!==i&&void 0!==i&&i.includes(":")),"argument-error",{appName:e.name});var t={apiKey:r,authDomain:i,clientPlatform:Rr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:We(Rr)},t=new He(e,t);return function(e,t){const n=(null==t?void 0:t.persistence)||[];var r=(Array.isArray(n)?n:[n]).map(te);null!=t&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(t,n),t})(e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{const r=e.getProvider("auth-internal");r.initialize()})),bi._registerComponent(new U("auth-internal",e=>{e=ze(e.getProvider("auth").getImmediate());return e=e,new Sr(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),bi.registerVersion("@firebase/auth","0.17.2",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Rr));async function Ar(e,t,n){var{BuildInfo:r}=Or();Q(t.sessionId,"AuthEvent did not contain a session ID");var i=await async function(e){const t=function(t){if(Q(/[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 Ve()?s.ibi=r.packageName:Ue()?s.apn=r.packageName:G(e,"operation-not-supported-in-this-environment"),r.displayName&&(s.appDisplayName=r.displayName),s.sessionId=i,wr(e,n,t.type,void 0,null!==(t=t.eventId)&&void 0!==t?t:void 0,s)}function Pr(r){const{cordova:i}=Or();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 Nr=20;class Cr extends Qn{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 Lr(e,t,n=null){return{type:t,eventId:n,urlResponse:null,sessionId:function(){const t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<Nr;e++){var r=Math.floor(Math.random()*n.length);t.push(n.charAt(r))}return t.join("")}(),postBody:null,tenantId:e.tenantId,error:K(e,"no-auth-event")}}async function Dr(e){var t=await Ur()._get(xr(e));return t&&await Ur()._remove(xr(e)),t}function Mr(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?K(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 Ur(){return te(en)}function xr(e){return Ae("authEvent",e.config.apiKey,e.name)}function Fr(e){if(null==e||!e.includes("?"))return{};const[,...t]=e.split("?");return T(t.join("?"))}const Vr=class{constructor(){this._redirectPersistence=nn,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=Xn}async _initialize(e){var t=e._key();let n=this.eventManagers.get(t);return n||(n=new Cr(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),n}_openPopup(e){G(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,n,r){var i,s;a=e,s=Or(),X("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"}),X(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"}),X("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"}),X("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"}),X("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(),zn.clear(),await this._originValidation(e);var a=Lr(e,n,r);n=e,r=a,await Ur()._set(xr(n),r);t=await Pr(await Ar(e,a,t));return async function(o,a,u){const{cordova:c}=Or();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(K(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),Ue()&&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{BuildInfo:t}=Or();const n={};Ve()?n.iosBundleId=t.packageName:Ue()?n.androidPackageName=t.packageName:G(e,"operation-not-supported-in-this-environment"),await nr(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(r,i){const{universalLinks:e,handleOpenURL:t,BuildInfo:n}=Or(),s=setTimeout(async()=>{await Dr(r),i.onEvent(jr())},500),o=async e=>{clearTimeout(s);var t=await Dr(r);let n=null;t&&null!=e&&e.url&&(n=Mr(t,e.url)),i.onEvent(n||jr())};void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,o);const a=t,u=`${n.packageName.toLowerCase()}://`;Or().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(u)&&o({url:e}),"function"==typeof a)try{a(e)}catch(e){console.error(e)}}}};function jr(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:K("no-auth-event")}}function Wr(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function Hr(e){return void 0===e&&(e=d()),!("file:"!==Wr()&&"ionic:"!==Wr()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function zr(e){return void 0===e&&(e=d()),p()&&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=sn();if(e)return e.setItem(t,"1"),e.removeItem(t),!zr()||f()}catch(e){return Br()&&f()}return!1}function Br(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function Gr(){return("http:"===Wr()||"https:"===Wr()||n()||Hr())&&!(h()||l())&&qr()&&!Br()}function Kr(){return Hr()&&"undefined"!=typeof document}var Jr={LOCAL:"local",NONE:"none",SESSION:"session"},$r=X,Yr="persistence";function Xr(r){return o(this,void 0,void 0,function(){var t,n;return a(this,function(e){switch(e.label){case 0:return[4,r._initializationPromise];case 1:return e.sent(),t=Zr(),n=Ae(Yr,r.config.apiKey,r.name),null!=t&&t.sessionStorage&&t.sessionStorage.setItem(n,r._getPersistence()),[2]}})})}function Zr(){return"undefined"!=typeof window?window:null}var Qr=X,ei=(ti.prototype._initialize=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._initialize(t)]}})})},ti.prototype._openPopup=function(t,n,r,i){return o(this,void 0,void 0,function(){return a(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)]}})})},ti.prototype._openRedirect=function(t,n,r,i){return o(this,void 0,void 0,function(){return a(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)]}})})},ti.prototype._isIframeWebStorageSupported=function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)},ti.prototype._originValidation=function(e){return this.assertedUnderlyingResolver._originValidation(e)},Object.defineProperty(ti.prototype,"_shouldInitProactively",{get:function(){return Kr()||this.browserResolver._shouldInitProactively},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"assertedUnderlyingResolver",{get:function(){return Qr(this.underlyingResolver,"internal-error"),this.underlyingResolver},enumerable:!1,configurable:!0}),ti.prototype.selectUnderlyingResolver=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return this.underlyingResolver?[2]:[4,function(){return o(this,void 0,void 0,function(){return a(this,function(e){return Kr()?[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]}})})},ti);function ti(){this.browserResolver=te(Tr),this.cordovaResolver=te(Vr),this.underlyingResolver=null,this._redirectPersistence=nn,this._completeRedirectFn=Xn}function ni(e){return e.unwrap()}function ri(e,t){var n,r,i=null===(r=t.customData)||void 0===r?void 0:r._tokenResponse;"auth/multi-factor-auth-required"===t.code?t.resolver=new ai(e,(r=t,e=A(n=e),X((n=r).operationType,e,"argument-error"),X(null===(r=n.serverResponse)||void 0===r?void 0:r.mfaPendingCredential,e,"argument-error"),Jt._fromError(e,n))):!i||(t=ii(n=t))&&(n.credential=t,n.tenantId=i.tenantId||void 0,n.email=i.email||void 0,n.phoneNumber=i.phoneNumber||void 0)}function ii(e){var t=(e instanceof g?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof g)&&"temporaryProof"in t&&"phoneNumber"in t)return Ln.credentialFromResult(e);var n,r=t.providerId;if(!r||r===F.PASSWORD)return null;switch(r){case F.GOOGLE:n=ct;break;case F.FACEBOOK:n=ut;break;case F.GITHUB:n=lt;break;case F.TWITTER:n=ht;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.")?dt._create(r,a):et._fromParams({providerId:r,signInMethod:r,pendingToken:a,idToken:i,accessToken:s}):new at(r).credential({idToken:i,accessToken:s,rawNonce:u}):null}return e instanceof g?n.credentialFromError(e):n.credentialFromResult(e)}function si(i,s){return o(this,void 0,void 0,function(){var t,n,r;return a(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s];case 1:return t=e.sent(),[3,3];case 2:throw(r=e.sent())instanceof g&&ri(i,r),r;case 3:return n=t.operationType,r=t.user,[2,{operationType:n,credential:ii(t),additionalUserInfo:Gt(t),user:ci.getOrCreate(r)}]}})})}function oi(n,r){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,r];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return si(n,t.confirm(e))}}]}})})}var ai=(Object.defineProperty(ui.prototype,"session",{get:function(){return this.resolver.session},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"hints",{get:function(){return this.resolver.hints},enumerable:!1,configurable:!0}),ui.prototype.resolveSignIn=function(e){return si(ni(this.auth),this.resolver.resolveSignIn(e))},ui);function ui(e,t){this.resolver=t,this.auth=e.wrapped()}var ci=(li.getOrCreate=function(e){return li.USER_MAP.has(e)||li.USER_MAP.set(e,new li(e)),li.USER_MAP.get(e)},li.prototype.delete=function(){return this._delegate.delete()},li.prototype.reload=function(){return this._delegate.reload()},li.prototype.toJSON=function(){return this._delegate.toJSON()},li.prototype.getIdTokenResult=function(e){return this._delegate.getIdTokenResult(e)},li.prototype.getIdToken=function(e){return this._delegate.getIdToken(e)},li.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},li.prototype.linkWithCredential=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,si(this.auth,Et(this._delegate,t))]})})},li.prototype.linkWithPhoneNumber=function(t,n){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,oi(this.auth,async function(e,t,n){const r=A(e);return await wt(!1,r,"phone"),n=await Cn(r.auth,t,A(n)),new Nn(n,e=>Et(r,e))}(this._delegate,t,n))]})})},li.prototype.linkWithPopup=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,si(this.auth,async function(e,t,n){$((e=A(e)).auth,t,st),n=Dn(e.auth,n);const r=new Wn(e.auth,"linkViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,t,ei))]})})},li.prototype.linkWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,Xr(ze(this.auth))];case 1:return e.sent(),[2,Yn(this._delegate,t,ei)]}})})},li.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},li.prototype.reauthenticateWithCredential=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,si(this.auth,Rt(this._delegate,t))]})})},li.prototype.reauthenticateWithPhoneNumber=function(e,t){return oi(this.auth,async function(e,t,n){const r=A(e);return n=await Cn(r.auth,t,A(n)),new Nn(n,e=>Rt(r,e))}(this._delegate,e,t))},li.prototype.reauthenticateWithPopup=function(e){return si(this.auth,async function(e,t,n){$((e=A(e)).auth,t,st),n=Dn(e.auth,n);const r=new Wn(e.auth,"reauthViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,e,ei))},li.prototype.reauthenticateWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,Xr(ze(this.auth))];case 1:return e.sent(),[2,$n(this._delegate,t,ei)]}})})},li.prototype.sendEmailVerification=function(e){return Ut(this._delegate,e)},li.prototype.unlink=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,_t(this._delegate,t)];case 1:return e.sent(),[2,this]}})})},li.prototype.updateEmail=function(e){return Vt(A(this._delegate),e,null)},li.prototype.updatePassword=function(e){return Vt(A(this._delegate),null,e)},li.prototype.updatePhoneNumber=function(e){return async function(e,t){await It(A(e),t)}(this._delegate,e)},li.prototype.updateProfile=function(e){return Ft(this._delegate,e)},li.prototype.verifyBeforeUpdateEmail=function(e,t){return xt(this._delegate,e,t)},Object.defineProperty(li.prototype,"emailVerified",{get:function(){return this._delegate.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"isAnonymous",{get:function(){return this._delegate.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"phoneNumber",{get:function(){return this._delegate.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"providerData",{get:function(){return this._delegate.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"refreshToken",{get:function(){return this._delegate.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"displayName",{get:function(){return this._delegate.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"email",{get:function(){return this._delegate.email},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"photoURL",{get:function(){return this._delegate.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"providerId",{get:function(){return this._delegate.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"uid",{get:function(){return this._delegate.uid},enumerable:!1,configurable:!0}),Object.defineProperty(li.prototype,"auth",{get:function(){return this._delegate.auth},enumerable:!1,configurable:!0}),li.USER_MAP=new WeakMap,li);function li(e){this._delegate=e,this.multiFactor=(e=A(e=e),Yt.has(e)||Yt.set(e,$t._fromUser(e)),Yt.get(e))}var di=X,hi=(Object.defineProperty(pi.prototype,"emulatorConfig",{get:function(){return this._delegate.emulatorConfig},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"currentUser",{get:function(){return this._delegate.currentUser?ci.getOrCreate(this._delegate.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"languageCode",{get:function(){return this._delegate.languageCode},set:function(e){this._delegate.languageCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"settings",{get:function(){return this._delegate.settings},enumerable:!1,configurable:!0}),Object.defineProperty(pi.prototype,"tenantId",{get:function(){return this._delegate.tenantId},set:function(e){this._delegate.tenantId=e},enumerable:!1,configurable:!0}),pi.prototype.useDeviceLanguage=function(){this._delegate.useDeviceLanguage()},pi.prototype.signOut=function(){return this._delegate.signOut()},pi.prototype.useEmulator=function(e,t){Be(this._delegate,e,t)},pi.prototype.applyActionCode=function(e){return Ct(this._delegate,e)},pi.prototype.checkActionCode=function(e){return Lt(this._delegate,e)},pi.prototype.confirmPasswordReset=function(e,t){return async function(e,t,n){await $e(A(e),{oobCode:t,newPassword:n})}(this._delegate,e,t)},pi.prototype.createUserWithEmailAndPassword=function(t,n){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,si(this._delegate,async function(e,t,n){const r=ze(e);return n=await pt(r,{returnSecureToken:!0,email:t,password:n}),n=await ft._fromIdTokenResponse(r,"signIn",n),await r._updateCurrentUser(n.user),n}(this._delegate,t,n))]})})},pi.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},pi.prototype.fetchSignInMethodsForEmail=function(e){return Mt(this._delegate,e)},pi.prototype.isSignInWithEmailLink=function(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=rt.parseLink(e))?void 0:e.operation)},pi.prototype.getRedirectResult=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return di(Gr(),this._delegate,"operation-not-supported-in-this-environment"),[4,async function(e,t){return await ze(e)._initializationPromise,Xn(e,t,!1)}(this._delegate,ei)];case 1:return(t=e.sent())?[2,si(this._delegate,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},pi.prototype.addFrameworkForLogging=function(e){ze(this._delegate)._logFramework(e)},pi.prototype.onAuthStateChanged=function(e,t,n){e=fi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onAuthStateChanged(t,n,e)},pi.prototype.onIdTokenChanged=function(e,t,n){e=fi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onIdTokenChanged(t,n,e)},pi.prototype.sendSignInLinkToEmail=function(e,t){return Dt(this._delegate,e,t)},pi.prototype.sendPasswordResetEmail=function(e,t){return Nt(this._delegate,e,t||void 0)},pi.prototype.setPersistence=function(s){return o(this,void 0,void 0,function(){var r,i;return a(this,function(e){switch(e.label){case 0:switch(t=this._delegate,n=s,$r(Object.values(Jr).includes(n),t,"invalid-persistence-type"),h()?$r(n!==Jr.SESSION,t,"unsupported-persistence-type"):l()?$r(n===Jr.NONE,t,"unsupported-persistence-type"):Br()?$r(n===Jr.NONE||n===Jr.LOCAL&&f(),t,"unsupported-persistence-type"):$r(n===Jr.NONE||qr(),t,"unsupported-persistence-type"),s){case Jr.SESSION:return[3,1];case Jr.LOCAL:return[3,2];case Jr.NONE:return[3,4]}return[3,5];case 1:return r=nn,[3,6];case 2:return[4,te(_n)._isAvailable()];case 3:return i=e.sent(),r=i?_n:en,[3,6];case 4:return r=Oe,[3,6];case 5:return[2,G("argument-error",{appName:this._delegate.name})];case 6:return[2,this._delegate.setPersistence(r)]}var t,n})})},pi.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},pi.prototype.signInAnonymously=function(){return si(this._delegate,async function(e){const t=ze(e);return await t._initializationPromise,null!==(e=t.currentUser)&&void 0!==e&&e.isAnonymous?new ft({user:t.currentUser,providerId:null,operationType:"signIn"}):(e=await pt(t,{returnSecureToken:!0}),e=await ft._fromIdTokenResponse(t,"signIn",e,!0),await t._updateCurrentUser(e.user),e)}(this._delegate))},pi.prototype.signInWithCredential=function(e){return si(this._delegate,kt(this._delegate,e))},pi.prototype.signInWithCustomToken=function(e){return si(this._delegate,St(this._delegate,e))},pi.prototype.signInWithEmailAndPassword=function(e,t){return si(this._delegate,(n=this._delegate,e=e,t=t,kt(A(n),it.credential(e,t))));var n},pi.prototype.signInWithEmailLink=function(e,t){return si(this._delegate,async function(e,t,n){return e=A(e),X((n=it.credentialWithLink(t,n||ne()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),kt(e,n)}(this._delegate,e,t))},pi.prototype.signInWithPhoneNumber=function(e,t){return oi(this._delegate,async function(e,t,n){const r=ze(e);return n=await Cn(r,t,A(n)),new Nn(n,e=>kt(r,e))}(this._delegate,e,t))},pi.prototype.signInWithPopup=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return di(Gr(),this._delegate,"operation-not-supported-in-this-environment"),[2,si(this._delegate,async function(e,t,n){var r=ze(e);$(e,t,st),n=Dn(r,n);const i=new Wn(r,"signInViaPopup",t,n);return i.executeNotNull()}(this._delegate,t,ei))]})})},pi.prototype.signInWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return di(Gr(),this._delegate,"operation-not-supported-in-this-environment"),[4,Xr(this._delegate)];case 1:return e.sent(),[2,Jn(this._delegate,t,ei)]}})})},pi.prototype.updateCurrentUser=function(e){return this._delegate.updateCurrentUser(e)},pi.prototype.verifyPasswordResetCode=function(e){return async function(e,t){var{data:t}=await Lt(A(e),t);return t.email}(this._delegate,e)},pi.prototype.unwrap=function(){return this._delegate},pi.prototype._delete=function(){return this._delegate._delete()},pi.prototype.linkUnderlyingAuth=function(){var e=this;this._delegate.wrapped=function(){return e}},pi.Persistence=Jr,pi);function pi(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();var n=e.options.apiKey;di(n,"invalid-api-key",{appName:e.name});var r=[Oe];if("undefined"!=typeof window)for(var r=function(e,t){var n=Zr();if(null==n||!n.sessionStorage)return[];switch(t=Ae(Yr,e,t),n.sessionStorage.getItem(t)){case Jr.NONE:return[Oe];case Jr.LOCAL:return[_n,nn];case Jr.SESSION:return[nn];default:return[]}}(n,e.name),i=0,s=[_n,en,nn];i<s.length;i++){var o=s[i];r.includes(o)||r.push(o)}di(n,"invalid-api-key",{appName:e.name});e="undefined"!=typeof window?ei:void 0;this._delegate=t.initialize({options:{persistence:r,popupRedirectResolver:e}}),this._delegate._updateErrorMap(W),this.linkUnderlyingAuth()}function fi(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&&ci.getOrCreate(e))},error:t,complete:n}}var mi=(vi.credential=function(e,t){return Ln.credential(e,t)},vi.prototype.verifyPhoneNumber=function(e,t){return this._delegate.verifyPhoneNumber(e,t)},vi.prototype.unwrap=function(){return this._delegate},vi.PHONE_SIGN_IN_METHOD=Ln.PHONE_SIGN_IN_METHOD,vi.PROVIDER_ID=Ln.PROVIDER_ID,vi);function vi(){this.providerId="phone",this._delegate=new Ln(ni(i.default.auth()))}var gi=X,yi=(_i.prototype.clear=function(){this._delegate.clear()},_i.prototype.render=function(){return this._delegate.render()},_i.prototype.verify=function(){return this._delegate.verify()},_i);function _i(e,t,n){var r;void 0===n&&(n=i.default.app()),gi(null===(r=n.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new Pn(e,t,n.auth()),this.type=this._delegate.type}var Ii;(Ii=i.default).INTERNAL.registerComponent(new U("auth-compat",function(e){var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new hi(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:V.EMAIL_SIGNIN,PASSWORD_RESET:V.PASSWORD_RESET,RECOVER_EMAIL:V.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:V.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:V.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:V.VERIFY_EMAIL}},EmailAuthProvider:it,FacebookAuthProvider:ut,GithubAuthProvider:lt,GoogleAuthProvider:ct,OAuthProvider:at,PhoneAuthProvider:mi,PhoneMultiFactorGenerator:Er,RecaptchaVerifier:yi,TwitterAuthProvider:ht,Auth:hi,AuthCredential:Je,Error:g}).setInstantiationMode("LAZY").setMultipleInstances(!1)),Ii.registerVersion("@firebase/auth-compat","0.1.2")}.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(_i,Ii){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=e(_i),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function s(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 a(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])}}}function u(e,t,n){if(n||2===arguments.length)for(var r,i=0,s=t.length;i<s;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var 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:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var s=e[i],o=i+1<e.length,a=o?e[i+1]:0,u=i+2<e.length,c=u?e[i+2]:0,l=(15&a)<<2|c>>6,c=63&c;u||(c=64,o||(l=64)),r.push(n[s>>2],n[(3&s)<<4|a>>4],n[l],n[c])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t}(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i,s,o,a=e[n++];a<128?t[r++]=String.fromCharCode(a):191<a&&a<224?(s=e[n++],t[r++]=String.fromCharCode((31&a)<<6|63&s)):239<a&&a<365?(i=((7&a)<<18|(63&(s=e[n++]))<<12|(63&(o=e[n++]))<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))):(s=e[n++],o=e[n++],t[r++]=String.fromCharCode((15&a)<<12|(63&s)<<6|63&o))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var s=n[e.charAt(i++)],o=i<e.length?n[e.charAt(i)]:0,a=++i<e.length?n[e.charAt(i)]:64,u=++i<e.length?n[e.charAt(i)]:64;if(++i,null==s||null==o||null==a||null==u)throw Error();r.push(s<<2|o>>4),64!==a&&(r.push(o<<4&240|a>>2),64!==u&&r.push(a<<6&192|u))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var 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)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},c=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 l(){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 h(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function p(){var e=d();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function f(){return"object"==typeof indexedDB}var m,v=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(g,m=Error),g);function g(e,t,n){t=m.call(this,t)||this;return t.code=e,t.customData=n,t.name="FirebaseError",Object.setPrototypeOf(t,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,y.prototype.create),t}var y=(_.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,i=t[0]||{},s=this.service+"/"+e,e=this.errors[e],e=e?(r=i,e.replace(I,function(e,t){var n=r[t];return null!=n?String(n):"<"+t+"?>"})):"Error",e=this.serviceName+": "+e+" ("+s+").";return new v(s,e,i)},_);function _(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var I=/\{\$([^}]+)}/g;function w(e){for(var n=[],t=0,r=Object.entries(e);t<r.length;t++){var i=r[t];!function(t,e){Array.isArray(e)?e.forEach(function(e){n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}):n.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}(i[0],i[1])}return n.length?"&"+n.join("&"):""}function b(e){var n={};return e.replace(/^\?/,"").split("&").forEach(function(e){var t;e&&(e=(t=e.split("="))[0],t=t[1],n[decodeURIComponent(e)]=decodeURIComponent(t))}),n}function T(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,0<n?n:void 0)}var k,E=(R.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},R.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},R.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},R.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=S),void 0===r.error&&(r.error=S),void 0===r.complete&&(r.complete=S);n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),n},R.prototype.unsubscribeOne=function(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))},R.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},R.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},R.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},R);function R(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}function S(){}function O(e){return e&&e._delegate?e._delegate:e}(L=k=k||{})[L.DEBUG=0]="DEBUG",L[L.VERBOSE=1]="VERBOSE",L[L.INFO=2]="INFO",L[L.WARN=3]="WARN",L[L.ERROR=4]="ERROR",L[L.SILENT=5]="SILENT";function A(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString(),s=C[t];if(!s)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[s].apply(console,u(["["+i+"] "+e.name+":"],n))}}var P={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},N=k.INFO,C=((L={})[k.DEBUG]="log",L[k.VERBOSE]="log",L[k.INFO]="info",L[k.WARN]="warn",L[k.ERROR]="error",L),L=(Object.defineProperty(D.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in k))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),D.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?P[e]:e},Object.defineProperty(D.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),D.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,k.DEBUG],e)),this._logHandler.apply(this,u([this,k.DEBUG],e))},D.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,k.VERBOSE],e)),this._logHandler.apply(this,u([this,k.VERBOSE],e))},D.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,k.INFO],e)),this._logHandler.apply(this,u([this,k.INFO],e))},D.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,k.WARN],e)),this._logHandler.apply(this,u([this,k.WARN],e))},D.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,u([this,k.ERROR],e)),this._logHandler.apply(this,u([this,k.ERROR],e))},D);function D(e){this.name=e,this._logLevel=N,this._logHandler=A,this._userLogHandler=null}var M=(U.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},U.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},U.prototype.setServiceProps=function(e){return this.serviceProps=e,this},U.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},U);function U(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}const F={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},x={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 V(){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 j(){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.","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 W=V,H=new y("auth","Firebase",V()),z=new L("@firebase/auth");function q(e,...t){z.logLevel<=k.ERROR&&z.error(`Auth (${Ii.SDK_VERSION}): ${e}`,...t)}function B(e,...t){throw $(e,...t)}function G(e,...t){return $(e,...t)}function K(e,t,n){n=Object.assign(Object.assign({},W()),{[t]:n});const r=new y("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&&B(e,"argument-error"),K(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function $(e,...t){if("string"==typeof e)return H.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 Y(e,t,...n){if(!e)throw $(t,...n)}function X(e){e="INTERNAL ASSERTION FAILED: "+e;throw q(e),new Error(e)}function Z(e,t){e||X(t)}const Q=new Map;function ee(e){Z(e instanceof Function,"Expected a class definition");let t=Q.get(e);return t?Z(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,Q.set(e,t)),t}function te(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function ne(){return"http:"===re()||"https:"===re()}function re(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class ie{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())||h()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(ne()||n()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function se(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 oe{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 X("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 X("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 X("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}const ae={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"},ue=new ie(3e4,6e4);function ce(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function le(i,s,o,a,e={}){return de(i,e,()=>{let e={},t={};a&&("GET"===s?t=a:e={body:JSON.stringify(a)});var n=w(Object.assign({key:i.config.apiKey},t)).slice(1);const r=new(oe.headers());return r.set("Content-Type","application/json"),r.set("X-Client-Version",i._getSdkClientVersion()),i.languageCode&&r.set("X-Firebase-Locale",i.languageCode),oe.fetch()(pe(i,i.config.apiHost,o,n),Object.assign({method:s,headers:r,referrerPolicy:"no-referrer"},e))})}async function de(t,e,n){t._canInitEmulator=!1;e=Object.assign(Object.assign({},ae),e);try{const s=new fe(t),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();var r=await o.json();if("needConfirmation"in r)throw me(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 me(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===u)throw me(t,"email-already-in-use",r);var i=e[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw K(t,i,c);B(t,i)}}catch(e){if(e instanceof v)throw e;B(t,"network-request-failed")}}async function he(e,t,n,r,i={}){i=await le(e,t,n,r,i);return"mfaPendingCredential"in i&&B(e,"multi-factor-auth-required",{serverResponse:i}),i}function pe(e,t,n,r){r=`${t}${n}?${r}`;return e.config.emulator?se(e.config,r):`${e.config.apiScheme}://${r}`}class fe{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(G(this.auth,"timeout")),ue.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function me(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=G(e,t,r);return i.customData._tokenResponse=n,i}function ve(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ge(e){return 1e3*Number(e)}function ye(e){var[t,n,e]=e.split(".");if(void 0===t||void 0===n||void 0===e)return q("JWT malformed, contained fewer than 3 sections"),null;try{var r=c(n);return r?JSON.parse(r):(q("Failed to decode base64 JWT payload"),null)}catch(e){return q("Caught error parsing JWT payload as JSON",e),null}}async function _e(t,n,e=!1){if(e)return n;try{return n}catch(e){throw e instanceof v&&(n=[e["code"]][0],"auth/user-disabled"===n||"auth/user-token-expired"===n)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Ie{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"===e.code&&this.schedule(!0))}this.schedule()}}class we{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ve(this.lastLoginAt),this.creationTime=ve(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function be(e){var t=e.auth,n=await e.getIdToken(),r=await _e(e,async function(e,t){return le(e,"POST","/v1/accounts:lookup",t)}(t,{idToken:n}));Y(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=s(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 we(i.createdAt,i.lastLoginAt),isAnonymous:t};Object.assign(e,t)}class Te{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Y(e.idToken,"internal-error"),Y(void 0!==e.idToken,"internal-error"),Y(void 0!==e.refreshToken,"internal-error");var t,t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):(Y(t=ye(t=e.idToken),"internal-error"),Y(void 0!==t.exp,"internal-error"),Y(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 Y(!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 r,i,{accessToken:t,refreshToken:e,expiresIn:n}=(i=t,await{accessToken:(n=await de(r=e,{},()=>{var e=w({grant_type:"refresh_token",refresh_token:i}).slice(1),{tokenApiHost:t,apiKey:n}=r.config,n=pe(r,t,"/v1/token",`key=${n}`);return oe.fetch()(n,{method:"POST",headers:{"X-Client-Version":r._getSdkClientVersion(),"Content-Type":"application/x-www-form-urlencoded"},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 Te;return n&&(Y("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(Y("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),t&&(Y("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 Te,this.toJSON())}_performRefresh(){return X("not implemented")}}function ke(e,t){Y("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Ee{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,e=s(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.emailVerified=!1,this.isAnonymous=!1,this.tenantId=null,this.providerData=[],this.proactiveRefresh=new Ie(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.metadata=new we(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await _e(this,this.stsTokenManager.getToken(this.auth,e));return Y(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=O(e);var r=await n.getIdToken(t),i=ye(r);return Y(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:ve(ge(i.auth_time)),issuedAtTime:ve(ge(i.iat)),expirationTime:ve(ge(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=O(e);await be(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Y(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 Ee(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){Y(!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 be(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e=await this.getIdToken();return await _e(this,async function(e,t){return le(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;Y(l&&f,e,"internal-error");t=Te.fromJSON(this.name,f);Y("string"==typeof l,e,"internal-error"),ke(n,e.name),ke(r,e.name),Y("boolean"==typeof d,e,"internal-error"),Y("boolean"==typeof h,e,"internal-error"),ke(i,e.name),ke(s,e.name),ke(o,e.name),ke(a,e.name),ke(u,e.name),ke(c,e.name);const m=new Ee({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 Te;r.updateFromServerResponse(t);n=new Ee({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await be(n),n}}class Re{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){}}Re.type="NONE";const Se=Re;function Oe(e,t,n){return`firebase:${e}:${t}:${n}`}class Ae{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;var{config:e,name:n}=this.auth;this.fullUserKey=Oe(this.userKey,e.apiKey,n),this.fullPersistenceKey=Oe("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?Ee._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 Ae(ee(Se),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let i=r[0]||ee(Se);const s=Oe(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=Ee._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 Ae(i,e,n)}}function Pe(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(De(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ne(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ue(t))return"Blackberry";if(Fe(t))return"Webos";if(Ce(t))return"Safari";if((t.includes("chrome/")||Le(t))&&!t.includes("edge/"))return"Chrome";if(Me(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 Ne(e=d()){return/firefox\//i.test(e)}function Ce(e=d()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Le(e=d()){return/crios\//i.test(e)}function De(e=d()){return/iemobile/i.test(e)}function Me(e=d()){return/android/i.test(e)}function Ue(e=d()){return/blackberry/i.test(e)}function Fe(e=d()){return/webos/i.test(e)}function xe(e=d()){return/iphone|ipad|ipod/i.test(e)}function Ve(e=d()){return xe(e)||Me(e)||Fe(e)||Ue(e)||/windows phone/i.test(e)||De(e)}function je(e,t=[]){let n;switch(e){case"Browser":n=Pe(d());break;case"Worker":n=`${Pe(d())}-${e}`;break;default:n=e}t=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ii.SDK_VERSION}/${t}`}class We{constructor(e,t){this.app=e,this.config=t,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ze(this),this.idTokenSubscription=new ze(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=H,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=t.sdkClientVersion}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=ee(n)),this._initializationPromise=this.queue(async()=>{var e;this._deleted||(this.persistenceManager=await Ae.create(this,t),this._deleted||(null!==(e=this._popupRedirectResolver)&&void 0!==e&&e._shouldInitProactively&&await this._popupRedirectResolver._initialize(this),await this.initializeCurrentUser(n),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)}}async initializeCurrentUser(e){var t,n;let r=await this.assertedPersistence.getCurrentUser();return e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,n=null===r||void 0===r?void 0:r._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==n||null==e||!e.user||(r=e.user)),r?r._redirectEventId?(Y(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)):this.reloadAndSetCurrentUserOrClear(r):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 be(e)}catch(e){if("auth/network-request-failed"!==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?O(e):null;return t&&Y(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){if(!this._deleted)return e&&Y(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(ee(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new y("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}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||(Y(e=e&&ee(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await Ae.create(this,[ee(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 Y(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 Y(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=je(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}_getSdkClientVersion(){return this.clientVersion}}function He(e){return O(e)}class ze{constructor(e){var t;this.auth=e,this.observer=null,this.addObserver=(t=new E(e=>this.observer=e,t)).subscribe.bind(t)}get next(){return Y(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function qe(e,t,n){const r=He(e);Y(r._canInitEmulator,r,"emulator-config-failed"),Y(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");e=!(null==n||!n.disableWarnings);const i=Be(t);var{host:n,port:t}=function(e){const t=Be(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:Ge(r.substr(s.length+1))}}var[e,s]=r.split(":");return{host:e,port:Ge(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})}),function(e){function t(){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||e||("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}(e)}function Be(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Ge(e){if(!e)return null;e=Number(e);return isNaN(e)?null:e}class Ke{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return X("not implemented")}_getIdTokenResponse(e){return X("not implemented")}_linkToIdToken(e,t){return X("not implemented")}_getReauthenticationResolver(e){return X("not implemented")}}async function Je(e,t){return le(e,"POST","/v1/accounts:resetPassword",ce(e,t))}async function $e(e,t){return le(e,"POST","/v1/accounts:update",t)}async function Ye(e,t){return le(e,"POST","/v1/accounts:sendOobCode",ce(e,t))}class Xe extends Ke{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Xe(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new Xe(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 he(e,"POST","/v1/accounts:signInWithPassword",ce(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return he(e,"POST","/v1/accounts:signInWithEmailLink",ce(e,t))}(e,{email:this._email,oobCode:this._password});default:B(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return $e(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return he(e,"POST","/v1/accounts:signInWithEmailLink",ce(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:B(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Ze(e,t){return he(e,"POST","/v1/accounts:signInWithIdp",ce(e,t))}class Qe extends Ke{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Qe(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):B("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=s(t,["providerId","signInMethod"]);if(!n||!e)return null;e=new Qe(n,e);return Object.assign(e,t),e}_getIdTokenResponse(e){return Ze(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ze(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ze(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=w(t)}return e}}const et={USER_NOT_FOUND:"user-not-found"};class tt extends Ke{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new tt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new tt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return he(e,"POST","/v1/accounts:signInWithPhoneNumber",ce(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){if((t=await he(e,"POST","/v1/accounts:signInWithPhoneNumber",ce(e,t))).temporaryProof)throw me(e,"account-exists-with-different-credential",t);return t}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return he(e,"POST","/v1/accounts:signInWithPhoneNumber",ce(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),et)}(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 tt({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:e}):null}}class nt{constructor(e){var t=b(T(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);Y(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=b(T(t=e)).link,r=n?b(T(n)).deep_link_id:null,((e=b(T(t)).deep_link_id)?b(T(e)).link:null)||e||r||n||t);try{return new nt(t)}catch(e){return null}}}class rt{constructor(){this.providerId=rt.PROVIDER_ID}static credential(e,t){return Xe._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=nt.parseLink(t);return Y(t,"argument-error"),Xe._fromEmailAndCode(e,t.code,t.tenantId)}}rt.PROVIDER_ID="password",rt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",rt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class it{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 st extends it{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ot extends st{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return Y("providerId"in e&&"signInMethod"in e,"argument-error"),Qe._fromParams(e)}credential(e){return this._credential(e)}_credential(e){return Y(e.idToken||e.accessToken,"argument-error"),Qe._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return ot.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return ot.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 ot(e)._credential({idToken:t,accessToken:n,rawNonce:s,pendingToken:i})}catch(e){return null}}}class at extends st{constructor(){super("facebook.com")}static credential(e){return Qe._fromParams({providerId:at.PROVIDER_ID,signInMethod:at.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return at.credentialFromTaggedObject(e)}static credentialFromError(e){return at.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return at.credential(e.oauthAccessToken)}catch(e){return null}}}at.FACEBOOK_SIGN_IN_METHOD="facebook.com",at.PROVIDER_ID="facebook.com";class ut extends st{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Qe._fromParams({providerId:ut.PROVIDER_ID,signInMethod:ut.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken: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{oauthIdToken:t,oauthAccessToken:e}=e;if(!t&&!e)return null;try{return ut.credential(t,e)}catch(e){return null}}}ut.GOOGLE_SIGN_IN_METHOD="google.com",ut.PROVIDER_ID="google.com";class ct extends st{constructor(){super("github.com")}static credential(e){return Qe._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ct.credential(e.oauthAccessToken)}catch(e){return null}}}ct.GITHUB_SIGN_IN_METHOD="github.com",ct.PROVIDER_ID="github.com";class lt extends Ke{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return Ze(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ze(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ze(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 lt(t,e):null}static _create(e,t){return new lt(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class dt extends st{constructor(){super("twitter.com")}static credential(e,t){return Qe._fromParams({providerId:dt.PROVIDER_ID,signInMethod:dt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return dt.credentialFromTaggedObject(e)}static credentialFromError(e){return dt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:t,oauthTokenSecret:e}=e;if(!t||!e)return null;try{return dt.credential(t,e)}catch(e){return null}}}async function ht(e,t){return he(e,"POST","/v1/accounts:signUp",ce(e,t))}dt.TWITTER_SIGN_IN_METHOD="twitter.com",dt.PROVIDER_ID="twitter.com";class pt{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 Ee._fromIdTokenResponse(e,n,r),r=ft(n);return new pt({user:e,providerId:r,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);var r=ft(n);return new pt({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function ft(e){return e.providerId||("phoneNumber"in e?"phone":null)}class mt extends v{constructor(e,t,n,r){super(t.code,t.message),this.operationType=n,this.user=r,this.name="FirebaseError",Object.setPrototypeOf(this,mt.prototype),this.appName=e.name,this.code=t.code,this.tenantId=null!==(e=e.tenantId)&&void 0!==e?e:void 0,this.serverResponse=t.customData.serverResponse}static _fromErrorAndOperation(e,t,n,r){return new mt(e,t,n,r)}}function vt(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 mt._fromErrorAndOperation(t,e,n,r);throw e})}function gt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function yt(e,t){const n=O(e);await It(!0,n,t);var t=(e=n.auth,t={idToken:await n.getIdToken(),deleteProvider:[t]},await le(e,"POST","/v1/accounts:update",t))["providerUserInfo"];const r=gt(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 _t(e,t,n=!1){n=await _e(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return pt._forOperation(e,"link",n)}async function It(e,t,n){await be(t);const r=gt(t.providerData);var i=!1===e?"provider-already-linked":"no-such-provider";Y(r.has(n)===e,t.auth,i)}async function wt(e,t,n=!1){var r=e["auth"],i="reauthenticate";try{var s=await _e(e,vt(r,i,t,e),n);Y(s.idToken,r,"internal-error");var o=ye(s.idToken);Y(o,r,"internal-error");var a=o["sub"];return Y(e.uid===a,r,"user-mismatch"),pt._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&B(r,"user-mismatch"),e}}async function bt(e,t,n=!1){t=await vt(e,"signIn",t),t=await pt._fromIdTokenResponse(e,"signIn",t);return n||await e._updateCurrentUser(t.user),t}async function Tt(e,t){return bt(He(e),t)}async function kt(e,t){e=O(e);return await It(!1,e,t.providerId),_t(e,t)}async function Et(e,t){return wt(O(e),t)}async function Rt(e,t){const n=He(e);t=await he(n,"POST","/v1/accounts:signInWithCustomToken",ce(n,{token:t,returnSecureToken:!0})),t=await pt._fromIdTokenResponse(n,"signIn",t);return await n._updateCurrentUser(t.user),t}class St{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?Ot._fromServerResponse(e,t):B(e,"internal-error")}}class Ot extends St{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new Ot(t)}}function At(e,t,n){var r;Y(0<(null===(r=n.url)||void 0===r?void 0:r.length),e,"invalid-continue-uri"),Y(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&&(Y(0<n.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iosBundleId=n.iOS.bundleId),n.android&&(Y(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 Pt(e,t,n){e=O(e),t={requestType:"PASSWORD_RESET",email:t};n&&At(e,t,n),await Ye(e,t)}async function Nt(e,t){await le(e=O(e),"POST","/v1/accounts:update",ce(e,{oobCode:t}))}async function Ct(e,t){var n=O(e),r=await Je(n,{oobCode:t}),t=r.requestType;switch(Y(t,n,"internal-error"),t){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":Y(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":Y(r.mfaInfo,n,"internal-error");default:Y(r.email,n,"internal-error")}let i=null;return r.mfaInfo&&(i=St._fromServerResponse(He(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 Lt(e,t,n){e=O(e),t={requestType:"EMAIL_SIGNIN",email:t};Y(n.handleCodeInApp,e,"argument-error"),n&&At(e,t,n),await Ye(e,t)}async function Dt(e,t){var n=ne()?te():"http://localhost",n=(await le(e=O(e),"POST","/v1/accounts:createAuthUri",ce(e,{identifier:t,continueUri:n})))["signinMethods"];return n||[]}async function Mt(e,t){var n=O(e),r={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&At(n.auth,r,t);var r=(await Ye(n.auth,r))["email"];r!==e.email&&await e.reload()}async function Ut(e,t,n){var r=O(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&At(r.auth,t,n);var t=(await Ye(r.auth,t))["email"];t!==e.email&&await e.reload()}async function Ft(e,{displayName:t,photoURL:n}){if(void 0!==t||void 0!==n){const r=O(e);e=await r.getIdToken(),n=await _e(r,async function(e,t){return le(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 xt(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 _e(e,$e(r,i));await e._updateTokensIfNecessary(r,!0)}class Vt{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class jt extends Vt{constructor(e,t,n,r){super(e,t,n),this.username=r}}class Wt extends Vt{constructor(e,t){super(e,"facebook.com",t)}}class Ht extends jt{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class zt extends Vt{constructor(e,t){super(e,"google.com",t)}}class qt extends jt{constructor(e,t,n){super(e,"twitter.com",t,n)}}function Bt(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=ye(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 Vt(r,i)}}if(!t)return null;switch(t){case"facebook.com":return new Wt(r,n);case"github.com":return new Ht(r,n);case"google.com":return new zt(r,n);case"twitter.com":return new qt(r,n,e.screenName||null);case"custom":case"anonymous":return new Vt(r,null);default:return new Vt(r,t,n)}}(e)}class Gt{constructor(e,t){this.type=e,this.credential=t}static _fromIdtoken(e){return new Gt("enroll",e)}static _fromMfaPendingCredential(e){return new Gt("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 Gt._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!==(t=e.multiFactorSession)&&void 0!==t&&t.idToken)return Gt._fromIdtoken(e.multiFactorSession.idToken)}return null}}class Kt{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,r){const i=He(e);e=(r.serverResponse.mfaInfo||[]).map(e=>St._fromServerResponse(i,e));Y(r.serverResponse.mfaPendingCredential,i,"internal-error");const s=Gt._fromMfaPendingCredential(r.serverResponse.mfaPendingCredential);return new Kt(s,e,async e=>{e=await e._process(i,s);delete r.serverResponse.mfaInfo,delete r.serverResponse.mfaPendingCredential;var t=Object.assign(Object.assign({},r.serverResponse),{idToken:e.idToken,refreshToken:e.refreshToken});switch(r.operationType){case"signIn":var n=await pt._fromIdTokenResponse(i,r.operationType,t);return await i._updateCurrentUser(n.user),n;case"reauthenticate":return Y(r.user,i,"internal-error"),pt._forOperation(r.user,r.operationType,t);default:B(i,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}class Jt{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>St._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new Jt(e)}async getSession(){return Gt._fromIdtoken(await this.user.getIdToken())}async enroll(e,t){const n=e;e=await this.getSession(),t=await _e(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 _e(this.user,(e=this.user.auth,n={idToken:n,mfaEnrollmentId:t},le(e,"POST","/v2/accounts/mfaEnrollment:withdraw",ce(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"!==e.code)throw e}}}const $t=new WeakMap;const Yt="__sak";class Xt{constructor(e,t){this.storage=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Yt,"1"),this.storage.removeItem(Yt),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()}}class Zt extends Xt{constructor(){var e;super(window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=(Ce(e=d())||xe(e))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=Ve(),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);p()&&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]}}Zt.type="LOCAL";const Qt=Zt;class en extends Xt{constructor(){super(window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}en.type="SESSION";const tn=en;class nn{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 nn(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 rn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}nn.receivers=[];class sn{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=rn("",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 on(){return window}function an(){return void 0!==on().WorkerGlobalScope&&"function"==typeof on().importScripts}const un="firebaseLocalStorageDb",cn="firebaseLocalStorage",ln="fbase_key";class dn{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 hn(e,t){return e.transaction([cn],t?"readwrite":"readonly").objectStore(cn)}function pn(){const r=indexedDB.open(un,1);return new Promise((n,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const e=r.result;try{e.createObjectStore(cn,{keyPath:ln})}catch(e){t(e)}}),r.addEventListener("success",async()=>{const e=r.result;var t;e.objectStoreNames.contains(cn)?n(e):(e.close(),t=indexedDB.deleteDatabase(un),await new dn(t).toPromise(),n(await pn()))})})}async function fn(e,t,n){n=hn(e,!0).put({fbase_key:t,value:n});return new dn(n).toPromise()}function mn(e,t){t=hn(e,!0).delete(t);return new dn(t).toPromise()}class vn{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 pn(),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 an()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=nn._getInstance(an()?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 sn(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 pn();return await fn(e,Yt,"1"),await mn(e,Yt),!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=>fn(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=hn(e,!1).get(t),void 0===(t=await new dn(t).toPromise())?null:t.value}(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>mn(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e,t,n=await this._withRetries(e=>{e=hn(e,!1).getAll();return new dn(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()}}vn.type="LOCAL";const gn=vn;function yn(r){return new Promise((e,n)=>{const t=document.createElement("script");t.setAttribute("src",r),t.onload=e,t.onerror=e=>{const t=G("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 _n(e){return`__${e}${Math.floor(1e6*Math.random())}`}class In{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 wn(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 wn{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;Y(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 bn=_n("rcb"),Tn=new ie(3e4,6e4);class kn{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!on().grecaptcha}load(s,o=""){var e;return Y((e=o).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),s,"argument-error"),this.shouldResolveImmediately(o)?Promise.resolve(on().grecaptcha):new Promise((t,r)=>{const i=on().setTimeout(()=>{r(G(s,"network-request-failed"))},Tn.get());on()[bn]=()=>{on().clearTimeout(i),delete on()[bn];const e=on().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(G(s,"internal-error"))},yn(`https://www.google.com/recaptcha/api.js??${w({onload:bn,render:"explicit",hl:o})}`).catch(()=>{clearTimeout(i),r(G(s,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!on().grecaptcha&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class En{async load(e){return new In(e)}clearedOneInstance(){}}const Rn="recaptcha",Sn={theme:"light",type:"image"};class On{constructor(e,t=Object.assign({},Sn),n){this.parameters=t,this.type=Rn,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=He(n),this.isInvisible="invisible"===this.parameters.size,Y("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");e="string"==typeof e?document.getElementById(e):e;Y(e,this.auth,"argument-error"),this.container=e,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?En:kn),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(){Y(!this.parameters.sitekey,this.auth,"argument-error"),Y(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),Y("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=on()[n];"function"==typeof e&&e(t)}}}assertNotDestroyed(){Y(!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(){Y(ne()&&!an(),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 le(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");Y(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return Y(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class An{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=tt._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function Pn(t,n,r){var i,s,o,a,u,c,l=await r.verify();try{Y("string"==typeof l,t,"argument-error"),Y(r.type===Rn,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 Y("enroll"===d.type,t,"internal-error"),(u=t,c={idToken:d.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,recaptchaToken:l}},await le(u,"POST","/v2/accounts/mfaEnrollment:start",ce(u,c))).phoneSessionInfo.sessionInfo;Y("signin"===d.type,t,"internal-error");var h=(null===(i=e.multiFactorHint)||void 0===i?void 0:i.uid)||e.multiFactorUid;return Y(h,t,"missing-multi-factor-info"),(a={mfaPendingCredential:d.credential,mfaEnrollmentId:h,phoneSignInInfo:{recaptchaToken:l}},await le(t,"POST","/v2/accounts/mfaSignIn:start",ce(t,a))).phoneResponseInfo.sessionInfo}var p=(s=t,o={phoneNumber:e.phoneNumber,recaptchaToken:l},await le(s,"POST","/v1/accounts:sendVerificationCode",ce(s,o)))["sessionInfo"];return p}finally{r._reset()}}class Nn{constructor(e){this.providerId=Nn.PROVIDER_ID,this.auth=He(e)}verifyPhoneNumber(e,t){return Pn(this.auth,e,O(t))}static credential(e,t){return tt._fromVerification(e,t)}static credentialFromResult(e){return Nn.credentialFromTaggedObject(e)}static credentialFromError(e){return Nn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{phoneNumber:t,temporaryProof:e}=e;return t&&e?tt._fromTokenResponse(t,e):null}}function Cn(e,t){return t?ee(t):(Y(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Nn.PROVIDER_ID="phone",Nn.PHONE_SIGN_IN_METHOD="phone";class Ln extends Ke{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ze(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ze(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ze(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 Dn(e){return bt(e.auth,new Ln(e),e.bypassAuthState)}function Mn(e){var{auth:t,user:n}=e;return Y(n,t,"internal-error"),wt(n,new Ln(e),e.bypassAuthState)}async function Un(e){var{auth:t,user:n}=e;return Y(n,t,"internal-error"),_t(n,new Ln(e),e.bypassAuthState)}class Fn{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 Dn;case"linkViaPopup":case"linkViaRedirect":return Un;case"reauthViaPopup":case"reauthViaRedirect":return Mn;default:B(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 xn=new ie(2e3,1e4);class Vn extends Fn{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Vn.currentPopupAction&&Vn.currentPopupAction.cancel(),Vn.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return Y(e,this.auth,"internal-error"),e}async onExecution(){Z(1===this.filter.length,"Popup operations only handle one event");var e=rn();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(G(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(G(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Vn.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(G(this.auth,"popup-closed-by-user"))},2e3):this.pollId=window.setTimeout(t,xn.get())};t()}}Vn.currentPopupAction=null;const jn="pendingRedirect",Wn=new Map;class Hn extends Fn{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let t=Wn.get(this.auth._key());if(!t){try{const i=(e=this.resolver,n=this.auth,r=Bn(n),n="true"===await qn(e)._get(r),await qn(e)._remove(r),await n)?await super.execute():null;t=()=>Promise.resolve(i)}catch(e){t=()=>Promise.reject(e)}Wn.set(this.auth._key(),t)}var e,n,r;return 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 zn(e,t){return qn(e)._set(Bn(t),"true")}function qn(e){return ee(e._redirectPersistence)}function Bn(e){return Oe(jn,e.config.apiKey,e.name)}function Gn(e,t,n){return async function(e,t,n){var r=He(e);J(e,t,it);const i=Cn(r,n);return await zn(i,r),i._openRedirect(r,t,"signInViaRedirect")}(e,t,n)}function Kn(e,t,n){return async function(e,t,n){e=O(e);J(e.auth,t,it);const r=Cn(e.auth,n);await zn(r,e.auth);n=await Yn(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",n)}(e,t,n)}function Jn(e,t,n){return async function(e,t,n){e=O(e);J(e.auth,t,it);const r=Cn(e.auth,n);await It(!1,e,t.providerId),await zn(r,e.auth);n=await Yn(e);return r._openRedirect(e.auth,t,"linkViaRedirect",n)}(e,t,n)}async function $n(e,t,n=!1){const r=He(e);e=Cn(r,t);const i=new Hn(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 Yn(e){var t=rn(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Xn{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 Qn(e);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(e,t){var n;e.error&&!Qn(e)?(n=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error",t.onError(G(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(Zn(e))}saveEventToCache(e){this.cachedEventUids.add(Zn(e)),this.lastProcessedEventTime=Date.now()}}function Zn(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function Qn({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function er(e,t={}){return le(e,"GET","/v1/projects",t)}const tr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,nr=/^https?/;async function rr(e){if(!e.config.emulator){var t=(await er(e))["authorizedDomains"];for(const n of t)try{if(function(e){const t=te(),{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(!nr.test(n))return!1;if(tr.test(e))return r===e;const s=e.replace(/\./g,"\\."),o=new RegExp("^(.+\\."+s+"|"+s+")$","i");return o.test(r)}(n))return}catch(e){}B(e,"unauthorized-domain")}}const ir=new ie(3e4,6e4);function sr(){const t=on().___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 or=null;function ar(e){var i;return or=or||(i=e,new Promise((e,t)=>{function n(){sr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{sr(),t(G(i,"network-request-failed"))},timeout:ir.get()})}if(null!==(r=null===(r=on().gapi)||void 0===r?void 0:r.iframes)&&void 0!==r&&r.Iframe)e(gapi.iframes.getContext());else{if(null===(r=on().gapi)||void 0===r||!r.load){var r=_n("iframefcb");return on()[r]=()=>{gapi.load?n():t(G(i,"network-request-failed"))},yn(`https://apis.google.com/js/api.js?onload=${r}`)}n()}}).catch(e=>{throw or=null,e})),or}const ur=new ie(5e3,15e3),cr="__/auth/iframe",lr="emulator/auth/iframe",dr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},hr=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function pr(o){const e=await ar(o);var t=on().gapi;return Y(t,o,"internal-error"),e.open({where:document.body,url:function(e){var t=e.config;Y(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?se(t,lr):`https://${e.config.authDomain}/${cr}`;const r={apiKey:t.apiKey,appName:e.name,v:Ii.SDK_VERSION};(t=hr.get(e.config.apiHost))&&(r.eid=t);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${w(r).slice(1)}`}(o),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:dr,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});const n=G(o,"network-request-failed"),r=on().setTimeout(()=>{t(n)},ur.get());function i(){on().clearTimeout(r),e(s)}s.ping(i).then(i,()=>{t(n)})}))}const fr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class mr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function vr(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({},fr),{width:r.toString(),height:i.toString(),top:s,left:o});o=d().toLowerCase();n&&(a=Le(o)?"_blank":n),Ne(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],xe(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 mr(null);const l=window.open(t||"",a,n);Y(l,e,"popup-blocked");try{l.focus()}catch(e){}return new mr(l)}const gr="__/auth/handler",yr="emulator/auth/handler";function _r(e,t,n,r,i,s){Y(e.config.authDomain,e,"auth-domain-config-required"),Y(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Ii.SDK_VERSION,eventId:i};if(t instanceof it){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(var 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 st){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?se(e,yr):`https://${e.authDomain}/${gr}`}?${w(c).slice(1)}`}const Ir="webStorageSupport";const wr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=tn,this._completeRedirectFn=$n}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()"),vr(e,_r(e,t,n,te(),r),rn())}async _openRedirect(e,t,n,r){return await this._originValidation(e),r=_r(e,t,n,te(),r),on().location.href=r,new Promise(()=>{})}_initialize(e){var 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}async initAndGetManager(t){const e=await pr(t),n=new Xn(t);return e.register("authEvent",e=>{return Y(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(Ir,{type:Ir},e=>{e=null===(e=null==e?void 0:e[0])||void 0===e?void 0:e[Ir];void 0!==e&&n(!!e),B(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=rr(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ve()||Ce()||xe()}};class br 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 X("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new br(e)}_finalizeEnroll(e,t,n){return e=e,n={idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()},le(e,"POST","/v2/accounts/mfaEnrollment:finalize",ce(e,n))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},le(e,"POST","/v2/accounts/mfaSignIn:finalize",ce(e,t))}}class Tr{constructor(){}static assertion(e){return br._fromCredential(e)}}Tr.FACTOR_ID="phone";var kr;class Er{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(){Y(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function Rr(){return window}kr="Browser",Ii._registerComponent(new M("auth",(e,{options:n})=>{e=e.getProvider("app").getImmediate();const{apiKey:r,authDomain:i}=e.options;return(e=>{Y(r&&!r.includes(":"),"invalid-api-key",{appName:e.name}),Y(!(null!==i&&void 0!==i&&i.includes(":")),"argument-error",{appName:e.name});var t={apiKey:r,authDomain:i,clientPlatform:kr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:je(kr)},t=new We(e,t);return function(e,t){const n=(null==t?void 0:t.persistence)||[];var r=(Array.isArray(n)?n:[n]).map(ee);null!=t&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(t,n),t})(e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{const r=e.getProvider("auth-internal");r.initialize()})),Ii._registerComponent(new M("auth-internal",e=>{e=He(e.getProvider("auth").getImmediate());return e=e,new Er(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ii.registerVersion("@firebase/auth","0.18.0-2021823172527",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(kr));async function Sr(e,t,n){var r=Rr()["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 xe()?s.ibi=r.packageName:Me()?s.apn=r.packageName:B(e,"operation-not-supported-in-this-environment"),r.displayName&&(s.appDisplayName=r.displayName),s.sessionId=i,_r(e,n,t.type,void 0,null!==(t=t.eventId)&&void 0!==t?t:void 0,s)}function Or(r){const i=Rr()["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 Ar=20;class Pr extends Xn{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 Nr(e,t,n=null){return{type:t,eventId:n,urlResponse:null,sessionId:function(){const t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<Ar;e++){var r=Math.floor(Math.random()*n.length);t.push(n.charAt(r))}return t.join("")}(),postBody:null,tenantId:e.tenantId,error:G(e,"no-auth-event")}}async function Cr(e){var t=await Dr()._get(Mr(e));return t&&await Dr()._remove(Mr(e)),t}function Lr(e,t){var n,r,i;const s=(n=Ur(o=t),r=n.link?decodeURIComponent(n.link):void 0,i=Ur(r).link,t=n.deep_link_id?decodeURIComponent(n.deep_link_id):void 0,(n=Ur(t).link)||t||i||r||o);if(s.includes("/__/auth/callback")){var o=Ur(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?G(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 Dr(){return ee(Qt)}function Mr(e){return Oe("authEvent",e.config.apiKey,e.name)}function Ur(e){if(null==e||!e.includes("?"))return{};const[,...t]=e.split("?");return b(t.join("?"))}const Fr=class{constructor(){this._redirectPersistence=tn,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=$n}async _initialize(e){var t=e._key();let n=this.eventManagers.get(t);return n||(n=new Pr(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),n}_openPopup(e){B(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,n,r){var i,s;a=e,s=Rr(),Y("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"}),Y(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"}),Y("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"}),Y("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"}),Y("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(),Wn.clear(),await this._originValidation(e);var a=Nr(e,n,r);n=e,r=a,await Dr()._set(Mr(n),r);t=await Or(await Sr(e,a,t));return async function(o,a,u){const c=Rr()["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(G(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),Me()&&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=Rr()["BuildInfo"];const n={};xe()?n.iosBundleId=t.packageName:Me()?n.androidPackageName=t.packageName:B(e,"operation-not-supported-in-this-environment"),await er(e,n)}(e)),this.originValidationPromises[t]}attachCallbackListeners(r,i){const{universalLinks:e,handleOpenURL:t,BuildInfo:n}=Rr(),s=setTimeout(async()=>{await Cr(r),i.onEvent(xr())},500),o=async e=>{clearTimeout(s);var t=await Cr(r);let n=null;t&&null!=e&&e.url&&(n=Lr(t,e.url)),i.onEvent(n||xr())};void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,o);const a=t,u=`${n.packageName.toLowerCase()}://`;Rr().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(u)&&o({url:e}),"function"==typeof a)try{a(e)}catch(e){console.error(e)}}}};function xr(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:G("no-auth-event")}}function Vr(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function jr(e){return void 0===e&&(e=d()),!("file:"!==Vr()&&"ionic:"!==Vr()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function Wr(e){return void 0===e&&(e=d()),p()&&11===(null===document||void 0===document?void 0:document.documentMode)||(void 0===(e=e)&&(e=d()),/Edge\/\d+/.test(e))}function Hr(){try{var e=self.localStorage,t=rn();if(e)return e.setItem(t,"1"),e.removeItem(t),!Wr()||f()}catch(e){return zr()&&f()}return!1}function zr(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function qr(){return("http:"===Vr()||"https:"===Vr()||n()||jr())&&!(h()||l())&&Hr()&&!zr()}function Br(){return jr()&&"undefined"!=typeof document}var Gr={LOCAL:"local",NONE:"none",SESSION:"session"},Kr=Y,Jr="persistence";function $r(r){return o(this,void 0,void 0,function(){var t,n;return a(this,function(e){switch(e.label){case 0:return[4,r._initializationPromise];case 1:return e.sent(),t=Yr(),n=Oe(Jr,r.config.apiKey,r.name),null!=t&&t.sessionStorage&&t.sessionStorage.setItem(n,r._getPersistence()),[2]}})})}function Yr(){return"undefined"!=typeof window?window:null}var Xr=Y,Zr=(Qr.prototype._initialize=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this.selectUnderlyingResolver()];case 1:return e.sent(),[2,this.assertedUnderlyingResolver._initialize(t)]}})})},Qr.prototype._openPopup=function(t,n,r,i){return o(this,void 0,void 0,function(){return a(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)]}})})},Qr.prototype._openRedirect=function(t,n,r,i){return o(this,void 0,void 0,function(){return a(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)]}})})},Qr.prototype._isIframeWebStorageSupported=function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)},Qr.prototype._originValidation=function(e){return this.assertedUnderlyingResolver._originValidation(e)},Object.defineProperty(Qr.prototype,"_shouldInitProactively",{get:function(){return Br()||this.browserResolver._shouldInitProactively},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"assertedUnderlyingResolver",{get:function(){return Xr(this.underlyingResolver,"internal-error"),this.underlyingResolver},enumerable:!1,configurable:!0}),Qr.prototype.selectUnderlyingResolver=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return this.underlyingResolver?[2]:[4,function(){return o(this,void 0,void 0,function(){return a(this,function(e){return Br()?[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]}})})},Qr);function Qr(){this.browserResolver=ee(wr),this.cordovaResolver=ee(Fr),this.underlyingResolver=null,this._redirectPersistence=tn,this._completeRedirectFn=$n}function ei(e){return e.unwrap()}function ti(e,t){var n,r,i=null===(r=t.customData)||void 0===r?void 0:r._tokenResponse;"auth/multi-factor-auth-required"===t.code?t.resolver=new si(e,(r=t,e=O(n=e),Y((n=r).operationType,e,"argument-error"),Y(null===(r=n.serverResponse)||void 0===r?void 0:r.mfaPendingCredential,e,"argument-error"),Kt._fromError(e,n))):!i||(t=ni(n=t))&&(n.credential=t,n.tenantId=i.tenantId||void 0,n.email=i.email||void 0,n.phoneNumber=i.phoneNumber||void 0)}function ni(e){var t=(e instanceof v?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof v)&&"temporaryProof"in t&&"phoneNumber"in t)return Nn.credentialFromResult(e);var n,r=t.providerId;if(!r||r===F.PASSWORD)return null;switch(r){case F.GOOGLE:n=ut;break;case F.FACEBOOK:n=at;break;case F.GITHUB:n=ct;break;case F.TWITTER:n=dt;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.")?lt._create(r,a):Qe._fromParams({providerId:r,signInMethod:r,pendingToken:a,idToken:i,accessToken:s}):new ot(r).credential({idToken:i,accessToken:s,rawNonce:u}):null}return e instanceof v?n.credentialFromError(e):n.credentialFromResult(e)}function ri(i,s){return o(this,void 0,void 0,function(){var t,n,r;return a(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s];case 1:return t=e.sent(),[3,3];case 2:throw(r=e.sent())instanceof v&&ti(i,r),r;case 3:return n=t.operationType,r=t.user,[2,{operationType:n,credential:ni(t),additionalUserInfo:Bt(t),user:ai.getOrCreate(r)}]}})})}function ii(n,r){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return[4,r];case 1:return[2,{verificationId:(t=e.sent()).verificationId,confirm:function(e){return ri(n,t.confirm(e))}}]}})})}var si=(Object.defineProperty(oi.prototype,"session",{get:function(){return this.resolver.session},enumerable:!1,configurable:!0}),Object.defineProperty(oi.prototype,"hints",{get:function(){return this.resolver.hints},enumerable:!1,configurable:!0}),oi.prototype.resolveSignIn=function(e){return ri(ei(this.auth),this.resolver.resolveSignIn(e))},oi);function oi(e,t){this.resolver=t,this.auth=e.wrapped()}var ai=(ui.getOrCreate=function(e){return ui.USER_MAP.has(e)||ui.USER_MAP.set(e,new ui(e)),ui.USER_MAP.get(e)},ui.prototype.delete=function(){return this._delegate.delete()},ui.prototype.reload=function(){return this._delegate.reload()},ui.prototype.toJSON=function(){return this._delegate.toJSON()},ui.prototype.getIdTokenResult=function(e){return this._delegate.getIdTokenResult(e)},ui.prototype.getIdToken=function(e){return this._delegate.getIdToken(e)},ui.prototype.linkAndRetrieveDataWithCredential=function(e){return this.linkWithCredential(e)},ui.prototype.linkWithCredential=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,ri(this.auth,kt(this._delegate,t))]})})},ui.prototype.linkWithPhoneNumber=function(t,n){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,ii(this.auth,async function(e,t,n){const r=O(e);return await It(!1,r,"phone"),n=await Pn(r.auth,t,O(n)),new An(n,e=>kt(r,e))}(this._delegate,t,n))]})})},ui.prototype.linkWithPopup=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,ri(this.auth,async function(e,t,n){J((e=O(e)).auth,t,it),n=Cn(e.auth,n);const r=new Vn(e.auth,"linkViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,t,Zr))]})})},ui.prototype.linkWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,$r(He(this.auth))];case 1:return e.sent(),[2,Jn(this._delegate,t,Zr)]}})})},ui.prototype.reauthenticateAndRetrieveDataWithCredential=function(e){return this.reauthenticateWithCredential(e)},ui.prototype.reauthenticateWithCredential=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,ri(this.auth,Et(this._delegate,t))]})})},ui.prototype.reauthenticateWithPhoneNumber=function(e,t){return ii(this.auth,async function(e,t,n){const r=O(e);return n=await Pn(r.auth,t,O(n)),new An(n,e=>Et(r,e))}(this._delegate,e,t))},ui.prototype.reauthenticateWithPopup=function(e){return ri(this.auth,async function(e,t,n){J((e=O(e)).auth,t,it),n=Cn(e.auth,n);const r=new Vn(e.auth,"reauthViaPopup",t,n,e);return r.executeNotNull()}(this._delegate,e,Zr))},ui.prototype.reauthenticateWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,$r(He(this.auth))];case 1:return e.sent(),[2,Kn(this._delegate,t,Zr)]}})})},ui.prototype.sendEmailVerification=function(e){return Mt(this._delegate,e)},ui.prototype.unlink=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,yt(this._delegate,t)];case 1:return e.sent(),[2,this]}})})},ui.prototype.updateEmail=function(e){return xt(O(this._delegate),e,null)},ui.prototype.updatePassword=function(e){return xt(O(this._delegate),null,e)},ui.prototype.updatePhoneNumber=function(e){return async function(e,t){await _t(O(e),t)}(this._delegate,e)},ui.prototype.updateProfile=function(e){return Ft(this._delegate,e)},ui.prototype.verifyBeforeUpdateEmail=function(e,t){return Ut(this._delegate,e,t)},Object.defineProperty(ui.prototype,"emailVerified",{get:function(){return this._delegate.emailVerified},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"isAnonymous",{get:function(){return this._delegate.isAnonymous},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"phoneNumber",{get:function(){return this._delegate.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"providerData",{get:function(){return this._delegate.providerData},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"refreshToken",{get:function(){return this._delegate.refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"tenantId",{get:function(){return this._delegate.tenantId},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"displayName",{get:function(){return this._delegate.displayName},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"email",{get:function(){return this._delegate.email},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"photoURL",{get:function(){return this._delegate.photoURL},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"providerId",{get:function(){return this._delegate.providerId},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"uid",{get:function(){return this._delegate.uid},enumerable:!1,configurable:!0}),Object.defineProperty(ui.prototype,"auth",{get:function(){return this._delegate.auth},enumerable:!1,configurable:!0}),ui.USER_MAP=new WeakMap,ui);function ui(e){this._delegate=e,this.multiFactor=(e=O(e=e),$t.has(e)||$t.set(e,Jt._fromUser(e)),$t.get(e))}var ci=Y,li=(Object.defineProperty(di.prototype,"emulatorConfig",{get:function(){return this._delegate.emulatorConfig},enumerable:!1,configurable:!0}),Object.defineProperty(di.prototype,"currentUser",{get:function(){return this._delegate.currentUser?ai.getOrCreate(this._delegate.currentUser):null},enumerable:!1,configurable:!0}),Object.defineProperty(di.prototype,"languageCode",{get:function(){return this._delegate.languageCode},set:function(e){this._delegate.languageCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(di.prototype,"settings",{get:function(){return this._delegate.settings},enumerable:!1,configurable:!0}),Object.defineProperty(di.prototype,"tenantId",{get:function(){return this._delegate.tenantId},set:function(e){this._delegate.tenantId=e},enumerable:!1,configurable:!0}),di.prototype.useDeviceLanguage=function(){this._delegate.useDeviceLanguage()},di.prototype.signOut=function(){return this._delegate.signOut()},di.prototype.useEmulator=function(e,t){qe(this._delegate,e,t)},di.prototype.applyActionCode=function(e){return Nt(this._delegate,e)},di.prototype.checkActionCode=function(e){return Ct(this._delegate,e)},di.prototype.confirmPasswordReset=function(e,t){return async function(e,t,n){await Je(O(e),{oobCode:t,newPassword:n})}(this._delegate,e,t)},di.prototype.createUserWithEmailAndPassword=function(t,n){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,ri(this._delegate,async function(e,t,n){const r=He(e);return n=await ht(r,{returnSecureToken:!0,email:t,password:n}),n=await pt._fromIdTokenResponse(r,"signIn",n),await r._updateCurrentUser(n.user),n}(this._delegate,t,n))]})})},di.prototype.fetchProvidersForEmail=function(e){return this.fetchSignInMethodsForEmail(e)},di.prototype.fetchSignInMethodsForEmail=function(e){return Dt(this._delegate,e)},di.prototype.isSignInWithEmailLink=function(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=nt.parseLink(e))?void 0:e.operation)},di.prototype.getRedirectResult=function(){return o(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return ci(qr(),this._delegate,"operation-not-supported-in-this-environment"),[4,async function(e,t){return await He(e)._initializationPromise,$n(e,t,!1)}(this._delegate,Zr)];case 1:return(t=e.sent())?[2,ri(this._delegate,Promise.resolve(t))]:[2,{credential:null,user:null}]}})})},di.prototype.addFrameworkForLogging=function(e){He(this._delegate)._logFramework(e)},di.prototype.onAuthStateChanged=function(e,t,n){e=hi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onAuthStateChanged(t,n,e)},di.prototype.onIdTokenChanged=function(e,t,n){e=hi(e,t,n),t=e.next,n=e.error,e=e.complete;return this._delegate.onIdTokenChanged(t,n,e)},di.prototype.sendSignInLinkToEmail=function(e,t){return Lt(this._delegate,e,t)},di.prototype.sendPasswordResetEmail=function(e,t){return Pt(this._delegate,e,t||void 0)},di.prototype.setPersistence=function(s){return o(this,void 0,void 0,function(){var r,i;return a(this,function(e){switch(e.label){case 0:switch(t=this._delegate,n=s,Kr(Object.values(Gr).includes(n),t,"invalid-persistence-type"),h()?Kr(n!==Gr.SESSION,t,"unsupported-persistence-type"):l()?Kr(n===Gr.NONE,t,"unsupported-persistence-type"):zr()?Kr(n===Gr.NONE||n===Gr.LOCAL&&f(),t,"unsupported-persistence-type"):Kr(n===Gr.NONE||Hr(),t,"unsupported-persistence-type"),s){case Gr.SESSION:return[3,1];case Gr.LOCAL:return[3,2];case Gr.NONE:return[3,4]}return[3,5];case 1:return r=tn,[3,6];case 2:return[4,ee(gn)._isAvailable()];case 3:return i=e.sent(),r=i?gn:Qt,[3,6];case 4:return r=Se,[3,6];case 5:return[2,B("argument-error",{appName:this._delegate.name})];case 6:return[2,this._delegate.setPersistence(r)]}var t,n})})},di.prototype.signInAndRetrieveDataWithCredential=function(e){return this.signInWithCredential(e)},di.prototype.signInAnonymously=function(){return ri(this._delegate,async function(e){const t=He(e);return await t._initializationPromise,null!==(e=t.currentUser)&&void 0!==e&&e.isAnonymous?new pt({user:t.currentUser,providerId:null,operationType:"signIn"}):(e=await ht(t,{returnSecureToken:!0}),e=await pt._fromIdTokenResponse(t,"signIn",e,!0),await t._updateCurrentUser(e.user),e)}(this._delegate))},di.prototype.signInWithCredential=function(e){return ri(this._delegate,Tt(this._delegate,e))},di.prototype.signInWithCustomToken=function(e){return ri(this._delegate,Rt(this._delegate,e))},di.prototype.signInWithEmailAndPassword=function(e,t){return ri(this._delegate,(n=this._delegate,e=e,t=t,Tt(O(n),rt.credential(e,t))));var n},di.prototype.signInWithEmailLink=function(e,t){return ri(this._delegate,async function(e,t,n){return e=O(e),Y((n=rt.credentialWithLink(t,n||te()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),Tt(e,n)}(this._delegate,e,t))},di.prototype.signInWithPhoneNumber=function(e,t){return ii(this._delegate,async function(e,t,n){const r=He(e);return n=await Pn(r,t,O(n)),new An(n,e=>Tt(r,e))}(this._delegate,e,t))},di.prototype.signInWithPopup=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){return ci(qr(),this._delegate,"operation-not-supported-in-this-environment"),[2,ri(this._delegate,async function(e,t,n){var r=He(e);J(e,t,it),n=Cn(r,n);const i=new Vn(r,"signInViaPopup",t,n);return i.executeNotNull()}(this._delegate,t,Zr))]})})},di.prototype.signInWithRedirect=function(t){return o(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return ci(qr(),this._delegate,"operation-not-supported-in-this-environment"),[4,$r(this._delegate)];case 1:return e.sent(),[2,Gn(this._delegate,t,Zr)]}})})},di.prototype.updateCurrentUser=function(e){return this._delegate.updateCurrentUser(e)},di.prototype.verifyPasswordResetCode=function(e){return async function(e,t){return(t=(await Ct(O(e),t))["data"]).email}(this._delegate,e)},di.prototype.unwrap=function(){return this._delegate},di.prototype._delete=function(){return this._delegate._delete()},di.prototype.linkUnderlyingAuth=function(){var e=this;this._delegate.wrapped=function(){return e}},di.Persistence=Gr,di);function di(e,t){if(this.app=e,t.isInitialized())return this._delegate=t.getImmediate(),void this.linkUnderlyingAuth();var n=e.options.apiKey;ci(n,"invalid-api-key",{appName:e.name});var r=[Se];if("undefined"!=typeof window)for(var r=function(e,t){var n=Yr();if(null==n||!n.sessionStorage)return[];switch(t=Oe(Jr,e,t),n.sessionStorage.getItem(t)){case Gr.NONE:return[Se];case Gr.LOCAL:return[gn,tn];case Gr.SESSION:return[tn];default:return[]}}(n,e.name),i=0,s=[gn,Qt,tn];i<s.length;i++){var o=s[i];r.includes(o)||r.push(o)}ci(n,"invalid-api-key",{appName:e.name});e="undefined"!=typeof window?Zr:void 0;this._delegate=t.initialize({options:{persistence:r,popupRedirectResolver:e}}),this._delegate._updateErrorMap(j),this.linkUnderlyingAuth()}function hi(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&&ai.getOrCreate(e))},error:t,complete:n}}var pi=(fi.credential=function(e,t){return Nn.credential(e,t)},fi.prototype.verifyPhoneNumber=function(e,t){return this._delegate.verifyPhoneNumber(e,t)},fi.prototype.unwrap=function(){return this._delegate},fi.PHONE_SIGN_IN_METHOD=Nn.PHONE_SIGN_IN_METHOD,fi.PROVIDER_ID=Nn.PROVIDER_ID,fi);function fi(){this.providerId="phone",this._delegate=new Nn(ei(i.default.auth()))}var mi=Y,vi=(gi.prototype.clear=function(){this._delegate.clear()},gi.prototype.render=function(){return this._delegate.render()},gi.prototype.verify=function(){return this._delegate.verify()},gi);function gi(e,t,n){var r;void 0===n&&(n=i.default.app()),mi(null===(r=n.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:n.name}),this._delegate=new On(e,t,n.auth()),this.type=this._delegate.type}var yi;(yi=i.default).INTERNAL.registerComponent(new M("auth-compat",function(e){var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new li(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:x.EMAIL_SIGNIN,PASSWORD_RESET:x.PASSWORD_RESET,RECOVER_EMAIL:x.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:x.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:x.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:x.VERIFY_EMAIL}},EmailAuthProvider:rt,FacebookAuthProvider:at,GithubAuthProvider:ct,GoogleAuthProvider:ut,OAuthProvider:ot,PhoneAuthProvider:pi,PhoneMultiFactorGenerator:Tr,RecaptchaVerifier:vi,TwitterAuthProvider:dt,Auth:li,AuthCredential:Ke,Error:v}).setInstantiationMode("LAZY").setMultipleInstances(!1)),yi.registerVersion("@firebase/auth-compat","0.1.3-2021823172527")}.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
|