1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6129],{26129:(e,t,i)=>{i.d(t,{LF:()=>eT,LO:()=>ea,_W:()=>er});var a=i(25591),s=i(33757),n=i(65991),r=i(51597),o=i(53710);let l="@firebase/installations",c="0.6.22",h=`w:${c}`,g="FIS_v2",u=new s.FA("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function f(e){return e instanceof s.g&&e.code.includes("request-failed")}function d({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function m(e){return{token:e.token,requestStatus:2,expiresIn:Number(e.expiresIn.replace("s","000")),creationTime:Date.now()}}async function p(e,t){let i=(await t.json()).error;return u.create("request-failed",{requestName:e,serverCode:i.code,serverMessage:i.message,serverStatus:i.status})}function w({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}async function v(e){let t=await e();return t.status>=500&&t.status<600?e():t}async function y({appConfig:e,heartbeatServiceProvider:t},{fid:i}){let a=d(e),s=w(e),n=t.getImmediate({optional:!0});if(n){let e=await n.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}let r={method:"POST",headers:s,body:JSON.stringify({fid:i,authVersion:g,appId:e.appId,sdkVersion:h})},o=await v(()=>fetch(a,r));if(o.ok){let e=await o.json();return{fid:e.fid||i,registrationStatus:2,refreshToken:e.refreshToken,authToken:m(e.authToken)}}throw await p("Create Installation",o)}function C(e){return new Promise(t=>{setTimeout(t,e)})}let b=/^[cdef][\w-]{21}$/;function _(e){return`${e.appName}!${e.appId}`}let S=new Map;function T(e,t){let i=_(e);E(i,t),function(e,t){let i=(!k&&"BroadcastChannel"in self&&((k=new BroadcastChannel("[Firebase] FID Change")).onmessage=e=>{E(e.data.key,e.data.fid)}),k);i&&i.postMessage({key:e,fid:t}),0===S.size&&k&&(k.close(),k=null)}(i,t)}function E(e,t){let i=S.get(e);if(i)for(let e of i)e(t)}let k=null,I="firebase-installations-store",M=null;function F(){return M||(M=(0,o.P2)("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(I)}})),M}async function R(e,t){let i=_(e),a=(await F()).transaction(I,"readwrite"),s=a.objectStore(I),n=await s.get(i);return await s.put(t,i),await a.done,n&&n.fid===t.fid||T(e,t.fid),t}async function A(e){let t=_(e),i=(await F()).transaction(I,"readwrite");await i.objectStore(I).delete(t),await i.done}async function P(e,t){let i=_(e),a=(await F()).transaction(I,"readwrite"),s=a.objectStore(I),n=await s.get(i),r=t(n);return void 0===r?await s.delete(i):await s.put(r,i),await a.done,r&&(!n||n.fid!==r.fid)&&T(e,r.fid),r}async function x(e){let t,i=await P(e.appConfig,i=>{let a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(u.create("app-offline"))};let i={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},a=L(e,i);return{installationEntry:i,registrationPromise:a}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:D(e)}:{installationEntry:t}}(e,O(i||{fid:function(){try{var e;let t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;let i=(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22));return b.test(i)?i:""}catch{return""}}(),registrationStatus:0}));return t=a.registrationPromise,a.installationEntry});return""===i.fid?{installationEntry:await t}:{installationEntry:i,registrationPromise:t}}async function L(e,t){try{let i=await y(e,t);return R(e.appConfig,i)}catch(i){throw f(i)&&409===i.customData.serverCode?await A(e.appConfig):await R(e.appConfig,{fid:t.fid,registrationStatus:0}),i}}async function D(e){let t=await $(e.appConfig);for(;1===t.registrationStatus;)await C(100),t=await $(e.appConfig);if(0===t.registrationStatus){let{installationEntry:t,registrationPromise:i}=await x(e);return i||t}return t}function $(e){return P(e,e=>
1{if(!e)throw u.create("installation-not-found");return O(e)})}function O(e){var t;return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e}async function j({appConfig:e,heartbeatServiceProvider:t},i){let a=function(e,{fid:t}){return`${d(e)}/${t}/authTokens:generate`}(e,i),s=function(e,{refreshToken:t}){var i;let a=w(e);return a.append("Authorization",(i=t,`${g} ${i}`)),a}(e,i),n=t.getImmediate({optional:!0});if(n){let e=await n.getHeartbeatsHeader();e&&s.append("x-firebase-client",e)}let r={method:"POST",headers:s,body:JSON.stringify({installation:{sdkVersion:h,appId:e.appId}})},o=await v(()=>fetch(a,r));if(o.ok)return m(await o.json());throw await p("Generate Auth Token",o)}async function N(e,t=!1){let i,a=await P(e.appConfig,a=>{var s;if(!K(a))throw u.create("not-registered");let n=a.authToken;if(!t&&2===(s=n).requestStatus&&!function(e){let t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(s))return a;if(1===n.requestStatus)return i=B(e,t),a;{if(!navigator.onLine)throw u.create("app-offline");let t=function(e){let t={requestStatus:1,requestTime:Date.now()};return{...e,authToken:t}}(a);return i=z(e,t),t}});return i?await i:a.authToken}async function B(e,t){let i=await H(e.appConfig);for(;1===i.authToken.requestStatus;)await C(100),i=await H(e.appConfig);let a=i.authToken;return 0===a.requestStatus?N(e,t):a}function H(e){return P(e,e=>{var t;if(!K(e))throw u.create("not-registered");return 1===(t=e.authToken).requestStatus&&t.requestTime+1e4<Date.now()?{...e,authToken:{requestStatus:0}}:e})}async function z(e,t){try{let i=await j(e,t),a={...t,authToken:i};return await R(e.appConfig,a),i}catch(i){if(f(i)&&(401===i.customData.serverCode||404===i.customData.serverCode))await A(e.appConfig);else{let i={...t,authToken:{requestStatus:0}};await R(e.appConfig,i)}throw i}}function K(e){return void 0!==e&&2===e.registrationStatus}async function V(e){let{installationEntry:t,registrationPromise:i}=await x(e);return i?i.catch(console.error):N(e).catch(console.error),t.fid}async function U(e,t=!1){return await q(e),(await N(e,t)).token}async function q(e){let{registrationPromise:t}=await x(e);t&&await t}function W(e){return u.create("missing-app-config-values",{valueName:e})}let G="installations";(0,a.om)(new n.uA(G,e=>{let t=e.getProvider("app").getImmediate(),i=function(e){if(!e||!e.options)throw W("App Configuration");if(!e.name)throw W("App Name");for(let t of["projectId","apiKey","appId"])if(!e.options[t])throw W(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),s=(0,a.j6)(t,"heartbeat");return{app:t,appConfig:i,heartbeatServiceProvider:s,_delete:()=>Promise.resolve()}},"PUBLIC")),(0,a.om)(new n.uA("installations-internal",e=>{let t=e.getProvider("app").getImmediate(),i=(0,a.j6)(t,G).getImmediate();return{getId:()=>V(i),getToken:e=>U(i,e)}},"PRIVATE")),(0,a.KO)(l,c),(0,a.KO)(l,c,"esm2020");let J="@firebase/remote-config",X="0.8.3";class Y{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}let Q="remote-config",Z=new s.FA("remoteconfig","Remote Config",{"already-initialized":"Remote Config already initialized","registration-window":"Undefined window object. This SDK only supports usage in a browser environment.","registration-project-id":"Undefined project identifier. Check Firebase app initialization.","registration-api-key":"Undefined API key. Check Firebase app initialization.","registration-app-id":"Undefined app identifier. Check Firebase app initialization.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}.","fetch-client-network":"Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-timeout":'The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',"fetch-throttle":'The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',"fetch-client-parse":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","indexed-db-unavailable":"Indexed DB is not supported by current browser","custom-signal-max-allowed-signals":"Setting more than {$maxSignals} custom signals is not supported.","stream-error":"The stream was not able to connect to the backend: {$originalErrorMessage}.","realtime-unavailable":"The Realtime service is unavailable: {$originalErrorMessage}","update-message-invalid":"The stream invalidation message was unparsable: {$originalErrorMessage}","update-not-fetched":"Unable to fetch the latest config: {$originalErrorMessage}","analytics-unavailable":"Connection to Firebase Analytics failed: {$originalErrorMessage}"}),ee=["1","true","t","yes","y","on"];class et{constructor(e,t=""){this._source=e,this._value=t}asString(){return this._value}asBoolean(){return"static"!==this._source&&ee.indexOf(this._value.toLowerCase())>=0}asNumber(){if("static"===this._source)return 0;let e=Number(this._value);return isNaN(e)&&(e=0),e}getSource(){return this._source}}class ei{constructor(e){this.storage=e._storage,this.logger=e._logger,this.analyticsProvider=e._analyticsProvider}async updateActiveExperiments(e){let t=await this.storage.getActiveExperiments()||new Set,i=this.createExperimentInfoMap(e);return this.addActiveExperiments(i),this.removeInactiveExperiments(t,i),this.storage.setActiveExperiments(new Set(i.keys()))}createExperimentInfoMap(e){let t=new Map;for(let i of e)t.set(i.experimentId,i);return t}addActiveExperiments(e){let t={};for(let[i,a]of e.entries())t[`firebase${i}`]=a.variantId;this.addExperimentToAnalytics(t)}removeInactiveExperiments(e,t){let i={};for(let a of e)t.has(a)||(i[`firebase${a}`]=null);this.addExperimentToAnalytics(i)}addExperimentToAnalytics(e){if(0!==Object.keys(e).length)try{let t=this.analyticsProvider.getImmediate({optional:!0});t?(t.setUserProperties(e),t.logEvent("set_firebase_experiment_state")):this.logger.warn("Analytics import failed. Verify if you have imported Firebase Analytics in your app code.")}catch(e){throw Z.create("analytics-unavailable",{originalErrorMessage:e?.message})}}}function ea(e=(0,a.Sx)(),t={}){e=(0,s.Ku)(e);let i=(0,a.j6)(e,Q);if(i.isInitialized()){let e=i.getOptions();if((0,s.bD)(e,t))return i.getImmediate();throw Z.create("already-initialized")}i.initialize({options:t});let n=i.getImmediate();return t.initialFetchResponse&&(n._initializePromise=Promise.all([n._storage.setLastSuccessfulFetchResponse(t.initialFetchResponse),n._storage.setActiveConfigEtag(t.initialFetchResponse?.eTag||""),n._storage.setActiveConfigTemplateVersion(t.initialFetchResponse.templateVersion||0),n._storageCache.setLastSuccessfulFetchTimestampMillis(Date.now()),n._storageCache.setLastFetchStatus("success"),n._storageCache.setActiveConfig(t.initialFetchResponse?.config||{})]).then(),n._isInitializationComplete=!0),n}async function es(e){let t=(0,s.Ku)(e),[i,a]=await Promise.all([t._storage.getLastSuccessfulFetchResponse(),t._storage.getActiveConfigEtag()]);if(!i||!i.config||!i.eTag||!i.templateVersion||i.eTag===a)return!1;let n=new ei(t),r=i.experiments?n.updateActiveExperiments(i.experiments):Promise.resolve();return await Promise.all([t._storageCache.setActiveConfig(i.config),t._storage.setActiveConfigEtag(i.eTag),t._storage.setActiveConfigTemplateVersion(i.templateVersion),r]),!0}async function en(e){let t=(0,s.Ku)(e),i=new Y;setTimeout(async()=>{i.abort()},t.settings.fetchTimeoutMillis);let a=t._storageCache.getCustomSignals();a&&t._logger.debug(`Fetching config with custom signals: ${JSON.stringify(a)}`);try{await t._client.fetch({cacheMaxAgeMillis:t.settings.minimumFetchIntervalMillis,signal:i,customSignals:a}),await t._storageCache.setLastFetchStatus("success")}
1catch(i){let e=i instanceof s.g&&-1!==i.code.indexOf("fetch-throttle")?"throttle":"failure";throw await t._storageCache.setLastFetchStatus(e),i}}function er(e,t){let i=(0,s.Ku)(e);i._isInitializationComplete||i._logger.debug(`A value was requested for key "${t}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);let a=i._storageCache.getActiveConfig();return a&&void 0!==a[t]?new et("remote",a[t]):i.defaultConfig&&void 0!==i.defaultConfig[t]?new et("default",String(i.defaultConfig[t])):(i._logger.debug(`Returning static value for key "${t}". Define a default or remote value if this is unintentional.`),new et("static"))}class eo{constructor(e,t,i,a){this.client=e,this.storage=t,this.storageCache=i,this.logger=a}isCachedDataFresh(e,t){if(!t)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;let i=Date.now()-t,a=i<=e;return this.logger.debug(`Config fetch cache check. Cache age millis: ${i}. Cache max age millis (minimumFetchIntervalMillis setting): ${e}. Is cache hit: ${a}.`),a}async fetch(e){let[t,i]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(i&&this.isCachedDataFresh(e.cacheMaxAgeMillis,t))return i;e.eTag=i&&i.eTag;let a=await this.client.fetch(e),s=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===a.status&&s.push(this.storage.setLastSuccessfulFetchResponse(a)),await Promise.all(s),a}}
1class el{constructor(e,t,i,a,s,n){this.firebaseInstallations=e,this.sdkVersion=t,this.namespace=i,this.projectId=a,this.apiKey=s,this.appId=n}async fetch(e){let t,i,a,s,n,[r,o]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),l=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",c=`${l}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,h=fetch(c,{method:"POST",headers:{"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":e.eTag||"*"},body:JSON.stringify({sdk_version:this.sdkVersion,app_instance_id:r,app_instance_id_token:o,app_id:this.appId,language_code:function(e=navigator){return e.languages&&e.languages[0]||e.language}(),custom_signals:e.customSignals})}),g=new Promise((t,i)=>{e.signal.addEventListener(()=>{let e=Error("The operation was aborted.");e.name="AbortError",i(e)})});try{await Promise.race([h,g]),t=await h}catch(t){let e="fetch-client-network";throw t?.name==="AbortError"&&(e="fetch-timeout"),Z.create(e,{originalErrorMessage:t?.message})}let u=t.status,f=t.headers.get("ETag")||void 0;if(200===t.status){let e;try{e=await t.json()}catch(e){throw Z.create("fetch-client-parse",{originalErrorMessage:e?.message})}i=e.entries,a=e.state,s=e.templateVersion,n=e.experimentDescriptions}if("INSTANCE_STATE_UNSPECIFIED"===a?u=500:"NO_CHANGE"===a?u=304:("NO_TEMPLATE"===a||"EMPTY_CONFIG"===a)&&(i={},n=[]),304!==u&&200!==u)throw Z.create("fetch-status",{httpStatus:u});return{status:u,eTag:f,config:i,templateVersion:s,experiments:n}}}class ec{constructor(e,t){this.client=e,this.storage=t}async fetch(e){let t=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(e,t)}async attemptFetch(e,{throttleEndTimeMillis:t,backoffCount:i}){var a;await (a=e.signal,new Promise((e,i)=>{let s=setTimeout(e,Math.max(t-Date.now(),0));a.addEventListener(()=>{clearTimeout(s),i(Z.create("fetch-throttle",{throttleEndTimeMillis:t}))})}));try{let t=await this.client.fetch(e);return await this.storage.deleteThrottleMetadata(),t}catch(a){if(!function(e){if(!(e instanceof s.g)||!e.customData)return!1;let t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}(a))throw a;let t={throttleEndTimeMillis:Date.now()+(0,s.p9)(i),backoffCount:i+1};return await this.storage.setThrottleMetadata(t),this.attemptFetch(e,t)}}}class eh{get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}constructor(e,t,i,a,s,n,r){this.app=e,this._client=t,this._storageCache=i,this._storage=a,this._logger=s,this._realtimeHandler=n,this._analyticsProvider=r,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}}function eg(e,t){let i=e.target.error||void 0;return Z.create(t,{originalErrorMessage:i&&i?.message})}let eu="app_namespace_store";class ef{getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(e){return this.set("last_fetch_status",e)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(e){return this.set("last_successful_fetch_timestamp_millis",e)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(e){return this.set("last_successful_fetch_response",e)}getActiveConfig(){return this.get("active_config")}setActiveConfig(e){return this.set("active_config",e)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(e){return this.set("active_config_etag",e)}getActiveExperiments(){return this.get("active_experiments")}setActiveExperiments(e){return this.set("active_experiments",e)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(e){return this.set("throttle_metadata",e)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}getCustomSignals(){return this.get("custom_signals")}getRealtimeBackoffMetadata(){return this.get("realtime_backoff_metadata")}setRealtimeBackoffMetadata(e){return this.set("realtime_backoff_metadata",e)}getActiveConfigTemplateVersion(){return this.get("last_known_template_version")}setActiveConfigTemplateVersion(e){return this.set("last_known_template_version",e)}}class ed extends ef{constructor(e,t,i,a=new Promise((e,t)=>
1{try{let i=indexedDB.open("firebase_remote_config",1);i.onerror=e=>{t(eg(e,"storage-open"))},i.onsuccess=t=>{e(t.target.result)},i.onupgradeneeded=e=>{let t=e.target.result;0===e.oldVersion&&t.createObjectStore(eu,{keyPath:"compositeKey"})}}catch(e){t(Z.create("storage-open",{originalErrorMessage:e?.message}))}})){super(),this.appId=e,this.appName=t,this.namespace=i,this.openDbPromise=a}async setCustomSignals(e){let t=(await this.openDbPromise).transaction([eu],"readwrite"),i=ep(e,await this.getWithTransaction("custom_signals",t)||{});return await this.setWithTransaction("custom_signals",i,t),i}async getWithTransaction(e,t){return new Promise((i,a)=>{let s=t.objectStore(eu),n=this.createCompositeKey(e);try{let e=s.get(n);e.onerror=e=>{a(eg(e,"storage-get"))},e.onsuccess=e=>{let t=e.target.result;t?i(t.value):i(void 0)}}catch(e){a(Z.create("storage-get",{originalErrorMessage:e?.message}))}})}async setWithTransaction(e,t,i){return new Promise((a,s)=>{let n=i.objectStore(eu),r=this.createCompositeKey(e);try{let e=n.put({compositeKey:r,value:t});e.onerror=e=>{s(eg(e,"storage-set"))},e.onsuccess=()=>{a()}}catch(e){s(Z.create("storage-set",{originalErrorMessage:e?.message}))}})}async get(e){let t=(await this.openDbPromise).transaction([eu],"readonly");return this.getWithTransaction(e,t)}async set(e,t){let i=(await this.openDbPromise).transaction([eu],"readwrite");return this.setWithTransaction(e,t,i)}async delete(e){let t=await this.openDbPromise;return new Promise((i,a)=>{let s=t.transaction([eu],"readwrite").objectStore(eu),n=this.createCompositeKey(e);try{let e=s.delete(n);e.onerror=e=>{a(eg(e,"storage-delete"))},e.onsuccess=()=>{i()}}catch(e){a(Z.create("storage-delete",{originalErrorMessage:e?.message}))}})}createCompositeKey(e){return[this.appId,this.appName,this.namespace,e].join()}}class em extends ef{constructor(){super(...arguments),this.storage={}}async get(e){return Promise.resolve(this.storage[e])}async set(e,t){return this.storage[e]=t,Promise.resolve(void 0)}async delete(e){return this.storage[e]=void 0,Promise.resolve()}async setCustomSignals(e){let t=this.storage.custom_signals||{};return this.storage.custom_signals=ep(e,t),Promise.resolve(this.storage.custom_signals)}}function ep(e,t){let i=Object.fromEntries(Object.entries({...t,...e}).filter(([e,t])=>null!==t).map(([e,t])=>"number"==typeof t?[e,t.toString()]:[e,t]));if(Object.keys(i).length>100)throw Z.create("custom-signal-max-allowed-signals",{maxSignals:100});return i}class ew{constructor(e){this.storage=e}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}getCustomSignals(){return this.customSignals}async loadFromStorage(){let e=this.storage.getLastFetchStatus(),t=this.storage.getLastSuccessfulFetchTimestampMillis(),i=this.storage.getActiveConfig(),a=this.storage.getCustomSignals(),s=await e;s&&(this.lastFetchStatus=s);let n=await t;n&&(this.lastSuccessfulFetchTimestampMillis=n);let r=await i;r&&(this.activeConfig=r);let o=await a;o&&(this.customSignals=o)}setLastFetchStatus(e){return this.lastFetchStatus=e,this.storage.setLastFetchStatus(e)}setLastSuccessfulFetchTimestampMillis(e){return this.lastSuccessfulFetchTimestampMillis=e,this.storage.setLastSuccessfulFetchTimestampMillis(e)}setActiveConfig(e){return this.activeConfig=e,this.storage.setActiveConfig(e)}async setCustomSignals(e){this.customSignals=await this.storage.setCustomSignals(e)}}class ev{constructor(e){this.allowedEvents_=e,this.listeners_={},(0,s.vA)(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){let i=[...this.listeners_[e]];for(let e=0;e<i.length;e++)i[e].callback.apply(i[e].context,t)}}on(e,t,i){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:i});let a=this.getInitialEvent(e);a&&t.apply(i,a)}off(e,t,i){this.validateEventType_(e);let a=this.listeners_[e]||[];for(let e=0;e<a.length;e++)if(a[e].callback===t&&(!i||i===a[e].context))return void a.splice(e,1)}validateEventType_(e){(0,s.vA)(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}}class ey extends ev{static getInstance(){return new ey}constructor(){let e,t;super(["visible"]),"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}getInitialEvent(e){return(0,s.vA)("visible"===e,"Unknown event type: "+e),[this.visible_]}}let eC="featureDisabled",eb="retryIntervalSeconds",e_="latestTemplateVersionNumber";class eS{constructor(e,t,i,a,s,n,r,o,l,c){this.firebaseInstallations=e,this.storage=t,this.sdkVersion=i,this.namespace=a,this.projectId=s,this.apiKey=n,this.appId=r,this.logger=o,this.storageCache=l,this.cachingClient=c,this.observers=new Set,this.isConnectionActive=!1,this.isRealtimeDisabled=!1,this.httpRetriesRemaining=8,this.isInBackgroun
1d=!1,this.decoder=new TextDecoder("utf-8"),this.isClosingConnection=!1,this.propagateError=e=>this.observers.forEach(t=>t.error?.(e)),this.isStatusCodeRetryable=e=>!e||[408,429,502,503,504].includes(e),this.setRetriesRemaining(),ey.getInstance().on("visible",this.onVisibilityChange,this)}async setRetriesRemaining(){let e=await this.storage.getRealtimeBackoffMetadata(),t=e?.numFailedStreams||0;this.httpRetriesRemaining=Math.max(8-t,1)}async updateBackoffMetadataWithLastFailedStreamConnectionTime(e){let t=((await this.storage.getRealtimeBackoffMetadata())?.numFailedStreams||0)+1,i=(0,s.p9)(t,6e4,2);await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:new Date(e.getTime()+i),numFailedStreams:t})}async updateBackoffMetadataWithRetryInterval(e){let t=new Date(Date.now()+1e3*e);await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:t,numFailedStreams:0}),await this.retryHttpConnectionWhenBackoffEnds()}async closeRealtimeHttpConnection(){if(!this.isClosingConnection){this.isClosingConnection=!0;try{this.reader&&await this.reader.cancel()}catch(e){this.logger.debug("Failed to cancel the reader, connection was lost.")}finally{this.reader=void 0}this.controller&&(await this.controller.abort(),this.controller=void 0),this.isClosingConnection=!1}}async resetRealtimeBackoff(){await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:new Date(-1),numFailedStreams:0})}resetRetryCount(){this.httpRetriesRemaining=8}async establishRealtimeConnection(e,t,i,a){let s=await this.storage.getActiveConfigEtag(),n=await this.storage.getActiveConfigTemplateVersion(),r={"X-Goog-Api-Key":this.apiKey,"X-Goog-Firebase-Installations-Auth":i,"Content-Type":"application/json",Accept:"application/json","If-None-Match":s||"*","Content-Encoding":"gzip"},o={project:this.projectId,namespace:this.namespace,lastKnownVersionNumber:n,appId:this.appId,sdkVersion:this.sdkVersion,appInstanceId:t};return await fetch(e,{method:"POST",headers:r,body:JSON.stringify(o),signal:a})}getRealtimeUrl(){let e=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfigrealtime.googleapis.com";return new URL(`${e}/v1/projects/${this.projectId}/namespaces/${this.namespace}
1:streamFetchInvalidations?key=${this.apiKey}`)}async createRealtimeConnection(){let[e,t]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken(!1)]);this.controller=new AbortController;let i=this.getRealtimeUrl();return await this.establishRealtimeConnection(i,e,t,this.controller.signal)}async retryHttpConnectionWhenBackoffEnds(){let e=await this.storage.getRealtimeBackoffMetadata();e||(e={backoffEndTimeMillis:new Date(-1),numFailedStreams:0});let t=Math.max(0,new Date(e.backoffEndTimeMillis).getTime()-Date.now());await this.makeRealtimeHttpConnection(t)}setIsHttpConnectionRunning(e){this.isConnectionActive=e}checkAndSetHttpConnectionFlagIfNotRunning(){let e=this.canEstablishStreamConnection();return e&&this.setIsHttpConnectionRunning(!0),e}fetchResponseIsUpToDate(e,t){return null!=e.config&&e.templateVersion?e.templateVersion>=t:"success"===this.storageCache.getLastFetchStatus()}parseAndValidateConfigUpdateMessage(e){let t=e.indexOf("{"),i=e.indexOf("}",t);return t<0||i<0||t>=i?"":e.substring(t,i+1)}isEventListenersEmpty(){return 0===this.observers.size}getRandomInt(e){return Math.floor(Math.random()*e)}executeAllListenerCallbacks(e){this.observers.forEach(t=>t.next(e))}getChangedParams(e,t){let i=new Set,a=new Set(Object.keys(e||{})),s=new Set(Object.keys(t||{}));for(let n of a)s.has(n)&&e[n]===t[n]||i.add(n);for(let e of s)a.has(e)||i.add(e);return i}async fetchLatestConfig(e,t){let i=e-1,a=this.storageCache.getCustomSignals();a&&this.logger.debug(`Fetching config with custom signals: ${JSON.stringify(a)}`);let s=new Y;try{let e=await this.cachingClient.fetch({cacheMaxAgeMillis:0,signal:s,customSignals:a,fetchType:"REALTIME",fetchAttempt:3-i}),n=await this.storage.getActiveConfig();if(!this.fetchResponseIsUpToDate(e,t)){this.logger.debug("Fetched template version is the same as SDK's current version. Retrying fetch."),await this.autoFetch(i,t);return}if(null==e.config)return void this.logger.debug("The fetch succeeded, but the backend had no updates.");null==n&&(n={});let r=this.getChangedParams(e.config,n);if(0===r.size)return void this.logger.debug("Config was fetched, but no params changed.");this.executeAllListenerCallbacks({getUpdatedKeys:()=>new Set(r)})}catch(i){let e=i instanceof Error?i.message:String(i),t=Z.create("update-not-fetched",{originalErrorMessage:`Failed to auto-fetch config update: ${e}`});this.propagateError(t)}}async autoFetch(e,t){if(0===e){let e=Z.create("update-not-fetched",{originalErrorMessage:"Unable to fetch the latest version of the template."});this.propagateError(e);return}let i=1e3*this.getRandomInt(4);await new Promise(e=>setTimeout(e,i)),await this.fetchLatestConfig(e,t)}async handleNotifications(e){let t,i="";for(;;){let{done:a,value:s}=await e.read();if(a)break;if(i+=t=this.decoder.decode(s,{stream:!0}),t.includes("}")){if(0===(i=this.parseAndValidateConfigUpdateMessage(i)).length)continue;try{let e=JSON.parse(i);if(this.isEventListenersEmpty())break;if(eC in e&&!0===e[eC]){let e=Z.create("realtime-unavailable",{originalErrorMessage:"The server is temporarily unavailable. Try again in a few minutes."});this.propagateError(e);break}if(e_ in e){let t=await this.storage.getActiveConfigTemplateVersion(),i=Number(e[e_]);t&&i>t&&await this.autoFetch(3,i)}if(eb in e){let t=Number(e[eb]);await this.updateBackoffMetadataWithRetryInterval(t)}}catch(t){this.logger.debug("Unable to parse latest config update message.",t);let e=t instanceof Error?t.message:String(t);this.propagateError(Z.create("update-message-invalid",{originalErrorMessage:e}))}i=""}}}async listenForNotifications(e){try{await this.handleNotifications(e)}catch(e){this.isInBackground||this.logger.debug("Real-time connection was closed due to an exception.")}}async prepareAndBeginRealtimeHttpStream(){let e,t;if(!this.checkAndSetHttpConnectionFlagIfNotRunning())return;let i=await this.storage.getRealtimeBackoffMetadata();i||(i={backoffEndTimeMillis:new Date(-1),numFailedStreams:0});let a=i.backoffEndTimeMillis.getTime();if(Date.now()<a)return void await this.retryHttpConnectionWhenBackoffEnds();try{if(t=(e=await this.createRealtimeConnection()).status,e.ok&&e.body){this.resetRetryCount(),await this.resetRealtimeBackoff();let t=e.body.getReader();this.reader=t,await this.listenForNotifications(t)}}
1catch(e){this.isInBackground?this.resetRetryCount():this.logger.debug("Exception connecting to real-time RC backend. Retrying the connection...:",e)}finally{await this.closeRealtimeHttpConnection(),this.setIsHttpConnectionRunning(!1);let i=!this.isInBackground&&(void 0===t||this.isStatusCodeRetryable(t));if(i&&await this.updateBackoffMetadataWithLastFailedStreamConnectionTime(new Date),i||e?.ok)await this.retryHttpConnectionWhenBackoffEnds();else{let e=`Unable to connect to the server. HTTP status code: ${t}`,i=Z.create("stream-error",{originalErrorMessage:e});this.propagateError(i)}}}canEstablishStreamConnection(){let e=this.observers.size>0,t=!this.isRealtimeDisabled,i=!this.isConnectionActive,a=!this.isInBackground;return e&&t&&i&&a}async makeRealtimeHttpConnection(e){if(this.canEstablishStreamConnection()){if(this.httpRetriesRemaining>0)this.httpRetriesRemaining--,await new Promise(t=>setTimeout(t,e)),this.prepareAndBeginRealtimeHttpStream();else if(!this.isInBackground){let e=Z.create("stream-error",{originalErrorMessage:"Unable to connect to the server. Check your connection and try again."});this.propagateError(e)}}}async beginRealtime(){this.observers.size>0&&await this.makeRealtimeHttpConnection(0)}addObserver(e){this.observers.add(e),this.beginRealtime()}removeObserver(e){this.observers.has(e)&&this.observers.delete(e)}async onVisibilityChange(e){this.isInBackground=!e,e?e&&await this.beginRealtime():await this.closeRealtimeHttpConnection()}}async function eT(e){return e=(0,s.Ku)(e),await en(e),es(e)}(0,a.om)(new n.uA(Q,function(e,{options:t}){let i=e.getProvider("app").getImmediate(),n=e.getProvider("installations-internal").getImmediate(),o=e.getProvider("analytics-internal"),{projectId:l,apiKey:c,appId:h}=i.options;if(!l)throw Z.create("registration-project-id");if(!c)throw Z.create("registration-api-key");if(!h)throw Z.create("registration-app-id");let g=t?.templateId||"firebase",u=(0,s.zW)()?new ed(h,i.name,g):new em,f=new ew(u),d=new r.Vy(J);d.logLevel=r.$b.ERROR;let m=new eo(new ec(new el(n,a.MF,g,l,c,h),u),u,f,d),p=new eS(n,u,a.MF,g,l,c,h,d,f,m),w=new eh(i,m,f,u,d,p,o);return!function(e){let t=(0,s.Ku)(e);t._initializePromise||(t._initializePromise=t._storageCache.loadFromStorage().then(()=>{t._isInitializationComplete=!0})),t._initializePromise}(w),w},"PUBLIC").setMultipleInstances(!0)),(0,a.KO)(J,X),(0,a.KO)(J,X,"esm2020")}}]);
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.