import{_getProvider as e,SDK_VERSION as t,_registerComponent as n,registerVersion as r,getApp as i}from"https://www.gstatic.com/firebasejs/9.16.0/firebase-app.js";var o=function(e,t){return o=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])},o(e,t)};function s(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}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>2,d=(3&i)<<4|s>>4;let l=(15&s)<<2|u>>6,h=63&u;a||(h=64,o||(l=64)),r.push(n[c],n[d],n[l],n[h])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){const t=[];let n=0;for(let r=0;r>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n191&&i<224){const o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t>4;if(r.push(u),64!==s){const e=o<<4&240|s>>2;if(r.push(e),64!==a){const e=s<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};function f(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class p extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,v.prototype.create)}}class v{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],o=i?function(e,t){return e.replace(m,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",s=`${this.serviceName}: ${o} (${r}).`;return new p(r,s,n)}}const m=/\{\$([^}]+)}/g;function g(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],o=t[i];if(_(n)&&_(o)){if(!g(n,o))return!1}else if(n!==o)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function _(e){return null!==e&&"object"==typeof e}function I(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function y(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function b(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class T{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}function k(e){return e&&e._delegate?e._delegate:e}class A{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var w;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(w||(w={}));const S={debug:w.DEBUG,verbose:w.VERBOSE,info:w.INFO,warn:w.WARN,error:w.ERROR,silent:w.SILENT},N=w.INFO,R={[w.DEBUG]:"log",[w.VERBOSE]:"log",[w.INFO]:"info",[w.WARN]:"warn",[w.ERROR]:"error"},O=(e,t,...n)=>{if(t3)throw r;return this.db&&(this.db.close(),this.db=void 0),[3,6];case 6:return[3,1];case 7:return[2]}}))}))},e.prototype.initializeServiceWorkerMessaging=function(){return c(this,void 0,void 0,(function(){return d(this,(function(e){return[2,M()?this.initializeReceiver():this.initializeSender()]}))}))},e.prototype.initializeReceiver=function(){return c(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return this.receiver=C._getInstance(M()?self:null),this.receiver._subscribe("keyChanged",(function(t,n){return c(e,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this._poll()];case 1:return[2,{keyProcessed:e.sent().includes(n.key)}]}}))}))})),this.receiver._subscribe("ping",(function(t,n){return c(e,void 0,void 0,(function(){return d(this,(function(e){return[2,["keyChanged"]]}))}))})),[2]}))}))},e.prototype.initializeSender=function(){var e,t;return c(this,void 0,void 0,(function(){var n,r;return d(this,(function(i){switch(i.label){case 0:return n=this,[4,F()];case 1:return n.activeServiceWorker=i.sent(),this.activeServiceWorker?(this.sender=new L(this.activeServiceWorker),[4,this.sender._send("ping",{},800)]):[2];case 2:return(r=i.sent())?((null===(e=r[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=r[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0),[2]):[2]}}))}))},e.prototype.notifyServiceWorker=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:if(!this.sender||!this.activeServiceWorker||function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()!==this.activeServiceWorker)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)];case 2:case 3:return t.sent(),[3,4];case 4:return[2]}}))}))},e.prototype._isAvailable=function(){return c(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),indexedDB?[4,q()]:[2,!1];case 1:return[4,z(e=t.sent(),"__sak","1")];case 2:return t.sent(),[4,B(e,"__sak")];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return[2,!1]}}))}))},e.prototype._withPendingWrite=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:this.pendingWrites++,t.label=1;case 1:return t.trys.push([1,,3,4]),[4,e()];case 2:return t.sent(),[3,4];case 3:return this.pendingWrites--,[7];case 4:return[2]}}))}))},e.prototype._set=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return d(this,(function(r){return[2,this._withPendingWrite((function(){return c(n,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,this._withRetries((function(n){return z(n,e,t)}))];case 1:return n.sent(),this.localCache[e]=t,[2,this.notifyServiceWorker(e)]}}))}))}))]}))}))},e.prototype._get=function(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,this._withRetries((function(t){return function(e,t){return c(this,void 0,void 0,(function(){var n,r;return d(this,(function(i){switch(i.label){case 0:return n=H(e,!1).get(t),[4,new x(n).toPromise()];case 1:return[2,void 0===(r=i.sent())?null:r.value]}}))}))}(t,e)}))];case 1:return t=n.sent(),this.localCache[e]=t,[2,t]}}))}))},e.prototype._remove=function(e){return c(this,void 0,void 0,(function(){var t=this;return d(this,(function(n){return[2,this._withPendingWrite((function(){return c(t,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,this._withRetries((function(t){return B(t,e)}))];case 1:return t.sent(),delete this.localCache[e],[2,this.notifyServiceWorker(e)]}}))}))}))]}))}))},e.prototype._poll=function(){return c(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l;return d(this,(function(d){switch(d.label){case 0:return[4,this._withRetries((function(e){var t=H(e,!1).getAll();return new x(t).toPromise()}))];case 1:if(!(e=d.sent()))return[2,[]];if(0!==this.pendingWrites)return[2,[]];for(t=[],n=new Set,r=0,i=e;re,"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(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}return e.prototype.get=function(){return pe()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)},e}();function me(e,t){ae(e.emulator,"Emulator should always be set here");var n=e.emulator.url;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}var ge,_e=function(){function e(){}return e.initialize=function(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)},e.fetch=function(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void se("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},e.headers=function(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void se("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},e.response=function(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void se("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},e}(),Ie=((ge={}).CREDENTIAL_MISMATCH="custom-token-mismatch",ge.MISSING_CUSTOM_TOKEN="internal-error",ge.INVALID_IDENTIFIER="invalid-email",ge.MISSING_CONTINUE_URI="internal-error",ge.INVALID_PASSWORD="wrong-password",ge.MISSING_PASSWORD="internal-error",ge.EMAIL_EXISTS="email-already-in-use",ge.PASSWORD_LOGIN_DISABLED="operation-not-allowed",ge.INVALID_IDP_RESPONSE="invalid-credential",ge.INVALID_PENDING_TOKEN="invalid-credential",ge.FEDERATED_USER_ID_ALREADY_LINKED="credential-already-in-use",ge.MISSING_REQ_TYPE="internal-error",ge.EMAIL_NOT_FOUND="user-not-found",ge.RESET_PASSWORD_EXCEED_LIMIT="too-many-requests",ge.EXPIRED_OOB_CODE="expired-action-code",ge.INVALID_OOB_CODE="invalid-action-code",ge.MISSING_OOB_CODE="internal-error",ge.CREDENTIAL_TOO_OLD_LOGIN_AGAIN="requires-recent-login",ge.INVALID_ID_TOKEN="invalid-user-token",ge.TOKEN_EXPIRED="user-token-expired",ge.USER_NOT_FOUND="user-token-expired",ge.TOO_MANY_ATTEMPTS_TRY_LATER="too-many-requests",ge.INVALID_CODE="invalid-verification-code",ge.INVALID_SESSION_INFO="invalid-verification-id",ge.INVALID_TEMPORARY_PROOF="invalid-credential",ge.MISSING_SESSION_INFO="missing-verification-id",ge.SESSION_EXPIRED="code-expired",ge.MISSING_ANDROID_PACKAGE_NAME="missing-android-pkg-name",ge.UNAUTHORIZED_DOMAIN="unauthorized-continue-uri",ge.INVALID_OAUTH_CLIENT_ID="invalid-oauth-client-id",ge.ADMIN_ONLY_OPERATION="admin-restricted-operation",ge.INVALID_MFA_PENDING_CREDENTIAL="invalid-multi-factor-session",ge.MFA_ENROLLMENT_NOT_FOUND="multi-factor-info-not-found",ge.MISSING_MFA_ENROLLMENT_ID="missing-multi-factor-info",ge.MISSING_MFA_PENDING_CREDENTIAL="missing-multi-factor-session",ge.SECOND_FACTOR_EXISTS="second-factor-already-in-use",ge.SECOND_FACTOR_LIMIT_EXCEEDED="maximum-second-factor-count-exceeded",ge.BLOCKING_FUNCTION_ERROR_RESPONSE="internal-error",ge),ye=new ve(3e4,6e4);function be(e,t){return e.tenantId&&!t.tenantId?a(a({},t),{tenantId:e.tenantId}):t}function Te(e,t,n,r,i){return void 0===i&&(i={}),c(this,void 0,void 0,(function(){var o=this;return d(this,(function(s){return[2,Ee(e,i,(function(){return c(o,void 0,void 0,(function(){var i,o,s,u;return d(this,(function(c){switch(c.label){case 0:return i={},o={},r&&("GET"===t?o=r:i={body:JSON.stringify(r)}),s=I(a({key:e.config.apiKey},o)).slice(1),[4,e._getAdditionalHeaders()];case 1:return(u=c.sent())["Content-Type"]="application/json",e.languageCode&&(u["X-Firebase-Locale"]=e.languageCode),[2,_e.fetch()(Ae(e,e.config.apiHost,n,s),a({method:t,headers:u,referrerPolicy:"no-referrer"},i))]}}))}))}))]}))}))}function Ee(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o,s,u,c,l,h,f,v;return d(this,(function(d){switch(d.label){case 0:e._canInitEmulator=!1,r=a(a({},Ie),t),d.label=1;case 1:return d.trys.push([1,4,,5]),i=new we(e),[4,Promise.race([n(),i.promise])];case 2:return o=d.sent(),i.clearNetworkTimeout(),[4,o.json()];case 3:if("needConfirmation"in(s=d.sent()))throw Se(e,"account-exists-with-different-credential",s);if(o.ok&&!("errorMessage"in s))return[2,s];if(u=o.ok?s.errorMessage:s.error.message,c=u.split(" : "),l=c[0],h=c[1],"FEDERATED_USER_ID_ALREADY_LINKED"===l)throw Se(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===l)throw Se(e,"email-already-in-use",s);if("USER_DISABLED"===l)throw Se(e,"user-disabled",s);if(f=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-"),h)throw ne(e,f,h);return ee(e,f),[3,5];case 4:if((v=d.sent())instanceof p)throw v;return ee(e,"network-request-failed"),[3,5];case 5:return[2]}}))}))}function ke(e,t,n,r,i){return void 0===i&&(i={}),c(this,void 0,void 0,(function(){var o;return d(this,(function(s){switch(s.label){case 0:return[4,Te(e,t,n,r,i)];case 1:return"mfaPendingCredential"in(o=s.sent())&&ee(e,"multi-factor-auth-required",{_serverResponse:o}),[2,o]}}))}))}function Ae(e,t,n,r){var i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?me(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}var we=function(){function e(e){var t=this;this.auth=e,this.timer=null,this.promise=new Promise((function(e,n){t.timer=setTimeout((function(){return n(te(t.auth,"network-request-failed"))}),ye.get())}))}return e.prototype.clearNetworkTimeout=function(){clearTimeout(this.timer)},e}();function Se(e,t,n){var r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);var i=te(e,t,r);return i.customData._tokenResponse=n,i}function Ne(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return[2,Te(e,"POST","/v1/accounts:delete",t)]}))}))}function Re(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return[2,Te(e,"POST","/v1/accounts:update",t)]}))}))}function Oe(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return[2,Te(e,"POST","/v1/accounts:lookup",t)]}))}))}function Pe(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function Ce(e,t){return void 0===t&&(t=!1),k(e).getIdToken(t)}function De(e,t){return void 0===t&&(t=!1),c(this,void 0,void 0,(function(){var n,r,i,o,s;return d(this,(function(a){switch(a.label){case 0:return[4,(n=k(e)).getIdToken(t)];case 1:return r=a.sent(),oe((i=Ue(r))&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error"),o="object"==typeof i.firebase?i.firebase:void 0,s=null==o?void 0:o.sign_in_provider,[2,{claims:i,token:r,authTime:Pe(Le(i.auth_time)),issuedAtTime:Pe(Le(i.iat)),expirationTime:Pe(Le(i.exp)),signInProvider:s||null,signInSecondFactor:(null==o?void 0:o.sign_in_second_factor)||null}]}}))}))}function Le(e){return 1e3*Number(e)}function Ue(e){var t=e.split("."),n=t[0],r=t[1],i=t[2];if(void 0===n||void 0===r||void 0===i)return Z("JWT malformed, contained fewer than 3 sections"),null;try{var o=function(e){try{return h.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(r);return o?JSON.parse(o):(Z("Failed to decode base64 JWT payload"),null)}catch(e){return Z("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function Me(e,t,n){return void 0===n&&(n=!1),c(this,void 0,void 0,(function(){var r;return d(this,(function(i){switch(i.label){case 0:if(n)return[2,t];i.label=1;case 1:return i.trys.push([1,3,,6]),[4,t];case 2:return[2,i.sent()];case 3:return(r=i.sent())instanceof p&&function(e){var t=e.code;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}(r)?e.auth.currentUser!==e?[3,5]:[4,e.auth.signOut()]:[3,5];case 4:i.sent(),i.label=5;case 5:throw r;case 6:return[2]}}))}))}var Fe=function(){function e(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}return e.prototype._start=function(){this.isRunning||(this.isRunning=!0,this.schedule())},e.prototype._stop=function(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))},e.prototype.getInterval=function(e){var t;if(e){var n=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),n}this.errorBackoff=3e4;n=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,n)},e.prototype.schedule=function(e){var t=this;if(void 0===e&&(e=!1),this.isRunning){var n=this.getInterval(e);this.timerId=setTimeout((function(){return c(t,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.iteration()];case 1:return e.sent(),[2]}}))}))}),n)}},e.prototype.iteration=function(){return c(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.user.getIdToken(!0)];case 1:return t.sent(),[3,3];case 2:return(null==(e=t.sent())?void 0:e.code)==="auth/".concat("network-request-failed")&&this.schedule(!0),[2];case 3:return this.schedule(),[2]}}))}))},e}(),Ve=function(){function e(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}return e.prototype._initializeTime=function(){this.lastSignInTime=Pe(this.lastLoginAt),this.creationTime=Pe(this.createdAt)},e.prototype._copy=function(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()},e.prototype.toJSON=function(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}},e}();function xe(e){var t;return c(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,h,f,p;return d(this,(function(d){switch(d.label){case 0:return n=e.auth,[4,e.getIdToken()];case 1:return r=d.sent(),[4,Me(e,Oe(n,{idToken:r}))];case 2:return oe(null==(i=d.sent())?void 0:i.users.length,n,"internal-error"),o=i.users[0],e._notifyReloadListener(o),s=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map((function(e){var t=e.providerId,n=u(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[],v=e.providerData,m=s,a=l(l([],v.filter((function(e){return!m.some((function(t){return t.providerId===e.providerId}))})),!0),m,!0),c=e.isAnonymous,h=!(e.email&&o.passwordHash||(null==a?void 0:a.length)),f=!!c&&h,p={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new Ve(o.createdAt,o.lastLoginAt),isAnonymous:f},Object.assign(e,p),[2]}var v,m}))}))}function He(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,xe(t=k(e))];case 1:return n.sent(),[4,t.auth._persistUserIfCurrent(t)];case 2:return n.sent(),t.auth._notifyListenersIfCurrent(t),[2]}}))}))}function je(e,t){return c(this,void 0,void 0,(function(){var n,r=this;return d(this,(function(i){switch(i.label){case 0:return[4,Ee(e,{},(function(){return c(r,void 0,void 0,(function(){var n,r,i,o,s,a;return d(this,(function(u){switch(u.label){case 0:return n=I({grant_type:"refresh_token",refresh_token:t}).slice(1),r=e.config,i=r.tokenApiHost,o=r.apiKey,s=Ae(e,i,"/v1/token","key=".concat(o)),[4,e._getAdditionalHeaders()];case 1:return(a=u.sent())["Content-Type"]="application/x-www-form-urlencoded",[2,_e.fetch()(s,{method:"POST",headers:a,body:n})]}}))}))}))];case 1:return[2,{accessToken:(n=i.sent()).access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}]}}))}))}var qe=function(){function e(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}return Object.defineProperty(e.prototype,"isExpired",{get:function(){return!this.expirationTime||Date.now()>this.expirationTime-3e4},enumerable:!1,configurable:!0}),e.prototype.updateFromServerResponse=function(e){oe(e.idToken,"internal-error"),oe(void 0!==e.idToken,"internal-error"),oe(void 0!==e.refreshToken,"internal-error");var t,n,r="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):(t=e.idToken,oe(n=Ue(t),"internal-error"),oe(void 0!==n.exp,"internal-error"),oe(void 0!==n.iat,"internal-error"),Number(n.exp)-Number(n.iat));this.updateTokensAndExpiration(e.idToken,e.refreshToken,r)},e.prototype.getToken=function(e,t){return void 0===t&&(t=!1),c(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return oe(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?[4,this.refresh(e,this.refreshToken)]:[3,2]:[2,this.accessToken];case 1:return n.sent(),[2,this.accessToken];case 2:return[2,null]}}))}))},e.prototype.clearRefreshToken=function(){this.refreshToken=null},e.prototype.refresh=function(e,t){return c(this,void 0,void 0,(function(){var n,r,i,o;return d(this,(function(s){switch(s.label){case 0:return[4,je(e,t)];case 1:return n=s.sent(),r=n.accessToken,i=n.refreshToken,o=n.expiresIn,this.updateTokensAndExpiration(r,i,Number(o)),[2]}}))}))},e.prototype.updateTokensAndExpiration=function(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n},e.fromJSON=function(t,n){var r=n.refreshToken,i=n.accessToken,o=n.expirationTime,s=new e;return r&&(oe("string"==typeof r,"internal-error",{appName:t}),s.refreshToken=r),i&&(oe("string"==typeof i,"internal-error",{appName:t}),s.accessToken=i),o&&(oe("number"==typeof o,"internal-error",{appName:t}),s.expirationTime=o),s},e.prototype.toJSON=function(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}},e.prototype._assign=function(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime},e.prototype._clone=function(){return Object.assign(new e,this.toJSON())},e.prototype._performRefresh=function(){return se("not implemented")},e}();function ze(e,t){oe("string"==typeof e||void 0===e,"internal-error",{appName:t})}var Be=function(){function e(e){var t=e.uid,n=e.auth,r=e.stsTokenManager,i=u(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Fe(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?l([],i.providerData,!0):[],this.metadata=new Ve(i.createdAt||void 0,i.lastLoginAt||void 0)}return e.prototype.getIdToken=function(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,Me(this,this.stsTokenManager.getToken(this.auth,e))];case 1:return oe(t=n.sent(),this.auth,"internal-error"),this.accessToken===t?[3,3]:(this.accessToken=t,[4,this.auth._persistUserIfCurrent(this)]);case 2:n.sent(),this.auth._notifyListenersIfCurrent(this),n.label=3;case 3:return[2,t]}}))}))},e.prototype.getIdTokenResult=function(e){return De(this,e)},e.prototype.reload=function(){return He(this)},e.prototype._assign=function(e){this!==e&&(oe(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((function(e){return a({},e)})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))},e.prototype._clone=function(t){return new e(a(a({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))},e.prototype._onReload=function(e){oe(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)},e.prototype._notifyReloadListener=function(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e},e.prototype._startProactiveRefresh=function(){this.proactiveRefresh._start()},e.prototype._stopProactiveRefresh=function(){this.proactiveRefresh._stop()},e.prototype._updateTokensIfNecessary=function(e,t){return void 0===t&&(t=!1),c(this,void 0,void 0,(function(){var n;return d(this,(function(r){switch(r.label){case 0:return n=!1,e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t?[4,xe(this)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this.auth._persistUserIfCurrent(this)];case 3:return r.sent(),n&&this.auth._notifyListenersIfCurrent(this),[2]}}))}))},e.prototype.delete=function(){return c(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.getIdToken()];case 1:return e=t.sent(),[4,Me(this,Ne(this.auth,{idToken:e}))];case 2:return t.sent(),this.stsTokenManager.clearRefreshToken(),[2,this.auth.signOut()]}}))}))},e.prototype.toJSON=function(){return a(a({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((function(e){return a({},e)})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})},Object.defineProperty(e.prototype,"refreshToken",{get:function(){return this.stsTokenManager.refreshToken||""},enumerable:!1,configurable:!0}),e._fromJSON=function(t,n){var r,i,o,s,u,c,d,l,h=null!==(r=n.displayName)&&void 0!==r?r:void 0,f=null!==(i=n.email)&&void 0!==i?i:void 0,p=null!==(o=n.phoneNumber)&&void 0!==o?o:void 0,v=null!==(s=n.photoURL)&&void 0!==s?s:void 0,m=null!==(u=n.tenantId)&&void 0!==u?u:void 0,g=null!==(c=n._redirectEventId)&&void 0!==c?c:void 0,_=null!==(d=n.createdAt)&&void 0!==d?d:void 0,I=null!==(l=n.lastLoginAt)&&void 0!==l?l:void 0,y=n.uid,b=n.emailVerified,T=n.isAnonymous,E=n.providerData,k=n.stsTokenManager;oe(y&&k,t,"internal-error");var A=qe.fromJSON(this.name,k);oe("string"==typeof y,t,"internal-error"),ze(h,t.name),ze(f,t.name),oe("boolean"==typeof b,t,"internal-error"),oe("boolean"==typeof T,t,"internal-error"),ze(p,t.name),ze(v,t.name),ze(m,t.name),ze(g,t.name),ze(_,t.name),ze(I,t.name);var w=new e({uid:y,auth:t,email:f,emailVerified:b,displayName:h,isAnonymous:T,photoURL:v,phoneNumber:p,tenantId:m,stsTokenManager:A,createdAt:_,lastLoginAt:I});return E&&Array.isArray(E)&&(w.providerData=E.map((function(e){return a({},e)}))),g&&(w._redirectEventId=g),w},e._fromIdTokenResponse=function(t,n,r){return void 0===r&&(r=!1),c(this,void 0,void 0,(function(){var i,o;return d(this,(function(s){switch(s.label){case 0:return(i=new qe).updateFromServerResponse(n),[4,xe(o=new e({uid:n.localId,auth:t,stsTokenManager:i,isAnonymous:r}))];case 1:return s.sent(),[2,o]}}))}))},e}(),We=function(){function e(){this.type="NONE",this.storage={}}return e.prototype._isAvailable=function(){return c(this,void 0,void 0,(function(){return d(this,(function(e){return[2,!0]}))}))},e.prototype._set=function(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return this.storage[e]=t,[2]}))}))},e.prototype._get=function(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){return[2,void 0===(t=this.storage[e])?null:t]}))}))},e.prototype._remove=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){return delete this.storage[e],[2]}))}))},e.prototype._addListener=function(e,t){},e.prototype._removeListener=function(e,t){},e.type="NONE",e}();function Ge(e,t,n){return"".concat("firebase",":").concat(e,":").concat(t,":").concat(n)}var Ke=function(){function e(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;var r=this.auth,i=r.config,o=r.name;this.fullUserKey=Ge(this.userKey,i.apiKey,o),this.fullPersistenceKey=Ge("persistence",i.apiKey,o),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}return e.prototype.setCurrentUser=function(e){return this.persistence._set(this.fullUserKey,e.toJSON())},e.prototype.getCurrentUser=function(){return c(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.persistence._get(this.fullUserKey)];case 1:return[2,(e=t.sent())?Be._fromJSON(this.auth,e):null]}}))}))},e.prototype.removeCurrentUser=function(){return this.persistence._remove(this.fullUserKey)},e.prototype.savePersistenceForRedirect=function(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)},e.prototype.setPersistence=function(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return this.persistence===e?[2]:[4,this.getCurrentUser()];case 1:return t=n.sent(),[4,this.removeCurrentUser()];case 2:return n.sent(),this.persistence=e,t?[2,this.setCurrentUser(t)]:[2]}}))}))},e.prototype.delete=function(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)},e.create=function(t,n,r){return void 0===r&&(r="authUser"),c(this,void 0,void 0,(function(){var i,o,s,a,u,l,h,f,p,v,m=this;return d(this,(function(g){switch(g.label){case 0:return n.length?[4,Promise.all(n.map((function(e){return c(m,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return[4,e._isAvailable()];case 1:return t.sent()?[2,e]:[2,void 0]}}))}))})))]:[2,new e(ce(We),t,r)];case 1:i=g.sent().filter((function(e){return e})),o=i[0]||ce(We),s=Ge(r,t.config.apiKey,t.name),a=null,u=0,l=n,g.label=2;case 2:if(!(u=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function nt(e,n){var r;switch(void 0===n&&(n=[]),e){case"Browser":r=Je(f());break;case"Worker":r="".concat(Je(f()),"-").concat(e);break;default:r=e}var i=n.length?n.join(","):"FirebaseCore-web";return"".concat(r,"/").concat("JsCore","/").concat(t,"/").concat(i)}var rt=function(){function e(e){this.auth=e,this.queue=[]}return e.prototype.pushCallback=function(e,t){var n=this,r=function(t){return new Promise((function(n,r){try{n(e(t))}catch(e){r(e)}}))};r.onAbort=t,this.queue.push(r);var i=this.queue.length-1;return function(){n.queue[i]=function(){return Promise.resolve()}}},e.prototype.runMiddleware=function(e){return c(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u;return d(this,(function(c){switch(c.label){case 0:if(this.auth.currentUser===e)return[2];t=[],c.label=1;case 1:c.trys.push([1,6,,7]),n=0,r=this.queue,c.label=2;case 2:return n0,e,"invalid-continue-uri"),oe(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(oe(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(oe(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}function an(e,t,n){return c(this,void 0,void 0,(function(){var r,i;return d(this,(function(o){switch(o.label){case 0:return r=k(e),i={requestType:"PASSWORD_RESET",email:t},n&&sn(r,i,n),[4,gt(r,i)];case 1:return o.sent(),[2]}}))}))}function un(e,t,n){return c(this,void 0,void 0,(function(){return d(this,(function(r){switch(r.label){case 0:return[4,lt(k(e),{oobCode:t,newPassword:n})];case 1:return r.sent(),[2]}}))}))}function cn(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,ft(k(e),{oobCode:t})];case 1:return n.sent(),[2]}}))}))}function dn(e,t){return c(this,void 0,void 0,(function(){var n,r,i,o;return d(this,(function(s){switch(s.label){case 0:return[4,lt(n=k(e),{oobCode:t})];case 1:switch(r=s.sent(),oe(i=r.requestType,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":oe(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":oe(r.mfaInfo,n,"internal-error");default:oe(r.email,n,"internal-error")}return o=null,r.mfaInfo&&(o=rn._fromServerResponse(ot(n),r.mfaInfo)),[2,{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:o},operation:i}]}}))}))}function ln(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,dn(k(e),t)];case 1:return[2,n.sent().data.email]}}))}))}function hn(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o;return d(this,(function(s){switch(s.label){case 0:return[4,Ht(r=ot(e),{returnSecureToken:!0,email:t,password:n})];case 1:return i=s.sent(),[4,jt._fromIdTokenResponse(r,"signIn",i)];case 2:return o=s.sent(),[4,r._updateCurrentUser(o.user)];case 3:return s.sent(),[2,o]}}))}))}function fn(e,t,n){return Qt(k(e),Ot.credential(t,n))}function pn(e,t,n){return c(this,void 0,void 0,(function(){var r,i;return d(this,(function(o){switch(o.label){case 0:return r=k(e),i={requestType:"EMAIL_SIGNIN",email:t},oe(n.handleCodeInApp,r,"argument-error"),n&&sn(r,i,n),[4,_t(r,i)];case 1:return o.sent(),[2]}}))}))}function vn(e,t){var n=Nt.parseLink(t);return"EMAIL_SIGNIN"===(null==n?void 0:n.operation)}function mn(e,t,n){return c(this,void 0,void 0,(function(){var r,i;return d(this,(function(o){return r=k(e),oe((i=Ot.credentialWithLink(t,n||le()))._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),[2,Qt(r,i)]}))}))}function gn(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return[2,Te(e,"POST","/v1/accounts:createAuthUri",be(e,t))]}))}))}function _n(e,t){return c(this,void 0,void 0,(function(){var n,r;return d(this,(function(i){switch(i.label){case 0:return n=he()?le():"http://localhost",r={identifier:t,continueUri:n},[4,gn(k(e),r)];case 1:return[2,i.sent().signinMethods||[]]}}))}))}function In(e,t){return c(this,void 0,void 0,(function(){var n,r,i;return d(this,(function(o){switch(o.label){case 0:return n=k(e),[4,e.getIdToken()];case 1:return r=o.sent(),i={requestType:"VERIFY_EMAIL",idToken:r},t&&sn(n.auth,i,t),[4,mt(n.auth,i)];case 2:return o.sent().email===e.email?[3,4]:[4,e.reload()];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}function yn(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o;return d(this,(function(s){switch(s.label){case 0:return r=k(e),[4,e.getIdToken()];case 1:return i=s.sent(),o={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:i,newEmail:t},n&&sn(r.auth,o,n),[4,It(r.auth,o)];case 2:return s.sent().email===e.email?[3,4]:[4,e.reload()];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))}function bn(e,t){return c(this,void 0,void 0,(function(){return d(this,(function(n){return[2,Te(e,"POST","/v1/accounts:update",t)]}))}))}function Tn(e,t){var n=t.displayName,r=t.photoURL;return c(this,void 0,void 0,(function(){var t,i,o,s,a;return d(this,(function(u){switch(u.label){case 0:return void 0===n&&void 0===r?[2]:[4,(t=k(e)).getIdToken()];case 1:return i=u.sent(),o={idToken:i,displayName:n,photoUrl:r,returnSecureToken:!0},[4,Me(t,bn(t.auth,o))];case 2:return s=u.sent(),t.displayName=s.displayName||null,t.photoURL=s.photoUrl||null,a=t.providerData.find((function(e){return"password"===e.providerId})),a&&(a.displayName=t.displayName,a.photoURL=t.photoURL),[4,t._updateTokensIfNecessary(s)];case 3:return u.sent(),[2]}}))}))}function En(e,t){return An(k(e),t,null)}function kn(e,t){return An(k(e),null,t)}function An(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o,s;return d(this,(function(a){switch(a.label){case 0:return r=e.auth,[4,e.getIdToken()];case 1:return i=a.sent(),o={idToken:i,returnSecureToken:!0},t&&(o.email=t),n&&(o.password=n),[4,Me(e,ht(r,o))];case 2:return s=a.sent(),[4,e._updateTokensIfNecessary(s,!0)];case 3:return a.sent(),[2]}}))}))}var wn=function(e,t,n){void 0===n&&(n={}),this.isNewUser=e,this.providerId=t,this.profile=n},Sn=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r)||this;return o.username=i,o}return s(t,e),t}(wn),Nn=function(e){function t(t,n){return e.call(this,t,"facebook.com",n)||this}return s(t,e),t}(wn),Rn=function(e){function t(t,n){return e.call(this,t,"github.com",n,"string"==typeof(null==n?void 0:n.login)?null==n?void 0:n.login:null)||this}return s(t,e),t}(Sn),On=function(e){function t(t,n){return e.call(this,t,"google.com",n)||this}return s(t,e),t}(wn),Pn=function(e){function t(t,n,r){return e.call(this,t,"twitter.com",n,r)||this}return s(t,e),t}(Sn);function Cn(e){var t=e,n=t.user,r=t._tokenResponse;return n.isAnonymous&&!r?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;var r=e.providerId,i=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},o=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!r&&(null==e?void 0:e.idToken)){var s=null===(n=null===(t=Ue(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(s)return new wn(o,"anonymous"!==s&&"custom"!==s?s:null)}if(!r)return null;switch(r){case"facebook.com":return new Nn(o,i);case"github.com":return new Rn(o,i);case"google.com":return new On(o,i);case"twitter.com":return new Pn(o,i,e.screenName||null);case"custom":case"anonymous":return new wn(o,null);default:return new wn(o,r,i)}}(r)}function Dn(e,t){return k(e).setPersistence(t)}function Ln(e,t,n,r){return k(e).onIdTokenChanged(t,n,r)}function Un(e,t,n){return k(e).beforeAuthStateChanged(t,n)}function Mn(e,t,n,r){return k(e).onAuthStateChanged(t,n,r)}function Fn(e){k(e).useDeviceLanguage()}function Vn(e,t){return k(e).updateCurrentUser(t)}function xn(e){return k(e).signOut()}function Hn(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){return[2,k(e).delete()]}))}))}var jn=function(){function e(e,t,n){this.type=e,this.credential=t,this.auth=n}return e._fromIdtoken=function(t,n){return new e("enroll",t,n)},e._fromMfaPendingCredential=function(t){return new e("signin",t)},e.prototype.toJSON=function(){var e;return{multiFactorSession:(e={},e["enroll"===this.type?"idToken":"pendingCredential"]=this.credential,e)}},e.fromJSON=function(t){var n,r;if(null==t?void 0:t.multiFactorSession){if(null===(n=t.multiFactorSession)||void 0===n?void 0:n.pendingCredential)return e._fromMfaPendingCredential(t.multiFactorSession.pendingCredential);if(null===(r=t.multiFactorSession)||void 0===r?void 0:r.idToken)return e._fromIdtoken(t.multiFactorSession.idToken)}return null},e}(),qn=function(){function e(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}return e._fromError=function(t,n){var r=this,i=ot(t),o=n.customData._serverResponse,s=(o.mfaInfo||[]).map((function(e){return rn._fromServerResponse(i,e)}));oe(o.mfaPendingCredential,i,"internal-error");var u=jn._fromMfaPendingCredential(o.mfaPendingCredential);return new e(u,s,(function(e){return c(r,void 0,void 0,(function(){var t,r,s;return d(this,(function(c){switch(c.label){case 0:return[4,e._process(i,u)];case 1:switch(t=c.sent(),delete o.mfaInfo,delete o.mfaPendingCredential,r=a(a({},o),{idToken:t.idToken,refreshToken:t.refreshToken}),n.operationType){case"signIn":return[3,2];case"reauthenticate":return[3,5]}return[3,6];case 2:return[4,jt._fromIdTokenResponse(i,n.operationType,r)];case 3:return s=c.sent(),[4,i._updateCurrentUser(s.user)];case 4:return c.sent(),[2,s];case 5:return oe(n.user,i,"internal-error"),[2,jt._forOperation(n.user,n.operationType,r)];case 6:ee(i,"internal-error"),c.label=7;case 7:return[2]}}))}))}))},e.prototype.resolveSignIn=function(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){return t=e,[2,this.signInResolver(t)]}))}))},e}();function zn(e,t){var n,r=k(e),i=t;return oe(t.customData.operationType,r,"argument-error"),oe(null===(n=i.customData._serverResponse)||void 0===n?void 0:n.mfaPendingCredential,r,"argument-error"),qn._fromError(r,i)}var Bn=function(){function e(e){var t=this;this.user=e,this.enrolledFactors=[],e._onReload((function(n){n.mfaInfo&&(t.enrolledFactors=n.mfaInfo.map((function(t){return rn._fromServerResponse(e.auth,t)})))}))}return e._fromUser=function(t){return new e(t)},e.prototype.getSession=function(){return c(this,void 0,void 0,(function(){var e,t;return d(this,(function(n){switch(n.label){case 0:return t=(e=jn)._fromIdtoken,[4,this.user.getIdToken()];case 1:return[2,t.apply(e,[n.sent(),this.user.auth])]}}))}))},e.prototype.enroll=function(e,t){return c(this,void 0,void 0,(function(){var n,r,i;return d(this,(function(o){switch(o.label){case 0:return n=e,[4,this.getSession()];case 1:return r=o.sent(),[4,Me(this.user,n._process(this.user.auth,r,t))];case 2:return i=o.sent(),[4,this.user._updateTokensIfNecessary(i)];case 3:return o.sent(),[2,this.user.reload()]}}))}))},e.prototype.unenroll=function(e){return c(this,void 0,void 0,(function(){var t,n,r,i;return d(this,(function(o){switch(o.label){case 0:return t="string"==typeof e?e:e.uid,[4,this.user.getIdToken()];case 1:return n=o.sent(),[4,Me(this.user,(s=this.user.auth,a={idToken:n,mfaEnrollmentId:t},Te(s,"POST","/v2/accounts/mfaEnrollment:withdraw",be(s,a))))];case 2:return r=o.sent(),this.enrolledFactors=this.enrolledFactors.filter((function(e){return e.uid!==t})),[4,this.user._updateTokensIfNecessary(r)];case 3:o.sent(),o.label=4;case 4:return o.trys.push([4,6,,7]),[4,this.user.reload()];case 5:return o.sent(),[3,7];case 6:if((null==(i=o.sent())?void 0:i.code)!=="auth/".concat("user-token-expired"))throw i;return[3,7];case 7:return[2]}var s,a}))}))},e}(),Wn=new WeakMap;function Gn(e){var t=k(e);return Wn.has(t)||Wn.set(t,Bn._fromUser(t)),Wn.get(t)}var Kn="@firebase/auth",Jn=function(){function e(e){this.auth=e,this.internalListeners=new Map}return e.prototype.getUid=function(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null},e.prototype.getToken=function(e){return c(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.assertAuthConfigured(),[4,this.auth._initializationPromise];case 1:return t.sent(),this.auth.currentUser?[4,this.auth.currentUser.getIdToken(e)]:[2,null];case 2:return[2,{accessToken:t.sent()}]}}))}))},e.prototype.addAuthTokenListener=function(e){if(this.assertAuthConfigured(),!this.internalListeners.has(e)){var t=this.auth.onIdTokenChanged((function(t){e((null==t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}},e.prototype.removeAuthTokenListener=function(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())},e.prototype.assertAuthConfigured=function(){oe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")},e.prototype.updateProactiveRefresh=function(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()},e}();var Yn={PHONE:"phone"},Xn={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},$n={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Qn={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Zn={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"},er=function(){function e(e,t){this.storageRetriever=e,this.type=t}return e.prototype._isAvailable=function(){try{return this.storage?(this.storage.setItem("__sak","1"),this.storage.removeItem("__sak"),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}},e.prototype._set=function(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()},e.prototype._get=function(e){var t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)},e.prototype._remove=function(e){return this.storage.removeItem(e),Promise.resolve()},Object.defineProperty(e.prototype,"storage",{get:function(){return this.storageRetriever()},enumerable:!1,configurable:!0}),e}();var tr=function(e){function t(){var t,n=e.call(this,(function(){return window.localStorage}),"LOCAL")||this;return n.boundEventHandler=function(e,t){return n.onStorageEvent(e,t)},n.listeners={},n.localCache={},n.pollTimer=null,n.safariLocalStorageNotSynced=(Ye(t=f())||et(t))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),n.fallbackToPolling=function(e){return void 0===e&&(e=f()),et(e)||$e(e)||Ze(e)||Qe(e)||/windows phone/i.test(e)||Xe(e)}(),n._shouldAllowMigration=!0,n}return s(t,e),t.prototype.forAllChangedKeys=function(e){for(var t=0,n=Object.keys(this.listeners);t0&&(a.scopes=f.join(","))}e.tenantId&&(a.tid=e.tenantId);for(var p=a,v=0,m=Object.keys(p);v=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Nr(e))},e.prototype.saveEventToCache=function(e){this.cachedEventUids.add(Nr(e)),this.lastProcessedEventTime=Date.now()},e}();function Nr(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((function(e){return e})).join("-")}function Rr(e){var t=e.type,n=e.error;return"unknown"===t&&(null==n?void 0:n.code)==="auth/".concat("no-auth-event")}var Or=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.passiveListeners=new Set,t.initPromise=new Promise((function(e){t.resolveInialized=e})),t}return s(t,e),t.prototype.addPassiveListener=function(e){this.passiveListeners.add(e)},t.prototype.removePassiveListener=function(e){this.passiveListeners.delete(e)},t.prototype.resetRedirect=function(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1},t.prototype.onEvent=function(t){return this.resolveInialized(),this.passiveListeners.forEach((function(e){return e(t)})),e.prototype.onEvent.call(this,t)},t.prototype.initialized=function(){return c(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.initPromise];case 1:return e.sent(),[2]}}))}))},t}(Sr);function Pr(e,t){return Ur()._set(Mr(e),t)}function Cr(e){return c(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,Ur()._get(Mr(e))];case 1:return(t=n.sent())?[4,Ur()._remove(Mr(e))]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2,t]}}))}))}function Dr(e,t){var n,r,i=function(e){var t=Fr(e),n=t.link?decodeURIComponent(t.link):void 0,r=Fr(n).link,i=t.deep_link_id?decodeURIComponent(t.deep_link_id):void 0;return Fr(i).link||i||r||n||e}(t);if(i.includes("/__/auth/callback")){var o=Fr(i),s=o.firebaseError?function(e){try{return JSON.parse(e)}catch(e){return null}}(decodeURIComponent(o.firebaseError)):null,a=null===(r=null===(n=null==s?void 0:s.code)||void 0===n?void 0:n.split("auth/"))||void 0===r?void 0:r[1],u=a?te(a):null;return u?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:u,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:i,postBody:null}}return null}function Lr(){for(var e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=0;n<20;n++){var r=Math.floor(Math.random()*t.length);e.push(t.charAt(r))}return e.join("")}function Ur(){return ce(nr)}function Mr(e){return Ge("authEvent",e.config.apiKey,e.name)}function Fr(e){if(!(null==e?void 0:e.includes("?")))return{};var t=e.split("?");return t[0],y(t.slice(1).join("?"))}var Vr,xr=function(){function e(){this._redirectPersistence=rr,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=_r,this._overrideRedirectResult=pr}return e.prototype._initialize=function(e){return c(this,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t=e._key(),(n=this.eventManagers.get(t))||(n=new Or(e),this.eventManagers.set(t,n),this.attachCallbackListeners(e,n)),[2,n]}))}))},e.prototype._openPopup=function(e){ee(e,"operation-not-supported-in-this-environment")},e.prototype._openRedirect=function(e,t,n,r){return c(this,void 0,void 0,(function(){var i,o,s;return d(this,(function(a){switch(a.label){case 0:return function(e){var t,n,r,i,o,s,a,u,c,d,l=br();oe("function"==typeof(null===(t=null==l?void 0:l.universalLinks)||void 0===t?void 0:t.subscribe),e,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),oe(void 0!==(null===(n=null==l?void 0:l.BuildInfo)||void 0===n?void 0:n.packageName),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),oe("function"==typeof(null===(o=null===(i=null===(r=null==l?void 0:l.cordova)||void 0===r?void 0:r.plugins)||void 0===i?void 0:i.browsertab)||void 0===o?void 0:o.openUrl),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),oe("function"==typeof(null===(u=null===(a=null===(s=null==l?void 0:l.cordova)||void 0===s?void 0:s.plugins)||void 0===a?void 0:a.browsertab)||void 0===u?void 0:u.isAvailable),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),oe("function"==typeof(null===(d=null===(c=null==l?void 0:l.cordova)||void 0===c?void 0:c.InAppBrowser)||void 0===d?void 0:d.open),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"})}(e),[4,this._initialize(e)];case 1:return[4,(i=a.sent()).initialized()];case 2:return a.sent(),i.resetRedirect(),dr.clear(),[4,this._originValidation(e)];case 3:return a.sent(),o=function(e,t,n){return void 0===n&&(n=null),{type:t,eventId:n,urlResponse:null,sessionId:Lr(),postBody:null,tenantId:e.tenantId,error:te(e,"no-auth-event")}}(e,n,r),[4,Pr(e,o)];case 4:return a.sent(),[4,Er(e,o,t)];case 5:return[4,kr(a.sent())];case 6:return s=a.sent(),[2,Ar(e,i,s)]}}))}))},e.prototype._isIframeWebStorageSupported=function(e,t){throw new Error("Method not implemented.")},e.prototype._originValidation=function(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=function(e){return c(this,void 0,void 0,(function(){var t,n;return d(this,(function(r){switch(r.label){case 0:return t=br().BuildInfo,n={},et()?n.iosBundleId=t.packageName:$e()?n.androidPackageName=t.packageName:ee(e,"operation-not-supported-in-this-environment"),[4,Tr(e,n)];case 1:return r.sent(),[2]}}))}))}(e)),this.originValidationPromises[t]},e.prototype.attachCallbackListeners=function(e,t){var n=this,r=br(),i=r.universalLinks,o=r.handleOpenURL,s=r.BuildInfo,a=setTimeout((function(){return c(n,void 0,void 0,(function(){return d(this,(function(n){switch(n.label){case 0:return[4,Cr(e)];case 1:return n.sent(),t.onEvent(jr()),[2]}}))}))}),500),u=function(r){return c(n,void 0,void 0,(function(){var n,i;return d(this,(function(o){switch(o.label){case 0:return clearTimeout(a),[4,Cr(e)];case 1:return n=o.sent(),i=null,n&&(null==r?void 0:r.url)&&(i=Dr(n,r.url)),t.onEvent(i||jr()),[2]}}))}))};void 0!==i&&"function"==typeof i.subscribe&&i.subscribe(null,u);var l=o,h="".concat(s.packageName.toLowerCase(),"://");br().handleOpenURL=function(e){return c(n,void 0,void 0,(function(){return d(this,(function(t){if(e.toLowerCase().startsWith(h)&&u({url:e}),"function"==typeof l)try{l(e)}catch(e){console.error(e)}return[2]}))}))}},e}(),Hr=xr;function jr(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:te("no-auth-event")}}function qr(e,t,n){return function(e,t,n){return c(this,void 0,void 0,(function(){var r,i;return d(this,(function(o){switch(o.label){case 0:return r=ot(e),re(e,t,Pt),[4,r._initializationPromise];case 1:return o.sent(),[4,fr(i=ir(r,n),r)];case 2:return o.sent(),[2,i._openRedirect(r,t,"signInViaRedirect")]}}))}))}(e,t,n)}function zr(e,t,n){return function(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o;return d(this,(function(s){switch(s.label){case 0:return re((r=k(e)).auth,t,Pt),[4,r.auth._initializationPromise];case 1:return s.sent(),[4,fr(i=ir(r.auth,n),r.auth)];case 2:return s.sent(),[4,Ir(r)];case 3:return o=s.sent(),[2,i._openRedirect(r.auth,t,"reauthViaRedirect",o)]}}))}))}(e,t,n)}function Br(e,t,n){return function(e,t,n){return c(this,void 0,void 0,(function(){var r,i,o;return d(this,(function(s){switch(s.label){case 0:return re((r=k(e)).auth,t,Pt),[4,r.auth._initializationPromise];case 1:return s.sent(),i=ir(r.auth,n),[4,Yt(!1,r,t.providerId)];case 2:return s.sent(),[4,fr(i,r.auth)];case 3:return s.sent(),[4,Ir(r)];case 4:return o=s.sent(),[2,i._openRedirect(r.auth,t,"linkViaRedirect",o)]}}))}))}(e,t,n)}function Wr(t){void 0===t&&(t=i());var n=e(t,"auth");return n.isInitialized()?n.getImmediate():de(t,{persistence:G,popupRedirectResolver:Hr})}Vr="Cordova",n(new A("auth",(function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=r.options,s=o.apiKey,a=o.authDomain;return function(e,t){oe(s&&!s.includes(":"),"invalid-api-key",{appName:e.name}),oe(!(null==a?void 0:a.includes(":")),"argument-error",{appName:e.name});var r={apiKey:s,authDomain:a,clientPlatform:Vr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:nt(Vr)},i=new it(e,t,r);return function(e,t){var n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(ce);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(i,n),i}(r,i)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((function(e,t,n){e.getProvider("auth-internal").initialize()}))),n(new A("auth-internal",(function(e){return function(e){return new Jn(e)}(ot(e.getProvider("auth").getImmediate()))}),"PRIVATE").setInstantiationMode("EXPLICIT")),r(Kn,"0.21.1",function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Vr)),r(Kn,"0.21.1","esm5");export{Zn as ActionCodeOperation,Nt as ActionCodeURL,dt as AuthCredential,$ as AuthErrorCodes,Tt as EmailAuthCredential,Ot as EmailAuthProvider,Lt as FacebookAuthProvider,Yn as FactorId,Mt as GithubAuthProvider,Ut as GoogleAuthProvider,At as OAuthCredential,Dt as OAuthProvider,Qn as OperationType,St as PhoneAuthCredential,Xn as ProviderId,Vt as SAMLAuthProvider,$n as SignInMethod,xt as TwitterAuthProvider,cn as applyActionCode,Un as beforeAuthStateChanged,nr as browserLocalPersistence,rr as browserSessionPersistence,dn as checkActionCode,un as confirmPasswordReset,at as connectAuthEmulator,Hr as cordovaPopupRedirectResolver,hn as createUserWithEmailAndPassword,J as debugErrorMap,Hn as deleteUser,_n as fetchSignInMethodsForEmail,Cn as getAdditionalUserInfo,Wr as getAuth,Ce as getIdToken,De as getIdTokenResult,zn as getMultiFactorResolver,gr as getRedirectResult,We as inMemoryPersistence,G as indexedDBLocalPersistence,de as initializeAuth,vn as isSignInWithEmailLink,Zt as linkWithCredential,Br as linkWithRedirect,Gn as multiFactor,Mn as onAuthStateChanged,Ln as onIdTokenChanged,Rt as parseActionCodeURL,Y as prodErrorMap,en as reauthenticateWithCredential,zr as reauthenticateWithRedirect,He as reload,In as sendEmailVerification,an as sendPasswordResetEmail,pn as sendSignInLinkToEmail,Dn as setPersistence,zt as signInAnonymously,Qt as signInWithCredential,nn as signInWithCustomToken,fn as signInWithEmailAndPassword,mn as signInWithEmailLink,qr as signInWithRedirect,xn as signOut,Kt as unlink,Vn as updateCurrentUser,En as updateEmail,kn as updatePassword,Tn as updateProfile,Fn as useDeviceLanguage,yn as verifyBeforeUpdateEmail,ln as verifyPasswordResetCode}; //# sourceMappingURL=firebase-auth-cordova.js.map