1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[888],{3446:function(e,t,n){"use strict";n.d(t,{$:function(){return tm},A:function(){return h},D:function(){return d},I:function(){return eD},J:function(){return ex},L:function(){return eQ},N:function(){return er},P:function(){return nN},Q:function(){return e4},R:function(){return nE},U:function(){return e3},V:function(){return e7},W:function(){return e8},X:function(){return e5},Y:function(){return tt},Z:function(){return tn},_:function(){return ta},a:function(){return t3},a0:function(){return tg},a1:function(){return ty},a2:function(){return tw},a3:function(){return tI},a4:function(){return tS},a5:function(){return tk},a6:function(){return tC},a7:function(){return tA},a8:function(){return tR},a9:function(){return tN},aA:function(){return b},aB:function(){return n6},aC:function(){return en},aD:function(){return es},aE:function(){return n4},aF:function(){return nG},aG:function(){return nK},aH:function(){return eN},aL:function(){return t8},aO:function(){return te},aa:function(){return tO},ab:function(){return tD},ac:function(){return tP},ad:function(){return tx},ae:function(){return tM},af:function(){return tU},ai:function(){return tV},aj:function(){return tj},ak:function(){return tB},an:function(){return th},ao:function(){return tQ},aq:function(){return tY},ar:function(){return t1},as:function(){return E},at:function(){return em},au:function(){return ed},av:function(){return g},aw:function(){return ip},ax:function(){return n7},ay:function(){return eg},az:function(){return y},b:function(){return t6},c:function(){return nF},d:function(){return nj},e:function(){return nV},f:function(){return nJ},g:function(){return n0},h:function(){return nY},i:function(){return np},j:function(){return n2},k:function(){return iy},l:function(){return nk},m:function(){return i_},o:function(){return iO},p:function(){return u},r:function(){return nC},s:function(){return nS},u:function(){return nR}});var i,r=n(4444),s=n(5816);function a(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)0>t.indexOf(i[r])&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}"function"==typeof SuppressedError&&SuppressedError;var o=n(3333),l=n(8463);let u={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},h={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 c(){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."}}let d=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 al
1ways 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
vendor: 7,825 bytes, line 1
1 malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend."
1}},f=new r.LL("auth","Firebase",c()),p=new o.Yd("@firebase/auth");function m(e,...t){p.logLevel<=o.in.ERROR&&p.error(`Auth (${s.SDK_VERSION}): ${e}`,...t)}function g(e,...t){throw _(e,...t)}function y(e,...t){return _(e,...t)}function v(e,t,n){let i=Object.assign(Object.assign({},c()),{[t]:n});return new r.LL("auth","Firebase",i).create(t,{appName:e.name})}function w(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&g(e,"argument-error"),v(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function _(e,...t){if("string"!=typeof e){let n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return f.create(e,...t)}function b(e,t,...n){if(!e)throw _(t,...n)}function T(e){let t="INTERNAL ASSERTION FAILED: "+e;throw m(t),Error(t)}function E(e,t){e||T(t)}function I(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function S(){return"http:"===k()||"https:"===k()}function k(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}class C{constructor(e,t){this.shortDelay=e,this.longDelay=t,E(t>e,"Short delay should be less than long delay!"),this.isMobile=(0,r.uI)()||(0,r.b$)()}get(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(S()||(0,r.ru)()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function A(e,t){E(e.emulator,"Emulator should always be set here");let{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class R{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void T("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void T("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void T("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let N={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-rec
1aptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},O=new C(3e4,6e4);function D(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function P(e,t,n,i,s={}){return L(e,s,async()=>{let s={},a={};i&&("GET"===t?a=i:s={body:JSON.stringify(i)});let o=(0,r.xO)(Object.assign({key:e.config.apiKey},a)).slice(1),l=await e._getAdditionalHeaders();return l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode),R.fetch()(M(e,e.config.apiHost,n,o),Object.assign({method:t,headers:l,referrerPolicy:"no-referrer"},s))})}async function L(e,t,n){e._canInitEmulator=!1;let i=Object.assign(Object.assign({},N),t);try{let t=new U(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let s=await r.json();if("needConfirmation"in s)throw F(e,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{let[t,n]=(r.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw F(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw F(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw F(e,"user-disabled",s);let a=i[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(n)throw v(e,a,n);g(e,a)}}catch(t){if(t instanceof r.ZR)throw t;g(e,"network-request-failed",{message:String(t)})}}async function x(e,t,n,i,r={}){let s=await P(e,t,n,i,r);return"mfaPendingCredential"in s&&g(e,"multi-factor-auth-required",{_serverResponse:s}),s}function M(e,t,n,i){let r=`${t}${n}?${i}`;return e.config.emulator?A(e.config,r):`${e.config.apiScheme}://${r}`}class U{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(y(this.auth,"network-request-failed")),O.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function F(e,t,n){let i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);let r=y(e,t,i);return r.customData._tokenResponse=n,r}async function V(e,t){return P(e,"POST","/v1/accounts:delete",t)}async function j(e,t){return P(e,"POST","/v1/accounts:update",t)}async function B(e,t){return P(e,"POST","/v1/accounts:lookup",t)}function z(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function q(e,t=!1){let n=(0,r.m9)(e),i=await n.getIdToken(t),s=H(i);b(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");let a="object"==typeof s.firebase?s.firebase:void 0,o=null==a?void 0:a.sign_in_provider;return{claims:s,token:i,authTime:z($(s.auth_time)),issuedAtTime:z($(s.iat)),expirationTime:z($(s.exp)),signInProvider:o||null,signInSecondFactor:(null==a?void 0:a.sign_in_second_factor)||null}}function $(e){return 1e3*Number(e)}function H(e){let[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return m("JWT malformed, contained fewer than 3 sections"),null;try{let e=(0,r.tV)(n);if(!e)return m("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return m("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}async function K(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof r.ZR&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class G{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){var t;if(!e)return this.errorBackoff=3e4,Math.max(0,(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(null==e?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class W{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=z(this.lastLoginAt),this.creationTime=z(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Q(e){var t;let n=e.auth,i=await e.getIdToken(),r=await K(e,B(n,{idToken:i}));b(null==r?void 0:r.users.length,n,"internal-error");let s=r.users[0];e._notifyReloadListener(s);let o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?s.providerUserInfo.map(e=>{var{providerId:t}=e,n=a(e,["providerId"]);
1return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}):[],l=[...e.providerData.filter(e=>!o.some(t=>t.providerId===e.providerId)),...o],u=e.isAnonymous,h=!(e.email&&s.passwordHash)&&!(null==l?void 0:l.length);Object.assign(e,{uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:l,metadata:new W(s.createdAt,s.lastLoginAt),isAnonymous:!!u&&h})}async function J(e){let t=(0,r.m9)(e);await Q(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}async function X(e,t){let n=await L(e,{},async()=>{let n=(0,r.xO)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:s}=e.config,a=M(e,i,"/v1/token",`key=${s}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",R.fetch()(a,{method:"POST",headers:o,body:n})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}class Y{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){b(e.idToken,"internal-error"),b(void 0!==e.idToken,"internal-error"),b(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){let t=H(e);return b(t,"internal-error"),b(void 0!==t.exp,"internal-error"),b(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return(b(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired)?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:i,expiresIn:r}=await X(e,t);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){let{refreshToken:n,accessToken:i,expirationTime:r}=t,s=new Y;return n&&(b("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(b("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(b("number"==typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}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 Y,this.toJSON())}_performRefresh(){return T("not implemented")}}function Z(e,t){b("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ee{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=a(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new G(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new W(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await K(this,this.stsTokenManager.getToken(this.auth,e));return b(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return q(this,e)}reload(){return J(this)}_assign(e){this!==e&&(b(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new ee(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){b(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await Q(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){let e=await this.getIdToken();return await K(this,V(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,isA
1nonymous: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,i,r,s,a,o,l,u;let h=null!==(n=t.displayName)&&void 0!==n?n:void 0,c=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=t.photoURL)&&void 0!==s?s:void 0,p=null!==(a=t.tenantId)&&void 0!==a?a:void 0,m=null!==(o=t._redirectEventId)&&void 0!==o?o:void 0,g=null!==(l=t.createdAt)&&void 0!==l?l:void 0,y=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:E}=t;b(v&&E,e,"internal-error");let I=Y.fromJSON(this.name,E);b("string"==typeof v,e,"internal-error"),Z(h,e.name),Z(c,e.name),b("boolean"==typeof w,e,"internal-error"),b("boolean"==typeof _,e,"internal-error"),Z(d,e.name),Z(f,e.name),Z(p,e.name),Z(m,e.name),Z(g,e.name),Z(y,e.name);let S=new ee({uid:v,auth:e,email:c,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:I,createdAt:g,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map(e=>Object.assign({},e))),m&&(S._redirectEventId=m),S}static async _fromIdTokenResponse(e,t,n=!1){let i=new Y;i.updateFromServerResponse(t);let r=new ee({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await Q(r),r}}let et=new Map;function en(e){E(e instanceof Function,"Expected a class definition");let t=et.get(e);return t?E(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,et.set(e,t)),t}class ei{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}ei.type="NONE";let er=ei;
1function es(e,t,n){return`firebase:${e}:${t}:${n}`}class ea{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:i,name:r}=this.auth;this.fullUserKey=es(this.userKey,i.apiKey,r),this.fullPersistenceKey=es("persistence",i.apiKey,r),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(){let 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)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new ea(en(er),e,n);let i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),r=i[0]||en(er),s=es(n,e.config.apiKey,e.name),a=null;for(let n of t)try{let t=await n._get(s);if(t){let i=ee._fromJSON(e,t);n!==r&&(a=i),r=n;break}}catch(e){}let o=i.filter(e=>e._shouldAllowMigration);return r._shouldAllowMigration&&o.length&&(r=o[0],a&&await r._set(s,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==r)try{await e._remove(s)}catch(e){}}))),new ea(r,e,n)}}function eo(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ec(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";{if(t.includes("edge/"))return"Edge";if(el(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ef(t))return"Blackberry";if(ep(t))return"Webos";if(eu(t))return"Safari";if((t.includes("chrome/")||eh(t))&&!t.includes("edge/"))return"Chrome";if(ed(t))return"Android";let n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if((null==n?void 0:n.length)===2)return n[1]}return"Other"}function el(e=(0,r.z$)()){return/firefox\//i.test(e)}function eu(e=(0,r.z$)()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function eh(e=(0,r.z$)()){return/crios\//i.test(e)}function ec(e=(0,r.z$)()){return/iemobile/i.test(e)}function ed(e=(0,r.z$)()){return/android/i.test(e)}function ef(e=(0,r.z$)()){return/blackberry/i.test(e)}function ep(e=(0,r.z$)()){return/webos/i.test(e)}function em(e=(0,r.z$)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function eg(e=(0,r.z$)()){return/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)}function ey(e=(0,r.z$)()){return em(e)||ed(e)||ep(e)||ef(e)||/windows phone/i.test(e)||ec(e)}function ev(e,t=[]){let n;switch(e){case"Browser":n=eo((0,r.z$)());break;case"Worker":n=`${eo((0,r.z$)())}-${e}`;break;default:n=e}let i=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${s.SDK_VERSION}/${i}`}async function ew(e){return(await P(e,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function e_(e,t){return P(e,"GET","/v2/recaptchaConfig",D(e,t))}function eb(e){return void 0!==e&&void 0!==e.getResponse}function eT(e){return void 0!==e&&void 0!==e.enterprise}class eE{constructor(e){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.emailPasswordEnabled=e.recaptchaEnforcementState.some(e=>"EMAIL_PASSWORD_PROVIDER"===e.provider&&"OFF"!==e.enforcementState)}}function eI(e){return new Promise((t,n)=>{var i,r;let s=document.createElement("script");s.setAttribute("src",e),s.onload=t,s.onerror=e=>{let t=y("internal-error");t.customData=e,n(t)},s.type="text/javascript",s.charset="UTF-8",(null!==(r=null===(i=document.getElementsByTagName("head"))||void 0===i?void 0:i[0])&&void 0!==r?r:document).appendChild(s)})}function eS(e){return`__${e}${Math.floor(1e6*Math.random())}`}class ek{constructor(e){this.type="recaptcha-enterprise",this.auth=eN(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>
1{e_(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0===i.recaptchaKey)n(Error("recaptcha Enterprise site key undefined"));else{let n=new eE(i);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function i(t,n,i){let r=window.grecaptcha;eT(r)?r.enterprise.ready(()=>{r.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n("NO_RECAPTCHA")})}):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((e,r)=>{n(this.auth).then(n=>{if(!t&&eT(window.grecaptcha))i(n,e,r);else{if("undefined"==typeof window){r(Error("RecaptchaVerifier is only supported in browser"));return}eI("https://www.google.com/recaptcha/enterprise.js?render="+n).then(()=>{i(n,e,r)}).catch(e=>{r(e)})}}).catch(e=>{r(e)})})}}async function eC(e,t,n,i=!1){let r;let s=new ek(e);try{r=await s.verify(n)}catch(e){r=await s.verify(n,!0)}let a=Object.assign({},t);return i?Object.assign(a,{captchaResp:r}):Object.assign(a,{captchaResponse:r}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}class eA{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let n=t=>new Promise((n,i)=>{try{let i=e(t);n(i)}catch(e){i(e)}});n.onAbort=t,this.queue.push(n);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}class eR{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new eO(this),this.idTokenSubscription=new eO(this),this.beforeStateQueue=new eA(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=f,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=en(t)),this._initializationPromise=this.queue(async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await ea.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t;let n=await this.assertedPersistence.getCurrentUser(),i=n,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==i?void 0:i._redirectEventId,a=await this.tryRedirectSignIn(e);(!n||n===s)&&(null==a?void 0:a.user)&&(i=a.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return(b(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId)?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Q(e)}catch(e){if((null==e?void 0:e.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}
1async updateCurrentUser(e){let t=e?(0,r.m9)(e):null;return t&&b(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&b(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(en(e))})}async initializeRecaptchaConfig(){let e=new eE(await e_(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==this.tenantId?this._agentRecaptchaConfig=e:this._tenantRecaptchaConfigs[this.tenantId]=e,e.emailPasswordEnabled&&new ek(this).verify()}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new r.LL("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&en(e)||this._popupRedirectResolver;b(t,this,"argument-error"),this.redirectPersistenceManager=await ea.create(this,[en(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return(this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e)?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._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,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};let r="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return(b(s,this,"internal-error"),s.then(()=>r(this.currentUser)),"function"==typeof t)?e.addObserver(t,n,i):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return b(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ev(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);let n=await (null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);let i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;let t=await (null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){p.logLevel<=o.in.WARN&&p.warn(`Auth (${s.SDK_VERSION}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function eN(e){return(0,r.m9)(e)}class eO{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,r.ne)(e=>this.observer=e)}get next(){return b(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function eD(e,t,n){let i=eN(e);b(i._canInitEmulator,i,"emulator-config-failed"),b(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");let r=!!(null==n?void 0:n.disableWarnings),s=eP(t),{host:a,port:o}=function(e){let t=eP(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};let i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){let e=r[1];return{host:e,port:eL(i.substr(e.length+1))}}{let[e,t]=i.split(":");return{host:e,port:eL(t)}}}(t),l=null===o?"":`:${o}`;i.config.emulator={url:`${s}//${a}${l}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:a,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function eP(e){let t=e.indexOf(":");
1return t<0?"":e.substr(0,t+1)}function eL(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class ex{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return T("not implemented")}_getIdTokenResponse(e){return T("not implemented")}_linkToIdToken(e,t){return T("not implemented")}_getReauthenticationResolver(e){return T("not implemented")}}async function eM(e,t){return P(e,"POST","/v1/accounts:resetPassword",D(e,t))}async function eU(e,t){return P(e,"POST","/v1/accounts:update",t)}async function eF(e,t){return P(e,"POST","/v1/accounts:update",D(e,t))}async function eV(e,t){return x(e,"POST","/v1/accounts:signInWithPassword",D(e,t))}async function ej(e,t){return P(e,"POST","/v1/accounts:sendOobCode",D(e,t))}async function eB(e,t){return ej(e,t)}async function ez(e,t){return ej(e,t)}async function eq(e,t){return ej(e,t)}async function e$(e,t){return ej(e,t)}async function eH(e,t){return x(e,"POST","/v1/accounts:signInWithEmailLink",D(e,t))}async function eK(e,t){return x(e,"POST","/v1/accounts:signInWithEmailLink",D(e,t))}class eG extends ex{constructor(e,t,n,i=null){super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new eG(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new eG(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){var t;switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(t=e._getRecaptchaConfig())||void 0===t||!t.emailPasswordEnabled)return eV(e,n).catch(async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");let t=await eC(e,n,"signInWithPassword");return eV(e,t)}});{let t=await eC(e,n,"signInWithPassword");return eV(e,t)}case"emailLink":return eH(e,{email:this._email,oobCode:this._password});default:g(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return eU(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return eK(e,{idToken:t,email:this._email,oobCode:this._password});default:g(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function eW(e,t){return x(e,"POST","/v1/accounts:signInWithIdp",D(e,t))}class eQ extends ex{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new eQ(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,n
1once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:i}=t,r=a(t,["providerId","signInMethod"]);if(!n||!i)return null;let s=new eQ(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(e){return eW(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,eW(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,eW(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let 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=(0,r.xO)(t)}return e}}async function eJ(e,t){return P(e,"POST","/v1/accounts:sendVerificationCode",D(e,t))}async function eX(e,t){return x(e,"POST","/v1/accounts:signInWithPhoneNumber",D(e,t))}async function eY(e,t){let n=await x(e,"POST","/v1/accounts:signInWithPhoneNumber",D(e,t));if(n.temporaryProof)throw F(e,"account-exists-with-different-credential",n);return n}let eZ={USER_NOT_FOUND:"user-not-found"};async function e0(e,t){return x(e,"POST","/v1/accounts:signInWithPhoneNumber",D(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),eZ)}class e1 extends ex{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new e1({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new e1({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return eX(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return eY(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return e0(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:i}}toJSON(){let 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){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:r}=e;return n||t||i||r?new e1({verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:r}):null}}class e2{constructor(e){var t,n,i,s,a,o;let l=(0,r.zd)((0,r.pd)(e)),u=null!==(t=l.apiKey)&&void 0!==t?t:null,h=null!==(n=l.oobCode)&&void 0!==n?n:null,c=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!==(i=l.mode)&&void 0!==i?i:null);b(u&&h&&c,"argument-error"),this.apiKey=u,this.operation=c,this.code=h,this.continueUrl=null!==(s=l.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(a=l.languageCode)&&void 0!==a?a:null,this.tenantId=null!==(o=l.tenantId)&&void 0!==o?o:null}static parseLink(e){let t=function(e){let t=(0,r.zd)((0,r.pd)(e)).link,n=t?(0,r.zd)((0,r.pd)(t)).deep_link_id:null,i=(0,r.zd)((0,r.pd)(e)).deep_link_id;return(i?(0,r.zd)((0,r.pd)(i)).link:null)||i||n||t||e}(e);try{return new e2(t)}catch(e){return null}}}class e4{constructor(){this.providerId=e4.PROVIDER_ID}static credential(e,t){return eG._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=e2.parseLink(t);return b(n,"argument-error"),eG._fromEmailAndCode(e,n.code,n.tenantId)}}e4.PROVIDER_ID="password",e4.EMAIL_PASSWORD_SIGN_IN_METHOD="password",e4.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class e9{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 e6 extends e9{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class e5 extends e6{static credentialFromJSON(e){let t="string"==typeof e?JSON.parse(e):e;return b("providerId"in t&&"signInMethod"in t,"argument-error"),eQ._fromParams(t)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return b(e.idToken||e.accessToken,"argument-error"),eQ._fromParams(Object.assign(Object.assign({}
1,e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return e5.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return e5.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:i,pendingToken:r,nonce:s,providerId:a}=e;if(!n&&!i&&!t&&!r||!a)return null;try{return new e5(a)._credential({idToken:t,accessToken:n,nonce:s,pendingToken:r})}catch(e){return null}}}class e3 extends e6{constructor(){super("facebook.com")}static credential(e){return eQ._fromParams({providerId:e3.PROVIDER_ID,signInMethod:e3.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e3.credentialFromTaggedObject(e)}static credentialFromError(e){return e3.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e3.credential(e.oauthAccessToken)}catch(e){return null}}}e3.FACEBOOK_SIGN_IN_METHOD="facebook.com",e3.PROVIDER_ID="facebook.com";class e7 extends e6{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return eQ._fromParams({providerId:e7.PROVIDER_ID,signInMethod:e7.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return e7.credentialFromTaggedObject(e)}static credentialFromError(e){return e7.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return e7.credential(t,n)}catch(e){return null}}}e7.GOOGLE_SIGN_IN_METHOD="google.com",e7.PROVIDER_ID="google.com";class e8 extends e6{constructor(){super("github.com")}static credential(e){return eQ._fromParams({providerId:e8.PROVIDER_ID,signInMethod:e8.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e8.credentialFromTaggedObject(e)}static credentialFromError(e){return e8.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e8.credential(e.oauthAccessToken)}catch(e){return null}}}e8.GITHUB_SIGN_IN_METHOD="github.com",e8.PROVIDER_ID="github.com";class te extends ex{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return eW(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,eW(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,eW(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let{providerId:t,signInMethod:n,pendingToken:i}="string"==typeof e?JSON.parse(e):e;return t&&n&&i&&t===n?new te(t,i):null}static _create(e,t){return new te(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class tt extends e9{constructor(e){b(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return tt.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return tt.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let t=te.fromJSON(e);return b(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:t,providerId:n}=e;if(!t||!n)return null;try{return te._create(n,t)}catch(e){return null}}}class tn extends e6{constructor(){super("twitter.com")}static credential(e,t){return eQ._fromParams({providerId:tn.PROVIDER_ID,signInMethod:tn.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return tn.credentialFromTaggedObject(e)}static credentialFromError(e){return tn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return tn.credential(t,n)}catch(e){return null}}}async function ti(e,t){return x(e,"POST","/v1/accounts:signUp",D(e,t))}tn.TWITTER_SIGN_IN_METHOD="twitter.com",tn.PROVIDER_ID="twitter.com";class tr{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,i=!1){return new tr({user:await ee._fromIdTokenResponse(e,n,i),providerId:ts(n),_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){return await e._updateTokensIfNecessary(n,!0),new tr({user:e,providerId:ts(n),_tokenResponse:n,operationType:t})}}function ts(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}async function ta(e){var t;let n=eN(e);if(await n._initializationPromise,null===(t=n.currentUser)||void 0===t?void 0:t.isAnonymous)return new tr({user:n.currentUser,providerId:null,operationType:"signIn"});let i=await ti(n,{returnSecureToken:!0}),r=await tr._fromIdTokenResponse(n,"signIn",i,!0);return await n._updateCurrentUser(r.user),r}class to extends r.ZR{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,to.prototype),this.customData={appName:e.n
1ame,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new to(e,t,n,i)}}function tl(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw to._fromErrorAndOperation(e,n,t,i);throw n})}function tu(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function th(e,t){let n=(0,r.m9)(e);await td(!0,n,t);let{providerUserInfo:i}=await j(n.auth,{idToken:await n.getIdToken(),deleteProvider:[t]}),s=tu(i||[]);return n.providerData=n.providerData.filter(e=>s.has(e.providerId)),s.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function tc(e,t,n=!1){let i=await K(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return tr._forOperation(e,"link",i)}async function td(e,t,n){await Q(t),b(tu(t.providerData).has(n)===e,t.auth,!1===e?"provider-already-linked":"no-such-provider")}async function tf(e,t,n=!1){let{auth:i}=e,r="reauthenticate";try{let s=await K(e,tl(i,r,t,e),n);b(s.idToken,i,"internal-error");let a=H(s.idToken);b(a,i,"internal-error");let{sub:o}=a;return b(e.uid===o,i,"user-mismatch"),tr._forOperation(e,r,s)}catch(e){throw(null==e?void 0:e.code)==="auth/user-not-found"&&g(i,"user-mismatch"),e}}async function tp(e,t,n=!1){let i="signIn",r=await tl(e,i,t),s=await tr._fromIdTokenResponse(e,i,r);return n||await e._updateCurrentUser(s.user),s}async function tm(e,t){return tp(eN(e),t)}async function tg(e,t){let n=(0,r.m9)(e);return await td(!1,n,t.providerId),tc(n,t)}async function ty(e,t){return tf((0,r.m9)(e),t)}async function tv(e,t){return x(e,"POST","/v1/accounts:signInWithCustomToken",D(e,t))}async function tw(e,t){let n=eN(e),i=await tv(n,{token:t,returnSecureToken:!0}),r=await tr._fromIdTokenResponse(n,"signIn",i);return await n._updateCurrentUser(r.user),r}class t_{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?tb._fromServerResponse(e,t):"totpInfo"in t?tT._fromServerResponse(e,t):g(e,"internal-error")}}class tb extends t_{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new tb(t)}}class tT extends t_{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new tT(t)}}function tE(e,t,n){var i;b((null===(i=n.url)||void 0===i?void 0:i.length)>0,e,"invalid-continue-uri"),b(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&&(b(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(b(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)}async function tI(e,t,n){var i;let r=eN(e),s={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(i=r._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled){let e=await eC(r,s,"getOobCode",!0);n&&tE(r,e,n),await ez(r,e)}else n&&tE(r,s,n),await ez(r,s).catch(async e=>{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");let e=await eC(r,s,"getOobCode",!0);n&&tE(r,e,n),await ez(r,e)}})}async function tS(e,t,n){await eM((0,r.m9)(e),{oobCode:t,newPassword:n})}async function tk(e,t){await eF((0,r.m9)(e),{oobCode:t})}async function tC(e,t){let n=(0,r.m9)(e),i=await eM(n,{oobCode:t}),s=i.requestType;switch(b(s,n,"internal-error"),s){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":b(i.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":b(i.mfaInfo,n,"internal-error");default:b(i.email,n,"internal-error")}let a=null;return i.mfaInfo&&(a=t_._fromServerResponse(eN(n),i.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:a},operation:s}}async function tA(e,t){let{data:n}=await tC((0,r.m9)(e),t);return n.email}async function tR(e,t,n){var i;let r;let s=eN(e),a={returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"};if(null===(i=s._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled){let e=await eC(s,a,"signUpPassword");r=ti(s,e)}else r=ti(s,a).catch(async e=>
1{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.");let e=await eC(s,a,"signUpPassword");return ti(s,e)}});let o=await r.catch(e=>Promise.reject(e)),l=await tr._fromIdTokenResponse(s,"signIn",o);return await s._updateCurrentUser(l.user),l}function tN(e,t,n){return tm((0,r.m9)(e),e4.credential(t,n))}async function tO(e,t,n){var i;let r=eN(e),s={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"};function a(e,t){b(t.handleCodeInApp,r,"argument-error"),t&&tE(r,e,t)}if(null===(i=r._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled){let e=await eC(r,s,"getOobCode",!0);a(e,n),await eq(r,e)}else a(s,n),await eq(r,s).catch(async e=>{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");let e=await eC(r,s,"getOobCode",!0);a(e,n),await eq(r,e)}})}function tD(e,t){let n=e2.parseLink(t);return(null==n?void 0:n.operation)==="EMAIL_SIGNIN"}async function tP(e,t,n){let i=(0,r.m9)(e),s=e4.credentialWithLink(t,n||I());return b(s._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),tm(i,s)}async function tL(e,t){return P(e,"POST","/v1/accounts:createAuthUri",D(e,t))}async function tx(e,t){let n=S()?I():"http://localhost",{signinMethods:i}=await tL((0,r.m9)(e),{identifier:t,continueUri:n});return i||[]}async function tM(e,t){let n=(0,r.m9)(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&tE(n.auth,i,t);let{email:s}=await eB(n.auth,i);s!==e.email&&await e.reload()}async function tU(e,t,n){let i=(0,r.m9)(e),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t};n&&tE(i.auth,s,n);let{email:a}=await e$(i.auth,s);a!==e.email&&await e.reload()}async function tF(e,t){return P(e,"POST","/v1/accounts:update",t)}async function tV(e,{displayName:t,photoURL:n}){if(void 0===t&&void 0===n)return;let i=(0,r.m9)(e),s=await i.getIdToken(),a=await K(i,tF(i.auth,{idToken:s,displayName:t,photoUrl:n,returnSecureToken:!0}));i.displayName=a.displayName||null,i.photoURL=a.photoUrl||null;let o=i.providerData.find(({providerId:e})=>"password"===e);o&&(o.displayName=i.displayName,o.photoURL=i.photoURL),await i._updateTokensIfNecessary(a)}function tj(e,t){return tz((0,r.m9)(e),t,null)}function tB(e,t){return tz((0,r.m9)(e),null,t)}async function tz(e,t,n){let{auth:i}=e,r={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(r.email=t),n&&(r.password=n);let s=await K(e,eU(i,r));await e._updateTokensIfNecessary(s,!0)}class tq{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class t$ extends tq{constructor(e,t,n,i){super(e,t,n),this.username=i}}class tH extends tq{constructor(e,t){super(e,"facebook.com",t)}}class tK extends t${constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class tG extends tq{constructor(e,t){super(e,"google.com",t)}}class tW extends t${constructor(e,t,n){super(e,"twitter.com",t,n)}}function tQ(e){let{user:t,_tokenResponse:n}=e;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;let{providerId:i}=e,r=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},s=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!i&&(null==e?void 0:e.idToken)){let i=null===(n=null===(t=H(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(i)return new tq(s,"anonymous"!==i&&"custom"!==i?i:null)}if(!i)return null;switch(i){case"facebook.com":return new tH(s,r);case"github.com":return new tK(s,r);case"google.com":return new tG(s,r);case"twitter.com":return new tW(s,r,e.screenName||null);case"custom":case"anonymous":return new tq(s,null);default:return new tq(s,i,r)}}(n)}class tJ{constructor(e,t,n){this.type=e,this.credential=t,this.auth=n}static _fromIdtoken(e,t){return new tJ("enroll",e,t)}static _fromMfaPendingCredential(e){return new tJ("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t,n;if(null==e?void 0:e.multiFactorSession){if(null===(t=e.multiFactorSession)||void 0===t?void 0:t.pendingCredential)return tJ._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null===(n=e.multiFactorSession)||void 0===n?void 0:n.idToken)return tJ._fromIdtoken(e.multiFactorSession.idToken)}return null}}class tX{constructor(e,t,n){this.session=e,this.hints=t,this.signInResolver=n}static _fromError(e,t){let n=eN(e),i=t.customData._serverResponse,r=(i.mfaInfo||[]).map(e=>t_._fromServerResponse(n,e));b(i.mfaPendingCredential,n,"internal-error");let s=tJ._fromMfaPendingCredential(i.mfaPendingCredential);return new tX(s,r,async e=>{let r=await e._process(n,s);delete i.mfaInfo,delete i.mfaPendingCredential;let a=Object.assign(Object.assign({},i),{idToken:r.idToken,refreshToken:r.refreshToken});switch(t.operationType){case"signIn":let o=await tr._fromIdTokenResponse(n,t.operationType,a);return await n._updateCurrentUser(o.user),o;case"reauthenticate":return b(t.user,n,"internal-error"),tr._forOperation(t.user,t.operationType,a);default:g(n,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}function tY(e,t){var n;let i=(0,r.m9)(e);return b(t.customData.operationType,i,"argument-error"),b(null===(n=t.customData._serverResponse)||void 0===n?void 0:n.mfaPendingCredential,i,"argument-error"),tX._fromError(i,t)}class tZ{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(t=>t_._fromServerResponse(e.auth,t)))})}static _fromUser(e){return new tZ(e)}async getSession(){return tJ._fromIdtoken(await this.user.getIdToken(),this.user.auth)}
1async enroll(e,t){let n=await this.getSession(),i=await K(this.user,e._process(this.user.auth,n,t));return await this.user._updateTokensIfNecessary(i),this.user.reload()}async unenroll(e){let t="string"==typeof e?e:e.uid,n=await this.user.getIdToken();try{var i,r;let e=await K(this.user,(i=this.user.auth,r={idToken:n,mfaEnrollmentId:t},P(i,"POST","/v2/accounts/mfaEnrollment:withdraw",D(i,r))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(e),await this.user.reload()}catch(e){throw e}}}let t0=new WeakMap;function t1(e){let t=(0,r.m9)(e);return t0.has(t)||t0.set(t,tZ._fromUser(t)),t0.get(t)}let t2="__sak";class t4{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(t2,"1"),this.storage.removeItem(t2),Promise.resolve(!0)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class t9 extends t4{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){let e=(0,r.z$)();return eu(e)||em(e)}()&&function(){try{return!!(window&&window!==window.top)}catch(e){return!1}}(),this.fallbackToPolling=ey(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});return}let n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){let i=this.storage.getItem(n);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}let i=()=>{let e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);(0,r.w1)()&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t?JSON.parse(t):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){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}t9.type="LOCAL";let t6=t9;class t5 extends t4{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}t5.type="SESSION";let t3=t5;class t7{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let n=new t7(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:n,data:i}=e.data,r=this.handlersMap[n];if(!(null==r?void 0:r.size))return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:n});let s=Array.from(r).map(async t=>t(e.origin,i)),a=await Promise.all(s.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:n,response:a})}_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 t8(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}t7.receivers=[];class ne{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,n=50){let i,r;let s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((a,o)=>{let l=t8("",20);s.port1.start();let u=setTimeout(()=>{o(Error("unsupported_event"))},n);r={messageChannel:s,onMessage(e){if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(u),i=setTimeout(()=>{o(Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(e.data.response);break;default:clearTimeout(u),clearTimeout(i),o(Error("invalid_response"))}}},this.handlers.add(r),s.port1.addEventListener("message",r.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{r&&this.removeMessageHandler(r)})}}function nt(){return window}
1function nn(){return void 0!==nt().WorkerGlobalScope&&"function"==typeof nt().importScripts}async function ni(){if(!(null==navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}let nr="firebaseLocalStorageDb",ns="firebaseLocalStorage",na="fbase_key";class no{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 nl(e,t){return e.transaction([ns],t?"readwrite":"readonly").objectStore(ns)}function nu(){let e=indexedDB.open(nr,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(ns,{keyPath:na})}catch(e){n(e)}}),e.addEventListener("success",async()=>{let n=e.result;n.objectStoreNames.contains(ns)?t(n):(n.close(),await new no(indexedDB.deleteDatabase(nr)).toPromise(),t(await nu()))})})}async function nh(e,t,n){return new no(nl(e,!0).put({[na]:t,value:n})).toPromise()}async function nc(e,t){let n=nl(e,!1).get(t),i=await new no(n).toPromise();return void 0===i?null:i.value}function nd(e,t){return new no(nl(e,!0).delete(t)).toPromise()}class nf{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 nu()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return nn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=t7._getInstance(nn()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await ni(),!this.activeServiceWorker)return;this.sender=new ne(this.activeServiceWorker);let n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null==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;let e=await nu();return await nh(e,t2,"1"),await nd(e,t2),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>nh(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>nc(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>nd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new no(nl(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],n=new Set;for(let{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(let e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(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()}}nf.type="LOCAL";let np=nf;class nm{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){let n=this.counter;return this._widgets.set(n,new ng(e,this.auth.name,t||{})),this.counter++,n}reset(e){var t;let n=e||1e12;null===(t=this._widgets.get(n))||void 0===t||t.delete(),this._widgets.delete(n)}getResponse(e){var t;return(null===(t=this._widgets.get(e||1e12))||void 0===t?void 0:t.getResponse())||""}async execute(e){var t;return null===(t=this._widgets.get(e||1e12))||void 0===t||t.execute(),""}}class ng{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i="string"==typeof e?document.getElementById(e):e;b(i,"argument-error",{appName:t}),this.container=i,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(e){let t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<50;e++)t.push(n.charAt(Math.floor(Math.random()*n.length)));return t.join("")}(0);let{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 Error("reCAPTCHA mock was already deleted!")}}let ny=eS("rcb"),nv=new C(3e4,6e4);class nw{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!(null===(e=nt().grecaptcha)||void 0===e?void 0:e.render)}load(e,t=""){return(b(t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t),e,"argument-error"),this.shouldResolveImmediately(t)&&eb(nt().grecaptcha))?Promise.resolve(nt().grecaptcha):new Promise((n,i)=>
1{let s=nt().setTimeout(()=>{i(y(e,"network-request-failed"))},nv.get());nt()[ny]=()=>{nt().clearTimeout(s),delete nt()[ny];let r=nt().grecaptcha;if(!r||!eb(r)){i(y(e,"internal-error"));return}let a=r.render;r.render=(e,t)=>{let n=a(e,t);return this.counter++,n},this.hostLanguage=t,n(r)},eI(`https://www.google.com/recaptcha/api.js??${(0,r.xO)({onload:ny,render:"explicit",hl:t})}`).catch(()=>{clearTimeout(s),i(y(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!!(null===(t=nt().grecaptcha)||void 0===t?void 0:t.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}class n_{async load(e){return new nm(e)}clearedOneInstance(){}}let nb="recaptcha",nT={theme:"light",type:"image"};class nE{constructor(e,t=Object.assign({},nT),n){this.parameters=t,this.type=nb,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=eN(n),this.isInvisible="invisible"===this.parameters.size,b("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");let i="string"==typeof e?document.getElementById(e):e;b(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new n_:new nw,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha();return t.getResponse(e)||new Promise(n=>{let i=e=>{e&&(this.tokenChangeListeners.delete(i),n(e))};this.tokenChangeListeners.add(i),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){b(!this.parameters.sitekey,this.auth,"argument-error"),b(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),b("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof e)e(t);else if("string"==typeof e){let n=nt()[e];"function"==typeof n&&n(t)}}}assertNotDestroyed(){b(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}
1async init(){let e;b(S()&&!nn(),this.auth,"internal-error"),await (e=null,new Promise(t=>{if("complete"===document.readyState){t();return}e=()=>t(),window.addEventListener("load",e)}).catch(t=>{throw e&&window.removeEventListener("load",e),t})),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let t=await ew(this.auth);b(t,this.auth,"internal-error"),this.parameters.sitekey=t}getAssertedRecaptcha(){return b(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class nI{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=e1._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function nS(e,t,n){let i=eN(e);return new nI(await nA(i,t,(0,r.m9)(n)),e=>tm(i,e))}async function nk(e,t,n){let i=(0,r.m9)(e);return await td(!1,i,"phone"),new nI(await nA(i.auth,t,(0,r.m9)(n)),e=>tg(i,e))}async function nC(e,t,n){let i=(0,r.m9)(e);return new nI(await nA(i.auth,t,(0,r.m9)(n)),e=>ty(i,e))}async function nA(e,t,n){var i,r,s;let a=await n.verify();try{let o;if(b("string"==typeof a,e,"argument-error"),b(n.type===nb,e,"argument-error"),o="string"==typeof t?{phoneNumber:t}:t,"session"in o){let t=o.session;if("phoneNumber"in o)return b("enroll"===t.type,e,"internal-error"),(await (r={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,recaptchaToken:a}},P(e,"POST","/v2/accounts/mfaEnrollment:start",D(e,r)))).phoneSessionInfo.sessionInfo;{b("signin"===t.type,e,"internal-error");let n=(null===(i=o.multiFactorHint)||void 0===i?void 0:i.uid)||o.multiFactorUid;return b(n,e,"missing-multi-factor-info"),(await (s={mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:a}},P(e,"POST","/v2/accounts/mfaSignIn:start",D(e,s)))).phoneResponseInfo.sessionInfo}}{let{sessionInfo:t}=await eJ(e,{phoneNumber:o.phoneNumber,recaptchaToken:a});return t}}finally{n._reset()}}async function nR(e,t){await tc((0,r.m9)(e),t)}class nN{constructor(e){this.providerId=nN.PROVIDER_ID,this.auth=eN(e)}verifyPhoneNumber(e,t){return nA(this.auth,e,(0,r.m9)(t))}static credential(e,t){return e1._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;let{phoneNumber:t,temporaryProof:n}=e;return t&&n?e1._fromTokenResponse(t,n):null}}function nO(e,t){return t?en(t):(b(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}nN.PROVIDER_ID="phone",nN.PHONE_SIGN_IN_METHOD="phone";class nD extends ex{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return eW(e,this._buildIdpRequest())}_linkToIdToken(e,t){return eW(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return eW(e,this._buildIdpRequest())}_buildIdpRequest(e){let 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 nP(e){return tp(e.auth,new nD(e),e.bypassAuthState)}function nL(e){let{auth:t,user:n}=e;return b(n,t,"internal-error"),tf(n,new nD(e),e.bypassAuthState)}async function nx(e){let{auth:t,user:n}=e;return b(n,t,"internal-error"),tc(n,new nD(e),e.bypassAuthState)}class nM{constructor(e,t,n,i,r=!1){this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=r,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){let{urlResponse:t,sessionId:n,postBody:i,tenantId:r,error:s,type:a}=e;if(s){this.reject(s);return}let o={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return nP;case"linkViaPopup":case"linkViaRedirect":return nx;case"reauthViaPopup":case"reauthViaRedirect":return nL;default:g(this.auth,"internal-error")}}resolve(e){E(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){E(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()}}let nU=new C(2e3,1e4);
1async function nF(e,t,n){let i=eN(e);w(e,t,e9);let r=nO(i,n);return new nB(i,"signInViaPopup",t,r).executeNotNull()}async function nV(e,t,n){let i=(0,r.m9)(e);w(i.auth,t,e9);let s=nO(i.auth,n);return new nB(i.auth,"reauthViaPopup",t,s,i).executeNotNull()}async function nj(e,t,n){let i=(0,r.m9)(e);w(i.auth,t,e9);let s=nO(i.auth,n);return new nB(i.auth,"linkViaPopup",t,s,i).executeNotNull()}class nB extends nM{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,nB.currentPopupAction&&nB.currentPopupAction.cancel(),nB.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return b(e,this.auth,"internal-error"),e}async onExecution(){E(1===this.filter.length,"Popup operations only handle one event");let e=t8();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(y(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(y(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,nB.currentPopupAction=null}pollUserCancellation(){let e=()=>{var t,n;if(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(y(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,nU.get())};e()}}nB.currentPopupAction=null;let nz=new Map;class nq extends nM{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=nz.get(this.auth._key());if(!e){try{let t=await n$(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}nz.set(this.auth._key(),e)}return this.bypassAuthState||nz.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function n$(e,t){let n=nQ(t),i=nW(e);if(!await i._isAvailable())return!1;let r=await i._get(n)==="true";return await i._remove(n),r}async function nH(e,t){return nW(e)._set(nQ(t),"true")}function nK(){nz.clear()}function nG(e,t){nz.set(e._key(),t)}function nW(e){return en(e._redirectPersistence)}function nQ(e){return es("pendingRedirect",e.config.apiKey,e.name)}function nJ(e,t,n){return nX(e,t,n)}async function nX(e,t,n){let i=eN(e);w(e,t,e9),await i._initializationPromise;let r=nO(i,n);return await nH(r,i),r._openRedirect(i,t,"signInViaRedirect")}function nY(e,t,n){return nZ(e,t,n)}async function nZ(e,t,n){let i=(0,r.m9)(e);w(i.auth,t,e9),await i.auth._initializationPromise;let s=nO(i.auth,n);await nH(s,i.auth);let a=await n9(i);return s._openRedirect(i.auth,t,"reauthViaRedirect",a)}function n0(e,t,n){return n1(e,t,n)}async function n1(e,t,n){let i=(0,r.m9)(e);w(i.auth,t,e9),await i.auth._initializationPromise;let s=nO(i.auth,n);await td(!1,i,t.providerId),await nH(s,i.auth);let a=await n9(i);return s._openRedirect(i.auth,t,"linkViaRedirect",a)}async function n2(e,t){return await eN(e)._initializationPromise,n4(e,t,!1)}async function n4(e,t,n=!1){let i=eN(e),r=nO(i,t),s=new nq(i,r,n),a=await s.execute();return a&&!n&&(delete a.user._redirectEventId,await i._persistUserIfCurrent(a.user),await i._setRedirectUser(null,t)),a}async function n9(e){let t=t8(`${e.uid}:::`);return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class n6{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=
1Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return n3(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!n3(e)){let i=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(y(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(n5(e))}saveEventToCache(e){this.cachedEventUids.add(n5(e)),this.lastProcessedEventTime=Date.now()}}function n5(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function n3({type:e,error:t}){return"unknown"===e&&(null==t?void 0:t.code)==="auth/no-auth-event"}async function n7(e,t={}){return P(e,"GET","/v1/projects",t)}let n8=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ie=/^https?/;async function it(e){if(e.config.emulator)return;let{authorizedDomains:t}=await n7(e);for(let e of t)try{if(function(e){let t=I(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){let r=new URL(e);return""===r.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!ie.test(n))return!1;if(n8.test(e))return i===e;let r=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}(e))return}catch(e){}g(e,"unauthorized-domain")}let ii=new C(3e4,6e4);function ir(){let e=nt().___jsl;if(null==e?void 0:e.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let is=null,ia=new C(5e3,15e3),io={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},il=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function iu(e){let t=await (is=is||new Promise((t,n)=>{var i,r,s;function a(){ir(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{ir(),n(y(e,"network-request-failed"))},timeout:ii.get()})}if(null===(r=null===(i=nt().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)t(gapi.iframes.getContext());else if(null===(s=nt().gapi)||void 0===s?void 0:s.load)a();else{let t=eS("iframefcb");return nt()[t]=()=>{gapi.load?a():n(y(e,"network-request-failed"))},eI(`https://apis.google.com/js/api.js?onload=${t}`).catch(e=>n(e))}}).catch(e=>{throw is=null,e})),n=nt().gapi;return b(n,e,"internal-error"),t.open({where:document.body,url:function(e){let t=e.config;b(t.authDomain,e,"auth-domain-config-required");let n=t.emulator?A(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:s.SDK_VERSION},a=il.get(e.config.apiHost);a&&(i.eid=a);let o=e._getFrameworks();return o.length&&(i.fw=o.join(",")),`${n}?${(0,r.xO)(i).slice(1)}`}(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:io,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});let r=y(e,"network-request-failed"),s=nt().setTimeout(()=>{i(r)},ia.get());function a(){nt().clearTimeout(s),n(t)}t.ping(a).then(a,()=>{i(r)})}))}let ih={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ic{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let id=encodeURIComponent("fac");async function ip(e,t,n,i,a,o){b(e.config.authDomain,e,"auth-domain-config-required"),b(e.config.apiKey,e,"invali
1d-api-key");let l={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:s.SDK_VERSION,eventId:a};if(t instanceof e9)for(let[n,i]of(t.setDefaultLanguage(e.languageCode),l.providerId=t.providerId||"",(0,r.xb)(t.getCustomParameters())||(l.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(o||{})))l[n]=i;if(t instanceof e6){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(l.scopes=e.join(","))}for(let t of(e.tenantId&&(l.tid=e.tenantId),Object.keys(l)))void 0===l[t]&&delete l[t];let u=await e._getAppCheckToken(),h=u?`#${id}=${encodeURIComponent(u)}`:"";return`${function({config:e}){return e.emulator?A(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${(0,r.xO)(l).slice(1)}${h}`}let im="webStorageSupport";class ig{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=t3,this._completeRedirectFn=n4,this._overrideRedirectResult=nG}async _openPopup(e,t,n,i){var s;E(null===(s=this.eventManagers[e._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");let a=await ip(e,t,n,I(),i);return function(e,t,n,i=500,s=600){let a=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString(),l="",u=Object.assign(Object.assign({},ih),{width:i.toString(),height:s.toString(),top:a,left:o}),h=(0,r.z$)().toLowerCase();n&&(l=eh(h)?"_blank":n),el(h)&&(t=t||"http://localhost",u.scrollbars="yes");let c=Object.entries(u).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=(0,r.z$)()){var t;return em(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(h)&&"_self"!==l)return function(e,t){let n=document.createElement("a");n.href=e,n.target=t;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(t||"",l),new ic(null);let d=window.open(t||"",l,c);b(d,e,"popup-blocked");try{d.focus()}catch(e){}return new ic(d)}(e,a,t8())}async _openRedirect(e,t,n,i){var r;return await this._originValidation(e),r=await ip(e,t,n,I(),i),nt().location.href=r,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(E(n,"If manager is not set, promise should be"),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await iu(e),n=new n6(e);return t.register("authEvent",t=>(b(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(im,{type:im},n=>{var i;let r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[im];void 0!==r&&t(!!r),g(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=it(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return ey()||eu()||em()}}let iy=ig;class iv{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 T("unexpected MultiFactorSessionType")}}}class iw extends iv{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new iw(e)}_finalizeEnroll(e,t,n){return P(e,"POST","/v2/accounts/mfaEnrollment:finalize",D(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}_finalizeSignIn(e,t){return P(e,"POST","/v2/accounts/mfaSignIn:finalize",D(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}}class i_{constructor(){}static assertion(e){return iw._fromCredential(e)}}i_.FACTOR_ID="phone";class ib{static assertionForEnrollment(e,t){return iT._fromSecret(e,t)}static assertionForSignIn(e,t){return iT._fromEnrollmentId(e,t)}static async generateSecret(e){var t;b(void 0!==e.auth,"internal-error");let n=await P(t=e.auth,"POST","/v2/accounts/mfaEnrollment:start",D(t,{idToken:e.credential,totpEnrollmentInfo:{}}));return iE._fromStartTotpMfaEnrollmentResponse(n,e.auth)}}ib.FACTOR_ID="totp";class iT extends iv{constructor(e,t,n){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(e,t){return new iT(t,void 0,e)}static _fromEnrollmentId(e,t){return new iT(t,e)}async _finalizeEnroll(e,t,n){return b(void 0!==this.secret,e,"argument-error"),P(e,"POST","/v2/accounts/mfaEnrollment:finalize",D(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)}))}async _finalizeSignIn(e,t){b(void 0!==this.enrollmentId&&void 0!==this.otp,e,"argument-error");let n={verificationCode:this.otp};return P(e,"POST","/v2/accounts/mfaSignIn:finalize",D(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n}))}}class iE{constructor(e,t,n,i,r,s,a){this.sessionInfo=s,this.auth=a,this.secretKey=e,this.hashingAlgorithm=t,this.co
1deLength=n,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=r}static _fromStartTotpMfaEnrollmentResponse(e,t){return new iE(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){var n;let i=!1;return(iI(e)||iI(t))&&(i=!0),i&&(iI(e)&&(e=(null===(n=this.auth.currentUser)||void 0===n?void 0:n.email)||"unknownuser"),iI(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}}function iI(e){return void 0===e||(null==e?void 0:e.length)===0}var iS="@firebase/auth",ik="0.23.2";class iC{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(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){b(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let iA=(0,r.Pz)("authIdTokenMaxAge")||300,iR=null,iN=e=>async t=>{let n=t&&await t.getIdTokenResult(),i=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(i&&i>iA)return;let r=null==n?void 0:n.token;iR!==r&&(iR=r,await fetch(e,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};function iO(e=(0,s.getApp)()){let t=(0,s._getProvider)(e,"auth");if(t.isInitialized())return t.getImmediate();let n=function(e,t){let n=(0,s._getProvider)(e,"auth");if(n.isInitialized()){let e=n.getImmediate(),i=n.getOptions();if((0,r.vZ)(i,null!=t?t:{}))return e;g(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:iy,persistence:[np,t6,t3]}),i=(0,r.Pz)("authTokenSyncURL");if(i){var a,o;let e=iN(i);a=()=>e(n.currentUser),(0,r.m9)(n).beforeAuthStateChanged(e,a),o=t=>e(t),(0,r.m9)(n).onIdTokenChanged(o,void 0,void 0)}let l=(0,r.q4)("auth");return l&&eD(n,`http://${l}`),n}i="Browser",(0,s._registerComponent)(new l.wA("auth",(e,{options:t})=>{let n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:o}=n.options;b(a&&!a.includes(":"),"invalid-api-key",{appName:n.name});let l=new eR(n,r,s,{apiKey:a,authDomain:o,clientPlatform:i,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ev(i)});return function(e,t){let n=(null==t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(en);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver)}(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),(0,s._registerComponent)(new l.wA("auth-internal",e=>new iC(eN(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,s.registerVersion)(iS,ik,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(i)),(0,s.registerVersion)(iS,ik,"esm2017")},4444:function(e,t,n){"use strict";n.d(t,{BH:function(){return w},G6:function(){return A},L:function(){return u},LL:function(){return D},P0:function(){return g},Pz:function(){return v},Sg:function(){return _},UG:function(){return E},ZB:function(){return function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(let i in n)n.hasOwnProperty(i)&&"__proto__"!==i&&(t[i]=e(t[i],n[i]));return t}},ZR:function(){return O},aH:function(){return y},b$:function(){return k},eu:function(){return N},hl:function(){return R},jU:function(){return I},m9:function(){return q},ne:function(){return j},pd:function(){return V},q4:function(){return m},r3:function(){return L},ru:function(){return S},tV:function(){return h},uI:function(){return T},vZ:function(){return function e(t,n){if(t===n)return!0;let i=Object.keys(t),r=Object.keys(n);for(let s of i){if(!r.includes(s))return!1;let i=t[s],a=n[s];if(M(i)&&M(a)){if(!e(i,a))return!1}else if(i!==a)return!1}for(let e of r)if(!i.includes(e))return!1;return!0}},w1:function(){return C},xO:function(){return U},xb:function(){return x},z$:function(){return b},zd:function(){return F}});var i=n(3454);let r=function(e){let t=[],n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:((64512&r)==55296&&i+1<e.length&&(64512&e.charCodeAt(i+1))==56320?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[
1n++]=r>>18|240,t[n++]=r>>12&63|128):t[n++]=r>>12|224,t[n++]=r>>6&63|128),t[n++]=63&r|128)}return t},s=function(e){let t=[],n=0,i=0;for(;n<e.length;){let r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){let s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){let s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{let s=e[n++],a=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&a)}}return t.join("")},a={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){let r=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,u=r>>2,h=(3&r)<<4|a>>4,c=(15&a)<<2|l>>6,d=63&l;o||(d=64,s||(c=64)),i.push(n[u],n[h],n[c],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):s(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){let r=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0,a=++t<e.length?n[e.charAt(t)]:64,l=++t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==s||null==a||null==l)throw new o;let u=r<<2|s>>4;if(i.push(u),64!==a){let e=s<<4&240|a>>2;if(i.push(e),64!==l){let e=a<<6&192|l;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let l=function(e){let t=r(e);return a.encodeByteArray(t,!0)},u=function(e){return l(e).replace(/\./g,"")},h=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},c=()=>(function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw Error("Unable to locate global object.")})().__FIREBASE_DEFAULTS__,d=()=>{if(void 0===i||void 0===i.env)return;let e=i.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},f=()=>{let e;if("undefined"==typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&h(e[1]);return t&&JSON.parse(t)},p=()=>{try{return c()||d()||f()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},m=e=>{var t,n;return null===(n=null===(t=p())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},g=e=>{let t=m(e);if(!t)return;let n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]},y=()=>{var e;return null===(e=p())||void 0===e?void 0:e.config},v=e=>{var t;return null===(t=p())||void 0===t?void 0:t[`_${e}`]};class w{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}function _(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');
1let n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[u(JSON.stringify({alg:"none",type:"JWT"})),u(JSON.stringify(s)),""].join(".")}function b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function T(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(b())}function E(){var e;let t=null===(e=p())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(e){return!1}}function I(){return"object"==typeof self&&self.self===self}function S(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function k(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function C(){let e=b();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function A(){return!E()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function R(){try{return"object"==typeof indexedDB}catch(e){return!1}}function N(){return new Promise((e,t)=>{try{let n=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}class O extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,O.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,D.prototype.create)}}class D{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},i=`${this.service}/${e}`,r=this.errors[e],s=r?r.replace(P,(e,t)=>{let i=n[t];return null!=i?String(i):`<${t}?>`}):"Error",a=`${this.serviceName}: ${s} (${i}).`;return new O(i,a,n)}}let P=/\{\$([^}]+)}/g;function L(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function x(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function M(e){return null!==e&&"object"==typeof e}function U(e){let t=[];for(let[n,i]of Object.entries(e))Array.isArray(i)?i.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function F(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[n,i]=e.split("=");
1t[decodeURIComponent(n)]=decodeURIComponent(i)}}),t}function V(e){let t=e.indexOf("?");if(!t)return"";let n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}function j(e,t){let n=new B(e,t);return n.subscribe.bind(n)}class B{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 i;if(void 0===e&&void 0===t&&void 0===n)throw Error("Missing Observer.");void 0===(i=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:n}:e).next&&(i.next=z),void 0===i.error&&(i.error=z),void 0===i.complete&&(i.complete=z);let r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),r}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<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function z(){}function q(e){return e&&e._delegate?e._delegate:e}},3454:function(e,t,n){"use strict";var i,r;e.exports=(null==(i=n.g.process)?void 0:i.env)&&"object"==typeof(null==(r=n.g.process)?void 0:r.env)?n.g.process:n(7663)},3837:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return n(3414)}])},1124:function(e,t,n){"use strict";n.d(t,{S:function(){return i}});let i=n(7294).createContext({})},5202:function(e,t,n){"use strict";n.d(t,{I8:function(){return c},OE:function(){return m},db:function(){return h},iH:function(){return g},bo:function(){return p},tO:function(){return d},gU:function(){return f}});var i=n(5893),r=n(5816);(0,r.registerVersion)("firebase","9.23.0","app");var s=n(6100),a=n(3446);n(4444),n(3333),n(8463);var o=n(6650),l=n(6501);n(7294);let u=(0,r.initializeApp)({apiKey:"AIzaSyARpxVaU_5VhISTsdxt3QPtnv78E81f5EA",authDomain:"fitness-8cde3.firebaseapp.com",databaseURL:"https://fitness-8cde3.firebaseio.com",projectId:"fitness-8cde3",storageBucket:"fitness-8cde3.appspot.com",messagingSenderId:"545034120793",appId:"1:545034120793:web:8a8416e13d03626d1dcb48",measurementId:"G-KDEPEM06HD"}),h=(0,s.ad)(u),c=(0,a.o)(u),d=(0,o.cF)(u),f=async function(e){let{ref:t,data:n}=e;async function r(e){let{ref:t,data:n}=e;"new"===t[t.length-1]?await (0,s.ET)((0,s.hJ)(h,...t.slice(0,-1)),n):await (0,s.r7)((0,s.JU)(h,...t),n)}console.log(t,n),l.ZP.promise(r({ref:t,data:n}),{loading:"Saving...",success:(0,i.jsx)("b",{children:"Settings saved!"}),error:(0,i.jsx)("b",{children:"Could not save."})})},p=async function(e){let{ref:t,data:n}=e;console.log(t,n),await (0,s.pl)((0,s.JU)(h,...t),n)},m=async function(e,t){let n=await (0,s.ET)((0,s.hJ)(h,"units"),e);t&&t(n.id)},g=async function(e){let{ref:t}=e;await (0,s.oe)((0,s.JU)(h,...t))}},3414:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var i=n(5893),r=n(7294);n(2073),n(484),n(7685),n(5532),n(7335),n(479);var s=n(1124),a=n(5202);function o(e){let{Component:t,pageProps:n}=e,[o,l]=(0,r.useState)({inited:!1});return(0,r.useEffect)(()=>{let e=a.I8.onAuthStateChanged(e=>{l(e)});return()=>e()},[]),(0,i.jsx)(s.S.Provider,{value:{state:o,dispatch:l},children:(0,i.jsx)(t,{...n})})}},7685:function(){},2073:function(){},484:function(){},5532:function(){},479:function(){},7335:function(){},7663:function(e){!function(){var t={229:function(e){var t,n,i,r=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}
1catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var l=[],u=!1,h=-1;function c(){u&&i&&(u=!1,i.length?l=i.concat(l):h=-1,l.length&&d())}function d(){if(!u){var e=o(c);u=!0;for(var t=l.length;t;){for(i=l,l=[];++h<t;)i&&i[h].run();h=-1,t=l.length}i=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}r.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||o(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(e){return[]},r.binding=function(e){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw Error("process.chdir is not supported")},r.umask=function(){return 0}}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var s=n[e]={exports:{}},a=!0;try{t[e](s,s.exports,i),a=!1}finally{a&&delete n[e]}return s.exports}i.ab="//";var r=i(229);e.exports=r}()},5816:function(e,t,n){"use strict";let i,r,s;n.r(t),n.d(t,{FirebaseError:function(){return l.ZR},SDK_VERSION:function(){return F},_DEFAULT_ENTRY_NAME:function(){return k},_addComponent:function(){return N},_addOrOverwriteComponent:function(){return O},_apps:function(){return A},_clearComponents:function(){return x},_components:function(){return R},_getProvider:function(){return P},_registerComponent:function(){return D},_removeServiceInstance:function(){return L},deleteApp:function(){return z},getApp:function(){return j},getApps:function(){return B},initializeApp:function(){return V},onLog:function(){return $},registerVersion:function(){return q},setLogLevel:function(){return H}});var a=n(8463),o=n(3333),l=n(4444);let u=(e,t)=>t.some(t=>e instanceof t),h=new WeakMap,c=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return c.get(e);if("objectStoreNames"===t)return e.objectStoreNames||d.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return g(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function g(e){var t;if(e instanceof IDBRequest)return function(e){let t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(g(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&h.set(t,e)}).catch(()=>{}),p.set(t,e),t}(e);if(f.has(e))return f.get(e);let n="function"==typeof(t=e)?t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(y(this),e),g(h.get(this))}:function(...e){return g(t.apply(y(this),e))}:function(e,...n){let i=t.call(y(this),e,...n);return d.set(i,e.sort?e.sort():[e]),g(i)}:(t instanceof IDBTransaction&&function(e){if(c.has(e))return;let t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});c.set(e,t)}(t),u(t,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(t,m):t;return n!==e&&(f.set(e,n),p.set(n,e)),n}let y=e=>p.get(e),v=["get","getKey","getAll","getAllKeys","count"],w=["put","add","delete","clear"],_=new Map;function b(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(_.get(t))return _.get(t);let n=t.replace(/FromIndex$/,""),i=t!==n,r=w.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||v.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,r?"readwrite":"readonly"),a=s.store;
1return i&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),r&&s.done]))[0]};return _.set(t,s),s}m={...s=m,get:(e,t,n)=>b(e,t)||s.get(e,t,n),has:(e,t)=>!!b(e,t)||s.has(e,t)};class T{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(!function(e){let t=e.getComponent();return(null==t?void 0:t.type)==="VERSION"}(e))return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let E="@firebase/app",I="0.9.13",S=new o.Yd("@firebase/app"),k="[DEFAULT]",C={[E]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},A=new Map,R=new Map;function N(e,t){try{e.container.addComponent(t)}catch(n){S.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function O(e,t){e.container.addOrOverwriteComponent(t)}function D(e){let t=e.name;if(R.has(t))return S.debug(`There were multiple attempts to register component ${t}.`),!1;
1for(let n of(R.set(t,e),A.values()))N(n,e);return!0}function P(e,t){let n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function L(e,t,n=k){P(e,t).clearInstance(n)}function x(){R.clear()}let M=new l.LL("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class U{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new a.wA("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw M.create("app-deleted",{appName:this._name})}}let F="9.23.0";function V(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});let i=Object.assign({name:k,automaticDataCollectionEnabled:!1},t),r=i.name;if("string"!=typeof r||!r)throw M.create("bad-app-name",{appName:String(r)});if(n||(n=(0,l.aH)()),!n)throw M.create("no-options");let s=A.get(r);if(s){if((0,l.vZ)(n,s.options)&&(0,l.vZ)(i,s.config))return s;throw M.create("duplicate-app",{appName:r})}let o=new a.H0(r);for(let e of R.values())o.addComponent(e);let u=new U(n,i,o);return A.set(r,u),u}function j(e=k){let t=A.get(e);if(!t&&e===k&&(0,l.aH)())return V();if(!t)throw M.create("no-app",{appName:e});return t}function B(){return Array.from(A.values())}async function z(e){let t=e.name;A.has(t)&&(A.delete(t),await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function q(e,t,n){var i;let r=null!==(i=C[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);let s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){let e=[`Unable to register library "${r}" with version "${t}":`];s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),S.warn(e.join(" "));return}D(new a.wA(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}function $(e,t){if(null!==e&&"function"!=typeof e)throw M.create("invalid-log-argument");(0,o.Am)(e,t)}function H(e){(0,o.Ub)(e)}let K="firebase-heartbeat-store",G=null;function W(){return G||(G=(function(e,t,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){let a=indexedDB.open(e,1),o=g(a);return i&&a.addEventListener("upgradeneeded",e=>{i(g(a.result),e.oldVersion,e.newVersion,g(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o})("firebase-heartbeat-database",0,{upgrade:(e,t)=>{0===t&&e.createObjectStore(K)}}).catch(e=>{throw M.create("idb-open",{originalErrorMessage:e.message})})),G}async function Q(e){try{let t=await W();return await t.transaction(K).objectStore(K).get(X(e))}catch(e){if(e instanceof l.ZR)S.warn(e.message);else{let t=M.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}async function J(e,t){try{let n=(await W()).transaction(K,"readwrite"),i=n.objectStore(K);await i.put(t,X(e)),await n.done}catch(e){if(e instanceof l.ZR)S.warn(e.message);else{let t=M.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}function X(e){return`${e.name}!${e.options.appId}`}class Y{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new ee(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){let e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Z();return(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))?void 0:(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{let t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache))}
1async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";let e=Z(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){let n=[],i=e.slice();for(let r of e){let e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),et(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),et(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=(0,l.L)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function Z(){return new Date().toISOString().substring(0,10)}class ee{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,l.hl)()&&(0,l.eu)().then(()=>!0).catch(()=>!1)}async read(){return await this._canUseIndexedDBPromise&&await Q(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return J(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return J(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function et(e){return(0,l.L)(JSON.stringify({version:2,heartbeats:e})).length}D(new a.wA("platform-logger",e=>new T(e),"PRIVATE")),D(new a.wA("heartbeat",e=>new Y(e),"PRIVATE")),q(E,I,""),q(E,I,"esm2017"),q("fire-js","")},8463:function(e,t,n){"use strict";n.d(t,{H0:function(){return o},wA:function(){return r}});var i=n(4444);class r{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}}let s="[DEFAULT]";class a{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new i.BH;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),i=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(i)return null;throw e}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:s})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=s){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=s){return this.instances.has(e)}getOptions(e=s){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(i);return i}onInit(e,t){var n;let i=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(i,r);let s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let i of n)try{i(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:e===s?void 0:e,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}return n||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},3333:function(e,t,n){"use strict";var i,r;n.d(t,{Am:function(){return d},Ub:function(){return c},Yd:function(){return h},in:function(){return i}});let s=[];(r=i||(i={}))[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";let a={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.S
1ILENT},o=i.INFO,l={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},u=(e,t,...n)=>{if(t<e.logLevel)return;let i=new Date().toISOString(),r=l[t];if(r)console[r](`[${i}] ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class h{constructor(e){this.name=e,this._logLevel=o,this._logHandler=u,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?a[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}function c(e){s.forEach(t=>{t.setLogLevel(e)})}function d(e,t){for(let n of s){let r=null;t&&t.level&&(r=a[t.level]),null===e?n.userLogHandler=null:n.userLogHandler=(t,n,...s)=>{let a=s.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");n>=(null!=r?r:t.logLevel)&&e({level:i[n].toLowerCase(),message:a,args:s,type:t.name})}}}},6100:function(e,t,n){"use strict";n.d(t,{ET:function(){return lC},hJ:function(){return oW},oe:function(){return lk},JU:function(){return oQ},ad:function(){return oZ},cf:function(){return lA},pl:function(){return lI},r7:function(){return lS}});var i,r,s,a,o,l,u,h=n(5816),c=n(8463),d=n(3333),f=n(4444),p={},m=m||{},g=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{})||self;function y(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function v(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function w(e,t,n){return e.call.apply(e.bind,arguments)}function _(e,t,n){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function b(e,t,n){return(b=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?w:_).apply(null,arguments)}function T(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function E(e,t){function n(){}n.prototype=t.prototype,e.$=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.ac=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function I(){this.s=this.s,this.o=this.o}I.prototype.s=!1,I.prototype.sa=function(){this.s||(this.s=!0,this.N())},I.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};let S=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,0);for(let n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return -1};function k(e){let t=e.length;if(0<t){let n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function C(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(y(n)){let t=e.length||0,i=n.length||0;e.length=t+i;for(let r=0;r<i;r++)e[t+r]=n[r]}else e.push(n)}}function A(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}A.prototype.h=function(){this.defaultPrevented=!0};var R=function(){if(!g.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{g.addEventListener("test",()=>{},t),g.removeEventListener("test",()=>{},t)}catch(e){}return e}();function N(e){return/^[\s\xa0]*$/.test(e)}function O(){var e=g.navigator;return e&&(e=e.userAgent)?e:""}function D(e){return -1!=O().indexOf(e)}function P(e){return P[" "](e),e}P[" "]=function(){};var L=D("Opera"),x=D("Trident")||D("MSIE"),M=D("Edge"),U=M||x,F=D("Gecko")&&!(-1!=O().toLowerCase().indexOf("webkit")&&!D("Edge"))&&!(D("Trident")||D("MSIE"))&&!D("Edge"),V=-1!=O().toLowerCase().indexOf("webkit")&&!D("Edge");function j(){var e=g.document;return e?e.documentMode:void 0}e:{var B,z="",q=(B=O(),F?/rv:([^\);]+)(\)|;)/.exec(B):M?/Edge\/([\d\.]+)/.exec(B):x?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(B):V?/WebKit\/(\S+)/.exec(B):L?/(?:Version)[ \/]?(\S+)/.exec(B):void 0);if(q&&(z=q?q[1]:""),x){var $=j();if(null!=$&&$>parseFloat(z)){r=String($);break e}}r=z}var H=g.document&&x&&(j()||parseInt(r,10))||void 0;function K(e,t){if(A.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(F){e:{try{P(t.nodeName);var r=!0;break e}catch(e){}r=!1}r||(t=null)}}
1else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:G[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&K.$.h.call(this)}}E(K,A);var G={2:"touch",3:"pen",4:"mouse"};K.prototype.h=function(){K.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var W="closure_listenable_"+(1e6*Math.random()|0),Q=0;function J(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.la=r,this.key=++Q,this.fa=this.ia=!1}function X(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function Y(e,t,n){for(let i in e)t.call(n,e[i],i,e)}function Z(e){let t={};for(let n in e)t[n]=e[n];return t}let ee="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function et(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t])e[n]=i[n];for(let t=0;t<ee.length;t++)n=ee[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function en(e){this.src=e,this.g={},this.h=0}function ei(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=S(r,t);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(X(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function er(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.fa&&s.listener==t&&!!n==s.capture&&s.la==i)return r}return -1}en.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var a=er(e,t,i,r);return -1<a?(t=e[a],n||(t.ia=!1)):((t=new J(t,this.src,s,!!i,r)).ia=n,e.push(t)),t};var es="closure_lm_"+(1e6*Math.random()|0),ea={};function eo(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var a=v(r)?!!r.capture:!!r,o=ec(e);if(o||(e[es]=o=new en(e)),(n=o.add(t,n,i,a,s)).proxy)return n;if(i=function e(t){return eh.call(e.src,e.listener,t)},n.proxy=i,i.src=e,i.listener=n,e.addEventListener)R||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(eu(t.toString()),i);else if(e.addListener&&e.removeListener)e.addListener(i);else throw Error("addEventListener and attachEvent are unavailable.");return n}function el(e){if("number"!=typeof e&&e&&!e.fa){var t=e.src;if(t&&t[W])ei(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(eu(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=ec(t))?(ei(n,e),0==n.h&&(n.src=null,t[es]=null)):X(e)}}}function eu(e){return e in ea?ea[e]:ea[e]="on"+e}function eh(e,t){if(e.fa)e=!0;else{t=new K(t,this);var n=e.listener,i=e.la||e.src;e.ia&&el(e),e=n.call(i,t)}return e}function ec(e){return(e=e[es])instanceof en?e:null}var ed="__closure_events_fn_"+(1e9*Math.random()>>>0);function ef(e){return"function"==typeof e?e:(e[ed]||(e[ed]=function(t){return e.handleEvent(t)}),e[ed])}function ep(){I.call(this),this.i=new en(this),this.S=this,this.J=null}function em(e,t){var n,i=e.J;if(i)for(n=[];i;i=i.J)n.push(i);if(e=e.S,i=t.type||t,"string"==typeof t)t=new A(t,e);else if(t instanceof A)t.target=t.target||e;else{var r=t;et(t=new A(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var a=t.g=n[s];r=eg(a,i,!0,t)&&r}if(r=eg(a=t.g=e,i,!0,t)&&r,r=eg(a,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=eg(a=t.g=n[s],i,!1,t)&&r}function eg(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var a=t[s];if(a&&!a.fa&&a.capture==n){var o=a.listener,l=a.la||a.src;a.ia&&ei(e.i,a),r=!1!==o.call(l,i)&&r}}return r&&!i.defaultPrevented}E(ep,I),ep.prototype[W]=!0,ep.prototype.removeEventListener=function(e,t,n,i){!function e(t,n,i,r,s){if(Array.isArray(n))for(var a=0;a<n.length;a++)e(t,n[a],i,r,s);else(r=v(r)?!!r.capture:!!r,i=ef(i),t&&t[W])?(t=t.i,(n=String(n).toString())in t.g&&-1<(i=er(a=t.g[n],i,r,s))&&
1(X(a[i]),Array.prototype.splice.call(a,i,1),0==a.length&&(delete t.g[n],t.h--))):t&&(t=ec(t))&&(n=t.g[n.toString()],t=-1,n&&(t=er(n,i,r,s)),(i=-1<t?n[t]:null)&&el(i))}(this,e,t,n,i)},ep.prototype.N=function(){if(ep.$.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)X(n[i]);delete t.g[e],t.h--}}this.J=null},ep.prototype.O=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},ep.prototype.P=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};var ey=g.JSON.stringify;class ev{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}class ew{constructor(){this.h=this.g=null}add(e,t){let n=e_.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var e_=new ev(()=>new eb,e=>e.reset());class eb{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let eT,eE=!1,eI=new ew,eS=()=>{let e=g.Promise.resolve(void 0);eT=()=>{e.then(ek)}};var ek=()=>{let e;for(var t;e=null,eI.g&&(e=eI.g,eI.g=eI.g.next,eI.g||(eI.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){g.setTimeout(()=>{throw e},0)}(e)}e_.j(t),100>e_.h&&(e_.h++,t.next=e_.g,e_.g=t)}eE=!1};function eC(e,t){ep.call(this),this.h=e||1,this.g=t||g,this.j=b(this.qb,this),this.l=Date.now()}function eA(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function eR(e,t,n){if("function"==typeof e)n&&(e=b(e,n));else if(e&&"function"==typeof e.handleEvent)e=b(e.handleEvent,e);else throw Error("Invalid listener argument");return 2147483647<Number(t)?-1:g.setTimeout(e,t||0)}E(eC,ep),(u=eC.prototype).ga=!1,u.T=null,u.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),em(this,"tick"),this.ga&&(eA(this),this.start()))}},u.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())},u.N=function(){eC.$.N.call(this),eA(this),delete this.g};class eN extends I{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:function e(t){t.g=eR(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.j);let n=t.h;t.h=null,t.m.apply(null,n)}(this)}N(){super.N(),this.g&&(g.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function eO(e){I.call(this),this.h=e,this.g={}}E(eO,I);var eD=[];function eP(e,t,n,i){Array.isArray(n)||(n&&(eD[0]=n.toString()),n=eD);for(var r=0;r<n.length;r++){var s=function e(t,n,i,r,s){if(r&&r.once)return function e(t,n,i,r,s){if(Array.isArray(n)){for(var a=0;a<n.length;a++)e(t,n[a],i,r,s);return null}return i=ef(i),t&&t[W]?t.P(n,i,v(r)?!!r.capture:!!r,s):eo(t,n,i,!0,r,s)}(t,n,i,r,s);if(Array.isArray(n)){for(var a=0;a<n.length;a++)e(t,n[a],i,r,s);return null}return i=ef(i),t&&t[W]?t.O(n,i,v(r)?!!r.capture:!!r,s):eo(t,n,i,!1,r,s)}(t,n[r],i||e.handleEvent,!1,e.h||e);if(!s)break;e.g[s.key]=s}}function eL(e){Y(e.g,function(e,t){this.g.hasOwnProperty(t)&&el(e)},e),e.g={}}function ex(){this.g=!0}function eM(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var a=1;a<r.length;a++)r[a]=""}}}}return ey(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}eO.prototype.N=function(){eO.$.N.call(this),eL(this)},eO.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ex.prototype.Ea=function(){this.g=!1},ex.prototype.info=function(){};var eU={},eF=null;function eV(){return eF=eF||new ep}function ej(e){A.call(this,eU.Ta,e)}function eB(e){let t=eV();em(t,new ej(t))}function ez(e,t){A.call(this,eU.STAT_EVENT,e),this.stat=t}function eq(e){let t=eV();em(t,new ez(t,e))}function e$(e,t){A.call(this,eU.Ua,e),this.size=t}function eH(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return g.setTimeout(function(){e()},t)}eU.Ta="serverreachability",E(ej,A),eU.STAT_EVENT="statevent",E(ez,A),eU.Ua="timingevent",E(e$,A);var eK={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9}
1,eG={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function eW(){}function eQ(e){return e.h||(e.h=e.i())}function eJ(){}eW.prototype.h=null;var eX={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function eY(){A.call(this,"d")}function eZ(){A.call(this,"c")}function e0(){}function e1(e,t,n,i){this.l=e,this.j=t,this.m=n,this.W=i||1,this.U=new eO(this),this.P=e4,e=U?125:void 0,this.V=new eC(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new e2}function e2(){this.i=null,this.g="",this.h=!1}E(eY,A),E(eZ,A),E(e0,eW),e0.prototype.g=function(){return new XMLHttpRequest},e0.prototype.i=function(){return{}},a=new e0;var e4=45e3,e9={},e6={};function e5(e,t,n){e.L=1,e.v=tp(tu(t)),e.s=n,e.S=!0,e3(e,null)}function e3(e,t){e.G=Date.now(),te(e),e.A=tu(e.v);var n=e.A,i=e.W;Array.isArray(i)||(i=[String(i)]),tC(n.i,"t",i),e.C=0,n=e.l.J,e.h=new e2,e.g=ng(e.l,n?t:null,!e.s),0<e.O&&(e.M=new eN(b(e.Pa,e,e.g),e.O)),eP(e.U,e.g,"readystatechange",e.nb),t=e.I?Z(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),eB(),function(e,t,n,i,r,s){e.info(function(){if(e.g){if(s)for(var a="",o=s.split("&"),l=0;l<o.length;l++){var u=o[l].split("=");if(1<u.length){var h=u[0];u=u[1];var c=h.split("_");a=2<=c.length&&"type"==c[1]?a+(h+"=")+u+"&":a+(h+"=redacted&")}}else a=null}else a=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+t+"\n"+n+"\n"+a})}(e.j,e.u,e.A,e.m,e.W,e.s)}function e7(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.l.Ha}function e8(e,t,n){let i=!0,r;for(;!e.J&&e.C<n.length;)if((r=function(e,t){var n=e.C,i=t.indexOf("\n",n);return -1==i?e6:isNaN(n=Number(t.substring(n,i)))?e9:(i+=1)+n>t.length?e6:(t=t.slice(i,i+n),e.C=i+n,t)}(e,n))==e6){4==t&&(e.o=4,eq(14),i=!1),eM(e.j,e.m,null,"[Incomplete Response]");break}else if(r==e9){e.o=4,eq(15),eM(e.j,e.m,n,"[Invalid Chunk]"),i=!1;break}else eM(e.j,e.m,r,null),ts(e,r);e7(e)&&r!=e6&&r!=e9&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,eq(16),i=!1),e.i=e.i&&i,i?0<n.length&&!e.ba&&(e.ba=!0,(t=e.l).g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),nl(t),t.M=!0,eq(11))):(eM(e.j,e.m,n,"[Invalid Chunked Response]"),tr(e),ti(e))}function te(e){e.Y=Date.now()+e.P,tt(e,e.P)}function tt(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=eH(b(e.lb,e),t)}function tn(e){e.B&&(g.clearTimeout(e.B),e.B=null)}function ti(e){0==e.l.H||e.J||nc(e.l,e)}function tr(e){tn(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,eA(e.V),eL(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function ts(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||tL(n.i,e))){if(!e.K&&tL(n.i,e)&&3==n.H){try{var i=n.Ja.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(n.g.G+3e3<e.G)nh(n),ne(n);else break e}no(n),eq(18)}}else n.Fa=r[1],0<n.Fa-n.V&&37500>r[2]&&n.G&&0==n.A&&!n.v&&(n.v=eH(b(n.ib,n),6e3));if(1>=tP(n.i)&&n.oa){try{n.oa()}catch(e){}n.oa=void 0}}else nf(n,11)}else if((e.K||n.g==e)&&nh(n),!N(t))for(r=n.Ja.g.parse(t),t=0;t<r.length;t++){let o=r[t];if(n.V=o[0],o=o[1],2==n.H){if("c"==o[0]){n.K=o[1],n.pa=o[2];let t=o[3];null!=t&&(n.ra=t,n.l.info("VER="+n.ra));let r=o[4];null!=r&&(n.Ga=r,n.l.info("SVER="+n.Ga));let l=o[5];null!=l&&"number"==typeof l&&0<l&&(i=1.5*l,n.L=i,n.l.info("backChannelRequestTimeoutMs_="+i)),i=n;let u=e.g;if(u){let e=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.i;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(tx(s,s.h),s.h=null))}if(i.F){let e=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.Da=e,tf(i.I,i.F,e))}}if(n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms")),(i=n).wa=nm(i,i.J?i.pa:null,i.Y),e.K){tM(i.i,e);var a=i.L;a&&e.setTimeout(a),e.B&&(tn(e),te(e)),i.g=e}else na(i);0<n.j.length&&nn(n)}else"stop"!=o[0]&&"close"!=o[0]||nf(n,7)}else 3==n.H&&("stop"==o[0]||"close"==o[0]?"stop"==o[0]?nf(n,7):t8(n):"noop"!=o[0]&&n.h&&n.h.Aa(o),n.A=0)}}eB(4)}catch(e){}}function ta(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(y(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.ta&&"function"==typeof e.ta)return e.ta();if(!e.Z||"function"!=typeof e.Z){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(y(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(let i in t=[],n=0,e)t[n++]=i;return t}}}(e),i=function(e){if(e.Z&&"function"==typeof e.Z)return e.Z();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
1if(y(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,s=0;s<r;s++)t.call(void 0,i[s],n&&n[s],e)}(u=e1.prototype).setTimeout=function(e){this.P=e},u.nb=function(e){e=e.target;let t=this.M;t&&3==t4(e)?t.l():this.Pa(e)},u.Pa=function(e){try{if(e==this.g)e:{let h=t4(this.g);var t=this.g.Ia();let c=this.g.da();if(!(3>h)&&(3!=h||U||this.g&&(this.h.h||this.g.ja()||t9(this.g)))){this.J||4!=h||7==t||(8==t||0>=c?eB(3):eB(2)),tn(this);var n=this.g.da();this.ca=n;t:if(e7(this)){var i=t9(this.g);e="";var r=i.length,s=4==t4(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){tr(this),ti(this);var a="";break t}this.h.i=new g.TextDecoder}for(t=0;t<r;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:s&&t==r-1});i.splice(0,r),this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.ja();if(this.i=200==n,function(e,t,n,i,r,s,a){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+a})}(this.j,this.u,this.A,this.m,this.W,h,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var o,l=this.g;if((o=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!N(o)){var u=o;break t}}u=null}if(n=u)eM(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,ts(this,n);else{this.i=!1,this.o=3,eq(12),tr(this),ti(this);break e}}this.S?(e8(this,h,a),U&&this.i&&3==h&&(eP(this.U,this.V,"tick",this.mb),this.V.start())):(eM(this.j,this.m,a,null),ts(this,a)),4==h&&tr(this),this.i&&!this.J&&(4==h?nc(this.l,this):(this.i=!1,te(this)))}else(function(e){let t={};e=(e.g&&2<=t4(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(N(e[i]))continue;var n=function(e){var t=1;e=e.split(":");let n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}(e[i]);let r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();let s=t[r]||[];t[r]=s,s.push(n)}!function(e,t){for(let n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.o=3,eq(12)):(this.o=0,eq(13)),tr(this),ti(this)}}}catch(e){}finally{}},u.mb=function(){if(this.g){var e=t4(this.g),t=this.g.ja();this.C<t.length&&(tn(this),e8(this,e,t),this.i&&4!=e&&te(this))}},u.cancel=function(){this.J=!0,tr(this)},u.lb=function(){this.B=null;let e=Date.now();0<=e-this.Y?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.j,this.A),2!=this.L&&(eB(),eq(17)),tr(this),this.o=2,ti(this)):tt(this,this.Y-e)};var to=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function tl(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof tl){this.h=e.h,th(this,e.j),this.s=e.s,this.g=e.g,tc(this,e.m),this.l=e.l;var t=e.i,n=new tE;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),td(this,n),this.o=e.o}else e&&(t=String(e).match(to))?(this.h=!1,th(this,t[1]||"",!0),this.s=tm(t[2]||""),this.g=tm(t[3]||"",!0),tc(this,t[4]),this.l=tm(t[5]||"",!0),td(this,t[6]||"",!0),this.o=tm(t[7]||"")):(this.h=!1,this.i=new tE(null,this.h))}function tu(e){return new tl(e)}function th(e,t,n){e.j=n?tm(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function tc(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function td(e,t,n){var i,r;t instanceof tE?(e.i=t,i=e.i,(r=e.h)&&!i.j&&(tI(i),i.i=null,i.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(tS(this,t),tC(this,n,e))},i)),i.j=r):(n||(t=tg(t,tb)),e.i=new tE(t,e.h))}function tf(e,t,n){e.i.set(t,n)}function tp(e){return tf(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function tm(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function tg(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,ty),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ty(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}tl.prototype.toString=function(){var e=[],t=this.j;t&&e.push(tg(t,tv,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(tg(t,tv,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(tg(n,"/"==n.charAt(0)?t_:tw,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",tg(n,tT)),e.join("")};var tv=/[#\/\?@]/g,tw=/[#\?:]/g,t_=/[#\?]/g,tb=/[#\?@]/g,tT=/#/g;function tE(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function tI(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function tS(e,t){tI(e),t=tA(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function tk(e,t){return tI(e),t=tA(e,t),e.g.has(t)}
1function tC(e,t,n){tS(e,t),0<n.length&&(e.i=null,e.g.set(tA(e,t),k(n)),e.h+=n.length)}function tA(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(u=tE.prototype).add=function(e,t){tI(this),this.i=null,e=tA(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},u.forEach=function(e,t){tI(this),this.g.forEach(function(n,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},u.ta=function(){tI(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){let r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},u.Z=function(e){tI(this);let t=[];if("string"==typeof e)tk(this,e)&&(t=t.concat(this.g.get(tA(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},u.set=function(e,t){return tI(this),this.i=null,tk(this,e=tA(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},u.get=function(e,t){return e&&0<(e=this.Z(e)).length?String(e[0]):t},u.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var i=t[n];let s=encodeURIComponent(String(i)),a=this.Z(i);for(i=0;i<a.length;i++){var r=s;""!==a[i]&&(r+="="+encodeURIComponent(String(a[i]))),e.push(r)}}return this.i=e.join("&")};var tR=class{constructor(e,t){this.g=e,this.map=t}};function tN(e){this.l=e||tO,e=g.PerformanceNavigationTiming?0<(e=g.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(g.g&&g.g.Ka&&g.g.Ka()&&g.g.Ka().ec),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var tO=10;function tD(e){return!!e.h||!!e.g&&e.g.size>=e.j}function tP(e){return e.h?1:e.g?e.g.size:0}function tL(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function tx(e,t){e.g?e.g.add(t):e.h=t}function tM(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function tU(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let n of e.g.values())t=t.concat(n.F);return t}return k(e.i)}tN.prototype.cancel=function(){if(this.i=tU(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var tF=class{stringify(e){return g.JSON.stringify(e,void 0)}parse(e){return g.JSON.parse(e,void 0)}};function tV(){this.g=new tF}function tj(e,t,n,i,r){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,r(i)}catch(e){}}function tB(e){this.l=e.fc||null,this.j=e.ob||!1}function tz(e,t){ep.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=tq,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}E(tB,eW),tB.prototype.g=function(){return new tz(this.l,this.j)},tB.prototype.i=(i={},function(){return i}),E(tz,ep);var tq=0;function t$(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function tH(e){e.readyState=4,e.l=null,e.j=null,e.A=null,tK(e)}function tK(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(u=tz.prototype).open=function(e,t){if(this.readyState!=tq)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,tK(this)},u.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||g).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},u.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,tH(this)),this.readyState=tq},u.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,tK(this)),this.g&&(this.readyState=3,tK(this),this.g))){if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(void 0!==g.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;t$(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))}},u.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tH(this):tK(this),3==this.readyState&&t$(this)}},u.Za=function(e){this.g&&(this.response=this.responseText=e,tH(this))},u.Ya=function(e){this.g&&(this.response=e,tH(this))},u.ka=function(){this.g&&tH(this)},u.setRequestHeader=function(e,t){this.v.append(e,t)},u.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},u.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var n=t.next();!n.done;)e.push((n=n.value)[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(tz.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var tG=g.JSON.parse;function tW(e){ep.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=tQ,this.L=this.M=!1}E(tW,ep);var tQ="",tJ=/^https?$/i,tX=["POST","PUT"];function tY(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,tZ(e),t1(e)}function tZ(e){e.F||(e.F=!0,em(e,"complete"),em(e,"error"))}function t0(e){if(e.h&&void 0!==m&&(!e.C[1]||4!=t4(e)||2!=e.da())){if(e.v&&4==t4(e))eR(e.La,0,e);else if(em(e,"readystatechange"),4==t4(e)){e.h=!1;try{let a=e.da();switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,n,i=!0;break;default:i=!1}if(!(t=i)){if(n=0===a){var r=String(e.I).match(to)[1]||null;!r&&g.self&&g.self.location&&(r=g.self.location.protocol.slice(0,-1)),n=!tJ.test(r?r.toLowerCase():"")}t=n}if(t)em(e,"complete"),em(e,"success");else{e.m=6;try{var s=2<t4(e)?e.g.statusText:""}catch(e){s=""}e.j=s+" ["+e.da()+"]",tZ(e)}}finally{t1(e)}}}}function t1(e,t){if(e.g){t2(e);let n=e.g,i=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||em(e,"ready");try{n.onreadystatechange=i}catch(e){}}}
1function t2(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(g.clearTimeout(e.A),e.A=null)}function t4(e){return e.g?e.g.readyState:0}function t9(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case tQ:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function t6(e){let t="";return Y(e,function(e,n){t+=n+":"+e+"\r\n"}),t}function t5(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=t6(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):tf(e,t,n))}function t3(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function t7(e){this.Ga=0,this.j=[],this.l=new ex,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=t3("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=t3("baseRetryDelayMs",5e3,e),this.hb=t3("retryDelaySeedMs",1e4,e),this.eb=t3("forwardChannelMaxRetries",2,e),this.xa=t3("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.dc||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new tN(e&&e.concurrentRequestLimit),this.Ja=new tV,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}function t8(e){if(nt(e),3==e.H){var t=e.W++,n=tu(e.I);if(tf(n,"SID",e.K),tf(n,"RID",t),tf(n,"TYPE","terminate"),nr(e,n),(t=new e1(e,e.l,t)).L=2,t.v=tp(tu(n)),n=!1,g.navigator&&g.navigator.sendBeacon)try{n=g.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&g.Image&&((new Image).src=t.v,n=!0),n||(t.g=ng(t.l,null),t.g.ha(t.v)),t.G=Date.now(),te(t)}np(e)}function ne(e){e.g&&(nl(e),e.g.cancel(),e.g=null)}function nt(e){ne(e),e.u&&(g.clearTimeout(e.u),e.u=null),nh(e),e.i.cancel(),e.m&&("number"==typeof e.m&&g.clearTimeout(e.m),e.m=null)}function nn(e){if(!tD(e.i)&&!e.m){e.m=!0;var t=e.Na;eT||eS(),eE||(eT(),eE=!0),eI.add(t,e),e.C=0}}function ni(e,t){var n;n=t?t.m:e.W++;let i=tu(e.I);tf(i,"SID",e.K),tf(i,"RID",n),tf(i,"AID",e.V),nr(e,i),e.o&&e.s&&t5(i,e.o,e.s),n=new e1(e,e.l,n,e.C+1),null===e.o&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=ns(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),tx(e.i,n),e5(n,i,t)}function nr(e,t){e.na&&Y(e.na,function(e,n){tf(t,n,e)}),e.h&&ta({},function(e,n){tf(t,n,e)})}function ns(e,t,n){n=Math.min(e.j.length,n);var i=e.h?b(e.h.Va,e.h,e):null;e:{var r=e.j;let t=-1;for(;;){let e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let a=0;a<n;a++){let n=r[a].g,o=r[a].map;if(0>(n-=t))t=Math.max(0,r[a].g-100),s=!1;else try{!function(e,t,n){let i=n||"";try{ta(e,function(e,n){let r=e;v(e)&&(r=ey(e)),t.push(i+n+"="+encodeURIComponent(r))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}(o,e,"req"+n+"_")}catch(e){i&&i(o)}}if(s){i=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,i}function na(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;eT||eS(),eE||(eT(),eE=!0),eI.add(t,e),e.A=0}}function no(e){return!e.g&&!e.u&&!(3<=e.A)&&(e.ba++,e.u=eH(b(e.Ma,e),nd(e,e.A)),e.A++,!0)}function nl(e){null!=e.B&&(g.clearTimeout(e.B),e.B=null)}function nu(e){e.g=new e1(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=tu(e.wa);tf(t,"RID","rpc"),tf(t,"SID",e.K),tf(t,"AID",e.V),tf(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&tf(t,"TO",e.qa),tf(t,"TYPE","xmlhttp"),nr(e,t),e.o&&e.s&&t5(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=tp(tu(t)),n.s=null,n.S=!0,e3(n,e)}function nh(e){null!=e.v&&(g.clearTimeout(e.v),e.v=null)}function nc(e,t){var n=null;if(e.g==t){nh(e),nl(e),e.g=null;var i=2}else{if(!tL(e.i,t))return;n=t.F,tM(e.i,t),i=1}if(0!=e.H){if(t.i){if(1==i){n=t.s?t.s.length:0,t=Date.now()-t.G;var r,s=e.C;em(i=eV(),new e$(i,n)),nn(e)}else na(e)}else if(3==(s=t.o)||0==s&&0<t.ca||!(1==i&&(r=t,!(tP(e.i)>=e.i.j-(e.m?1:0))&&(e.m?(e.j=r.F.concat(e.j),!0):1!=e.H&&2!=e.H&&!(e.C>=(e.cb?0:e.eb))&&(e.m=eH(b(e.Na,e,r),nd(e,e.C)),e.C++,!0)))||2==i&&no(e)))switch(n&&0<n.length&&((t=e.i).i=t.i.concat(n)),s){case 1:nf(e,5);break;case 4:nf(e,10);break;case 3:nf(e,6);break;default:nf(e,2)}}}
1function nd(e,t){let n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function nf(e,t){if(e.l.info("Error code "+t),2==t){var n=null;e.h&&(n=null);var i=b(e.pb,e);n||(n=new tl("//www.google.com/images/cleardot.gif"),g.location&&"http"==g.location.protocol||th(n,"https"),tp(n)),function(e,t){let n=new ex;if(g.Image){let i=new Image;i.onload=T(tj,n,i,"TestLoadImage: loaded",!0,t),i.onerror=T(tj,n,i,"TestLoadImage: error",!1,t),i.onabort=T(tj,n,i,"TestLoadImage: abort",!1,t),i.ontimeout=T(tj,n,i,"TestLoadImage: timeout",!1,t),g.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(n.toString(),i)}else eq(2);e.H=0,e.h&&e.h.za(t),np(e),nt(e)}function np(e){if(e.H=0,e.ma=[],e.h){let t=tU(e.i);(0!=t.length||0!=e.j.length)&&(C(e.ma,t),C(e.ma,e.j),e.i.i.length=0,k(e.j),e.j.length=0),e.h.ya()}}function nm(e,t,n){var i=n instanceof tl?tu(n):new tl(n);if(""!=i.g)t&&(i.g=t+"."+i.g),tc(i,i.m);else{var r=g.location;i=r.protocol,t=t?t+"."+r.hostname:r.hostname,r=+r.port;var s=new tl(null);i&&th(s,i),t&&(s.g=t),r&&tc(s,r),n&&(s.l=n),i=s}return n=e.F,t=e.Da,n&&t&&tf(i,n,t),tf(i,"VER",e.ra),nr(e,i),i}function ng(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tW(n&&e.Ha&&!e.va?new tB({ob:!0}):e.va)).Oa(e.J),t}function ny(){}function nv(){if(x&&!(10<=Number(H)))throw Error("Environmental error: no available transport.")}function nw(e,t){ep.call(this),this.g=new t7(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!N(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!N(t)&&(this.g.F=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new nT(this)}function n_(e){eY.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(let n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function nb(){eZ.call(this),this.status=1}function nT(e){this.g=e}function nE(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}function nI(e,t,n){n||(n=0);var i=Array(16);if("string"==typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],a=t+(s^n&(r^s))+i[0]+3614090360&4294967295;a=s+(r^(t=n+(a<<7&4294967295|a>>>25))&(n^r))+i[1]+3905402710&4294967295,a=r+(n^(s=t+(a<<12&4294967295|a>>>20))&(t^n))+i[2]+606105819&4294967295,a=n+(t^(r=s+(a<<17&4294967295|a>>>15))&(s^t))+i[3]+3250441966&4294967295,a=t+(s^(n=r+(a<<22&4294967295|a>>>10))&(r^s))+i[4]+4118548399&4294967295,a=s+(r^(t=n+(a<<7&4294967295|a>>>25))&(n^r))+i[5]+1200080426&4294967295,a=r+(n^(s=t+(a<<12&4294967295|a>>>20))&(t^n))+i[6]+2821735955&4294967295,a=n+(t^(r=s+(a<<17&4294967295|a>>>15))&(s^t))+i[7]+4249261313&4294967295,a=t+(s^(n=r+(a<<22&4294967295|a>>>10))&(r^s))+i[8]+1770035416&4294967295,a=s+(r^(t=n+(a<<7&4294967295|a>>>25))&(n^r))+i[9]+2336552879&4294967295,a=r+(n^(s=t+(a<<12&4294967295|a>>>20))&(t^n))+i[10]+4294925233&4294967295,a=n+(t^(r=s+(a<<17&4294967295|a>>>15))&(s^t))+i[11]+2304563134&4294967295,a=t+(s^(n=r+(a<<22&4294967295|a>>>10))&(r^s))+i[12]+1804603682&4294967295,a=s+(r^(t=n+(a<<7&4294967295|a>>>25))&(n^r))+i[13]+4254626195&4294967295,a=r+(n^(s=t+(a<<12&4294967295|a>>>20))&(t^n))+i[14]+2792965006&4294967295,a=n+(t^(r=s+(a<<17&4294967295|a>>>15))&(s^t))+i[15]+1236535329&4294967295,n=r+(a<<22&4294967295|a>>>10),a=t+(r^s&(n^r))+i[1]+4129170786&4294967295,t=n+(a<<5&4294967295|a>>>
127),a=s+(n^r&(t^n))+i[6]+3225465664&4294967295,s=t+(a<<9&4294967295|a>>>23),a=r+(t^n&(s^t))+i[11]+643717713&4294967295,r=s+(a<<14&4294967295|a>>>18),a=n+(s^t&(r^s))+i[0]+3921069994&4294967295,n=r+(a<<20&4294967295|a>>>12),a=t+(r^s&(n^r))+i[5]+3593408605&4294967295,t=n+(a<<5&4294967295|a>>>27),a=s+(n^r&(t^n))+i[10]+38016083&4294967295,s=t+(a<<9&4294967295|a>>>23),a=r+(t^n&(s^t))+i[15]+3634488961&4294967295,r=s+(a<<14&4294967295|a>>>18),a=n+(s^t&(r^s))+i[4]+3889429448&4294967295,n=r+(a<<20&4294967295|a>>>12),a=t+(r^s&(n^r))+i[9]+568446438&4294967295,t=n+(a<<5&4294967295|a>>>27),a=s+(n^r&(t^n))+i[14]+3275163606&4294967295,s=t+(a<<9&4294967295|a>>>23),a=r+(t^n&(s^t))+i[3]+4107603335&4294967295,r=s+(a<<14&4294967295|a>>>18),a=n+(s^t&(r^s))+i[8]+1163531501&4294967295,n=r+(a<<20&4294967295|a>>>12),a=t+(r^s&(n^r))+i[13]+2850285829&4294967295,t=n+(a<<5&4294967295|a>>>27),a=s+(n^r&(t^n))+i[2]+4243563512&4294967295,s=t+(a<<9&4294967295|a>>>23),a=r+(t^n&(s^t))+i[7]+1735328473&4294967295,r=s+(a<<14&4294967295|a>>>18),a=n+(s^t&(r^s))+i[12]+2368359562&4294967295,a=t+((n=r+(a<<20&4294967295|a>>>12))^r^s)+i[5]+4294588738&4294967295,a=s+((t=n+(a<<4&4294967295|a>>>28))^n^r)+i[8]+2272392833&4294967295,a=r+((s=t+(a<<11&4294967295|a>>>21))^t^n)+i[11]+1839030562&4294967295,a=n+((r=s+(a<<16&4294967295|a>>>16))^s^t)+i[14]+4259657740&4294967295,a=t+((n=r+(a<<23&4294967295|a>>>9))^r^s)+i[1]+2763975236&4294967295,a=s+((t=n+(a<<4&4294967295|a>>>28))^n^r)+i[4]+1272893353&4294967295,a=r+((s=t+(a<<11&4294967295|a>>>21))^t^n)+i[7]+4139469664&4294967295,a=n+((r=s+(a<<16&4294967295|a>>>16))^s^t)+i[10]+3200236656&4294967295,a=t+((n=r+(a<<23&4294967295|a>>>9))^r^s)+i[13]+681279174&4294967295,a=s+((t=n+(a<<4&4294967295|a>>>28))^n^r)+i[0]+3936430074&4294967295,a=r+((s=t+(a<<11&4294967295|a>>>21))^t^n)+i[3]+3572445317&4294967295,a=n+((r=s+(a<<16&4294967295|a>>>16))^s^t)+i[6]+76029189&4294967295,a=t+((n=r+(a<<23&4294967295|a>>>9))^r^s)+i[9]+3654602809&4294967295,a=s+((t=n+(a<<4&4294967295|a>>>28))^n^r)+i[12]+3873151461&4294967295,a=r+((s=t+(a<<11&4294967295|a>>>21))^t^n)+i[15]+530742520&4294967295,a=n+((r=s+(a<<16&4294967295|a>>>16))^s^t)+i[2]+3299628645&4294967295,n=r+(a<<23&4294967295|a>>>9),a=t+(r^(n|~s))+i[0]+4096336452&4294967295,t=n+(a<<6&4294967295|a>>>26),a=s+(n^(t|~r))+i[7]+1126891415&4294967295,s=t+(a<<10&4294967295|a>>>22),a=r+(t^(s|~n))+i[14]+2878612391&4294967295,r=s+(a<<15&4294967295|a>>>17),a=n+(s^(r|~t))+i[5]+4237533241&4294967295,n=r+(a<<21&4294967295|a>>>11),a=t+(r^(n|~s))+i[12]+1700485571&4294967295,t=n+(a<<6&4294967295|a>>>26),a=s+(n^(t|~r))+i[3]+2399980690&4294967295,s=t+(a<<10&4294967295|a>>>22),a=r+(t^(s|~n))+i[10]+4293915773&4294967295,r=s+(a<<15&4294967295|a>>>17),a=n+(s^(r|~t))+i[1]+2240044497&4294967295,n=r+(a<<21&4294967295|a>>>11),a=t+(r^(n|~s))+i[8]+1873313359&4294967295,t=n+(a<<6&4294967295|a>>>26),a=s+(n^(t|~r))+i[15]+4264355552&4294967295,s=t+(a<<10&4294967295|a>>>22),a=r+(t^(s|~n))+i[6]+2734768916&4294967295,r=s+(a<<15&4294967295|a>>>17),a=n+(s^(r|~t))+i[13]+1309151649&4294967295,n=r+(a<<21&4294967295|a>>>11),a=t+(r^(n|~s))+i[4]+4149444226&4294967295,t=n+(a<<6&4294967295|a>>>26),a=s+(n^(t|~r))+i[11]+3174756917&4294967295,s=t+(a<<10&4294967295|a>>>22),a=r+(t^(s|~n))+i[2]+718787259&4294967295,r=s+(a<<15&4294967295|a>>>17),a=n+(s^(r|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(a<<21&4294967295|a>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+s&4294967295}function nS(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}(u=tW.prototype).Oa=function(e){this.M=e},u.ha=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():a.g(),this.C=this.u?eQ(this.u):eQ(a),this.g.onreadystatechange=b(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(e){tY(this,e);return}if(e=n||"",n=new Map(this.headers),i){if(Object.getPrototypeOf(i)===Object.prototype)for(var r in i)n.set(r,i[r]);else if("function"==typeof i.keys&&"function"==typeof i.get)for(let e of i.keys())n.set(e,i.get(e));else throw Error("Unknown input type for opt_headers: "+String(i))}for(let[s,a]of(i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),r=g.FormData&&e instanceof g.FormData,!(0<=S(tX,t))||i||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),n))this.g.setRequestHeader(s,a);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{var s;t2(this),0<this.B&&((this.L=(s=this.g,x&&"number"==typeof s.timeout&&void 0!==s.ontimeout))?(this.g.timeout=this.B,this.g.ontimeout=b(this.ua,this)):this.A=eR(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(e){tY(this,e)}},u.ua=function(){void 0!==m&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,em(this,"timeout"),this.abort(8))},u.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,em(this,"complete"),em(this,"abort"),t1(this))},u.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),t1(this,!0)),tW.$.N.c
1all(this)},u.La=function(){this.s||(this.G||this.v||this.l?t0(this):this.kb())},u.kb=function(){t0(this)},u.isActive=function(){return!!this.g},u.da=function(){try{return 2<t4(this)?this.g.status:-1}catch(e){return -1}},u.ja=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},u.Wa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),tG(t)}},u.Ia=function(){return this.m},u.Sa=function(){return"string"==typeof this.j?this.j:String(this.j)},(u=t7.prototype).ra=8,u.H=1,u.Na=function(e){if(this.m){if(this.m=null,1==this.H){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;let r=new e1(this,this.l,e),s=this.s;if(this.U&&(s?et(s=Z(s),this.U):s=this.U),null!==this.o||this.O||(r.I=s,s=null),this.P)e:{for(var t=0,n=0;n<this.j.length;n++){t:{var i=this.j[n];if("__data__"in i.map&&"string"==typeof(i=i.map.__data__)){i=i.length;break t}i=void 0}if(void 0===i)break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.j.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=ns(this,r,t),tf(n=tu(this.I),"RID",e),tf(n,"CVER",22),this.F&&tf(n,"X-HTTP-Session-Id",this.F),nr(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(t6(s)))+"&"+t:this.o&&t5(n,this.o,s)),tx(this.i,r),this.bb&&tf(n,"TYPE","init"),this.P?(tf(n,"$req",t),tf(n,"SID","null"),r.aa=!0,e5(r,n,null)):e5(r,n,t),this.H=2}}else 3==this.H&&(e?ni(this,e):0==this.j.length||tD(this.i)||ni(this))}},u.Ma=function(){if(this.u=null,nu(this),this.ca&&!(this.M||null==this.g||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=eH(b(this.jb,this),e)}},u.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,eq(10),ne(this),nu(this))},u.ib=function(){null!=this.v&&(this.v=null,ne(this),no(this),eq(19))},u.pb=function(e){e?(this.l.info("Successfully pinged google.com"),eq(2)):(this.l.info("Failed to ping google.com"),eq(1))},u.isActive=function(){return!!this.h&&this.h.isActive(this)},(u=ny.prototype).Ba=function(){},u.Aa=function(){},u.za=function(){},u.ya=function(){},u.isActive=function(){return!0},u.Va=function(){},nv.prototype.g=function(e,t){return new nw(e,t)},E(nw,ep),nw.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;eq(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=nm(e,null,e.Y),nn(e)},nw.prototype.close=function(){t8(this.g)},nw.prototype.u=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=ey(e),e=n);t.j.push(new tR(t.fb++,e)),3==t.H&&nn(t)},nw.prototype.N=function(){this.g.h=null,delete this.j,t8(this.g),delete this.g,nw.$.N.call(this)},E(n_,eY),E(nb,eZ),E(nT,ny),nT.prototype.Ba=function(){em(this.g,"a")},nT.prototype.Aa=function(e){em(this.g,new n_(e))},nT.prototype.za=function(e){em(this.g,new nb)},nT.prototype.ya=function(){em(this.g,"b")},E(nE,function(){this.blockSize=-1}),nE.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},nE.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,i=this.m,r=this.h,s=0;s<t;){if(0==r)for(;s<=n;)nI(this,e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(i[r++]=e.charCodeAt(s++),r==this.blockSize){nI(this,i),r=0;break}}else for(;s<t;)if(i[r++]=e[s++],r==this.blockSize){nI(this,i),r=0;break}}this.h=r,this.i+=t},nE.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.j(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var nk={};function nC(e){var t;return -128<=e&&128>e?(t=function(e){return new nS([0|e],0>e?-1:0)},Object.prototype.hasOwnProperty.call(nk,e)?nk[e]:nk[e]=t(e)):new nS([0|e],0>e?-1:0)}function nA(e){if(isNaN(e)||!isFinite(e))return nN;if(0>e)return nx(nA(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=nR;return new nS(t,0)}var nR=4294967296,nN=nC(0),nO=nC(1),nD=nC(16777216);function nP(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function nL(e){return -1==e.h}function nx(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new nS(n,~e.h).add(nO)}function nM(e,t){return e.add(nx(t))}function nU(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function nF(e,t){this.g=e,this.h=t}function nV(e,t){if(nP(t))throw Error("division by zero");if(nP(e))return new nF(nN,nN);if(nL(e))return t=nV(nx(e),t),new nF(nx(t.g),nx(t.h));if(nL(t))return t=nV(e,nx(t)),new nF(nx(t.g),t.h);if(30<e.g.length){if(nL(e)||nL(t))throw Error("slowDivide_ only works with positive integers.");for(var n=nO,i=t;0>=i.X(e);)n=nj(n),i=nj(i);var r=nB(n,1),s=nB(i,1);for(i=nB(i,2),n=nB(n,2);!nP(i);){var a=s.add(i);0>=a.X(e)&&(r=r.add(n),s=a),i=nB(i,1),n=nB(n,1)}return t=nM(e,r.R(t)),new nF(r,t)}for(r=nN;0<=e.X(t);){for(i=48>=(i=Math.ceil(Math.log(n=Math.max(1,Math.floor(e.ea()/t.ea())))/M
1ath.LN2))?1:Math.pow(2,i-48),a=(s=nA(n)).R(t);nL(a)||0<a.X(e);)n-=i,a=(s=nA(n)).R(t);nP(s)&&(s=nO),r=r.add(s),e=nM(e,a)}return new nF(r,e)}function nj(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.D(i)<<1|e.D(i-1)>>>31;return new nS(n,e.h)}function nB(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,r=[],s=0;s<i;s++)r[s]=0<t?e.D(s+n)>>>t|e.D(s+n+1)<<32-t:e.D(s+n);return new nS(r,e.h)}(u=nS.prototype).ea=function(){if(nL(this))return-nx(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.D(n);e+=(0<=i?i:nR+i)*t,t*=nR}return e},u.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(nP(this))return"0";if(nL(this))return"-"+nx(this).toString(e);for(var t=nA(Math.pow(e,6)),n=this,i="";;){var r=nV(n,t).g,s=((0<(n=nM(n,r.R(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(nP(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},u.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},u.X=function(e){return nL(e=nM(this,e))?-1:nP(e)?0:1},u.abs=function(){return nL(this)?nx(this):this},u.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,r=0;r<=t;r++){var s=i+(65535&this.D(r))+(65535&e.D(r)),a=(s>>>16)+(this.D(r)>>>16)+(e.D(r)>>>16);i=a>>>16,s&=65535,a&=65535,n[r]=a<<16|s}return new nS(n,-2147483648&n[n.length-1]?-1:0)},u.R=function(e){if(nP(this)||nP(e))return nN;if(nL(this))return nL(e)?nx(this).R(nx(e)):nx(nx(this).R(e));if(nL(e))return nx(this.R(nx(e)));if(0>this.X(nD)&&0>e.X(nD))return nA(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var r=0;r<e.g.length;r++){var s=this.D(i)>>>16,a=65535&this.D(i),o=e.D(r)>>>16,l=65535&e.D(r);n[2*i+2*r]+=a*l,nU(n,2*i+2*r),n[2*i+2*r+1]+=s*l,nU(n,2*i+2*r+1),n[2*i+2*r+1]+=a*o,nU(n,2*i+2*r+1),n[2*i+2*r+2]+=s*o,nU(n,2*i+2*r+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new nS(n,0)},u.gb=function(e){return nV(this,e).h},u.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)&e.D(i);return new nS(n,this.h&e.h)},u.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)|e.D(i);return new nS(n,this.h|e.h)},u.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.D(i)^e.D(i);return new nS(n,this.h^e.h)},nv.prototype.createWebChannel=nv.prototype.g,nw.prototype.send=nw.prototype.u,nw.prototype.open=nw.prototype.m,nw.prototype.close=nw.prototype.close,eK.NO_ERROR=0,eK.TIMEOUT=8,eK.HTTP_ERROR=6,eG.COMPLETE="complete",eJ.EventType=eX,eX.OPEN="a",eX.CLOSE="b",eX.ERROR="c",eX.MESSAGE="d",ep.prototype.listen=ep.prototype.O,tW.prototype.listenOnce=tW.prototype.P,tW.prototype.getLastError=tW.prototype.Sa,tW.prototype.getLastErrorCode=tW.prototype.Ia,tW.prototype.getStatus=tW.prototype.da,tW.prototype.getResponseJson=tW.prototype.Wa,tW.prototype.getResponseText=tW.prototype.ja,tW.prototype.send=tW.prototype.ha,tW.prototype.setWithCredentials=tW.prototype.Oa,nE.prototype.digest=nE.prototype.l,nE.prototype.reset=nE.prototype.reset,nE.prototype.update=nE.prototype.j,nS.prototype.add=nS.prototype.add,nS.prototype.multiply=nS.prototype.R,nS.prototype.modulo=nS.prototype.gb,nS.prototype.compare=nS.prototype.X,nS.prototype.toNumber=nS.prototype.ea,nS.prototype.toString=nS.prototype.toString,nS.prototype.getBits=nS.prototype.D,nS.fromNumber=nA,nS.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return nx(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=nA(Math.pow(n,8)),r=nN,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),o=parseInt(t.substring(s,s+a),n);8>a?(a=nA(Math.pow(n,a)),r=r.R(a).add(nA(o))):r=(r=r.R(i)).add(nA(o))}return r};var nz=p.createWebChannelTransport=function(){return new nv},nq=p.getStatEventTarget=function(){return eV()},n$=p.ErrorCode=eK,nH=p.EventType=eG,nK=p.Event=eU,nG=p.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},nW=p.FetchXmlHttpFactory=tB,nQ=p.WebChannel=eJ,nJ=p.XhrIo=tW,nX=p.Md5=nE,nY=p.Integer=nS;n(3454);let nZ="@firebase/firestore";class n0{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}n0.UNAUTHENTICATED=new n0(null),n0.GOOGLE_CREDENTIALS=new n0("google-credentials-uid"),n0.FIRST_PARTY=new n0("first-party-uid"),n0.MOCK_USER=new n0("mock-user");let n1="9.23.0",n2=new d.Yd("@firebase/firestore");function n4(){return n2.logLevel}function n9(e,...t){if(n2.logLevel<=d.in.DEBUG){let n=t.map(n3);n2.debug(`Firestore (${n1}): ${e}`,...n)}}function n6(e,...t){if(n2.logLevel<=d.in.ERROR){let n=t.map(n3);n2.error(`Firestore (${n1}): ${e}`,...n)}}function n5(e,...t){if(n2.logLevel<=d.in.WARN){let n=t.map(n3);n2.warn(`Firestore (${n1}): ${e}`,...n)}}function n3(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function n7(e="Unexpected state"){let t=`FIRESTORE (${n1}) INTERNAL ASSERTION FAILED: `+e;throw n6(t),Error(t)}let n8={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
1ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class ie extends f.ZR{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class it{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class ii{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class ir{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(n0.UNAUTHENTICATED))}shutdown(){}}class is{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class ia{constructor(e){this.t=e,this.currentUser=n0.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i,i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve(),r=new it;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new it,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},a=e=>{n9("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?a(e):(n9("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new it)}},0),s()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(n9("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?("string"==typeof t.accessToken||n7(),new ii(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){let e=this.auth&&this.auth.getUid();return null===e||"string"==typeof e||n7(),new n0(e)}}class io{constructor(e,t,n){this.h=e,this.l=t,this.m=n,this.type="FirstParty",this.user=n0.FIRST_PARTY,this.g=new Map}p(){return this.m?this.m():null}get headers(){this.g.set("X-Goog-AuthUser",this.h);let e=this.p();return e&&this.g.set("Authorization",e),this.l&&this.g.set("X-Goog-Iam-Authorization-Token",this.l),this.g}}class il{constructor(e,t,n){this.h=e,this.l=t,this.m=n}getToken(){return Promise.resolve(new io(this.h,this.l,this.m))}start(e,t){e.enqueueRetryable(()=>t(n0.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class iu{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class ih{constructor(e){this.I=e,this.forceRefresh=!1,this.appCheck=null,this.T=null}start(e,t){let n=e=>{null!=e.error&&n9("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.T;return this.T=e.token,n9("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};let i=e=>{n9("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.I.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){let e=this.I.getImmediate({optional:!0});e?i(e):n9("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?("string"==typeof e.token||n7(),this.T=e.token,new iu(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}class ic{static A(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length,n="";for(;n.length<20;){let i=function(e){let t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(40);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let e=0;e<40;
1e++)n[e]=Math.floor(256*Math.random());return n}(0);for(let r=0;r<i.length;++r)n.length<20&&i[r]<t&&(n+=e.charAt(i[r]%e.length))}return n}}function id(e,t){return e<t?-1:e>t?1:0}function ip(e,t,n){return e.length===t.length&&e.every((e,i)=>n(e,t[i]))}class im{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new ie(n8.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800||e>=253402300800)throw new ie(n8.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return im.fromMillis(Date.now())}static fromDate(e){return im.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3);return new im(t,Math.floor(1e6*(e-1e3*t)))}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?id(this.nanoseconds,e.nanoseconds):id(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){return String(this.seconds- -62135596800).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class ig{constructor(e){this.timestamp=e}static fromTimestamp(e){return new ig(e)}static min(){return new ig(new im(0,0))}static max(){return new ig(new im(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class iy{constructor(e,t,n){void 0===t?t=0:t>e.length&&n7(),void 0===n?n=e.length-t:n>e.length-t&&n7(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===iy.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof iy?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++){let n=e.get(i),r=t.get(i);if(n<r)return -1;if(n>r)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class iv extends iy{construct(e,t,n){return new iv(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new ie(n8.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new iv(t)}static emptyPath(){return new iv([])}}let iw=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class i_ extends iy{construct(e,t,n){return new i_(e,t,n)}static isValidIdentifier(e){return iw.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),i_.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new i_(["__name__"])}static fromServerFormat(e){let t=[],n="",i=0,r=()=>{if(0===n.length)throw new ie(n8.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},s=!1;for(;i<e.length;){let t=e[i];
1if("\\"===t){if(i+1===e.length)throw new ie(n8.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new ie(n8.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?s=!s:"."!==t||s?n+=t:r(),i++}if(r(),s)throw new ie(n8.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new i_(t)}static emptyPath(){return new i_([])}}class ib{constructor(e){this.path=e}static fromPath(e){return new ib(iv.fromString(e))}static fromName(e){return new ib(iv.fromString(e).popFirst(5))}static empty(){return new ib(iv.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===iv.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return iv.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ib(new iv(e.slice()))}}class iT{constructor(e,t,n,i){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=i}}iT.UNKNOWN_ID=-1;class iE{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new iE(ig.min(),ib.empty(),-1)}static max(){return new iE(ig.max(),ib.empty(),-1)}}class iI{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function iS(e){if(e.code!==n8.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;n9("LocalStore","Unexpectedly lost primary lease")}class ik{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&n7(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new ik((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof ik?t:ik.resolve(t)}catch(e){return ik.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):ik.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):ik.reject(t)}static resolve(e){return new ik((t,n)=>{t(e)})}static reject(e){return new ik((t,n)=>{n(e)})}static waitFor(e){return new ik((t,n)=>{let i=0,r=0,s=!1;e.forEach(e=>{++i,e.next(()=>{++r,s&&r===i&&t()},e=>n(e))}),s=!0,r===i&&t()})}static or(e){let t=ik.resolve(!1);for(let n of e)t=t.next(e=>e?ik.resolve(e):n());return t}static forEach(e,t){let n=[];return e.forEach((e,i)=>{n.push(t.call(this,e,i))}),this.waitFor(n)}static mapArray(e,t){return new ik((n,i)=>{let r=e.length,s=Array(r),a=0;for(let o=0;o<r;o++){let l=o;t(e[l]).next(e=>{s[l]=e,++a===r&&n(s)},e=>i(e))}})}static doWhile(e,t){return new ik((n,i)=>{let r=()=>{!0===e()?t().next(()=>{r()},i):n()};r()})}}function iC(e){return"IndexedDbTransactionError"===e.name}class iA{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ot(e),this.ut=e=>t.writeSequenceNumber(e))}ot(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ut&&this.ut(e),e}}function iR(e){return 0===e&&1/e==-1/0}function iN(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function iO(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function iD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}iA.ct=-1;class iP{constructor(e,t){this.comparator=e,this.root=t||ix.EMPTY}insert(e,t){return new iP(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ix.BLACK,null,
1null))}remove(e){return new iP(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ix.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<0?n=n.left:(t+=n.left.size+1,n=n.right)}return -1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){let e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new iL(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new iL(this.root,e,this.comparator,!1)}getReverseIterator(){return new iL(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new iL(this.root,e,this.comparator,!0)}}class iL{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&i&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class ix{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:ix.RED,this.left=null!=i?i:ix.EMPTY,this.right=null!=r?r:ix.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,r){return new ix(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let i=this,r=n(e,i.key);return(i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n))).fixUp()}removeMin(){if(this.left.isEmpty())return ix.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let n,i=this;if(0>t(e,i.key))i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return ix.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,ix.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,ix.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return Math.pow(2,this.check())<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw n7();let e=this.left.check();if(e!==this.right.check())throw n7();return e+(this.isRed()?0:1)}}
1ix.EMPTY=null,ix.RED=!0,ix.BLACK=!1,ix.EMPTY=new class{constructor(){this.size=0}get key(){throw n7()}get value(){throw n7()}get color(){throw n7()}get left(){throw n7()}get right(){throw n7()}copy(e,t,n,i,r){return this}insert(e,t,n){return new ix(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class iM{constructor(e){this.comparator=e,this.data=new iP(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new iU(this.data.getIterator())}getIteratorFrom(e){return new iU(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof iM)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=n.getNext().key;if(0!==this.comparator(e,i))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new iM(this.comparator);return t.data=e,t}}class iU{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class iF{constructor(e){this.fields=e,e.sort(i_.comparator)}static empty(){return new iF([])}unionWith(e){let t=new iM(i_.comparator);for(let e of this.fields)t=t.add(e);for(let n of e)t=t.add(n);return new iF(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return ip(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class iV extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ij{constructor(e){this.binaryString=e}static fromBase64String(e){return new ij(function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new iV("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new ij(function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e))}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return btoa(this.binaryString)}toUint8Array(){return function(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return id(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}ij.EMPTY_BYTE_STRING=new ij("");let iB=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function iz(e){if(e||n7(),"string"==typeof e){let t=0,n=iB.exec(e);if(n||n7(),n[1]){let e=n[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:iq(e.seconds),nanos:iq(e.nanos)}}function iq(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function i$(e){return"string"==typeof e?ij.fromBase64String(e):ij.fromUint8Array(e)}function iH(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function iK(e){let t=e.mapValue.fields.__previous_value__;return iH(t)?iK(t):t}function iG(e){let t=iz(e.mapValue.fields.__local_write_time__.timestampValue);return new im(t.seconds,t.nanos)}class iW{constructor(e,t,n,i,r,s,a,o,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=r,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=l}}class iQ{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new iQ("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof iQ&&e.projectId===this.projectId&&e.database===this.database}}let iJ={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function iX(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?iH(e)?4:i8(e)?9007199254740991:10:n7()}function iY(e,t){if(e===t)return!0;let n=iX(e);if(n!==iX(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return iG(e).isEqual(iG(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=iz(e.timestampValue),i=iz(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return i$(e.bytesValue).isEqual(i$(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return iq(e.geoPointValue.latitude)===iq(t.geoPointValue.latitude)&&iq(e.geoPointValue.longitude)===iq(t.geoPointValue.longitude);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return iq(e.integerValue)===iq(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let n=iq(e.doubleValue),i=iq(t.doubleValue);return n===i?iR(n)===iR(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return ip(e.arrayValue.values||[],t.arrayValue.values||[],iY);case 10:return function(e,t){let n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(iN(n)!==iN(i))return!1;for(let e in n)if(n.hasOwnProperty(e)&&(void 0===i[e]||!iY(n[e],i[e])))return!1;return!0}(e,t);default:return n7()}}function iZ(e,t){return void 0!==(e.values||[]).find(e=>iY(e,t))}function i0(e,t){if(e===t)return 0;let n=iX(e),i=iX(t);if(n!==i)return id(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return id(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=iq(e.integerValue||e.doubleValue),i=iq(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return i1(e.timestampValue,t.timestampValue);case 4:return i1(iG(e),iG(t));case 5:return id(e.stringValue,t.stringValue);case 6:return function(e,t){let n=i$(e),i=i$(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){let t=id(n[e],i[e]);if(0!==t)return t}return id(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=id(iq(e.latitude),iq(t.latitude));return 0!==n?n:id(iq(e.longitude),iq(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){let n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){let t=i0(n[e],i[e]);if(t)return t}return id(n.length,i.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===iJ.mapValue&&t===iJ.mapValue)return 0;if(e===iJ.mapValue)return 1;if(t===iJ.mapValue)return -1;let n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){let t=id(i[e],s[e]);if(0!==t)return t;let a=i0(n[i[e]],r[s[e]]);if(0!==a)return a}return id(i.length,s.length)}(e.mapValue,t.mapValue);default:throw n7()}}function i1(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return id(e,t);let n=iz(e),i=iz(t),r=id(n.seconds,i.seconds);return 0!==r?r:id(n.nanos,i.nanos)}function i2(e){var t,n;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){let t=iz(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?i$
1(e.bytesValue).toBase64():"referenceValue"in e?(n=e.referenceValue,ib.fromName(n).toString()):"geoPointValue"in e?`geo(${(t=e.geoPointValue).latitude},${t.longitude})`:"arrayValue"in e?function(e){let t="[",n=!0;for(let i of e.values||[])n?n=!1:t+=",",t+=i2(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),n="{",i=!0;for(let r of t)i?i=!1:n+=",",n+=`${r}:${i2(e.fields[r])}`;return n+"}"}(e.mapValue):n7()}function i4(e){return!!e&&"integerValue"in e}function i9(e){return!!e&&"arrayValue"in e}function i6(e){return!!e&&"nullValue"in e}function i5(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function i3(e){return!!e&&"mapValue"in e}function i7(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return iO(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=i7(n)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=i7(e.arrayValue.values[n]);return t}return Object.assign({},e)}function i8(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class re{constructor(e){this.value=e}static empty(){return new re({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(!i3(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=i7(t)}setAll(e){let t=i_.emptyPath(),n={},i=[];e.forEach((e,r)=>{if(!t.isImmediateParentOf(r)){let e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=i7(e):i.push(r.lastSegment())});let r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){let t=this.field(e.popLast());i3(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return iY(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let i=t.mapValue.fields[e.get(n)];i3(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){for(let i of(iO(t,(t,n)=>e[t]=n),n))delete e[i]}clone(){return new re(i7(this.value))}}class rt{constructor(e,t,n,i,r,s,a){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=r,this.data=s,this.documentState=a}static newInvalidDocument(e){return new rt(e,0,ig.min(),ig.min(),ig.min(),re.empty(),0)}static newFoundDocument(e,t,n,i){return new rt(e,1,t,ig.min(),n,i,0)}static newNoDocument(e,t){return new rt(e,2,t,ig.min(),ig.min(),re.empty(),0)}static newUnknownDocument(e,t){return new rt(e,3,t,ig.min(),ig.min(),re.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(ig.min())&&(2===this.documentType||0===this.documentType)&&(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=re.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=re.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ig.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof rt&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new rt(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
1class rn{constructor(e,t){this.position=e,this.inclusive=t}}function ri(e,t,n){let i=0;for(let r=0;r<e.position.length;r++){let s=t[r],a=e.position[r];if(i=s.field.isKeyField()?ib.comparator(ib.fromName(a.referenceValue),n.key):i0(a,n.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function rr(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!iY(e.position[n],t.position[n]))return!1;return!0}class rs{constructor(e,t="asc"){this.field=e,this.dir=t}}class ra{}class ro extends ra{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new rc(e,t,n):"array-contains"===t?new rm(e,n):"in"===t?new rg(e,n):"not-in"===t?new ry(e,n):"array-contains-any"===t?new rv(e,n):new ro(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new rd(e,n):new rf(e,n)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(i0(t,this.value)):null!==t&&iX(this.value)===iX(t)&&this.matchesComparison(i0(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return n7()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class rl extends ra{constructor(e,t){super(),this.filters=e,this.op=t,this.lt=null}static create(e,t){return new rl(e,t)}matches(e){return ru(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.lt||(this.lt=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.lt}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){let e=this.ft(e=>e.isInequality());return null!==e?e.field:null}ft(e){for(let t of this.getFlattenedFilters())if(e(t))return t;return null}}function ru(e){return"and"===e.op}function rh(e){for(let t of e.filters)if(t instanceof rl)return!1;return!0}class rc extends ro{constructor(e,t,n){super(e,t,n),this.key=ib.fromName(n.referenceValue)}matches(e){let t=ib.comparator(e.key,this.key);return this.matchesComparison(t)}}class rd extends ro{constructor(e,t){super(e,"in",t),this.keys=rp("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class rf extends ro{constructor(e,t){super(e,"not-in",t),this.keys=rp("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function rp(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>ib.fromName(e.referenceValue))}class rm extends ro{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return i9(t)&&iZ(t.arrayValue,this.value)}}class rg extends ro{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&iZ(this.value.arrayValue,t)}}class ry extends ro{constructor(e,t){super(e,"not-in",t)}matches(e){if(iZ(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&!iZ(this.value.arrayValue,t)}}class rv extends ro{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!i9(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>iZ(this.value.arrayValue,e))}}class rw{constructor(e,t=null,n=[],i=[],r=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=s,this.endAt=a,this.dt=null}}function r_(e,t=null,n=[],i=[],r=null,s=null,a=null){return new rw(e,t,n,i,r,s,a)}function rb(e){if(null===e.dt){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:"+e.filters.map(e=>(function e(t){if(t instanceof ro)return t.field.canonicalString()+t.op.toString()+i2(t.value);if(rh(t)&&ru(t))return t.filters.map(t=>e(t)).join(",");{let n=t.filters.map(t=>e(t)).join(",");return`${t.op}(${n})`}})(e)).join(",")+"|ob:"+e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:"+e.limit),e.startAt&&(t+="|lb:"+(e.startAt.inclusive?"b:":"a:")+e.startAt.position.map(e=>i2(e)).join(",")),e.endAt&&(t+="|ub:"+(e.endAt.inclusive?"a:":"b:")+e.endAt.position.map(e=>i2(e)).join(",")),e.dt=t}return e.dt}function rT(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let r=0;r<e.orderBy.length;r++){var n,i;if(n=e.orderBy[r],i=t.orderBy[r],!(n.dir===i.dir&&n.field.isEqual(i.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!function e(t,n){return t instanceof ro?n instanceof ro&&t.op===n.op&&t.field.isEqual(n.field)&&iY(t.value,n.value):t instanceof rl?n instanceof rl&&t.op===n.op&&t.filters.length===n.filters.length&&t.filters.reduce((t,i,r)=>t&&e(i,n.filters[r]),!0):void n7()}(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!rr(e.startAt,t.startAt)&&rr(e.endAt,t.endAt)}function rE(e){return ib.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class rI{constructor(e,t=null,n=[],i=[],r=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=a,this.endAt=o,this.wt=null,this._t=null,this.startAt,this.endAt}}function rS(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function rk(e){if(null===e.wt){e.wt=[];let t=function(e){for(let t of e.filters){let e=t.getFirstInequalityField();if(null!==e)return e}return null}(e),n=e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null;if(null!==t&&null===n)t.isKeyField()||e.wt.push(new rs(t)),e.wt.push(new rs(i_.keyField(),"asc"));else{let t=!1;for(let n of e.explicitOrderBy)e.wt.push(n),n.field.isKeyField()&&(t=!0);if(!t){let t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.wt.push(new rs(i_.keyField(),t))}}}return e.wt}function rC(e){if(!e._t){if("F"===e.limitType)e._t=r_(e.path,e.collectionGroup,rk(e),e.filters,e.limit,e.startAt,e.endAt);else{let t=[];for(let n of rk(e)){let e="desc"===n.dir?"asc":"desc";t.push(new rs(n.field,e))}let n=e.endAt?new rn(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new rn(e.startAt.position,e.startAt.inclusive):null;e._t=r_(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}return e._t}function rA(e,t,n){return new rI(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function rR(e,t){return rT(rC(e),rC(t))&&e.limitType===t.limitType}function rN(e){return`${rb(rC(e))}|lt:${e.limitType}`}function rO(e){var t;let n;return`Query(target=${n=(t=rC(e)).path.canonicalString(),null!==t.collectionGroup&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof ro?`${t.field.canonicalString()} ${t.op} ${i2(t.value)}`:t instanceof rl?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(n+=", startAt: "+(t.startAt.inclusive?"b:":"a:")+t.startAt.position.map(e=>i2(e)).join(",")),t.endAt&&(n+=", endAt: "+(t.endAt.inclusive?"a:":"b:")+t.endAt.position.map(e=>i2(e)).join(",")),`Target(${n})`}; limitType=${e.limitType})`}function rD(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):ib.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(let n of rk(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}
1(e,t)&&(!e.startAt||!!function(e,t,n){let i=ri(e,t,n);return e.inclusive?i<=0:i<0}(e.startAt,rk(e),t))&&(!e.endAt||!!function(e,t,n){let i=ri(e,t,n);return e.inclusive?i>=0:i>0}(e.endAt,rk(e),t))}function rP(e){return(t,n)=>{let i=!1;for(let r of rk(e)){let e=function(e,t,n){let i=e.field.isKeyField()?ib.comparator(t.key,n.key):function(e,t,n){let i=t.data.field(e),r=n.data.field(e);return null!==i&&null!==r?i0(i,r):n7()}(e.field,t,n);switch(e.dir){case"asc":return i;case"desc":return -1*i;default:return n7()}}(r,t,n);if(0!==e)return e;i=i||r.field.isKeyField()}return 0}}class rL{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){for(let[t,i]of n)if(this.equalsFn(t,e))return i}}has(e){return void 0!==this.get(e)}set(e,t){let n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],e))return void(i[n]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return 1===n.length?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){iO(this.inner,(t,n)=>{for(let[t,i]of n)e(t,i)})}isEmpty(){return iD(this.inner)}size(){return this.innerSize}}let rx=new iP(ib.comparator),rM=new iP(ib.comparator);function rU(...e){let t=rM;for(let n of e)t=t.insert(n.key,n);return t}function rF(e){let t=rM;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function rV(){return new rL(e=>e.toString(),(e,t)=>e.isEqual(t))}let rj=new iP(ib.comparator),rB=new iM(ib.comparator);function rz(...e){let t=rB;for(let n of e)t=t.add(n);return t}let rq=new iM(id);function r$(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:iR(t)?"-0":t}}function rH(e){return{integerValue:""+e}}class rK{constructor(){this._=void 0}}function rG(e,t){return e instanceof rZ?i4(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}class rW extends rK{}class rQ extends rK{constructor(e){super(),this.elements=e}}function rJ(e,t){let n=r1(t);for(let t of e.elements)n.some(e=>iY(e,t))||n.push(t);return{arrayValue:{values:n}}}class rX extends rK{constructor(e){super(),this.elements=e}}function rY(e,t){let n=r1(t);for(let t of e.elements)n=n.filter(e=>!iY(e,t));return{arrayValue:{values:n}}}class rZ extends rK{constructor(e,t){super(),this.serializer=e,this.gt=t}}function r0(e){return iq(e.integerValue||e.doubleValue)}function r1(e){return i9(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class r2{constructor(e,t){this.version=e,this.transformResults=t}}class r4{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new r4}static exists(e){return new r4(void 0,e)}static updateTime(e){return new r4(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function r9(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class r6{}function r5(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new sr(e.key,r4.none()):new r8(e.key,e.data,r4.none());{let n=e.data,i=re.empty(),r=new iM(i_.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new se(e.key,i,new iF(r.toArray()),r4.none())}}function r3(e,t,n,i){return e instanceof r8?function(e,t,n,i){if(!r9(e.precondition,t))return n;let r=e.value.clone(),s=si(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof se?function(e,t,n,i){if(!r9(e.precondition,t))return n;let r=si(e.fieldTransforms,i,t),s=t.data;return(s.setAll(st(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n)?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):r9(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}function r7(e,t){var n,i;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,i=t.fieldTransforms,!!(void 0===n&&void 0===i||!(!n||!i)&&ip(n,i,(e,t)=>{var n,i;return e.field.isEqual(t.field)&&(n=e.transform,i=t.transform,n instanceof rQ&&i instanceof rQ||n instanceof rX&&i instanceof rX?ip(n.elements,i.elements,iY):n instanceof rZ&&i instanceof rZ?iY(n.gt,i.gt):n instanceof rW&&i instanceof rW)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class r8 extends r6{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.prec
1ondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class se extends r6{constructor(e,t,n,i,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function st(e){let t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){let i=e.data.field(n);t.set(n,i)}}),t}function sn(e,t,n){var i;let r=new Map;e.length===n.length||n7();for(let s=0;s<n.length;s++){let a=e[s],o=a.transform,l=t.data.field(a.field);r.set(a.field,(i=n[s],o instanceof rQ?rJ(o,l):o instanceof rX?rY(o,l):i))}return r}function si(e,t,n){let i=new Map;for(let r of e){let e=r.transform,s=n.data.field(r.field);i.set(r.field,e instanceof rW?function(e,t){let n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&iH(t)&&(t=iK(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(t,s):e instanceof rQ?rJ(e,s):e instanceof rX?rY(e,s):function(e,t){let n=rG(e,t),i=r0(n)+r0(e.gt);return i4(n)&&i4(e.gt)?rH(i):r$(e.serializer,i)}(e,s))}return i}class sr extends r6{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class ss extends r6{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class sa{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];if(r.key.isEqual(e.key)){var i;i=n[t],r instanceof r8?function(e,t,n){let i=e.value.clone(),r=sn(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(r,e,i):r instanceof se?function(e,t,n){if(!r9(e.precondition,t))return void t.convertToUnknownDocument(n.version);let i=sn(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(st(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(r,e,i):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,i)}}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=r3(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=r3(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=rV();return this.mutations.forEach(i=>{let r=e.get(i.key),s=r.overlayedDocument,a=this.applyToLocalView(s,r.mutatedFields),o=r5(s,a=t.has(i.key)?null:a);null!==o&&n.set(i.key,o),s.isValidDocument()||s.convertToNoDocument(ig.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),rz())}isEqual(e){return this.batchId===e.batchId&&ip(this.mutations,e.mutations,(e,t)=>r7(e,t))&&ip(this.baseMutations,e.baseMutations,(e,t)=>r7(e,t))}}class so{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){e.mutations.length===n.length||n7();let i=rj,r=e.mutations;for(let e=0;e<r.length;e++)i=i.insert(r[e].key,n[e].version);return new so(e,t,n,i)}}class sl{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{ 2 largestBatchId: ${this.largestBatchId}, 3 mutation: ${this.mutation.toString()} 4 }`}}class su{constructor(e,t){this.count=e,this.unchangedNames=t}}function sh(e){if(void 0===e)return n6("GRPC error has no .code"),n8.UNKNOWN;switch(e){case o.OK:return n8.OK;case o.CANCELLED:return n8.CANCELLED;case o.UNKNOWN:return n8.UNKNOWN;case o.DEADLINE_EXCEEDED:return n8.DEADLINE_EXCEEDED;case o.RESOURCE_EXHAUSTED:return n8.RESOURCE_EXHAUSTED;case o.INTERNAL:return n8.INTERNAL;case o.UNAVAILABLE:return n8.UNAVAILABLE;case o.UNAUTHENTICATED:return n8.UNAUTHENTICATED;case o.INVALID_ARGUMENT:return n8.INVALID_ARGUMENT;case o.NOT_FOUND:return n8.NOT_FOUND;case o.ALREADY_EXISTS:return n8.ALREADY_EXISTS;case o.PERMISSION_DENIED:return n8.PERMISSION_DENIED;case o.FAILED_PRECONDITION:return n8.FAILED_PRECONDITION;case o.ABORTED:return n8.ABORTED;case o.OUT_OF_RANGE:return n8.OUT_OF_RANGE;
4case o.UNIMPLEMENTED:return n8.UNIMPLEMENTED;case o.DATA_LOSS:return n8.DATA_LOSS;default:return n7()}}(l=o||(o={}))[l.OK=0]="OK",l[l.CANCELLED=1]="CANCELLED",l[l.UNKNOWN=2]="UNKNOWN",l[l.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",l[l.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",l[l.NOT_FOUND=5]="NOT_FOUND",l[l.ALREADY_EXISTS=6]="ALREADY_EXISTS",l[l.PERMISSION_DENIED=7]="PERMISSION_DENIED",l[l.UNAUTHENTICATED=16]="UNAUTHENTICATED",l[l.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",l[l.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",l[l.ABORTED=10]="ABORTED",l[l.OUT_OF_RANGE=11]="OUT_OF_RANGE",l[l.UNIMPLEMENTED=12]="UNIMPLEMENTED",l[l.INTERNAL=13]="INTERNAL",l[l.UNAVAILABLE=14]="UNAVAILABLE",l[l.DATA_LOSS=15]="DATA_LOSS";class sc{constructor(){this.onExistenceFilterMismatchCallbacks=new Map}static get instance(){return sd}static getOrCreateInstance(){return null===sd&&(sd=new sc),sd}onExistenceFilterMismatch(e){let t=Symbol();return this.onExistenceFilterMismatchCallbacks.set(t,e),()=>this.onExistenceFilterMismatchCallbacks.delete(t)}notifyOnExistenceFilterMismatch(e){this.onExistenceFilterMismatchCallbacks.forEach(t=>t(e))}}let sd=null,sf=new nY([4294967295,4294967295],0);function sp(e){let t=(new TextEncoder).encode(e),n=new nX;return n.update(t),new Uint8Array(n.digest())}function sm(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),i=t.getUint32(4,!0),r=t.getUint32(8,!0),s=t.getUint32(12,!0);return[new nY([n,i],0),new nY([r,s],0)]}class sg{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new sy(`Invalid padding: ${t}`);if(n<0||e.length>0&&0===this.hashCount)throw new sy(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new sy(`Invalid padding when bitmap length is 0: ${t}`);this.It=8*e.length-t,this.Tt=nY.fromNumber(this.It)}Et(e,t,n){let i=e.add(t.multiply(nY.fromNumber(n)));return 1===i.compare(sf)&&(i=new nY([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Tt).toNumber()}At(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}vt(e){if(0===this.It)return!1;let[t,n]=sm(sp(e));for(let e=0;e<this.hashCount;e++){let i=this.Et(t,n,e);if(!this.At(i))return!1}return!0}static create(e,t,n){let i=new sg(new Uint8Array(Math.ceil(e/8)),e%8==0?0:8-e%8,t);return n.forEach(e=>i.insert(e)),i}insert(e){if(0===this.It)return;let[t,n]=sm(sp(e));for(let e=0;e<this.hashCount;e++){let i=this.Et(t,n,e);this.Rt(i)}}Rt(e){this.bitmap[Math.floor(e/8)]|=1<<e%8}}class sy extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class sv{constructor(e,t,n,i,r){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let i=new Map;return i.set(e,sw.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new sv(ig.min(),i,new iP(id),rx,rz())}}class sw{constructor(e,t,n,i,r){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new sw(n,t,rz(),rz(),rz())}}class s_{constructor(e,t,n,i){this.Pt=e,this.removedTargetIds=t,this.key=n,this.bt=i}}class sb{constructor(e,t){this.targetId=e,this.Vt=t}}class sT{constructor(e,t,n=ij.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class sE{constructor(){this.St=0,this.Dt=sk(),this.Ct=ij.EMPTY_BYTE_STRING,this.xt=!1,this.Nt=!0}get current(){return this.xt}get resumeToken(){return this.Ct}get kt(){return 0!==this.St}get Mt(){return this.Nt}$t(e){e.approximateByteSize()>0&&(this.Nt=!0,this.Ct=e)}Ot(){let e=rz(),t=rz(),n=rz();return this.Dt.forEach((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:n7()}}),new sw(this.Ct,this.xt,e,t,n)}Ft(){this.Nt=!1,this.Dt=sk()}Bt(e,t){this.Nt=!0,this.Dt=this.Dt.insert(e,t)}Lt(e){this.Nt=!0,this.Dt=this.Dt.remove(e)}qt(){this.St+=1}Ut(){this.St-=1}Kt(){this.Nt=!0,this.xt=!0}}class sI{constructor(e){this.Gt=e,this.Qt=new Map,this.jt=rx,this.zt=sS(),this.Wt=new iP(id)}Ht(e){for(let t of e.Pt)e.bt&&e.bt.isFoundDocument()?this.Jt(t,e.bt):this.Yt(t,e.key,e.bt);for(let t of e.removedTargetIds)this.Yt(t,e.key,e.bt)}Xt(e){this.forEachTarget(e,t=>{let n=this.Zt(t);switch(e.state){case 0:this.te(t)&&n.$t(e.resumeToken);break;case 1:n.Ut(),n.kt||n.Ft(),n.$t(e.resumeToken);break;case 2:n.Ut(),n.kt||this.removeTarget(t);break;case 3:this.te(t)&&(n.Kt(),n.$t(e.resumeToken));break;case 4:this.te(t)&&(this.ee(t),n.$t(e.resumeToken));break;default:n7()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Qt.forEach((e,n)=>{this.te(n)&&t(n)})}ne(e){var t;let n=e.targetId,i=e.Vt.count,r=this.se(n);if(r){let s=r.target;if(rE(s)){if(0===i){let e=new ib(s.path);this.Yt(n,e,rt.newNoDocument(e,ig.min()))}else 1===i||n7()}else{let r=this.ie(n);if(r!==i){let i=this.re(e,r);0!==i&&(this.ee(n),this.Wt=this.Wt.insert(n,2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch")),null===(t=sc.instance)||void 0===t||t.notifyOnExistenceFilterMismatch(function(e,t,n){var i,r,s,a,o,l;let u={localCacheCount:t,existenceFilterCount:n.count},h=n.unchangedNames;return h&&(u.bloomFilter={applied:0===e,hashCount:null!==(i=null==h?void 0:h.hashCount)&&void 0!==i?i:0,bitmapLength:null!==(a=null===(s=null===(r=null==h?void 0:h.bits)||void 0===r?void 0:r.bitmap)||void 0===s?void 0:s.length)&&void 0!==a?a:0,padding:null!==(l=null===(o=null==h?void 0:h.bits)||void 0===o?void 0:o.padding)&&void 0!==l?l:0}),u}(i,r,e.Vt))}}}}re(e,t){let n,i;let{unchangedNames:r,count:s}=e.Vt;if(!r||!r.bits)return 1;let{bits:{bitmap:a="",padding:o=0},hashCount:l=0}=r;
4try{n=i$(a).toUint8Array()}catch(e){if(e instanceof iV)return n5("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),1;throw e}try{i=new sg(n,o,l)}catch(e){return n5(e instanceof sy?"BloomFilter error: ":"Applying bloom filter failed: ",e),1}return 0===i.It?1:s!==t-this.oe(e.targetId,i)?2:0}oe(e,t){let n=this.Gt.getRemoteKeysForTarget(e),i=0;return n.forEach(n=>{let r=this.Gt.ue(),s=`projects/${r.projectId}/databases/${r.database}/documents/${n.path.canonicalString()}`;t.vt(s)||(this.Yt(e,n,null),i++)}),i}ce(e){let t=new Map;this.Qt.forEach((n,i)=>{let r=this.se(i);if(r){if(n.current&&rE(r.target)){let t=new ib(r.target.path);null!==this.jt.get(t)||this.ae(i,t)||this.Yt(i,t,rt.newNoDocument(t,e))}n.Mt&&(t.set(i,n.Ot()),n.Ft())}});let n=rz();this.zt.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{let t=this.se(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(n=n.add(e))}),this.jt.forEach((t,n)=>n.setReadTime(e));let i=new sv(e,t,this.Wt,this.jt,n);return this.jt=rx,this.zt=sS(),this.Wt=new iP(id),i}Jt(e,t){if(!this.te(e))return;let n=this.ae(e,t.key)?2:0;this.Zt(e).Bt(t.key,n),this.jt=this.jt.insert(t.key,t),this.zt=this.zt.insert(t.key,this.he(t.key).add(e))}Yt(e,t,n){if(!this.te(e))return;let i=this.Zt(e);this.ae(e,t)?i.Bt(t,1):i.Lt(t),this.zt=this.zt.insert(t,this.he(t).delete(e)),n&&(this.jt=this.jt.insert(t,n))}removeTarget(e){this.Qt.delete(e)}ie(e){let t=this.Zt(e).Ot();return this.Gt.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}qt(e){this.Zt(e).qt()}Zt(e){let t=this.Qt.get(e);return t||(t=new sE,this.Qt.set(e,t)),t}he(e){let t=this.zt.get(e);return t||(t=new iM(id),this.zt=this.zt.insert(e,t)),t}te(e){let t=null!==this.se(e);return t||n9("WatchChangeAggregator","Detected inactive target",e),t}se(e){let t=this.Qt.get(e);return t&&t.kt?null:this.Gt.le(e)}ee(e){this.Qt.set(e,new sE),this.Gt.getRemoteKeysForTarget(e).forEach(t=>{this.Yt(e,t,null)})}ae(e,t){return this.Gt.getRemoteKeysForTarget(e).has(t)}}function sS(){return new iP(ib.comparator)}function sk(){return new iP(ib.comparator)}let sC={asc:"ASCENDING",desc:"DESCENDING"},sA={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},sR={and:"AND",or:"OR"};class sN{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function sO(e,t){return e.useProto3Json||null==t?t:{value:t}}function sD(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function sP(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function sL(e){return e||n7(),ig.fromTimestamp(function(e){let t=iz(e);return new im(t.seconds,t.nanos)}(e))}function sx(e,t){return new iv(["projects",e.projectId,"databases",e.database]).child("documents").child(t).canonicalString()}function sM(e){let t=iv.fromString(e);return sH(t)||n7(),t}function sU(e,t){return sx(e.databaseId,t.path)}function sF(e,t){let n=sM(t);if(n.get(1)!==e.databaseId.projectId)throw new ie(n8.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new ie(n8.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new ib(sB(n))}function sV(e,t){return sx(e.databaseId,t)}function sj(e){return new iv(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function sB(e){return e.length>4&&"documents"===e.get(4)||n7(),e.popFirst(5)}function sz(e,t,n){return{name:sU(e,t),fields:n.value.mapValue.fields}}function sq(e){return{fieldPath:e.canonicalString()}}function s$(e){return i_.fromServerFormat(e.fieldPath)}function sH(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class sK{constructor(e,t,n,i,r=ig.min(),s=ig.min(),a=ij.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new sK(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new sK(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new sK(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new sK(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class sG{constructor(e){this.fe=e}}class sW{constructor(){}_e(e,t){this.me(e,t),t.ge()}me(e,t){if("nullValue"in e)this.ye(t,5);else if("booleanValue"in e)this.ye(t,10),t.pe(e.booleanValue?1:0);else if("integerValue"in e)this.ye(t,15),t.pe(iq(e.integerValue));else if("doubleValue"in e){let n=iq(e.doubleValue);isNaN(n)?this.ye(t,13):(this.ye(t,15),iR(n)?t.pe(0):t.pe(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ye(t,20),"string"==typeof n?t.Ie(n):(t.Ie(`${n.seconds||""}`),t.pe(n.nanos||0))}else if("stringValue"in e)this.Te(e.stringValue,t),this.Ee(t);else if("bytesValue"in e)this.ye(t,30),t.Ae(i$(e.bytesValue)),this.Ee(t);else if("referenceValue"in e)this.ve(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.ye(t,45),t.pe(n.latitude||0),t.pe(n.longitude||0)}else"mapValue"in e?i8(e)?this.ye(t,Number.MAX_SAFE_INTEGER):(this.Re(e.mapValue,t),this.Ee(t)):"arrayValue"in e?(this.Pe(e.arrayValue,t),this.Ee(t)):n7()}Te(e,t){this.ye(t,25),this.be(e,t)}be(e,t){t.Ie(e)}Re(e,t){let n=e.fields||{};for(let e of(this.ye(t,55),Object.keys(n)))this.Te(e,t),this.me(n[e],t)}Pe(e,t){let n=e.values||[];for(let e of(this.ye(t,50),n))this.me(e,t)}
4ve(e,t){this.ye(t,37),ib.fromName(e).path.forEach(e=>{this.ye(t,60),this.be(e,t)})}ye(e,t){e.pe(t)}Ee(e){e.pe(2)}}sW.Ve=new sW;class sQ{constructor(){this.rn=new sJ}addToCollectionParentIndex(e,t){return this.rn.add(t),ik.resolve()}getCollectionParents(e,t){return ik.resolve(this.rn.getEntries(t))}addFieldIndex(e,t){return ik.resolve()}deleteFieldIndex(e,t){return ik.resolve()}getDocumentsMatchingTarget(e,t){return ik.resolve(null)}getIndexType(e,t){return ik.resolve(0)}getFieldIndexes(e,t){return ik.resolve([])}getNextCollectionGroupToUpdate(e){return ik.resolve(null)}getMinOffset(e,t){return ik.resolve(iE.min())}getMinOffsetFromCollectionGroup(e,t){return ik.resolve(iE.min())}updateCollectionGroup(e,t,n){return ik.resolve()}updateIndexEntries(e,t){return ik.resolve()}}class sJ{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new iM(iv.comparator),r=!i.has(n);return this.index[t]=i.add(n),r}has(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new iM(iv.comparator)).toArray()}}new Uint8Array(0);class sX{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new sX(e,sX.DEFAULT_COLLECTION_PERCENTILE,sX.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}sX.DEFAULT_COLLECTION_PERCENTILE=10,sX.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,sX.DEFAULT=new sX(41943040,sX.DEFAULT_COLLECTION_PERCENTILE,sX.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),sX.DISABLED=new sX(-1,0,0);class sY{constructor(e){this.Nn=e}next(){return this.Nn+=2,this.Nn}static kn(){return new sY(0)}static Mn(){return new sY(-1)}}class sZ{constructor(){this.changes=new rL(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,rt.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return void 0!==n?ik.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class s0{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class s1{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(n=i,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&r3(n.mutation,e,iF.empty(),im.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,rz()).next(()=>t))}getLocalViewOfDocuments(e,t,n=rz()){let i=rV();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(e=>{let t=rU();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let n=rV();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,rz()))}populateOverlays(e,t,n){let i=[];return n.forEach(e=>{t.has(e)||i.push(e)}),this.documentOverlayCache.getOverlays(e,i).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,i){let r=rx,s=rV(),a=rV();return t.forEach((e,t)=>{let a=n.get(t.key);i.has(t.key)&&(void 0===a||a.mutation instanceof se)?r=r.insert(t.key,t):void 0!==a?(s.set(t.key,a.mutation.getFieldMask()),r3(a.mutation,t,a.mutation.getFieldMask(),im.now())):s.set(t.key,iF.empty())}),this.recalculateAndSaveOverlays(e,r).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var n;return a.set(e,new s0(t,null!==(n=s.get(e))&&void 0!==n?n:null))}),a))}recalculateAndSaveOverlays(e,t){let n=rV(),i=new iP((e,t)=>e-t),r=rz();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let r of e)r.keys().forEach(e=>{let s=t.get(e);if(null===s)return;let a=n.get(e)||iF.empty();a=r.applyToLocalView(s,a),n.set(e,a);let o=(i.get(r.batchId)||rz()).add(e);i=i.insert(r.batchId,o)})}).next(()=>{let s=[],a=i.getReverseIterator();for(;a.hasNext();){let i=a.getNext(),o=i.key,l=i.value,u=rV();
4l.forEach(e=>{if(!r.has(e)){let i=r5(t.get(e),n.get(e));null!==i&&u.set(e,i),r=r.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,o,u))}return ik.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n){return ib.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):null!==t.collectionGroup?this.getDocumentsMatchingCollectionGroupQuery(e,t,n):this.getDocumentsMatchingCollectionQuery(e,t,n)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next(r=>{let s=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-r.size):ik.resolve(rV()),a=-1,o=r;return s.next(t=>ik.forEach(t,(t,n)=>(a<n.largestBatchId&&(a=n.largestBatchId),r.get(t)?ik.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,r)).next(()=>this.computeViews(e,o,t,rz())).next(e=>({batchId:a,changes:rF(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new ib(t)).next(e=>{let t=rU();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n){let i=t.collectionGroup,r=rU();return this.indexManager.getCollectionParents(e,i).next(s=>ik.forEach(s,s=>{let a=new rI(s.child(i),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,a,n).next(e=>{e.forEach((e,t)=>{r=r.insert(e,t)})})}).next(()=>r))}getDocumentsMatchingCollectionQuery(e,t,n){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(r=>(i=r,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i))).next(e=>{i.forEach((t,n)=>{let i=n.getKey();null===e.get(i)&&(e=e.insert(i,rt.newInvalidDocument(i)))});let n=rU();return e.forEach((e,r)=>{let s=i.get(e);void 0!==s&&r3(s.mutation,r,iF.empty(),im.now()),rD(t,r)&&(n=n.insert(e,r))}),n})}}class s2{constructor(e){this.serializer=e,this.cs=new Map,this.hs=new Map}getBundleMetadata(e,t){return ik.resolve(this.cs.get(t))}saveBundleMetadata(e,t){return this.cs.set(t.id,{id:t.id,version:t.version,createTime:sL(t.createTime)}),ik.resolve()}getNamedQuery(e,t){return ik.resolve(this.hs.get(t))}saveNamedQuery(e,t){return this.hs.set(t.name,{name:t.name,query:function(e){let t=function(e){var t;let n,i=function(e){let t=sM(e);return 4===t.length?iv.emptyPath():sB(t)}(e.parent),r=e.structuredQuery,s=r.from?r.from.length:0,a=null;if(s>0){1===s||n7();let e=r.from[0];e.allDescendants?a=e.collectionId:i=i.child(e.collectionId)}let o=[];r.where&&(o=function(e){var t;let n=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=s$(e.unaryFilter.field);return ro.create(t,"==",{doubleValue:NaN});case"IS_NULL":let n=s$(e.unaryFilter.field);return ro.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=s$(e.unaryFilter.field);return ro.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let r=s$(e.unaryFilter.field);return ro.create(r,"!=",{nullValue:"NULL_VALUE"});default:return n7()}}(t):void 0!==t.fieldFilter?ro.create(s$(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return n7()}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?rl.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return n7()}}(t.compositeFilter.op)):n7()}(e);return n instanceof rl&&rh(t=n)&&ru(t)?n.getFilters():[n]}(r.where));let l=[];r.orderBy&&(l=r.orderBy.map(e=>new rs(s$(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let u=null;r.limit&&(u=null==(n="object"==typeof(t=r.limit)?t.value:t)?null:n);let h=null;r.startAt&&(h=function(e){let t=!!e.before;return new rn(e.values||[],t)}(r.startAt));let c=null;return r.endAt&&(c=function(e){let t=!e.before;return new rn(e.values||[],t)}(r.endAt)),new rI(i,a,l,o,u,"F",h,c)}({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?rA(t,t.limit,"L"):t}(t.bundledQuery),readTime:sL(t.readTime)}),ik.resolve()}}class s4{constructor(){this.overlays=new iP(ib.comparator),this.ls=new Map}getOverlay(e,t){return ik.resolve(this.overlays.get(t))}getOverlays(e,t){let n=rV();return ik.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}
4saveOverlays(e,t,n){return n.forEach((n,i)=>{this.we(e,t,i)}),ik.resolve()}removeOverlaysForBatchId(e,t,n){let i=this.ls.get(n);return void 0!==i&&(i.forEach(e=>this.overlays=this.overlays.remove(e)),this.ls.delete(n)),ik.resolve()}getOverlaysForCollection(e,t,n){let i=rV(),r=t.length+1,s=new ib(t.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let e=a.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===r&&e.largestBatchId>n&&i.set(e.getKey(),e)}return ik.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let r=new iP((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=rV(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let a=rV(),o=r.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=i)););return ik.resolve(a)}we(e,t,n){let i=this.overlays.get(n.key);if(null!==i){let e=this.ls.get(i.largestBatchId).delete(n.key);this.ls.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new sl(t,n));let r=this.ls.get(t);void 0===r&&(r=rz(),this.ls.set(t,r)),this.ls.set(t,r.add(n.key))}}class s9{constructor(){this.fs=new iM(s6.ds),this.ws=new iM(s6._s)}isEmpty(){return this.fs.isEmpty()}addReference(e,t){let n=new s6(e,t);this.fs=this.fs.add(n),this.ws=this.ws.add(n)}gs(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.ys(new s6(e,t))}ps(e,t){e.forEach(e=>this.removeReference(e,t))}Is(e){let t=new ib(new iv([])),n=new s6(t,e),i=new s6(t,e+1),r=[];return this.ws.forEachInRange([n,i],e=>{this.ys(e),r.push(e.key)}),r}Ts(){this.fs.forEach(e=>this.ys(e))}ys(e){this.fs=this.fs.delete(e),this.ws=this.ws.delete(e)}Es(e){let t=new ib(new iv([])),n=new s6(t,e),i=new s6(t,e+1),r=rz();return this.ws.forEachInRange([n,i],e=>{r=r.add(e.key)}),r}containsKey(e){let t=new s6(e,0),n=this.fs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class s6{constructor(e,t){this.key=e,this.As=t}static ds(e,t){return ib.comparator(e.key,t.key)||id(e.As,t.As)}static _s(e,t){return id(e.As,t.As)||ib.comparator(e.key,t.key)}}class s5{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.vs=1,this.Rs=new iM(s6.ds)}checkEmpty(e){return ik.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){let r=this.vs;this.vs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new sa(r,t,n,i);for(let t of(this.mutationQueue.push(s),i))this.Rs=this.Rs.add(new s6(t.key,r)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return ik.resolve(s)}lookupMutationBatch(e,t){return ik.resolve(this.Ps(t))}getNextMutationBatchAfterBatchId(e,t){let n=this.bs(t+1),i=n<0?0:n;return ik.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return ik.resolve(0===this.mutationQueue.length?-1:this.vs-1)}getAllMutationBatches(e){return ik.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new s6(t,0),i=new s6(t,Number.POSITIVE_INFINITY),r=[];return this.Rs.forEachInRange([n,i],e=>{let t=this.Ps(e.As);r.push(t)}),ik.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new iM(id);return t.forEach(e=>{let t=new s6(e,0),i=new s6(e,Number.POSITIVE_INFINITY);this.Rs.forEachInRange([t,i],e=>{n=n.add(e.As)})}),ik.resolve(this.Vs(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,r=n;ib.isDocumentKey(r)||(r=r.child(""));let s=new s6(new ib(r),0),a=new iM(id);return this.Rs.forEachWhile(e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(a=a.add(e.As)),!0)},s),ik.resolve(this.Vs(a))}Vs(e){let t=[];return e.forEach(e=>{let n=this.Ps(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){0===this.Ss(t.batchId,"removed")||n7(),this.mutationQueue.shift();let n=this.Rs;return ik.forEach(t.mutations,i=>{let r=new s6(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Rs=n})}Cn(e){}containsKey(e,t){let n=new s6(t,0),i=this.Rs.firstAfterOrEqual(n);return ik.resolve(t.isEqual(i&&i.key))}
4performConsistencyCheck(e){return this.mutationQueue.length,ik.resolve()}Ss(e,t){return this.bs(e)}bs(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Ps(e){let t=this.bs(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class s3{constructor(e){this.Ds=e,this.docs=new iP(ib.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.Ds(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return ik.resolve(n?n.document.mutableCopy():rt.newInvalidDocument(t))}getEntries(e,t){let n=rx;return t.forEach(e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():rt.newInvalidDocument(e))}),ik.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=rx,s=t.path,a=new ib(s.child("")),o=this.docs.getIteratorFrom(a);for(;o.hasNext();){let{key:e,value:{document:a}}=o.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:0!==(n=ib.comparator(e.documentKey,t.documentKey))?n:id(e.largestBatchId,t.largestBatchId)}
vendor: 4,183 bytes, line 4
4(new iE(a.readTime,a.key,-1),n)||(i.has(a.key)||rD(t,a))&&(r=r.insert(a.key,a.mutableCopy()))}return ik.resolve(r)}getAllFromCollectionGroup(e,t,n,i){n7()}Cs(e,t){return ik.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new s7(this)}getSize(e){return ik.resolve(this.size)}}class s7 extends sZ{constructor(e){super(),this.os=e}applyChanges(e){let t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.os.addEntry(e,i)):this.os.removeEntry(n)}),ik.waitFor(t)}getFromCache(e,t){return this.os.getEntry(e,t)}getAllFromCache(e,t){return this.os.getEntries(e,t)}}class s8{constructor(e){this.persistence=e,this.xs=new rL(e=>rb(e),rT),this.lastRemoteSnapshotVersion=ig.min(),this.highestTargetId=0,this.Ns=0,this.ks=new s9,this.targetCount=0,this.Ms=sY.kn()}forEachTarget(e,t){return this.xs.forEach((e,n)=>t(n)),ik.resolve()}getLastRemoteSnapshotVersion(e){return ik.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return ik.resolve(this.Ns)}allocateTargetId(e){return this.highestTargetId=this.Ms.next(),ik.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Ns&&(this.Ns=t),ik.resolve()}Fn(e){this.xs.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Ms=new sY(t),this.highestTargetId=t),e.sequenceNumber>this.Ns&&(this.Ns=e.sequenceNumber)}addTargetData(e,t){return this.Fn(t),this.targetCount+=1,ik.resolve()}updateTargetData(e,t){return this.Fn(t),ik.resolve()}removeTargetData(e,t){return this.xs.delete(t.target),this.ks.Is(t.targetId),this.targetCount-=1,ik.resolve()}removeTargets(e,t,n){let i=0,r=[];return this.xs.forEach((s,a)=>{a.sequenceNumber<=t&&null===n.get(a.targetId)&&(this.xs.delete(s),r.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),ik.waitFor(r).next(()=>i)}getTargetCount(e){return ik.resolve(this.targetCount)}getTargetData(e,t){let n=this.xs.get(t)||null;return ik.resolve(n)}addMatchingKeys(e,t,n){return this.ks.gs(t,n),ik.resolve()}removeMatchingKeys(e,t,n){this.ks.ps(t,n);let i=this.persistence.referenceDelegate,r=[];return i&&t.forEach(t=>{r.push(i.markPotentiallyOrphaned(e,t))}),ik.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.ks.Is(t),ik.resolve()}getMatchingKeysForTargetId(e,t){let n=this.ks.Es(t);return ik.resolve(n)}containsKey(e,t){return ik.resolve(this.ks.containsKey(t))}}class ae{constructor(e,t){this.$s={},this.overlays={},this.Os=new iA(0),this.Fs=!1,this.Fs=!0,this.referenceDelegate=e(this),this.Bs=new s8(this),this.indexManager=new sQ,this.remoteDocumentCache=new s3(e=>this.referenceDelegate.Ls(e)),this.serializer=new sG(t),this.qs=new s2(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Fs=!1,Promise.resolve()}get started(){return this.Fs}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new s4,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.$s[e.toKey()];return n||(n=new s5(t,this.referenceDelegate),this.$s[e.toKey()]=n),n}getTargetCache(){return this.Bs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.qs}runTransaction(e,t,n){n9("MemoryPersistence","Starting transaction:",e);let i=new at(this.Os.next());return this.referenceDelegate.Us(),n(i).next(e=>this.referenceDelegate.Ks(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}Gs(e,t){return ik.or(Object.values(this.$s).map(n=>()=>n.containsKey(e,t)))}}class at extends iI{constructor(e){super(),this.currentSequenceNumber=e}}class an{constructor(e){this.persistence=e,this.Qs=new s9,this.js=null}static zs(e){return new an(e)}get Ws(){if(this.js)return this.js;throw n7()}addReference(e,t,n){return this.Qs.addReference(n,t),this.Ws.delete(n.toString()),ik.resolve()}removeReference(e,t,n){return this.Qs.removeReference(n,t),this.Ws.add(n.toString()),ik.resolve()}markPotentiallyOrphaned(e,t){return this.Ws.add(t.toString()),ik.resolve()}removeTarget(e,t){this.Qs.Is(t.targetId).forEach(e=>this.Ws.add(e.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>
4{e.forEach(e=>this.Ws.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Us(){this.js=new Set}Ks(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ik.forEach(this.Ws,n=>{let i=ib.fromPath(n);return this.Hs(e,i).next(e=>{e||t.removeEntry(i,ig.min())})}).next(()=>(this.js=null,t.apply(e)))}updateLimboDocument(e,t){return this.Hs(e,t).next(e=>{e?this.Ws.delete(t.toString()):this.Ws.add(t.toString())})}Ls(e){return 0}Hs(e,t){return ik.or([()=>ik.resolve(this.Qs.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gs(e,t)])}}class ai{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Fi=n,this.Bi=i}static Li(e,t){let n=rz(),i=rz();for(let e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new ai(e,t.fromCache,n,i)}}class ar{constructor(){this.qi=!1}initialize(e,t){this.Ui=e,this.indexManager=t,this.qi=!0}getDocumentsMatchingQuery(e,t,n,i){return this.Ki(e,t).next(r=>r||this.Gi(e,t,i,n)).next(n=>n||this.Qi(e,t))}Ki(e,t){if(rS(t))return ik.resolve(null);let n=rC(t);return this.indexManager.getIndexType(e,n).next(i=>0===i?null:(null!==t.limit&&1===i&&(n=rC(t=rA(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,n).next(i=>{let r=rz(...i);return this.Ui.getDocuments(e,r).next(i=>this.indexManager.getMinOffset(e,n).next(n=>{let s=this.ji(t,i);return this.zi(t,s,r,n.readTime)?this.Ki(e,rA(t,null,"F")):this.Wi(e,s,t,n)}))})))}Gi(e,t,n,i){return rS(t)||i.isEqual(ig.min())?this.Qi(e,t):this.Ui.getDocuments(e,n).next(r=>{let s=this.ji(t,r);return this.zi(t,s,n,i)?this.Qi(e,t):(n4()<=d.in.DEBUG&&n9("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),rO(t)),this.Wi(e,s,t,function(e,t){let n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1;return new iE(ig.fromTimestamp(1e9===i?new im(n+1,0):new im(n,i)),ib.empty(),-1)}(i,0)))})}ji(e,t){let n=new iM(rP(e));return t.forEach((t,i)=>{rD(e,i)&&(n=n.add(i))}),n}zi(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;let r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(i)>0)}Qi(e,t){return n4()<=d.in.DEBUG&&n9("QueryEngine","Using full collection scan to execute query:",rO(t)),this.Ui.getDocumentsMatchingQuery(e,t,iE.min())}Wi(e,t,n,i){return this.Ui.getDocumentsMatchingQuery(e,n,i).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class as{constructor(e,t,n,i){this.persistence=e,this.Hi=t,this.serializer=i,this.Ji=new iP(id),this.Yi=new rL(e=>rb(e),rT),this.Xi=new Map,this.Zi=e.getRemoteDocumentCache(),this.Bs=e.getTargetCache(),this.qs=e.getBundleCache(),this.tr(n)}tr(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new s1(this.Zi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Zi.setIndexManager(this.indexManager),this.Hi.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ji))}}async function aa(e,t){return await e.persistence.runTransaction("Handle user change","readonly",n=>{let i;return e.mutationQueue.getAllMutationBatches(n).next(r=>(i=r,e.tr(t),e.mutationQueue.getAllMutationBatches(n))).next(t=>{let r=[],s=[],a=rz();for(let e of i)for(let t of(r.push(e.batchId),e.mutations))a=a.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))a=a.add(t.key);return e.localDocuments.getDocuments(n,a).next(e=>({er:e,removedBatchIds:r,addedBatchIds:s}))})})}function ao(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Bs.getLastRemoteSnapshotVersion(t))}async function al(e,t,n){let i=e.Ji.get(t);try{n||await e.persistence.runTransaction("Release target",n?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,i))}catch(e){if(!iC(e))throw e;n9("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}e.Ji=e.Ji.remove(t),e.Yi.delete(i.target)}function au(e,t,n){let i=ig.min(),r=rz();
4return e.persistence.runTransaction("Execute query","readonly",s=>(function(e,t,n){let i=e.Yi.get(n);return void 0!==i?ik.resolve(e.Ji.get(i)):e.Bs.getTargetData(t,n)})(e,s,rC(t)).next(t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,e.Bs.getMatchingKeysForTargetId(s,t.targetId).next(e=>{r=e})}).next(()=>e.Hi.getDocumentsMatchingQuery(s,t,n?i:ig.min(),n?r:rz())).next(n=>{var i;let s;return i=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),s=e.Xi.get(i)||ig.min(),n.forEach((e,t)=>{t.readTime.compareTo(s)>0&&(s=t.readTime)}),e.Xi.set(i,s),{documents:n,ir:r}}))}class ah{constructor(){this.activeTargetIds=rq}lr(e){this.activeTargetIds=this.activeTargetIds.add(e)}dr(e){this.activeTargetIds=this.activeTargetIds.delete(e)}hr(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class ac{constructor(){this.Hr=new ah,this.Jr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.Hr.lr(e),this.Jr[e]||"not-current"}updateQueryState(e,t,n){this.Jr[e]=t}removeLocalQueryTarget(e){this.Hr.dr(e)}isLocalQueryTarget(e){return this.Hr.activeTargetIds.has(e)}clearQueryState(e){delete this.Jr[e]}getAllActiveQueryTargets(){return this.Hr.activeTargetIds}isActiveQueryTarget(e){return this.Hr.activeTargetIds.has(e)}start(){return this.Hr=new ah,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class ad{Yr(e){}shutdown(){}}class af{constructor(){this.Xr=()=>this.Zr(),this.eo=()=>this.no(),this.so=[],this.io()}Yr(e){this.so.push(e)}shutdown(){window.removeEventListener("online",this.Xr),window.removeEventListener("offline",this.eo)}io(){window.addEventListener("online",this.Xr),window.addEventListener("offline",this.eo)}Zr(){for(let e of(n9("ConnectivityMonitor","Network connectivity changed: AVAILABLE"),this.so))e(0)}no(){for(let e of(n9("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE"),this.so))e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let ap=null;function am(){return null===ap?ap=268435456+Math.round(2147483648*Math.random()):ap++,"0x"+ap.toString(16)}let ag={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class ay{constructor(e){this.ro=e.ro,this.oo=e.oo}uo(e){this.co=e}ao(e){this.ho=e}onMessage(e){this.lo=e}close(){this.oo()}send(e){this.ro(e)}fo(){this.co()}wo(e){this.ho(e)}_o(e){this.lo(e)}}let av="WebChannelConnection";class aw extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?"https":"http";this.mo=t+"://"+e.host,this.yo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get po(){return!1}Io(e,t,n,i,r){let s=am(),a=this.To(e,t);n9("RestConnection",`Sending RPC '${e}' ${s}:`,a,n);let o={};return this.Eo(o,i,r),this.Ao(e,a,o,n).then(t=>(n9("RestConnection",`Received RPC '${e}' ${s}: `,t),t),t=>{throw n5("RestConnection",`RPC '${e}' ${s} failed with error: `,t,"url: ",a,"request:",n),t})}vo(e,t,n,i,r,s){return this.Io(e,t,n,i,r)}Eo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+n1,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t)}To(e,t){let n=ag[e];return`${this.mo}/v1/${t}:${n}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Ao(e,t,n,i){let r=am();return new Promise((s,a)=>{let o=new nJ;o.setWithCredentials(!0),o.listenOnce(nH.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case n$.NO_ERROR:let t=o.getResponseJson();n9(av,`XHR for RPC '${e}' ${r} received:`,JSON.stringify(t)),s(t);break;case n$.TIMEOUT:n9(av,`RPC '${e}' ${r} timed out`),a(new ie(n8.DEADLINE_EXCEEDED,"Request time out"));break;case n$.HTTP_ERROR:let n=o.getStatus();if(n9(av,`RPC '${e}' ${r} failed with status:`,n,"response text:",o.getResponseText()),n>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e=function(e){let t=e.toLowerCase().replace(/_/g,"-");return Object.values(n8).indexOf(t)>=0?t:n8.UNKNOWN}(t.status);a(new ie(e,t.message))}else a(new ie(n8.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new ie(n8.UNAVAILABLE,"Connection failed."));break;default:n7()}}finally{n9(av,`RPC '${e}' ${r} completed.`)}});let l=JSON.stringify(i);n9(av,`RPC '${e}' ${r} sending request:`,i),o.send(t,"POST",l,n,15)})}Ro(e,t,n){let i=am(),r=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=nz(),a=nq(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`}
4,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;void 0!==u&&(l.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(l.xmlHttpFactory=new nW({})),this.Eo(l.initMessageHeaders,t,n),l.encodeInitMessageHeaders=!0;let h=r.join("");n9(av,`Creating RPC '${e}' stream ${i}: ${h}`,l);let c=s.createWebChannel(h,l),d=!1,f=!1,p=new ay({ro:t=>{f?n9(av,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(d||(n9(av,`Opening RPC '${e}' stream ${i} transport.`),c.open(),d=!0),n9(av,`RPC '${e}' stream ${i} sending:`,t),c.send(t))},oo:()=>c.close()}),m=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return m(c,nQ.EventType.OPEN,()=>{f||n9(av,`RPC '${e}' stream ${i} transport opened.`)}),m(c,nQ.EventType.CLOSE,()=>{f||(f=!0,n9(av,`RPC '${e}' stream ${i} transport closed`),p.wo())}),m(c,nQ.EventType.ERROR,t=>{f||(f=!0,n5(av,`RPC '${e}' stream ${i} transport errored:`,t),p.wo(new ie(n8.UNAVAILABLE,"The operation could not be completed")))}),m(c,nQ.EventType.MESSAGE,t=>{var n;if(!f){let r=t.data[0];r||n7();let s=r.error||(null===(n=r[0])||void 0===n?void 0:n.error);if(s){n9(av,`RPC '${e}' stream ${i} received error:`,s);let t=s.status,n=function(e){let t=o[e];if(void 0!==t)return sh(t)}(t),r=s.message;void 0===n&&(n=n8.INTERNAL,r="Unknown error status: "+t+" with message "+s.message),f=!0,p.wo(new ie(n,r)),c.close()}else n9(av,`RPC '${e}' stream ${i} received:`,r),p._o(r)}}),m(a,nK.STAT_EVENT,t=>{t.stat===nG.PROXY?n9(av,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===nG.NOPROXY&&n9(av,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{p.fo()},0),p}}function a_(){return"undefined"!=typeof document?document:null}function ab(e){return new sN(e,!0)}class aT{constructor(e,t,n=1e3,i=1.5,r=6e4){this.ii=e,this.timerId=t,this.Po=n,this.bo=i,this.Vo=r,this.So=0,this.Do=null,this.Co=Date.now(),this.reset()}reset(){this.So=0}xo(){this.So=this.Vo}No(e){this.cancel();let t=Math.floor(this.So+this.ko()),n=Math.max(0,Date.now()-this.Co),i=Math.max(0,t-n);i>0&&n9("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.So} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Do=this.ii.enqueueAfterDelay(this.timerId,i,()=>(this.Co=Date.now(),e())),this.So*=this.bo,this.So<this.Po&&(this.So=this.Po),this.So>this.Vo&&(this.So=this.Vo)}Mo(){null!==this.Do&&(this.Do.skipDelay(),this.Do=null)}cancel(){null!==this.Do&&(this.Do.cancel(),this.Do=null)}ko(){return(Math.random()-.5)*this.So}}class aE{constructor(e,t,n,i,r,s,a,o){this.ii=e,this.$o=n,this.Oo=i,this.connection=r,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.Fo=0,this.Bo=null,this.Lo=null,this.stream=null,this.qo=new aT(e,t)}Uo(){return 1===this.state||5===this.state||this.Ko()}Ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Go()}async stop(){this.Uo()&&await this.close(0)}Qo(){this.state=0,this.qo.reset()}jo(){this.Ko()&&null===this.Bo&&(this.Bo=this.ii.enqueueAfterDelay(this.$o,6e4,()=>this.zo()))}Wo(e){this.Ho(),this.stream.send(e)}async zo(){if(this.Ko())return this.close(0)}Ho(){this.Bo&&(this.Bo.cancel(),this.Bo=null)}Jo(){this.Lo&&(this.Lo.cancel(),this.Lo=null)}async close(e,t){this.Ho(),this.Jo(),this.qo.cancel(),this.Fo++,4!==e?this.qo.reset():t&&t.code===n8.RESOURCE_EXHAUSTED?(n6(t.toString()),n6("Using maximum backoff delay to prevent overloading the backend."),this.qo.xo()):t&&t.code===n8.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Yo(),this.stream.close(),this.stream=null),this.state=e,await this.listener.ao(t)}Yo(){}auth(){this.state=1;let e=this.Xo(this.Fo),t=this.Fo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.Fo===t&&this.Zo(e,n)},t=>{e(()=>{let e=new ie(n8.UNKNOWN,"Fetching auth token failed: "+t.message);return this.tu(e)})})}Zo(e,t){let n=this.Xo(this.Fo);this.stream=this.eu(e,t),this.stream.uo(()=>{n(()=>(this.state=2,this.Lo=this.ii.enqueueAfterDelay(this.Oo,1e4,()=>(this.Ko()&&(this.state=3),Promise.resolve())),this.listener.uo()))}),this.stream.ao(e=>{n(()=>this.tu(e))}),this.stream.onMessage(e=>{n(()=>this.onMessage(e))})}Go(){this.state=5,this.qo.No(async()=>{this.state=0,this.start()})}tu(e){return n9("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}Xo(e){return t=>{this.ii.enqueueAndForget(()=>this.Fo===e?t():(n9("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class aI extends aE{constructor(e,t,n,i,r,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,s),this.serializer
4=r}eu(e,t){return this.connection.Ro("Listen",e,t)}onMessage(e){this.qo.reset();let t=function(e,t){let n;if("targetChange"in t){var i,r;t.targetChange;let s="NO_CHANGE"===(i=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:n7(),a=t.targetChange.targetIds||[],o=(r=t.targetChange.resumeToken,e.useProto3Json?(void 0===r||"string"==typeof r||n7(),ij.fromBase64String(r||"")):(void 0===r||r instanceof Uint8Array||n7(),ij.fromUint8Array(r||new Uint8Array))),l=t.targetChange.cause;n=new sT(s,a,o,l&&new ie(void 0===l.code?n8.UNKNOWN:sh(l.code),l.message||"")||null)}else if("documentChange"in t){t.documentChange;let i=t.documentChange;i.document,i.document.name,i.document.updateTime;let r=sF(e,i.document.name),s=sL(i.document.updateTime),a=i.document.createTime?sL(i.document.createTime):ig.min(),o=new re({mapValue:{fields:i.document.fields}}),l=rt.newFoundDocument(r,s,a,o);n=new s_(i.targetIds||[],i.removedTargetIds||[],l.key,l)}else if("documentDelete"in t){t.documentDelete;let i=t.documentDelete;i.document;let r=sF(e,i.document),s=i.readTime?sL(i.readTime):ig.min(),a=rt.newNoDocument(r,s);n=new s_([],i.removedTargetIds||[],a.key,a)}else if("documentRemove"in t){t.documentRemove;let i=t.documentRemove;i.document;let r=sF(e,i.document);n=new s_([],i.removedTargetIds||[],r,null)}else{if(!("filter"in t))return n7();{t.filter;let e=t.filter;e.targetId;let{count:i=0,unchangedNames:r}=e,s=new su(i,r);n=new sb(e.targetId,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return ig.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?ig.min():t.readTime?sL(t.readTime):ig.min()}(e);return this.listener.nu(t,n)}su(e){let t={};t.database=sj(this.serializer),t.addTarget=function(e,t){let n;let i=t.target;if((n=rE(i)?{documents:{documents:[sV(e,i.path)]}}:{query:function(e,t){var n,i;let r={structuredQuery:{}},s=t.path;null!==t.collectionGroup?(r.parent=sV(e,s),r.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r.parent=sV(e,s.popLast()),r.structuredQuery.from=[{collectionId:s.lastSegment()}]);let a=function(e){if(0!==e.length)return function e(t){return t instanceof ro?function(e){if("=="===e.op){if(i5(e.value))return{unaryFilter:{field:sq(e.field),op:"IS_NAN"}};if(i6(e.value))return{unaryFilter:{field:sq(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(i5(e.value))return{unaryFilter:{field:sq(e.field),op:"IS_NOT_NAN"}};if(i6(e.value))return{unaryFilter:{field:sq(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:sq(e.field),op:sA[e.op],value:e.value}}}(t):t instanceof rl?function(t){let n=t.getFilters().map(t=>e(t));return 1===n.length?n[0]:{compositeFilter:{op:sR[t.op],filters:n}}}(t):n7()}(rl.create(e,"and"))}(t.filters);a&&(r.structuredQuery.where=a);let o=function(e){if(0!==e.length)return e.map(e=>({field:sq(e.field),direction:sC[e.dir]}))}(t.orderBy);o&&(r.structuredQuery.orderBy=o);let l=sO(e,t.limit);return null!==l&&(r.structuredQuery.limit=l),t.startAt&&(r.structuredQuery.startAt={before:(n=t.startAt).inclusive,values:n.position}),t.endAt&&(r.structuredQuery.endAt={before:!(i=t.endAt).inclusive,values:i.position}),r}(e,i)}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=sP(e,t.resumeToken);let i=sO(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(ig.min())>0){n.readTime=sD(e,t.snapshotVersion.toTimestamp());let i=sO(e,t.expectedCount);null!==i&&(n.expectedCount=i)}return n}(this.serializer,e);let n=function(e,t){let n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return n7()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.Wo(t)}iu(e){let t={};t.database=sj(this.serializer),t.removeTarget=e,this.Wo(t)}}class aS extends aE{constructor(e,t,n,i,r,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,s),this.serializer
4=r,this.ru=!1}get ou(){return this.ru}start(){this.ru=!1,this.lastStreamToken=void 0,super.start()}Yo(){this.ru&&this.uu([])}eu(e,t){return this.connection.Ro("Write",e,t)}onMessage(e){var t,n;if(e.streamToken||n7(),this.lastStreamToken=e.streamToken,this.ru){this.qo.reset();let i=(t=e.writeResults,n=e.commitTime,t&&t.length>0?(void 0!==n||n7(),t.map(e=>{let t;return(t=e.updateTime?sL(e.updateTime):sL(n)).isEqual(ig.min())&&(t=sL(n)),new r2(t,e.transformResults||[])})):[]),r=sL(e.commitTime);return this.listener.cu(r,i)}return e.writeResults&&0!==e.writeResults.length&&n7(),this.ru=!0,this.listener.au()}hu(){let e={};e.database=sj(this.serializer),this.Wo(e)}uu(e){let t={streamToken:this.lastStreamToken,writes:e.map(e=>(function(e,t){var n;let i;if(t instanceof r8)i={update:sz(e,t.key,t.value)};else if(t instanceof sr)i={delete:sU(e,t.key)};else if(t instanceof se)i={update:sz(e,t.key,t.data),updateMask:function(e){let t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}(t.fieldMask)};else{if(!(t instanceof ss))return n7();i={verify:sU(e,t.key)}}return t.fieldTransforms.length>0&&(i.updateTransforms=t.fieldTransforms.map(e=>(function(e,t){let n=t.transform;if(n instanceof rW)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof rQ)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof rX)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof rZ)return{fieldPath:t.field.canonicalString(),increment:n.gt};throw n7()})(0,e))),t.precondition.isNone||(i.currentDocument=void 0!==(n=t.precondition).updateTime?{updateTime:sD(e,n.updateTime.toTimestamp())}:void 0!==n.exists?{exists:n.exists}:n7()),i})(this.serializer,e))};this.Wo(t)}}class ak extends class{}{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.lu=!1}fu(){if(this.lu)throw new ie(n8.FAILED_PRECONDITION,"The client has already been terminated.")}Io(e,t,n){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,r])=>this.connection.Io(e,t,n,i,r)).catch(e=>{throw"FirebaseError"===e.name?(e.code===n8.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new ie(n8.UNKNOWN,e.toString())})}vo(e,t,n,i){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,s])=>this.connection.vo(e,t,n,r,s,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===n8.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new ie(n8.UNKNOWN,e.toString())})}terminate(){this.lu=!0}}class aC{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.wu=0,this._u=null,this.mu=!0}gu(){0===this.wu&&(this.yu("Unknown"),this._u=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._u=null,this.pu("Backend didn't respond within 10 seconds."),this.yu("Offline"),Promise.resolve())))}Iu(e){"Online"===this.state?this.yu("Unknown"):(this.wu++,this.wu>=1&&(this.Tu(),this.pu(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.yu("Offline")))}set(e){this.Tu(),this.wu=0,"Online"===e&&(this.mu=!1),this.yu(e)}yu(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}pu(e){let t=`Could not reach Cloud Firestore backend. ${e} 5This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.mu?(n6(t),this.mu=!1):n9("OnlineStateTracker",t)}Tu(){null!==this._u&&(this._u.cancel(),this._u=null)}}class aA{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Eu=[],this.Au=new Map,this.vu=new Set,this.Ru=[],this.Pu=r,this.Pu.Yr(e=>{n.enqueueAndForget(async()=>{aU(this)&&(n9("RemoteStore","Restarting streams for network reachability change."),await async function(e){e.vu.add(4),await aN(e),e.bu.set("Unknown"),e.vu.delete(4),await aR(e)}(this))})}),this.bu=new aC(n,i)}}async function aR(e){if(aU(e))for(let t of e.Ru)await t(!0)}async function aN(e){for(let t of e.Ru)await t(!1)}function aO(e,t){e.Au.has(t.targetId)||(e.Au.set(t.targetId,t),aM(e)?ax(e):aY(e).Ko()&&aP(e,t))}function aD(e,t){let n=aY(e);e.Au.delete(t),n.Ko()&&aL(e,t),0===e.Au.size&&(n.Ko()?n.jo():aU(e)&&e.bu.set("Unknown"))}function aP(e,t){if(e.Vu.qt(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(ig.min())>0){let n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}aY(e).su(t)}function aL(e,t){e.Vu.qt(t),aY(e).iu(t)}function ax(e){e.Vu=new sI({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),le:t=>e.Au.get(t)||null,ue:()=>e.datastore.serializer.databaseId}),aY(e).start(),e.bu.gu()}function aM(e){return aU(e)&&!aY(e).Uo()&&e.Au.size>0}function aU(e){return 0===e.vu.size}async function aF(e){e.Au.forEach((t,n)=>{aP(e,t)})}async function aV(e,t){e.Vu=void 0,aM(e)?(e.bu.Iu(t),ax(e)):e.bu.set("Unknown")}async function aj(e,t,n){if(e.bu.set("Online"),t instanceof sT&&2===t.state&&t.cause)try{await async function(e,t){let n=t.cause;for(let i of t.targetIds)e.Au.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.Au.delete(i),e.Vu.removeTarget(i))}(e,t)}catch(n){n9("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await aB(e,n)}else if(t instanceof s_?e.Vu.Ht(t):t instanceof sb?e.Vu.ne(t):e.Vu.Xt(t),!n.isEqual(ig.min()))try{let t=await ao(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.Vu.ce(t);
5return n.targetChanges.forEach((n,i)=>{if(n.resumeToken.approximateByteSize()>0){let r=e.Au.get(i);r&&e.Au.set(i,r.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{let i=e.Au.get(t);if(!i)return;e.Au.set(t,i.withResumeToken(ij.EMPTY_BYTE_STRING,i.snapshotVersion)),aL(e,t);let r=new sK(i.target,t,n,i.sequenceNumber);aP(e,r)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){n9("RemoteStore","Failed to raise snapshot:",t),await aB(e,t)}}async function aB(e,t,n){if(!iC(t))throw t;e.vu.add(1),await aN(e),e.bu.set("Offline"),n||(n=()=>ao(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{n9("RemoteStore","Retrying IndexedDB access"),await n(),e.vu.delete(1),await aR(e)})}function az(e,t){return t().catch(n=>aB(e,n,t))}async function aq(e){let t=aZ(e),n=e.Eu.length>0?e.Eu[e.Eu.length-1].batchId:-1;for(;aU(e)&&e.Eu.length<10;)try{let i=await function(e,t){return e.persistence.runTransaction("Get next mutation batch","readonly",n=>(void 0===t&&(t=-1),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)))}(e.localStore,n);if(null===i){0===e.Eu.length&&t.jo();break}n=i.batchId,function(e,t){e.Eu.push(t);let n=aZ(e);n.Ko()&&n.ou&&n.uu(t.mutations)}(e,i)}catch(t){await aB(e,t)}a$(e)&&aH(e)}function a$(e){return aU(e)&&!aZ(e).Uo()&&e.Eu.length>0}function aH(e){aZ(e).start()}async function aK(e){aZ(e).hu()}async function aG(e){let t=aZ(e);for(let n of e.Eu)t.uu(n.mutations)}async function aW(e,t,n){let i=e.Eu.shift(),r=so.from(i,t,n);await az(e,()=>e.remoteSyncer.applySuccessfulWrite(r)),await aq(e)}async function aQ(e,t){t&&aZ(e).ou&&await async function(e,t){var n;if(function(e){switch(e){default:return n7();case n8.CANCELLED:case n8.UNKNOWN:case n8.DEADLINE_EXCEEDED:case n8.RESOURCE_EXHAUSTED:case n8.INTERNAL:case n8.UNAVAILABLE:case n8.UNAUTHENTICATED:return!1;case n8.INVALID_ARGUMENT:case n8.NOT_FOUND:case n8.ALREADY_EXISTS:case n8.PERMISSION_DENIED:case n8.FAILED_PRECONDITION:case n8.ABORTED:case n8.OUT_OF_RANGE:case n8.UNIMPLEMENTED:case n8.DATA_LOSS:return!0}}(n=t.code)&&n!==n8.ABORTED){let n=e.Eu.shift();aZ(e).Qo(),await az(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await aq(e)}}(e,t),a$(e)&&aH(e)}async function aJ(e,t){e.asyncQueue.verifyOperationInProgress(),n9("RemoteStore","RemoteStore received new credentials");let n=aU(e);e.vu.add(3),await aN(e),n&&e.bu.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.vu.delete(3),await aR(e)}async function aX(e,t){t?(e.vu.delete(2),await aR(e)):t||(e.vu.add(2),await aN(e),e.bu.set("Unknown"))}function aY(e){var t,n,i;return e.Su||(e.Su=(t=e.datastore,n=e.asyncQueue,i={uo:aF.bind(null,e),ao:aV.bind(null,e),nu:aj.bind(null,e)},t.fu(),new aI(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,i)),e.Ru.push(async t=>{t?(e.Su.Qo(),aM(e)?ax(e):e.bu.set("Unknown")):(await e.Su.stop(),e.Vu=void 0)})),e.Su}function aZ(e){var t,n,i;return e.Du||(e.Du=(t=e.datastore,n=e.asyncQueue,i={uo:aK.bind(null,e),ao:aQ.bind(null,e),au:aG.bind(null,e),cu:aW.bind(null,e)},t.fu(),new aS(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,i)),e.Ru.push(async t=>{t?(e.Du.Qo(),await aq(e)):(await e.Du.stop(),e.Eu.length>0&&(n9("RemoteStore",`Stopping write stream with ${e.Eu.length} pending writes`),e.Eu=[]))})),e.Du}class a0{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new it,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}static createAndSchedule(e,t,n,i,r){let s=new a0(e,t,Date.now()+n,i,r);return s.start(n),s}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new ie(n8.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function a1(e,t){if(n6("AsyncQueue",`${t}: ${e}`),iC(e))return new ie(n8.UNAVAILABLE,`${t}: ${e}`);throw e}class a2{constructor(e){this.comparator=e?(t,n)=>e(t,n)||ib.comparator(t.key,n.key):(e,t)=>ib.comparator(e.key,t.key),this.keyedMap=rU(),this.sortedSet=new iP(this.comparator)}static emptySet(e){return new a2(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof a2)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){let n=new a2;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class a4{constructor(){this.Cu=new iP(ib.comparator)}track(e){let t=e.doc.key,n=this.Cu.get(t);n?0!==e.type&&3===n.type?this.Cu=this.Cu.insert(t,e):3===e.type&&1!==n.type?this.Cu=this.Cu.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.Cu=this.Cu.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.Cu=this.Cu.remove(t):1===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):n7():this.Cu=this.Cu.insert(t,e)}xu(){let e=[];return this.Cu.inorderTraversal((t,n)=>{e.push(n)}),e}}class a9{constructor(e,t,n,i,r,s,a,o,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=o,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,i,r){let s=[];
5return t.forEach(e=>{s.push({type:0,doc:e})}),new a9(e,t,a2.emptySet(t),s,n,i,!0,!1,r)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&rR(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class a6{constructor(){this.Nu=void 0,this.listeners=[]}}class a5{constructor(){this.queries=new rL(e=>rN(e),rR),this.onlineState="Unknown",this.ku=new Set}}async function a3(e,t){let n=t.query,i=!1,r=e.queries.get(n);if(r||(i=!0,r=new a6),i)try{r.Nu=await e.onListen(n)}catch(n){let e=a1(n,`Initialization of query '${rO(t.query)}' failed`);return void t.onError(e)}e.queries.set(n,r),r.listeners.push(t),t.Mu(e.onlineState),r.Nu&&t.$u(r.Nu)&&ot(e)}async function a7(e,t){let n=t.query,i=!1,r=e.queries.get(n);if(r){let e=r.listeners.indexOf(t);e>=0&&(r.listeners.splice(e,1),i=0===r.listeners.length)}if(i)return e.queries.delete(n),e.onUnlisten(n)}function a8(e,t){let n=!1;for(let i of t){let t=i.query,r=e.queries.get(t);if(r){for(let e of r.listeners)e.$u(i)&&(n=!0);r.Nu=i}}n&&ot(e)}function oe(e,t,n){let i=e.queries.get(t);if(i)for(let e of i.listeners)e.onError(n);e.queries.delete(t)}function ot(e){e.ku.forEach(e=>{e.next()})}class on{constructor(e,t,n){this.query=e,this.Ou=t,this.Fu=!1,this.Bu=null,this.onlineState="Unknown",this.options=n||{}}$u(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)3!==n.type&&t.push(n);e=new a9(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Fu?this.Lu(e)&&(this.Ou.next(e),t=!0):this.qu(e,this.onlineState)&&(this.Uu(e),t=!0),this.Bu=e,t}onError(e){this.Ou.error(e)}Mu(e){this.onlineState=e;let t=!1;return this.Bu&&!this.Fu&&this.qu(this.Bu,e)&&(this.Uu(this.Bu),t=!0),t}qu(e,t){return!e.fromCache||(!this.options.Ku||!("Offline"!==t))&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Lu(e){if(e.docChanges.length>0)return!0;let t=this.Bu&&this.Bu.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Uu(e){e=a9.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Fu=!0,this.Ou.next(e)}}class oi{constructor(e){this.key=e}}class or{constructor(e){this.key=e}}class os{constructor(e,t){this.query=e,this.Yu=t,this.Xu=null,this.hasCachedResults=!1,this.current=!1,this.Zu=rz(),this.mutatedKeys=rz(),this.tc=rP(e),this.ec=new a2(this.tc)}get nc(){return this.Yu}sc(e,t){let n=t?t.ic:new a4,i=t?t.ec:this.ec,r=t?t.mutatedKeys:this.mutatedKeys,s=i,a=!1,o="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,l="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{let u=i.get(e),h=rD(this.query,t)?t:null,c=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations),f=!1;u&&h?u.data.isEqual(h.data)?c!==d&&(n.track({type:3,doc:h}),f=!0):this.rc(u,h)||(n.track({type:2,doc:h}),f=!0,(o&&this.tc(h,o)>0||l&&0>this.tc(h,l))&&(a=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(o||l)&&(a=!0)),f&&(h?(s=s.add(h),r=d?r.add(e):r.delete(e)):(s=s.delete(e),r=r.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){let e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{ec:s,ic:n,zi:a,mutatedKeys:r}}rc(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){let i=this.ec;this.ec=e.ec,this.mutatedKeys=e.mutatedKeys;let r=e.ic.xu();r.sort((e,t)=>(function(e,t){let n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return n7()}};return n(e)-n(t)})(e.type,t.type)||this.tc(e.doc,t.doc)),this.oc(n);let s=t?this.uc():[],a=0===this.Zu.size&&this.current?1:0,o=a!==this.Xu;return(this.Xu=a,0!==r.length||o)?{snapshot:new a9(this.query,e.ec,i,r,e.mutatedKeys,0===a,o,!1,!!n&&n.resumeToken.approximateByteSize()>0),cc:s}:{cc:s}}Mu(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ec:this.ec,ic:new a4,mutatedKeys:this.mutatedKeys,zi:!1},!1)):{cc:[]}}ac(e){return!this.Yu.has(e)&&!!this.ec.has(e)&&!this.ec.get(e).hasLocalMutations}
5oc(e){e&&(e.addedDocuments.forEach(e=>this.Yu=this.Yu.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Yu=this.Yu.delete(e)),this.current=e.current)}uc(){if(!this.current)return[];let e=this.Zu;this.Zu=rz(),this.ec.forEach(e=>{this.ac(e.key)&&(this.Zu=this.Zu.add(e.key))});let t=[];return e.forEach(e=>{this.Zu.has(e)||t.push(new or(e))}),this.Zu.forEach(n=>{e.has(n)||t.push(new oi(n))}),t}hc(e){this.Yu=e.ir,this.Zu=rz();let t=this.sc(e.documents);return this.applyChanges(t,!0)}lc(){return a9.fromInitialDocuments(this.query,this.ec,this.mutatedKeys,0===this.Xu,this.hasCachedResults)}}class oa{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class oo{constructor(e){this.key=e,this.fc=!1}}class ol{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.dc={},this.wc=new rL(e=>rN(e),rR),this._c=new Map,this.mc=new Set,this.gc=new iP(ib.comparator),this.yc=new Map,this.Ic=new s9,this.Tc={},this.Ec=new Map,this.Ac=sY.Mn(),this.onlineState="Unknown",this.vc=void 0}get isPrimaryClient(){return!0===this.vc}}async function ou(e,t){var n,i;let r,s;let a=(e.remoteStore.remoteSyncer.applyRemoteEvent=of.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=ok.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=om.bind(null,e),e.dc.nu=a8.bind(null,e.eventManager),e.dc.Pc=oe.bind(null,e.eventManager),e),o=a.wc.get(t);if(o)r=o.targetId,a.sharedClientState.addLocalQueryTarget(r),s=o.view.lc();else{let e=await (n=a.localStore,i=rC(t),n.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return n.Bs.getTargetData(e,i).next(r=>r?(t=r,ik.resolve(t)):n.Bs.allocateTargetId(e).next(r=>(t=new sK(i,r,"TargetPurposeListen",e.currentSequenceNumber),n.Bs.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=n.Ji.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(n.Ji=n.Ji.insert(e.targetId,e),n.Yi.set(i,e.targetId)),e})),o=a.sharedClientState.addLocalQueryTarget(e.targetId);r=e.targetId,s=await oh(a,t,r,"current"===o,e.resumeToken),a.isPrimaryClient&&aO(a.remoteStore,e)}return s}async function oh(e,t,n,i,r){e.Rc=(t,n,i)=>(async function(e,t,n,i){let r=t.view.sc(n);r.zi&&(r=await au(e.localStore,t.query,!1).then(({documents:e})=>t.view.sc(e,r)));let s=i&&i.targetChanges.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,s);return oT(e,t.targetId,a.cc),a.snapshot})(e,t,n,i);let s=await au(e.localStore,t,!0),a=new os(t,s.ir),o=a.sc(s.documents),l=sw.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),u=a.applyChanges(o,e.isPrimaryClient,l);oT(e,n,u.cc);let h=new oa(t,n,a);return e.wc.set(t,h),e._c.has(n)?e._c.get(n).push(t):e._c.set(n,[t]),u.snapshot}async function oc(e,t){let n=e.wc.get(t),i=e._c.get(n.targetId);if(i.length>1)return e._c.set(n.targetId,i.filter(e=>!rR(e,t))),void e.wc.delete(t);e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)||await al(e.localStore,n.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(n.targetId),aD(e.remoteStore,n.targetId),o_(e,n.targetId)}).catch(iS)):(o_(e,n.targetId),await al(e.localStore,n.targetId,!0))}async function od(e,t,n){var i;let r=(e.remoteStore.remoteSyncer.applySuccessfulWrite=og.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=oy.bind(null,e),e);try{let e;let s=await function(e,t){let n,i;let r=im.now(),s=t.reduce((e,t)=>e.add(t.key),rz());return e.persistence.runTransaction("Locally write mutations","readwrite",a=>{let o=rx,l=rz();return e.Zi.getEntries(a,s).next(e=>{(o=e).forEach((e,t)=>{t.isValidDocument()||(l=l.add(e))})}).next(()=>e.localDocuments.getOverlayedDocuments(a,o)).next(i=>{n=i;let s=[];for(let e of t){let t=function(e,t){let n=null;for(let i of e.fieldTransforms){let e=t.data.field(i.field),r=rG(i.transform,e||null);null!=r&&(null===n&&(n=re.empty()),n.set(i.field,r))}return n||null}(e,n.get(e.key).overlayedDocument);null!=t&&s.push(new se(e.key,t,function e(t){let n=[];return iO(t.fields,(t,i)=>{let r=new i_([t]);if(i3(i)){let t=e(i.mapValue).fields;if(0===t.length)n.push(r);else for(let e of t)n.push(r.child(e))}else n.push(r)}),new iF(n)}(t.value.mapValue),r4.exists(!0)))}
5return e.mutationQueue.addMutationBatch(a,r,s,t)}).next(t=>{i=t;let r=t.applyToLocalDocumentSet(n,l);return e.documentOverlayCache.saveOverlays(a,t.batchId,r)})}).then(()=>({batchId:i.batchId,changes:rF(n)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(s.batchId),i=s.batchId,(e=r.Tc[r.currentUser.toKey()])||(e=new iP(id)),e=e.insert(i,n),r.Tc[r.currentUser.toKey()]=e,await oI(r,s.changes),await aq(r.remoteStore)}catch(t){let e=a1(t,"Failed to persist write");n.reject(e)}}async function of(e,t){try{let n=await function(e,t){let n=t.snapshotVersion,i=e.Ji;return e.persistence.runTransaction("Apply remote event","readwrite-primary",r=>{var s;let a,o;let l=e.Zi.newChangeBuffer({trackRemovals:!0});i=e.Ji;let u=[];t.targetChanges.forEach((s,a)=>{var o;let l=i.get(a);if(!l)return;u.push(e.Bs.removeMatchingKeys(r,s.removedDocuments,a).next(()=>e.Bs.addMatchingKeys(r,s.addedDocuments,a)));let h=l.withSequenceNumber(r.currentSequenceNumber);null!==t.targetMismatches.get(a)?h=h.withResumeToken(ij.EMPTY_BYTE_STRING,ig.min()).withLastLimboFreeSnapshotVersion(ig.min()):s.resumeToken.approximateByteSize()>0&&(h=h.withResumeToken(s.resumeToken,n)),i=i.insert(a,h),o=h,(0===l.resumeToken.approximateByteSize()||o.snapshotVersion.toMicroseconds()-l.snapshotVersion.toMicroseconds()>=3e8||s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size>0)&&u.push(e.Bs.updateTargetData(r,h))});let h=rx,c=rz();if(t.documentUpdates.forEach(n=>{t.resolvedLimboDocuments.has(n)&&u.push(e.persistence.referenceDelegate.updateLimboDocument(r,n))}),u.push((s=t.documentUpdates,a=rz(),o=rz(),s.forEach(e=>a=a.add(e)),l.getEntries(r,a).next(e=>{let t=rx;return s.forEach((n,i)=>{let r=e.get(n);i.isFoundDocument()!==r.isFoundDocument()&&(o=o.add(n)),i.isNoDocument()&&i.version.isEqual(ig.min())?(l.removeEntry(n,i.readTime),t=t.insert(n,i)):!r.isValidDocument()||i.version.compareTo(r.version)>0||0===i.version.compareTo(r.version)&&r.hasPendingWrites?(l.addEntry(i),t=t.insert(n,i)):n9("LocalStore","Ignoring outdated watch update for ",n,". Current version:",r.version," Watch version:",i.version)}),{nr:t,sr:o}})).next(e=>{h=e.nr,c=e.sr})),!n.isEqual(ig.min())){let t=e.Bs.getLastRemoteSnapshotVersion(r).next(t=>e.Bs.setTargetsMetadata(r,r.currentSequenceNumber,n));u.push(t)}return ik.waitFor(u).next(()=>l.apply(r)).next(()=>e.localDocuments.getLocalViewOfDocuments(r,h,c)).next(()=>h)}).then(t=>(e.Ji=i,t))}(e.localStore,t);
5t.targetChanges.forEach((t,n)=>{let i=e.yc.get(n);i&&(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1||n7(),t.addedDocuments.size>0?i.fc=!0:t.modifiedDocuments.size>0?i.fc||n7():t.removedDocuments.size>0&&(i.fc||n7(),i.fc=!1))}),await oI(e,n,t)}catch(e){await iS(e)}}function op(e,t,n){var i;if(e.isPrimaryClient&&0===n||!e.isPrimaryClient&&1===n){let n;let r=[];e.wc.forEach((e,n)=>{let i=n.view.Mu(t);i.snapshot&&r.push(i.snapshot)}),(i=e.eventManager).onlineState=t,n=!1,i.queries.forEach((e,i)=>{for(let e of i.listeners)e.Mu(t)&&(n=!0)}),n&&ot(i),r.length&&e.dc.nu(r),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function om(e,t,n){e.sharedClientState.updateQueryState(t,"rejected",n);let i=e.yc.get(t),r=i&&i.key;if(r){let n=new iP(ib.comparator);n=n.insert(r,rt.newNoDocument(r,ig.min()));let i=rz().add(r),s=new sv(ig.min(),new Map,new iP(id),n,i);await of(e,s),e.gc=e.gc.remove(r),e.yc.delete(t),oE(e)}else await al(e.localStore,t,!1).then(()=>o_(e,t,n)).catch(iS)}async function og(e,t){var n;let i=t.batch.batchId;try{let r=await (n=e.localStore).persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{let i=t.batch.keys(),r=n.Zi.newChangeBuffer({trackRemovals:!0});return(function(e,t,n,i){let r=n.batch,s=r.keys(),a=ik.resolve();return s.forEach(e=>{a=a.next(()=>i.getEntry(t,e)).next(t=>{let s=n.docVersions.get(e);null!==s||n7(),0>t.version.compareTo(s)&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))})}),a.next(()=>e.mutationQueue.removeMutationBatch(t,r))})(n,e,t,r).next(()=>r.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=rz();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,i))});ow(e,i,null),ov(e,i),e.sharedClientState.updateMutationState(i,"acknowledged"),await oI(e,r)}catch(e){await iS(e)}}async function oy(e,t,n){var i;try{let r=await (i=e.localStore).persistence.runTransaction("Reject batch","readwrite-primary",e=>{let n;
5return i.mutationQueue.lookupMutationBatch(e,t).next(t=>(null!==t||n7(),n=t.keys(),i.mutationQueue.removeMutationBatch(e,t))).next(()=>i.mutationQueue.performConsistencyCheck(e)).next(()=>i.documentOverlayCache.removeOverlaysForBatchId(e,n,t)).next(()=>i.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,n)).next(()=>i.localDocuments.getDocuments(e,n))});ow(e,t,n),ov(e,t),e.sharedClientState.updateMutationState(t,"rejected",n),await oI(e,r)}catch(e){await iS(e)}}function ov(e,t){(e.Ec.get(t)||[]).forEach(e=>{e.resolve()}),e.Ec.delete(t)}function ow(e,t,n){let i=e.Tc[e.currentUser.toKey()];if(i){let r=i.get(t);r&&(n?r.reject(n):r.resolve(),i=i.remove(t)),e.Tc[e.currentUser.toKey()]=i}}function o_(e,t,n=null){for(let i of(e.sharedClientState.removeLocalQueryTarget(t),e._c.get(t)))e.wc.delete(i),n&&e.dc.Pc(i,n);e._c.delete(t),e.isPrimaryClient&&e.Ic.Is(t).forEach(t=>{e.Ic.containsKey(t)||ob(e,t)})}function ob(e,t){e.mc.delete(t.path.canonicalString());let n=e.gc.get(t);null!==n&&(aD(e.remoteStore,n),e.gc=e.gc.remove(t),e.yc.delete(n),oE(e))}function oT(e,t,n){for(let i of n)i instanceof oi?(e.Ic.addReference(i.key,t),function(e,t){let n=t.key,i=n.path.canonicalString();e.gc.get(n)||e.mc.has(i)||(n9("SyncEngine","New document in limbo: "+n),e.mc.add(i),oE(e))}(e,i)):i instanceof or?(n9("SyncEngine","Document no longer in limbo: "+i.key),e.Ic.removeReference(i.key,t),e.Ic.containsKey(i.key)||ob(e,i.key)):n7()}function oE(e){for(;e.mc.size>0&&e.gc.size<e.maxConcurrentLimboResolutions;){let t=e.mc.values().next().value;e.mc.delete(t);let n=new ib(iv.fromString(t)),i=e.Ac.next();e.yc.set(i,new oo(n)),e.gc=e.gc.insert(n,i),aO(e.remoteStore,new sK(rC(new rI(n.path)),i,"TargetPurposeLimboResolution",iA.ct))}}async function oI(e,t,n){let i=[],r=[],s=[];e.wc.isEmpty()||(e.wc.forEach((a,o)=>{s.push(e.Rc(o,t,n).then(t=>{if((t||n)&&e.isPrimaryClient&&e.sharedClientState.updateQueryState(o.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);let e=ai.Li(o.targetId,t);r.push(e)}}))}),await Promise.all(s),e.dc.nu(i),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",n=>ik.forEach(t,t=>ik.forEach(t.Fi,i=>e.persistence.referenceDelegate.addReference(n,t.targetId,i)).next(()=>ik.forEach(t.Bi,i=>e.persistence.referenceDelegate.removeReference(n,t.targetId,i)))))}catch(e){if(!iC(e))throw e;n9("LocalStore","Failed to update sequence numbers: "+e)}for(let n of t){let t=n.targetId;if(!n.fromCache){let n=e.Ji.get(t),i=n.snapshotVersion,r=n.withLastLimboFreeSnapshotVersion(i);e.Ji=e.Ji.insert(t,r)}}}(e.localStore,r))}async function oS(e,t){var n;if(!e.currentUser.isEqual(t)){n9("SyncEngine","User change. New user:",t.toKey());let i=await aa(e.localStore,t);e.currentUser=t,n="'waitForPendingWrites' promise is rejected due to a user change.",e.Ec.forEach(e=>{e.forEach(e=>{e.reject(new ie(n8.CANCELLED,n))})}),e.Ec.clear(),e.sharedClientState.handleUserChange(t,i.removedBatchIds,i.addedBatchIds),await oI(e,i.er)}}function ok(e,t){let n=e.yc.get(t);if(n&&n.fc)return rz().add(n.key);{let n=rz(),i=e._c.get(t);if(!i)return n;for(let t of i){let i=e.wc.get(t);n=n.unionWith(i.view.nc)}return n}}class oC{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=ab(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){var t;return t=this.persistence,new as(t,new ar,e.initialUser,this.serializer)}createPersistence(e){return new ae(an.zs,this.serializer)}createSharedClientState(e){return new ac}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class oA{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedCl
5ientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>op(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=oS.bind(null,this.syncEngine),await aX(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new a5}createDatastore(e){let t=ab(e.databaseInfo.databaseId),n=new aw(e.databaseInfo);return new ak(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){var t;return t=this.localStore,new aA(t,this.datastore,e.asyncQueue,e=>op(this.syncEngine,e,0),af.D()?new af:new ad)}createSyncEngine(e,t){return function(e,t,n,i,r,s,a){let o=new ol(e,t,n,i,r,s);return a&&(o.vc=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){n9("RemoteStore","RemoteStore shutting down."),e.vu.add(5),await aN(e),e.Pu.shutdown(),e.bu.set("Unknown")}(this.remoteStore)}}class oR{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Sc(this.observer.next,e)}error(e){this.observer.error?this.Sc(this.observer.error,e):n6("Uncaught Error in snapshot listener:",e.toString())}Dc(){this.muted=!0}Sc(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}}class oN{constructor(e,t,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=n0.UNAUTHENTICATED,this.clientId=ic.A(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,async e=>{n9("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(n9("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new ie(n8.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();let e=new it;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){let t=a1(n,"Failed to shutdown persistence");e.reject(t)}}),e.promise}}async function oO(e,t){e.asyncQueue.verifyOperationInProgress(),n9("FirestoreClient","Initializing OfflineComponentProvider");let n=await e.getConfiguration();await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await aa(t.localStore,e),i=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function oD(e,t){e.asyncQueue.verifyOperationInProgress();let n=await oP(e);n9("FirestoreClient","Initializing OnlineComponentProvider");let i=await e.getConfiguration();await t.initialize(n,i),e.setCredentialChangeListener(e=>aJ(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>aJ(t.remoteStore,n)),e._onlineComponents=t}async function oP(e){if(!e._offlineComponents){if(e._uninitializedComponentsProvider){n9("FirestoreClient","Using user provided OfflineComponentProvider");try{await oO(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===n8.FAILED_PRECONDITION||t.code===n8.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;n5("Error using user provided cache. Falling back to memory cache: "+t),await oO(e,new oC)}}else n9("FirestoreClient","Using default OfflineComponentProvider"),await oO(e,new oC)}return e._offlineComponents}async function oL(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(n9("FirestoreClient","Using user provided OnlineComponentProvider"),await oD(e,e._uninitializedComponentsProvider._online)):(n9("FirestoreClient","Using default OnlineComponentProvider"),await oD(e,new oA))),e._onlineComponents}async function ox(e){let t=await oL(e),n=t.eventManager;return n.onListen=ou.bind(null,t.syncEngine),n.onUnlisten=oc.bind(null,t.syncEngine),n}function oM(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}let oU=new Map;
5function oF(e,t,n){if(!n)throw new ie(n8.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function oV(e){if(!ib.isDocumentKey(e))throw new ie(n8.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function oj(e){if(ib.isDocumentKey(e))throw new ie(n8.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function oB(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let n=(t=e).constructor?t.constructor.name:null;return n?`a custom ${n} object`:"an object"}}return"function"==typeof e?"a function":n7()}function oz(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new ie(n8.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=oB(e);throw new ie(n8.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}class oq{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new ie(n8.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.cache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new ie(n8.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new ie(n8.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=oM(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new ie(n8.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new ie(n8.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new ie(n8.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,n;return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class o${constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new oq({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new ie(n8.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new ie(n8.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new oq(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new ir;switch(e.type){case"firstParty":return new il(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;
5default:throw new ie(n8.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=oU.get(e);t&&(n9("ComponentProvider","Removing Datastore"),oU.delete(e),t.terminate())}(this),Promise.resolve()}}class oH{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new oG(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new oH(this.firestore,e,this._key)}}class oK{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new oK(this.firestore,e,this._query)}}class oG extends oK{constructor(e,t,n){super(e,t,new rI(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new oH(this.firestore,null,new ib(e))}withConverter(e){return new oG(this.firestore,e,this._path)}}function oW(e,t,...n){if(e=(0,f.m9)(e),oF("collection","path",t),e instanceof o$){let i=iv.fromString(t,...n);return oj(i),new oG(e,null,i)}{if(!(e instanceof oH||e instanceof oG))throw new ie(n8.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let i=e._path.child(iv.fromString(t,...n));return oj(i),new oG(e.firestore,null,i)}}function oQ(e,t,...n){if(e=(0,f.m9)(e),1==arguments.length&&(t=ic.A()),oF("doc","path",t),e instanceof o$){let i=iv.fromString(t,...n);return oV(i),new oH(e,null,new ib(i))}{if(!(e instanceof oH||e instanceof oG))throw new ie(n8.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let i=e._path.child(iv.fromString(t,...n));return oV(i),new oH(e.firestore,e instanceof oG?e.converter:null,new ib(i))}}class oJ{constructor(){this.Gc=Promise.resolve(),this.Qc=[],this.jc=!1,this.zc=[],this.Wc=null,this.Hc=!1,this.Jc=!1,this.Yc=[],this.qo=new aT(this,"async_queue_retry"),this.Xc=()=>{let e=a_();e&&n9("AsyncQueue","Visibility state changed to "+e.visibilityState),this.qo.Mo()};let e=a_();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Xc)}get isShuttingDown(){return this.jc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Zc(),this.ta(e)}enterRestrictedMode(e){if(!this.jc){this.jc=!0,this.Jc=e||!1;let t=a_();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Xc)}}enqueue(e){if(this.Zc(),this.jc)return new Promise(()=>{});let t=new it;return this.ta(()=>this.jc&&this.Jc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Qc.push(e),this.ea()))}async ea(){if(0!==this.Qc.length){try{await this.Qc[0](),this.Qc.shift(),this.qo.reset()}catch(e){if(!iC(e))throw e;n9("AsyncQueue","Operation failed with retryable error: "+e)}this.Qc.length>0&&this.qo.No(()=>this.ea())}}ta(e){let t=this.Gc.then(()=>(this.Hc=!0,e().catch(e=>{let t;throw this.Wc=e,this.Hc=!1,n6("INTERNAL UNHANDLED ERROR: ",(t=e.message||"",e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t)),e}).then(e=>(this.Hc=!1,e))));return this.Gc=t,t}enqueueAfterDelay(e,t,n){this.Zc(),this.Yc.indexOf(e)>-1&&(t=0);let i=a0.createAndSchedule(this,e,t,n,e=>this.na(e));return this.zc.push(i),i}Zc(){this.Wc&&n7()}verifyOperationInProgress(){}async sa(){let e;do e=this.Gc,await e;while(e!==this.Gc)}ia(e){for(let t of this.zc)if(t.timerId===e)return!0;return!1}ra(e){return this.sa().then(()=>{for(let t of(this.zc.sort((e,t)=>
5e.targetTimeMs-t.targetTimeMs),this.zc))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.sa()})}oa(e){this.Yc.push(e)}na(e){let t=this.zc.indexOf(e);this.zc.splice(t,1)}}function oX(e){return function(e,t){if("object"!=typeof e||null===e)return!1;for(let n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])}class oY extends o${constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new oJ,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||o1(this),this._firestoreClient.terminate()}}function oZ(e,t){let n="object"==typeof e?e:(0,h.getApp)(),i=(0,h._getProvider)(n,"firestore").getImmediate({identifier:"string"==typeof e?e:t||"(default)"});if(!i._initialized){let e=(0,f.P0)("firestore");e&&function(e,t,n,i={}){var r;let s=(e=oz(e,o$))._getSettings(),a=`${t}:${n}`;if("firestore.googleapis.com"!==s.host&&s.host!==a&&n5("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},s),{host:a,ssl:!1})),i.mockUserToken){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=n0.MOCK_USER;else{t=(0,f.Sg)(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);let s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new ie(n8.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new n0(s)}e._authCredentials=new is(new ii(t,n))}}(i,...e)}return i}function o0(e){return e._firestoreClient||o1(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function o1(e){var t,n,i,r;let s=e._freezeSettings(),a=(r=e._databaseId,new iW(r,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,oM(s.experimentalLongPollingOptions),s.useFetchStreams));e._firestoreClient=new oN(e._authCredentials,e._appCheckCredentials,e._queue,a),(null===(n=s.cache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=s.cache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.cache.kind,_offline:s.cache._offlineComponentProvider,_online:s.cache._onlineComponentProvider})}class o2{constructor(e){this._byteString=e}static fromBase64String(e){try{return new o2(ij.fromBase64String(e))}catch(e){throw new ie(n8.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new o2(ij.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class o4{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new ie(n8.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new i_(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class o9{constructor(e){this._methodName=e}}class o6{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new ie(n8.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new ie(n8.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return id(this._lat,e._lat)||id(this._long,e._long)}}let o5=/^__.*__$/;class o3{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new se(e,this.data,this.fieldMask,t,this.fieldTransforms):new r8(e,this.data,t,this.fieldTransforms)}}class o7{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new se(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function o8(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw n7()}}class le{constructor(e,t,n,i,r,s){this.settings=e,this.databaseId=t,this.serializer
5=n,this.ignoreUndefinedProperties=i,void 0===r&&this.ua(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get ca(){return this.settings.ca}aa(e){return new le(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ha(e){var t;let n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.aa({path:n,la:!1});return i.fa(e),i}da(e){var t;let n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.aa({path:n,la:!1});return i.ua(),i}wa(e){return this.aa({path:void 0,la:!0})}_a(e){return ld(e,this.settings.methodName,this.settings.ma||!1,this.path,this.settings.ga)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}ua(){if(this.path)for(let e=0;e<this.path.length;e++)this.fa(this.path.get(e))}fa(e){if(0===e.length)throw this._a("Document fields must not be empty");if(o8(this.ca)&&o5.test(e))throw this._a('Document fields cannot begin and end with "__"')}}class lt{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||ab(e)}ya(e,t,n,i=!1){return new le({ca:e,methodName:t,ga:n,path:i_.emptyPath(),la:!1,ma:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ln(e){let t=e._freezeSettings(),n=ab(e._databaseId);return new lt(e._databaseId,!!t.ignoreUndefinedProperties,n)}function li(e,t,n,i,r,s={}){let a,o;let l=e.ya(s.merge||s.mergeFields?2:0,t,n,r);ll("Data must be an object, but it was:",l,i);let u=la(i,l);if(s.merge)a=new iF(l.fieldMask),o=l.fieldTransforms;else if(s.mergeFields){let e=[];for(let i of s.mergeFields){let r=lu(t,i,n);if(!l.contains(r))throw new ie(n8.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);lf(e,r)||e.push(r)}a=new iF(e),o=l.fieldTransforms.filter(e=>a.covers(e.field))}else a=null,o=l.fieldTransforms;return new o3(new re(u),a,o)}class lr extends o9{_toFieldTransform(e){if(2!==e.ca)throw 1===e.ca?e._a(`${this._methodName}() can only appear at the top level of your update data`):e._a(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof lr}}function ls(e,t){if(lo(e=(0,f.m9)(e)))return ll("Unsupported field value:",t,e),la(e,t);if(e instanceof o9)return function(e,t){if(!o8(t.ca))throw t._a(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t._a(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.la&&4!==t.ca)throw t._a("Nested arrays are not supported");return function(e,t){let n=[],i=0;for(let r of e){let e=ls(r,t.wa(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=(0,f.m9)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e){var n,i,r;return n=t.serializer,"number"==typeof(r=i=e)&&Number.isInteger(r)&&!iR(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER?rH(i):r$(n,i)}if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let n=im.fromDate(e);return{timestampValue:sD(t.serializer,n)}}if(e instanceof im){let n=new im(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:sD(t.serializer,n)}}if(e instanceof o6)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof o2)return{bytesValue:sP(t.serializer,e._byteString)};if(e instanceof oH){let n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t._a(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:sx(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t._a(`Unsupported field value: ${oB(e)}`)}(e,t)}function la(e,t){let n={};return iD(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):iO(e,(e,i)=>{let r=ls(i,t.ha(e));null!=r&&(n[e]=r)}),{mapValue:{fields:n}}}function lo(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof im||e instanceof o6||e instanceof o2||e instanceof oH||e instanceof o9)}function ll(e,t,n){if(!lo(n)||!("object"==typeof n&&null!==n&&(Object.getPrototypeOf(n)===Object.prototype||null===Object.getPrototypeOf(n)))){let i=oB(n);throw"an object"===i?t._a(e+" a custom object"):t._a(e+" "+i)}}function lu(e,t,n){if((t=(0,f.m9)(t))instanceof o4)return t._internalPath;if("string"==typeof t)return lc(e,t);throw ld("Field path arguments must be of type string or ",e,!1,void 0,n)}let lh=RegExp("[~\\*/\\[\\]]");function lc(e,t,n){if(t.search(lh)>=0)throw ld(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new o4(...t.split("."))._internalPath}catch(i){throw ld(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function ld(e,t,n,i,r){let s=i&&!i.isEmpty(),a=void 0!==r,o=`Function ${t}
5() called with invalid data`;n&&(o+=" (via `toFirestore()`)"),o+=". ";let l="";return(s||a)&&(l+=" (found",s&&(l+=` in field ${i}`),a&&(l+=` in document ${r}`),l+=")"),new ie(n8.INVALID_ARGUMENT,o+e+l)}function lf(e,t){return e.some(e=>e.isEqual(t))}class lp{constructor(e,t,n,i,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new oH(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new lm(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(lg("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class lm extends lp{data(){return super.data()}}function lg(e,t){return"string"==typeof t?lc(e,t):t instanceof o4?t._internalPath:t._delegate._internalPath}class ly{convertValue(e,t="none"){switch(iX(e)){case 0:return null;case 1:return e.booleanValue;case 2:return iq(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(i$(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw n7()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return iO(e,(e,i)=>{n[e]=this.convertValue(i,t)}),n}convertGeoPoint(e){return new o6(iq(e.latitude),iq(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=iK(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(iG(e));default:return null}}convertTimestamp(e){let t=iz(e);return new im(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=iv.fromString(e);sH(n)||n7();let i=new iQ(n.get(1),n.get(3)),r=new ib(n.popFirst(5));return i.isEqual(t)||n6(`Document ${r} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),r}}function lv(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}class lw{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class l_ extends lp{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new lb(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(lg("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class lb extends l_{data(e={}){return super.data(e)}}class lT{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new lw(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){let e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new lb(this._firestore,this._userDataWriter,n.key,n,new lw(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new ie(n8.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{let i=new lb(e._firestore,e._userDataWriter,n.doc.key,n.doc,new lw(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{let i=new lb(e._firestore,e._userDataWriter,t.doc.key,t.doc,new lw(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(s=(n=n.add(t.doc)).indexOf(t.doc.key)),{type:function(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return n7()}}(t.type),doc:i,oldIndex:r,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}class lE extends ly{constructor(e){super(),this.firestore=e}convertBytes(e){return new o2(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
5return new oH(this.firestore,null,t)}}function lI(e,t,n){e=oz(e,oH);let i=oz(e.firestore,oY),r=lv(e.converter,t,n);return lR(i,[li(ln(i),"setDoc",e._key,r,null!==e.converter,n).toMutation(e._key,r4.none())])}function lS(e,t,n,...i){e=oz(e,oH);let r=oz(e.firestore,oY),s=ln(r);return lR(r,[("string"==typeof(t=(0,f.m9)(t))||t instanceof o4?function(e,t,n,i,r,s){let a=e.ya(1,t,n),o=[lu(t,i,n)],l=[r];if(s.length%2!=0)throw new ie(n8.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let e=0;e<s.length;e+=2)o.push(lu(t,s[e])),l.push(s[e+1]);let u=[],h=re.empty();for(let e=o.length-1;e>=0;--e)if(!lf(u,o[e])){let t=o[e],n=l[e];n=(0,f.m9)(n);let i=a.da(t);if(n instanceof lr)u.push(t);else{let e=ls(n,i);null!=e&&(u.push(t),h.set(t,e))}}return new o7(h,new iF(u),a.fieldTransforms)}(s,"updateDoc",e._key,t,n,i):function(e,t,n,i){let r=e.ya(1,t,n);ll("Data must be an object, but it was:",r,i);let s=[],a=re.empty();return iO(i,(e,i)=>{let o=lc(t,e,n);i=(0,f.m9)(i);let l=r.da(o);if(i instanceof lr)s.push(o);else{let e=ls(i,l);null!=e&&(s.push(o),a.set(o,e))}}),new o7(a,new iF(s),r.fieldTransforms)}(s,"updateDoc",e._key,t)).toMutation(e._key,r4.exists(!0))])}function lk(e){return lR(oz(e.firestore,oY),[new sr(e._key,r4.none())])}function lC(e,t){let n=oz(e.firestore,oY),i=oQ(e),r=lv(e.converter,t);return lR(n,[li(ln(e.firestore),"addDoc",i._key,r,null!==e.converter,{}).toMutation(i._key,r4.exists(!1))]).then(()=>i)}function lA(e,...t){var n,i,r;let s,a,o;e=(0,f.m9)(e);let l={includeMetadataChanges:!1},u=0;"object"!=typeof t[0]||oX(t[u])||(l=t[u],u++);let h={includeMetadataChanges:l.includeMetadataChanges};if(oX(t[u])){let e=t[u];t[u]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[u+1]=null===(i=e.error)||void 0===i?void 0:i.bind(e),t[u+2]=null===(r=e.complete)||void 0===r?void 0:r.bind(e)}if(e instanceof oH)a=oz(e.firestore,oY),o=new rI(e._key.path),s={next:n=>{t[u]&&t[u](function(e,t,n){let i=n.docs.get(t._key),r=new lE(e);return new l_(e,r,t._key,i,new lw(n.hasPendingWrites,n.fromCache),t.converter)}(a,e,n))},error:t[u+1],complete:t[u+2]};else{let n=oz(e,oK);a=oz(n.firestore,oY),o=n._query;let i=new lE(a);s={next:e=>{t[u]&&t[u](new lT(a,i,n,e))},error:t[u+1],complete:t[u+2]},function(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new ie(n8.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}(e._query)}return function(e,t,n,i){let r=new oR(i),s=new on(t,r,n);return e.asyncQueue.enqueueAndForget(async()=>a3(await ox(e),s)),()=>{r.Dc(),e.asyncQueue.enqueueAndForget(async()=>a7(await ox(e),s))}}(o0(a),o,h,s)}function lR(e,t){return function(e,t){let n=new it;return e.asyncQueue.enqueueAndForget(async()=>od(await oL(e).then(e=>e.syncEngine),t,n)),n.promise}(o0(e),t)}!function(e,t=!0){n1=h.SDK_VERSION,(0,h._registerComponent)(new c.wA("firestore",(e,{instanceIdentifier:n,options:i})=>{let r=e.getProvider("app").getImmediate(),s=new oY(new ia(e.getProvider("auth-internal")),new ih(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new ie(n8.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new iQ(e.options.projectId,t)}(r,n),r);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),(0,h.registerVersion)(nZ,"3.13.0",void 0),(0,h.registerVersion)(nZ,"3.13.0","esm2017")}()},6650:function(e,t,n){"use strict";n.d(t,{Jt:function(){return ey},cF:function(){return ew},iH:function(){return ev},B0:function(){return eg}});var i,r,s,a,o=n(5816),l=n(4444),u=n(8463);let h="firebasestorage.googleapis.com",c="storageBucket";class d extends l.ZR{constructor(e,t,n=0){super(f(e),`Firebase Storage: ${t} (${f(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,d.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return f(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} 6${this.customData.serverResponse}`:this.message=this._baseMessage}}function f(e){return"storage/"+e}function p(){return new d(s.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function m(){return new d(s.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function g(){return new d(s.CANCELED,"User canceled the upload/download.")}function y(){return new d(s.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function v(e){return new d(s.INVALID_ARGUMENT,e)}function w(){return new d(s.APP_DELETED,"The Firebase app was deleted.")}function _(e,t){return new d(s.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function b(e){throw new d(s.INTERNAL_ERROR,"Internal error: "+e)}(i=s||(s={})).UNKNOWN="unknown",i.OBJECT_NOT_FOUND="object-not-found",i.BUCKET_NOT_FOUND="bucket-not-found",i.PROJECT_NOT_FOUND="project-not-found",i.QUOTA_EXCEEDED="quota-exceeded",i.UNAUTHENTICATED="unauthenticated",i.UNAUTHORIZED="unauthorized",i.UNAUTHORIZED_APP="unauthorized-app",i.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",i.INVALID_CHECKSUM="invalid-checksum",i.CANCELED="canceled",i.INVALID_EVENT_NAME="invalid-event-name",i.INVALID_URL="invalid-url",i.INVALID_DEFAULT_BUCKET="invalid-default-bucket",i.NO_DEFAULT_BUCKET="no-default-bucket",i.CANNOT_SLICE_BLOB="cannot-slice-blob",i.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",i.NO_DOWNLOAD_URL="no-download-url",i.INVALID_ARGUMENT="invalid-argument",i.INVALID_ARGUMENT_COUNT="invalid-argument-count",i.APP_DELETED="app-deleted",i.INVALID_ROOT_OPERATION="invalid-root-operation",i.INVALID_FORMAT="invalid-format",i.INTERNAL_ERROR="internal-error",i.UNSUPPORTED_ENVIRONMENT="unsupported-environment";class T{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=T.makeFromUrl(e,t)}catch(t){return new T(e,"")}if(""===n.path)return n;throw new d(s.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+e+"'.")}static makeFromUrl(e,t){let n=null,i="([A-Za-z0-9.\\-_]+)",r=RegExp("^gs://"+i+"(/(.*))?$","i");function a(e){e.path_=decodeURIComponent(e.path)}
6let o=t.replace(/[.]/g,"\\."),l=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?$`,"i"),indices:{bucket:1,path:3},postModify:a},{regex:RegExp(`^https?://${t===h?"(?:storage.googleapis.com|storage.cloud.google.com)":t}/${i}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:a}];for(let t=0;t<l.length;t++){let i=l[t],r=i.regex.exec(e);if(r){let e=r[i.indices.bucket],t=r[i.indices.path];t||(t=""),n=new T(e,t),i.postModify(n);break}}if(null==n)throw new d(s.INVALID_URL,"Invalid URL '"+e+"'.");return n}}class E{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function I(e){return"string"==typeof e||e instanceof String}function S(e){return k()&&e instanceof Blob}function k(){return"undefined"!=typeof Blob&&!(0,l.UG)()}function C(e,t,n,i){if(i<t)throw v(`Invalid value for '${e}'. Expected ${t} or greater.`);if(i>n)throw v(`Invalid value for '${e}'. Expected ${n} or less.`)}function A(e,t,n){let i=t;return null==n&&(i=`https://${t}`),`${n}://${i}/v0${e}`}function R(e){let t=encodeURIComponent,n="?";for(let i in e)e.hasOwnProperty(i)&&(n=n+(t(i)+"=")+t(e[i])+"&");return n.slice(0,-1)}function N(e,t){let n=e>=500&&e<600,i=-1!==[408,429].indexOf(e),r=-1!==t.indexOf(e);return n||i||r}(r=a||(a={}))[r.NO_ERROR=0]="NO_ERROR",r[r.NETWORK_ERROR=1]="NETWORK_ERROR",r[r.ABORT=2]="ABORT";class O{constructor(e,t,n,i,r,s,a,o,l,u,h,c=!0){this.url_=e,this.method_=t,this.headers_=n,this.body_=i,this.successCodes_=r,this.additionalRetryCodes_=s,this.callback_=a,this.errorCallback_=o,this.timeout_=l,this.progressCallback_=u,this.connectionFactory_=h,this.retry=c,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){let e=(e,t)=>{let n=this.resolve_,i=this.reject_,r=t.connection;if(t.wasSuccessCode)try{let e=this.callback_(r,r.getResponse());void 0!==e?n(e):n()}catch(e){i(e)}else if(null!==r){let e=p();e.serverResponse=r.getErrorText(),i(this.errorCallback_?this.errorCallback_(r,e):e)}else i(t.canceled?this.appDelete_?w():g():m())};this.canceled_?e(!1,new D(!1,null,!0)):this.backoffId_=function(e,t,n){let i=1,r=null,s=null,a=!1,o=0,l=!1;function u(...e){l||(l=!0,t.apply(null,e))}function h(t){r=setTimeout(()=>{r=null,e(d,2===o)},t)}function c(){s&&clearTimeout(s)}function d(e,...t){let n;if(l){c();return}if(e||2===o||a){c(),u.call(null,e,...t);return}i<64&&(i*=2),1===o?(o=2,n=0):n=(i+Math.random())*1e3,h(n)}let f=!1;
6function p(e){!f&&(f=!0,c(),!l&&(null!==r?(e||(o=2),clearTimeout(r),h(0)):e||(o=1)))}return h(0),s=setTimeout(()=>{a=!0,p(!0)},n),p}((e,t)=>{if(t){e(!1,new D(!1,null,!0));return}let n=this.connectionFactory_();this.pendingConnection_=n;let i=e=>{let t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;let t=n.getErrorCode()===a.NO_ERROR,r=n.getStatus();if(!t||N(r,this.additionalRetryCodes_)&&this.retry){e(!1,new D(!1,null,n.getErrorCode()===a.ABORT));return}e(!0,new D(-1!==this.successCodes_.indexOf(r),n))})},e,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class D{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function P(...e){let t="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0;if(void 0!==t){let n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}if(k())return new Blob(e);throw new d(s.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}let L={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class x{constructor(e,t){this.data=e,this.contentType=t||null}}function M(e){let t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<=127?t.push(i):i<=2047?t.push(192|i>>6,128|63&i):(64512&i)==55296?n<e.length-1&&(64512&e.charCodeAt(n+1))==56320?(i=65536|(1023&i)<<10|1023&e.charCodeAt(++n),t.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i)):t.push(239,191,189):(64512&i)==56320?t.push(239,191,189):t.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(t)}function U(e,t){let n;switch(e){case L.BASE64:{let n=-1!==t.indexOf("-"),i=-1!==t.indexOf("_");if(n||i)throw _(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break}case L.BASE64URL:{let n=-1!==t.indexOf("+"),i=-1!==t.indexOf("/");if(n||i)throw _(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}}try{n=function(e){if("undefined"==typeof atob)throw new d(s.UNSUPPORTED_ENVIRONMENT,"base-64 is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.");return atob(e)}(t)}catch(t){if(t.message.includes("polyfill"))throw t;throw _(e,"Invalid character found")}let i=new Uint8Array(n.length);for(let e=0;e<n.length;e++)i[e]=n.charCodeAt(e);return i}class F{constructor(e){var t;this.base64=!1,this.contentType=null;let n=e.match(/^data:([^,]+)?,/);if(null===n)throw _(L.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");let i=n[1]||null;null!=i&&(this.base64=(t=";base64",i.length>=t.length&&i.substring(i.length-t.length)===t),this.contentType=this.base64?i.substring(0,i.length-7):i),this.rest=e.substring(e.indexOf(",")+1)}}class V{constructor(e,t){let n=0,i="";S(e)?(this.data_=e,n=e.size,i=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=i}size(){return this.size_}type(){return this.type_}slice(e,t){if(!S(this.data_))return new V(new Uint8Array(this.data_.buffer,e,t-e),!0);{var n;let i=(n=this.data_).webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null;return null===i?null:new V(i)}}static getBlob(...e){if(k()){let t=e.map(e=>e instanceof V?e.data_:e);return new V(P.apply(null,t))}{let t=e.map(e=>I(e)?function(e,t){switch(e){case L.RAW:return new x(M(t));case L.BASE64:case L.BASE64URL:return new x(U(e,t));case L.DATA_URL:return new x(function(e){let t=new F(e);return t.base64?U(L.BASE64,t.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw _(L.DATA_URL,"Malformed data URL.")}return M(t)}(t.rest)}(t),new F(t).contentType)}throw p()}(L.RAW,e).data:e.data_),n=0;
6t.forEach(e=>{n+=e.byteLength});let i=new Uint8Array(n),r=0;return t.forEach(e=>{for(let t=0;t<e.length;t++)i[r++]=e[t]}),new V(i,!0)}}uploadData(){return this.data_}}function j(e){var t;let n;try{n=JSON.parse(e)}catch(e){return null}return"object"!=typeof(t=n)||Array.isArray(t)?null:n}function B(e){let t=e.lastIndexOf("/",e.length-2);return -1===t?e:e.slice(t+1)}function z(e,t){return t}class q{constructor(e,t,n,i){this.server=e,this.local=t||e,this.writable=!!n,this.xform=i||z}}let $=null;function H(){if($)return $;let e=[];e.push(new q("bucket")),e.push(new q("generation")),e.push(new q("metageneration")),e.push(new q("name","fullPath",!0));let t=new q("name");t.xform=function(e,t){return!I(t)||t.length<2?t:B(t)},e.push(t);let n=new q("size");return n.xform=function(e,t){return void 0!==t?Number(t):t},e.push(n),e.push(new q("timeCreated")),e.push(new q("updated")),e.push(new q("md5Hash",null,!0)),e.push(new q("cacheControl",null,!0)),e.push(new q("contentDisposition",null,!0)),e.push(new q("contentEncoding",null,!0)),e.push(new q("contentLanguage",null,!0)),e.push(new q("contentType",null,!0)),e.push(new q("metadata","customMetadata",!0)),$=e}function K(e,t,n){let i=j(t);return null===i?null:function(e,t,n){let i={};i.type="file";let r=n.length;for(let e=0;e<r;e++){let r=n[e];i[r.local]=r.xform(i,t[r.server])}return Object.defineProperty(i,"ref",{get:function(){let t=new T(i.bucket,i.fullPath);return e._makeStorageReference(t)}}),i}(e,i,n)}function G(e,t){let n={},i=t.length;for(let r=0;r<i;r++){let i=t[r];i.writable&&(n[i.server]=e[i.local])}return JSON.stringify(n)}class W{constructor(e,t,n,i){this.url=e,this.method=t,this.handler=n,this.timeout=i,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function Q(e){if(!e)throw p()}function J(e,t){return function(n,i){let r=K(e,i,t);return Q(null!==r),r}}function X(e){return function(t,n){var i,r;let a;return 401===t.getStatus()?a=t.getErrorText().includes("Firebase App Check token is invalid")?new d(s.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new d(s.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(i=e.bucket,a=new d(s.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=e.path,a=new d(s.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):a=n,a.status=t.getStatus(),a.serverResponse=n.serverResponse,a}}function Y(e){let t=X(e);return function(n,i){let r=t(n,i);if(404===n.getStatus()){var a;a=e.path,r=new d(s.OBJECT_NOT_FOUND,"Object '"+a+"' does not exist.")}return r.serverResponse=i.serverResponse,r}}function Z(e,t,n){let i=Object.assign({},n);return i.fullPath=e.path,i.size=t.size(),!i.contentType&&(i.contentType=t&&t.type()||"application/octet-stream"),i}class ee{constructor(e,t,n,i){this.current=e,this.total=t,this.finalized=!!n,this.metadata=i||null}}function et(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){Q(!1)}return Q(!!n&&-1!==(t||["active"]).indexOf(n)),n}let en={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function ei(e){switch(e){case"running":case"pausing":case"canceling":return en.RUNNING;case"paused":return en.PAUSED;case"success":return en.SUCCESS;case"canceled":return en.CANCELED;default:return en.ERROR}}class er{constructor(e,t,n){"function"==typeof e||null!=t||null!=n?(this.next=e,this.error=null!=t?t:void 0,this.complete=null!=n?n:void 0):(this.next=e.next,this.error=e.error,this.complete=e.complete)}}function es(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}class ea{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=a.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=a.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=a.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,n,i){if(this.sent_)throw b("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==i)for(let e in i)i.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,i[e].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw b("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw b("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return -1}}getResponse(){if(!this.sent_)throw b("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw b("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class eo extends ea{initXhr(){this.xhr_.responseType="text"}}function el(){return new eo}class eu{constructor(e,t,n=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=H(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(s.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{let t=this.isExponentialBackoffExpired();if(N(e.status,[])){if(t)e=m();else{this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,this.completeTransitions_();return}}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(s.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>
6{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){let e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,n])=>{switch(this._state){case"running":e(t,n);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{let n=function(e,t,n,i,r){let s=t.bucketOnlyServerUrl(),a=Z(t,i,r),o={name:a.fullPath},l=A(s,e.host,e._protocol),u={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${i.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},h=G(a,n),c=new W(l,"POST",function(e){let t;et(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){Q(!1)}return Q(I(t)),t},e.maxUploadRetryTime);return c.urlParams=o,c.headers=u,c.body=h,c.errorHandler=X(t),c}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,el,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){let e=this._uploadUrl;this._resolveToken((t,n)=>{let i=function(e,t,n,i){let r=new W(n,"POST",function(e){let t=et(e,["active","final"]),n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){Q(!1)}n||Q(!1);let r=Number(n);return Q(!isNaN(r)),new ee(r,i.size(),"final"===t)},e.maxUploadRetryTime);return r.headers={"X-Goog-Upload-Command":"query"},r.errorHandler=X(t),r}(this._ref.storage,this._ref._location,e,this._blob),r=this._ref.storage._makeRequest(i,el,t,n);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){let e=262144*this._chunkMultiplier,t=new ee(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((i,r)=>{let a;try{a=function(e,t,n,i,r,a,o,l){let u=new ee(0,0);if(o?(u.current=o.current,u.total=o.total):(u.current=0,u.total=i.size()),i.size()!==u.total)throw new d(s.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");let h=u.total-u.current,c=h;r>0&&(c=Math.min(c,r));let f=u.current,p=f+c,m={"X-Goog-Upload-Command":0===c?"finalize":h===c?"upload, finalize":"upload","X-Goog-Upload-Offset":`${u.current}`},g=i.slice(f,p);if(null===g)throw y();let v=new W(n,"POST",function(e,n){let r;let s=et(e,["active","final"]),o=u.current+c,l=i.size();return r="final"===s?J(t,a)(e,n):null,new ee(o,l,"final"===s,r)},t.maxUploadRetryTime);return v.headers=m,v.body=g.uploadData(),v.progressCallback=l||null,v.errorHandler=X(e),v}(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(e){this._error=e,this._transition("error");return}let o=this._ref.storage._makeRequest(a,el,i,r,!1);this._request=o,o.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){262144*this._chunkMultiplier*2<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{let n=function(e,t,n){let i=A(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,s=new W(i,"GET",J(e,n),r);return s.errorHandler=Y(t),s}(this._ref.storage,this._ref._location,this._mappings),i=this._ref.storage._makeRequest
6(n,el,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{let n=function(e,t,n,i,r){let s=t.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},o=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();a["Content-Type"]="multipart/related; boundary="+o;let l=Z(t,i,r),u="--"+o+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+G(l,n)+"\r\n--"+o+"\r\nContent-Type: "+l.contentType+"\r\n\r\n",h=V.getBlob(u,i,"\r\n--"+o+"--");if(null===h)throw y();let c={name:l.fullPath},d=A(s,e.host,e._protocol),f=e.maxUploadRetryTime,p=new W(d,"POST",J(e,n),f);return p.urlParams=c,p.headers=a,p.body=h.uploadData(),p.errorHandler=X(t),p}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,el,e,t);this._request=i,i.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){let t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":let t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=g(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){let e=ei(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,i){let r=new er(t||void 0,n||void 0,i||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){let t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(ei(this._state)){case en.SUCCESS:es(this._resolve.bind(null,this.snapshot))();break;case en.CANCELED:case en.ERROR:es(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(ei(this._state)){case en.RUNNING:case en.PAUSED:e.next&&es(e.next.bind(e,this.snapshot))();break;case en.SUCCESS:e.complete&&es(e.complete.bind(e))();break;case en.CANCELED:case en.ERROR:default:e.error&&es(e.error.bind(e,this._error))()}}resume(){let e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){let e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){let e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class eh{constructor(e,t){this._service=e,t instanceof T?this._location=t:this._location=T.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new eh(e,t)}get root(){let e=new T(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return B(this._location.path)}get storage(){return this._service}get parent(){let e=function(e){if(0===e.length)return null;let t=e.lastIndexOf("/");return -1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;let t=new T(this._location.bucket,e);return new eh(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw new d(s.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}}function ec(e,t){let n=null==t?void 0:t[c];return null==n?null:T.makeFromBucketSpec(n,e)}class ed{constructor(e,t,n,i,r){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=i,this._firebaseVersion=r,this._bucket=null,this._host=h,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,null!=i?this._bucket=T.makeFromBucketSpec(i,this._host):this._bucket=ec(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=T.makeFromBucketSpec(this._url,e):this._bucket=ec(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){C("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){C("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;let e=this._authProvider.getImmediate({optional:!0});if(e){let t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){let e=this._appCheckProvider.getImmediate({optional:!0});
6return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new eh(this,e)}_makeRequest(e,t,n,i,r=!0){if(this._deleted)return new E(w());{let s=function(e,t,n,i,r,s,a=!0){let o=R(e.urlParams),l=e.url+o,u=Object.assign({},e.headers);return t&&(u["X-Firebase-GMPID"]=t),null!==n&&n.length>0&&(u.Authorization="Firebase "+n),u["X-Firebase-Storage-Version"]="webjs/"+(null!=s?s:"AppManager"),null!==i&&(u["X-Firebase-AppCheck"]=i),new O(l,e.method,u,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,a)}(e,this._appId,n,i,t,this._firebaseVersion,r);return this._requests.add(s),s.getPromise().then(()=>this._requests.delete(s),()=>this._requests.delete(s)),s}}async makeRequestWithTokens(e,t){let[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,i).getPromise()}}let ef="@firebase/storage",ep="0.11.2",em="storage";function eg(e,t,n){var i;return(i=e=(0,l.m9)(e))._throwIfRoot("uploadBytesResumable"),new eu(i,new V(t),n)}function ey(e){return function(e){e._throwIfRoot("getDownloadURL");let t=function(e,t,n){let i=new W(A(t.fullServerUrl(),e.host,e._protocol),"GET",function(t,i){let r=K(e,i,n);return Q(null!==r),function(e,t,n,i){let r=j(t);if(null===r||!I(r.downloadTokens))return null;let s=r.downloadTokens;if(0===s.length)return null;let a=encodeURIComponent;return s.split(",").map(t=>{let r=e.bucket,s=e.fullPath;return A("/b/"+a(r)+"/o/"+a(s),n,i)+R({alt:"media",token:t})})[0]}(r,i,e.host,e._protocol)},e.maxOperationRetryTime);return i.errorHandler=Y(t),i}(e.storage,e._location,H());return e.storage.makeRequestWithTokens(t,el).then(e=>{if(null===e)throw new d(s.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e})}(e=(0,l.m9)(e))}function ev(e,t){return function(e,t){if(!(t&&/^[A-Za-z]+:\/\//.test(t)))return function e(t,n){if(t instanceof ed){if(null==t._bucket)throw new d(s.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+c+"' property when initializing the app?");let i=new eh(t,t._bucket);return null!=n?e(i,n):i}return void 0!==n?function(e,t){let n=function(e,t){let n=t.split("/").filter(e=>e.length>0).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),i=new T(e._location.bucket,n);return new eh(e.storage,i)}(t,n):t}(e,t);if(e instanceof ed)return new eh(e,t);throw v("To use ref(service, url), the first argument must be a Storage instance.")}(e=(0,l.m9)(e),t)}function ew(e=(0,o.getApp)(),t){e=(0,l.m9)(e);let n=(0,o._getProvider)(e,em).getImmediate({identifier:t}),i=(0,l.P0)("storage");return i&&function(e,t,n,i={}){!function(e,t,n,i={}){e.host=`${t}:${n}`,e._protocol="http";let{mockUserToken:r}=i;r&&(e._overrideAuthToken="string"==typeof r?r:(0,l.Sg)(r,e.app.options.projectId))}(e,t,n,i)}(n,...i),n}(0,o._registerComponent)(new u.wA(em,function(e,{instanceIdentifier:t}){return new ed(e.getProvider("app").getImmediate(),e.getProvider("auth-internal"),e.getProvider("app-check-internal"),t,o.SDK_VERSION)},"PUBLIC").setMultipleInstances(!0)),(0,o.registerVersion)(ef,ep,""),(0,o.registerVersion)(ef,ep,"esm2017")},6501:function(e,t,n){"use strict";let i,r;n.d(t,{x7:function(){return ec},ZP:function(){return ed},Am:function(){return x}});var s,a=n(7294);let o={data:""},l=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||o,u=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,h=/\/\*[^]*?\*\/| +/g,c=/\n+/g,d=(e,t)=>{let n="",i="",r="";for(let s in e){let a=e[s];"@"==s[0]?"i"==s[1]?n=s+" "+a+";":i+="f"==s[1]?d(a,s):s+"{"+d(a,"k"==s[1]?"":t)+"}":"object"==typeof a?i+=d(a,t?t.replace(/([^,])+/g,e=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):s):null!=a&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),r+=d.p?d.p(s,a):s+":"+a+";")}return n+(t&&r?t+"{"+r+"}":r)+i},f={},p=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+p(e[n]);return t}return e},m=(e,t,n,i,r)=>{var s;let a=p(e),o=f[a]||(f[a]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(a));if(!f[o]){let t=a!==e?e:(e=>{let t,n,i=[{}];for(;t=u.exec(e.replace(h,""));)t[4]?i.shift():t[3]?(n=t[3].replace(c," ").trim(),i.unshift(i[0][n]=i[0][n]||{})):i[0][t[1]]=t[2].replace(c," ").trim();return i[0]})(e);f[o]=d(r?{["@keyframes "+o]:t}:t,n?"":"."+o)}let l=n&&f.g?f.g:null;return n&&(f.g=f[o]),s=f[o],l?t.data=t.data.replace(l,s):-1===t.data.indexOf(s)&&(t.data=i?s+t.data:t.data+s),o},g=(e,t,n)=>e.reduce((e,i,r)=>{let s=t[r];
6if(s&&s.call){let e=s(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?"."+t:e&&"object"==typeof e?e.props?"":d(e,""):!1===e?"":e}return e+i+(null==s?"":s)},"");function y(e){let t=this||{},n=e.call?e(t.p):e;return m(n.unshift?n.raw?g(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,l(t.target),t.g,t.o,t.k)}y.bind({g:1});let v,w,_,b=y.bind({k:1});function T(e,t){let n=this||{};return function(){let i=arguments;function r(s,a){let o=Object.assign({},s),l=o.className||r.className;n.p=Object.assign({theme:w&&w()},o),n.o=/ *go\d+/.test(l),o.className=y.apply(n,i)+(l?" "+l:""),t&&(o.ref=a);let u=e;return e[0]&&(u=o.as||e,delete o.as),_&&u[0]&&_(o),v(u,o)}return t?t(r):r}}var E=e=>"function"==typeof e,I=(e,t)=>E(e)?e(t):e,S=(i=0,()=>(++i).toString()),k=()=>{if(void 0===r&&"u">typeof window){let e=matchMedia("(prefers-reduced-motion: reduce)");r=!e||e.matches}return r},C=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,20)};case 1:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case 2:let{toast:n}=t;return C(e,{type:e.toasts.find(e=>e.id===n.id)?1:0,toast:n});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(e=>e.id===i||void 0===i?{...e,dismissed:!0,visible:!1}:e)};case 4:return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let r=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(e=>({...e,pauseDuration:e.pauseDuration+r}))}}},A=[],R={toasts:[],pausedAt:void 0},N=e=>{R=C(R,e),A.forEach(e=>{e(R)})},O={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},D=(e={})=>{let[t,n]=(0,a.useState)(R),i=(0,a.useRef)(R);(0,a.useEffect)(()=>(i.current!==R&&n(R),A.push(n),()=>{let e=A.indexOf(n);e>-1&&A.splice(e,1)}),[]);let r=t.toasts.map(t=>{var n,i,r;return{...e,...e[t.type],...t,removeDelay:t.removeDelay||(null==(n=e[t.type])?void 0:n.removeDelay)||(null==e?void 0:e.removeDelay),duration:t.duration||(null==(i=e[t.type])?void 0:i.duration)||(null==e?void 0:e.duration)||O[t.type],style:{...e.style,...null==(r=e[t.type])?void 0:r.style,...t.style}}});return{...t,toasts:r}},P=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(null==n?void 0:n.id)||S()}),L=e=>(t,n)=>{let i=P(t,e,n);return N({type:2,toast:i}),i.id},x=(e,t)=>L("blank")(e,t);x.error=L("error"),x.success=L("success"),x.loading=L("loading"),x.custom=L("custom"),x.dismiss=e=>{N({type:3,toastId:e})},x.remove=e=>N({type:4,toastId:e}),x.promise=(e,t,n)=>{let i=x.loading(t.loading,{...n,...null==n?void 0:n.loading});return"function"==typeof e&&(e=e()),e.then(e=>{let r=t.success?I(t.success,e):void 0;return r?x.success(r,{id:i,...n,...null==n?void 0:n.success}):x.dismiss(i),e}).catch(e=>{let r=t.error?I(t.error,e):void 0;r?x.error(r,{id:i,...n,...null==n?void 0:n.error}):x.dismiss(i)}),e};var M=(e,t)=>{N({type:1,toast:{id:e,height:t}})},U=()=>{N({type:5,time:Date.now()})},F=new Map,V=1e3,j=(e,t=V)=>{if(F.has(e))return;let n=setTimeout(()=>{F.delete(e),N({type:4,toastId:e})},t);F.set(e,n)},B=e=>{let{toasts:t,pausedAt:n}=D(e);(0,a.useEffect)(()=>{if(n)return;let e=Date.now(),i=t.map(t=>{if(t.duration===1/0)return;let n=(t.duration||0)+t.pauseDuration-(e-t.createdAt);if(n<0){t.visible&&x.dismiss(t.id);return}return setTimeout(()=>x.dismiss(t.id),n)});return()=>{i.forEach(e=>e&&clearTimeout(e))}},[t,n]);let i=(0,a.useCallback)(()=>{n&&N({type:6,time:Date.now()})},[n]),r=(0,a.useCallback)((e,n)=>{let{reverseOrder:i=!1,gutter:r=8,defaultPosition:s}=n||{},a=t.filter(t=>(t.position||s)===(e.position||s)&&t.height),o=a.findIndex(t=>t.id===e.id),l=a.filter((e,t)=>t<o&&e.visible).length;return a.filter(e=>e.visible).slice(...i?[l+1]:[0,l]).reduce((e,t)=>e+(t.height||0)+r,0)},[t]);return(0,a.useEffect)(()=>{t.forEach(e=>{if(e.dismissed)j(e.id,e.removeDelay);else{let t=F.get(e.id);t&&(clearTimeout(t),F.delete(e.id))}})},[t]),{toasts:t,handlers:{updateHeight:M,startPause:U,endPause:i,calculateOffset:r}}},z=b` 7from { 8 transform: scale(0) rotate(45deg); 9 opacity: 0; 10} 11to { 12 transform: scale(1) rotate(45deg); 13 opacity: 1; 14}`,q=b` 15from { 16 transform: scale(0); 17 opacity: 0; 18} 19to { 20 transform: scale(1); 21 opacity: 1; 22}`,$=b` 23from { 24 transform: scale(0) rotate(90deg); 25 opacity: 0; 26} 27to { 28 transform: scale(1) rotate(90deg); 29 opacity: 1; 30}`,H=T("div")`
31 width: 20px; 32 opacity: 0; 33 height: 20px; 34 border-radius: 10px; 35 background: ${e=>e.primary||"#ff4b4b"}; 36 position: relative; 37 transform: rotate(45deg); 38 39 animation: ${z} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 40 forwards; 41 animation-delay: 100ms; 42 43 &:after, 44 &:before { 45 content: ''; 46 animation: ${q} 0.15s ease-out forwards; 47 animation-delay: 150ms; 48 position: absolute; 49 border-radius: 3px; 50 opacity: 0; 51 background: ${e=>e.secondary||"#fff"}; 52 bottom: 9px; 53 left: 4px; 54 height: 2px; 55 width: 12px; 56 } 57 58 &:before { 59 animation: ${$} 0.15s ease-out forwards; 60 animation-delay: 180ms; 61 transform: rotate(90deg); 62 } 63`,K=b` 64 from { 65 transform: rotate(0deg); 66 } 67 to { 68 transform: rotate(360deg); 69 } 70`,G=T("div")` 71 width: 12px; 72 height: 12px; 73 box-sizing: border-box; 74 border: 2px solid; 75 border-radius: 100%; 76 border-color: ${e=>e.secondary||"#e0e0e0"}; 77 border-right-color: ${e=>e.primary||"#616161"}; 78 animation: ${K} 1s linear infinite; 79`,W=b` 80from { 81 transform: scale(0) rotate(45deg); 82 opacity: 0; 83} 84to { 85 transform: scale(1) rotate(45deg); 86 opacity: 1; 87}`,Q=b` 880% { 89 height: 0; 90 width: 0; 91 opacity: 0; 92} 9340% { 94 height: 0; 95 width: 6px; 96 opacity: 1; 97} 98100% { 99 opacity: 1; 100 height: 10px; 101}`,J=T("div")` 102 width: 20px; 103 opacity: 0; 104 height: 20px; 105 border-radius: 10px; 106 background: ${e=>e.primary||"#61d345"}; 107 position: relative; 108 transform: rotate(45deg); 109 110 animation: ${W} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 111 forwards; 112 animation-delay: 100ms; 113 &:after { 114 content: ''; 115 box-sizing: border-box; 116 animation: ${Q} 0.2s ease-out forwards; 117 opacity: 0; 118 animation-delay: 200ms; 119 position: absolute; 120 border-right: 2px solid; 121 border-bottom: 2px solid; 122 border-color: ${e=>e.secondary||"#fff"}; 123 bottom: 6px; 124 left: 6px; 125 height: 10px; 126 width: 6px; 127 } 128`,X=T("div")` 129 position: absolute; 130`,Y=T("div")` 131 position: relative; 132 display: flex; 133 justify-content: center; 134 align-items: center; 135 min-width: 20px; 136 min-height: 20px; 137`,Z=b` 138from { 139 transform: scale(0.6); 140 opacity: 0.4; 141} 142to { 143 transform: scale(1); 144 opacity: 1; 145}`,ee=T("div")` 146 position: relative; 147 transform: scale(0.6); 148 opacity: 0.4; 149 min-width: 20px; 150 animation: ${Z} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) 151 forwards; 152`,et=({toast:e})=>{let{icon:t,type:n,iconTheme:i}=e;return void 0!==t?"string"==typeof t?a.createElement(ee,null,t):t:"blank"===n?null:a.createElement(Y,null,a.createElement(G,{...i}),"loading"!==n&&a.createElement(X,null,"error"===n?a.createElement(H,{...i}):a.createElement(J,{...i})))},en=e=>` 1530% {transform: translate3d(0,${-200*e}%,0) scale(.6); opacity:.5;} 154100% {transform: translate3d(0,0,0) scale(1); opacity:1;} 155`,ei=e=>` 1560% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 157100% {transform: translate3d(0,${-150*e}%,-1px) scale(.6); opacity:0;} 158`,er=T("div")` 159 display: flex; 160 align-items: center; 161 background: #fff; 162 color: #363636; 163 line-height: 1.3; 164 will-change: transform; 165 box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); 166 max-width: 350px; 167 pointer-events: auto; 168 padding: 8px 10px; 169 border-radius: 8px; 170`,es=T("div")` 171 display: flex; 172 justify-content: center; 173 margin: 4px 10px; 174 color: inherit; 175 flex: 1 1 auto; 176 white-space: pre-line; 177`,ea=(e,t)=>{let n=e.includes("top")?1:-1,[i,r]=k()?["0%{opacity:0;} 100%{opacity:1;}","0%{opacity:1;} 100%{opacity:0;}"]:[en(n),ei(n)];return{animation:t?`${b(i)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${b(r)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},eo=a.memo(({toast:e,position:t,style:n,children:i})=>{let r=e.height?ea(e.position||t||"top-center",e.visible):{opacity:0},s=a.createElement(et,{toast:e}),o=a.createElement(es,{...e.ariaProps},I(e.message,e));return a.createElement(er,{className:e.className,style:{...r,...n,...e.style}},"function"==typeof i?i({icon:s,message:o}):a.createElement(a.Fragment,null,s,o))});s=a.createElement,d.p=void 0,v=s,w=void 0,_=void 0;var el=({id:e,className:t,style:n,onHeightUpdate:i,children:r})=>{let s=a.useCallback(t=>{if(t){let n=()=>{i(e,t.getBoundingClientRect().height)};n(),new MutationObserver(n).observe(t,{subtree:!0,childList:!0,characterData:!0}
177)}},[e,i]);return a.createElement("div",{ref:s,className:t,style:n},r)},eu=(e,t)=>{let n=e.includes("top"),i=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:k()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...n?{top:0}:{bottom:0},...i}},eh=y` 178 z-index: 9999; 179 > * { 180 pointer-events: auto; 181 } 182`,ec=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:i,children:r,containerStyle:s,containerClassName:o})=>{let{toasts:l,handlers:u}=B(n);return a.createElement("div",{id:"_rht_toaster",style:{position:"fixed",zIndex:9999,top:16,left:16,right:16,bottom:16,pointerEvents:"none",...s},className:o,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(n=>{let s=n.position||t,o=eu(s,u.calculateOffset(n,{reverseOrder:e,gutter:i,defaultPosition:t}));return a.createElement(el,{id:n.id,key:n.id,onHeightUpdate:u.updateHeight,className:n.visible?eh:"",style:o},"custom"===n.type?I(n.message,n):r?r(n):a.createElement(eo,{toast:n,position:s}))}))},ed=x}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[774,179],function(){return t(3837),t(3079)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.