PageSourceSearch

https://forza-community-hub.web.app/assets/vendor-firebase-QEW96k7u.js

js forza-community-hub.web.app collected 2026-10-03 12:23:58 UTC 394,786 bytes, 25 lines download raw bytes

vendor: 5,078 bytes, line 1
1var e=()=>void 0,t=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t},n=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,get ENCODED_VALS(){return this.ENCODED_VALS_BASE+`+/=`},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+`-_.`},HAS_NATIVE_SUPPORT:typeof atob==`function`,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_,r=[];for(let t=0;t<e.length;t+=3){let i=e[t],a=t+1<e.length,o=a?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,l=i>>2,u=(i&3)<<4|o>>4,d=(o&15)<<2|c>>6,f=c&63;s||(f=64,a||(d=64)),r.push(n[l],n[u],n[d],n[f])}return r.join(``)},encodeString(e,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(e):this.encodeByteArray(t(e),n)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):n(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){let a=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;let s=t<e.length?n[e.charAt(t)]:64;++t;let c=t<e.length?n[e.charAt(t)]:64;if(++t,a==null||o==null||s==null||c==null)throw new i;let l=a<<2|o>>4;if(r.push(l),s!==64){let e=o<<4&240|s>>2;if(r.push(e),c!==64){let e=s<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.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)}}},i=class extends Error{constructor(){super(...arguments),this.name=`DecodeBase64StringError`}},a=function(e){let n=t(e);return r.encodeByteArray(n,!0)},o=function(e){return a(e).replace(/\./g,``)},s=function(e){try{return r.decodeString(e,!0)}catch(e){console.error(`base64Decode failed: `,e)}return null};function c(){if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(typeof global<`u`)return global;throw Error(`Unable to locate global object.`)}var l=()=>c().__FIREBASE_DEFAULTS__,u=()=>{if(typeof process>`u`)return;let e={}.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},d=()=>{if(typeof document>`u`)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let t=e&&s(e[1]);return t&&JSON.parse(t)},f=()=>{try{return e()||l()||u()||d()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},p=e=>f()?.emulatorHosts?.[e],m=e=>{let t=p(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 r=parseInt(t.substring(n+1),10);return t[0]===`[`?[t.substring(1,n-1),r]:[t.substring(0,n),r]},h=()=>f()?.config,g=e=>f()?.[`_${e}`],ee=class{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),typeof e==`function`&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,n))}}};function te(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.`);let n={alg:`none`,type:`JWT`},r=t||`demo-project`,i=e.iat||0,a=e.sub||e.user_id;if(!a)throw Error(`mockUserToken must contain 'sub' or 'user_id' field!`);let s={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:a,user_id:a,firebase:{sign_in_provider:`custom`,identities:{}},...e};return[o(JSON.stringify(n)),o(JSON.stringify(s)),``].join(`.`)}function _(){return typeof navigator<`u`&&typeof navigator.userAgent==`string`?navigator.userAgent:``}function ne(){return typeof window<`u`&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(_())}function re(){let e=f()?.forceEnvironment;if(e===`node`)return!0;
vendor: 9,076 bytes, line 1
1if(e===`browser`)return!1;try{return Object.prototype.toString.call(global.process)===`[object process]`}catch{return!1}}function ie(){return typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`}function ae(){let e=typeof chrome==`object`?chrome.runtime:typeof browser==`object`?browser.runtime:void 0;return typeof e==`object`&&e.id!==void 0}function oe(){return typeof navigator==`object`&&navigator.product===`ReactNative`}function se(){let e=_();return e.indexOf(`MSIE `)>=0||e.indexOf(`Trident/`)>=0}function ce(){return!re()&&!!navigator.userAgent&&navigator.userAgent.includes(`Safari`)&&!navigator.userAgent.includes(`Chrome`)}function v(){try{return typeof indexedDB==`object`}catch{return!1}}function le(){return new Promise((e,t)=>{try{let n=!0,r=`validate-browser-context-for-indexeddb-analytics-module`,i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{t(i.error?.message||``)}}catch(e){t(e)}})}var ue=`FirebaseError`,de=class e extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=ue,Object.setPrototypeOf(this,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,fe.prototype.create)}},fe=class{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],a=i?pe(i,n):`Error`;return new de(r,`${this.serviceName}: ${a} (${r}).`,n)}};function pe(e,t){return e.replace(me,(e,n)=>{let r=t[n];return r==null?`<${n}?>`:String(r)})}var me=/\{\$([^}]+)}/g;function he(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function ge(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);for(let i of n){if(!r.includes(i))return!1;let n=e[i],a=t[i];if(_e(n)&&_e(a)){if(!ge(n,a))return!1}else if(n!==a)return!1}for(let e of r)if(!n.includes(e))return!1;return!0}function _e(e){return typeof e==`object`&&!!e}function ve(e){let t=[];for(let[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+`=`+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+`=`+encodeURIComponent(r));return t.length?`&`+t.join(`&`):``}function ye(e){let t={};return e.replace(/^\?/,``).split(`&`).forEach(e=>{if(e){let[n,r]=e.split(`=`);t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function be(e){let t=e.indexOf(`?`);if(!t)return``;let n=e.indexOf(`#`,t);return e.substring(t,n>0?n:void 0)}function xe(e,t){let n=new Se(e,t);return n.subscribe.bind(n)}var Se=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(e===void 0&&t===void 0&&n===void 0)throw Error(`Missing Observer.`);r=Ce(e,[`next`,`error`,`complete`])?e:{next:e,error:t,complete:n},r.next===void 0&&(r.next=we),r.error===void 0&&(r.error=we),r.complete===void 0&&(r.complete=we);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],--this.observerCount,this.observerCount===0&&this.onNoObservers!==void 0&&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(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(e){typeof console<`u`&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function Ce(e,t){if(typeof e!=`object`||!e)return!1;for(let n of t)if(n in e&&typeof e[n]==`function`)return!0;return!1}function we(){}function y(e){return e&&e._delegate?e._delegate:e}function Te(e){try{return(e.startsWith(`http://`)||e.startsWith(`https://`)?new URL(e).hostname:e).endsWith(`.cloudworkstations.dev`)}catch{return!1}}async function Ee(e){return(await fetch(e,{credentials:`include`})).ok}var De=class{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}},Oe=`[DEFAULT]`,ke=class{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 ee;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}else if(n)return null;else 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(je(e))try{this.getOrInitializeService({instanceIdentifier:Oe})}catch{}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch{}}}}clearInstance(e=Oe){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 this.component!=null}isInitialized(e=Oe){return this.instances.has(e)}getOptions(e=Oe){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 r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){let n=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(n)??new Set;r.add(e),this.onInitCallbacks.set(n,r);let i=this.instances.get(n);return i&&e(i,n),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let r of n)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:Ae(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{}return n||null}normalizeInstanceIdentifier(e=Oe){return this.component?this.component.multipleInstances?e:Oe:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!==`EXPLICIT`}};function Ae(e){return e===Oe?void 0:e}function je(e){return e.instantiationMode===`EAGER`}var Me=class{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 ke(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}},Ne=[],b;(function(e){e[e.DEBUG=0]=`DEBUG`,e[e.VERBOSE=1]=`VERBOSE`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.SILENT=5]=`SILENT`})(b||={});var Pe={debug:b.DEBUG,verbose:b.VERBOSE,info:b.INFO,warn:b.WARN,error:b.ERROR,silent:b.SILENT},x=b.INFO,S={[b.DEBUG]:`log`,[b.VERBOSE]:`log`,[b.INFO]:`info`,[b.WARN]:`warn`,[b.ERROR]:`error`},Fe=(e,t,...n)=>{if(t<e.logLevel)return;let r=new Date().toISOString(),i=S[t];if(i)console[i](`[${r}]  ${e.name}:`,...n);
vendor: 13,453 bytes, line 1
1else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)},Ie=class{constructor(e){this.name=e,this._logLevel=x,this._logHandler=Fe,this._userLogHandler=null,Ne.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in b))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e==`string`?Pe[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!=`function`)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,b.DEBUG,...e),this._logHandler(this,b.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,b.VERBOSE,...e),this._logHandler(this,b.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,b.INFO,...e),this._logHandler(this,b.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,b.WARN,...e),this._logHandler(this,b.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,b.ERROR,...e),this._logHandler(this,b.ERROR,...e)}},Le=(e,t)=>t.some(t=>e instanceof t),Re,ze;function Be(){return Re||=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]}function Ve(){return ze||=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]}var He=new WeakMap,Ue=new WeakMap,We=new WeakMap,Ge=new WeakMap,Ke=new WeakMap;function qe(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`success`,i),e.removeEventListener(`error`,a)},i=()=>{t($e(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener(`success`,i),e.addEventListener(`error`,a)});return t.then(t=>{t instanceof IDBCursor&&He.set(t,e)}).catch(()=>{}),Ke.set(t,e),t}function Je(e){if(Ue.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`complete`,i),e.removeEventListener(`error`,a),e.removeEventListener(`abort`,a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException(`AbortError`,`AbortError`)),r()};e.addEventListener(`complete`,i),e.addEventListener(`error`,a),e.addEventListener(`abort`,a)});Ue.set(e,t)}var Ye={get(e,t,n){if(e instanceof IDBTransaction){if(t===`done`)return Ue.get(e);if(t===`objectStoreNames`)return e.objectStoreNames||We.get(e);if(t===`store`)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $e(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t===`done`||t===`store`)?!0:t in e}};function Xe(e){Ye=e(Ye)}function Ze(e){return e===IDBDatabase.prototype.transaction&&!(`objectStoreNames`in IDBTransaction.prototype)?function(t,...n){let r=e.call(et(this),t,...n);return We.set(r,t.sort?t.sort():[t]),$e(r)}:Ve().includes(e)?function(...t){return e.apply(et(this),t),$e(He.get(this))}:function(...t){return $e(e.apply(et(this),t))}}function Qe(e){return typeof e==`function`?Ze(e):(e instanceof IDBTransaction&&Je(e),Le(e,Be())?new Proxy(e,Ye):e)}function $e(e){if(e instanceof IDBRequest)return qe(e);if(Ge.has(e))return Ge.get(e);let t=Qe(e);return t!==e&&(Ge.set(e,t),Ke.set(t,e)),t}var et=e=>Ke.get(e);function tt(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){let o=indexedDB.open(e,t),s=$e(o);return r&&o.addEventListener(`upgradeneeded`,e=>{r($e(o.result),e.oldVersion,e.newVersion,$e(o.transaction),e)}),n&&o.addEventListener(`blocked`,e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{a&&e.addEventListener(`close`,()=>a()),i&&e.addEventListener(`versionchange`,e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}var nt=[`get`,`getKey`,`getAll`,`getAllKeys`,`count`],rt=[`put`,`add`,`delete`,`clear`],it=new Map;function at(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t==`string`))return;if(it.get(t))return it.get(t);let n=t.replace(/FromIndex$/,``),r=t!==n,i=rt.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||nt.includes(n)))return;let a=async function(e,...t){let a=this.transaction(e,i?`readwrite`:`readonly`),o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return it.set(t,a),a}Xe(e=>({...e,get:(t,n,r)=>at(t,n)||e.get(t,n,r),has:(t,n)=>!!at(t,n)||e.has(t,n)}));var ot=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(st(e)){let t=e.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(e=>e).join(` `)}};function st(e){return e.getComponent()?.type===`VERSION`}var ct=`@firebase/app`,lt=`0.14.12`,ut=new Ie(`@firebase/app`),dt=`@firebase/app-compat`,ft=`@firebase/analytics-compat`,pt=`@firebase/analytics`,mt=`@firebase/app-check-compat`,ht=`@firebase/app-check`,gt=`@firebase/auth`,_t=`@firebase/auth-compat`,vt=`@firebase/database`,yt=`@firebase/data-connect`,bt=`@firebase/database-compat`,xt=`@firebase/functions`,St=`@firebase/functions-compat`,Ct=`@firebase/installations`,wt=`@firebase/installations-compat`,Tt=`@firebase/messaging`,Et=`@firebase/messaging-compat`,Dt=`@firebase/performance`,Ot=`@firebase/performance-compat`,kt=`@firebase/remote-config`,At=`@firebase/remote-config-compat`,jt=`@firebase/storage`,Mt=`@firebase/storage-compat`,Nt=`@firebase/firestore`,Pt=`@firebase/ai`,Ft=`@firebase/firestore-compat`,It=`firebase`,Lt=`12.13.0`,Rt=`[DEFAULT]`,zt={[ct]:`fire-core`,[dt]:`fire-core-compat`,[pt]:`fire-analytics`,[ft]:`fire-analytics-compat`,[ht]:`fire-app-check`,[mt]:`fire-app-check-compat`,[gt]:`fire-auth`,[_t]:`fire-auth-compat`,[vt]:`fire-rtdb`,[yt]:`fire-data-connect`,[bt]:`fire-rtdb-compat`,[xt]:`fire-fn`,[St]:`fire-fn-compat`,[Ct]:`fire-iid`,[wt]:`fire-iid-compat`,[Tt]:`fire-fcm`,[Et]:`fire-fcm-compat`,[Dt]:`fire-perf`,[Ot]:`fire-perf-compat`,[kt]:`fire-rc`,[At]:`fire-rc-compat`,[jt]:`fire-gcs`,[Mt]:`fire-gcs-compat`,[Nt]:`fire-fst`,[Ft]:`fire-fst-compat`,[Pt]:`fire-vertex`,"fire-js":`fire-js`,[It]:`fire-js-all`},Bt=new Map,Vt=new Map,Ht=new Map;function Ut(e,t){try{e.container.addComponent(t)}catch(n){ut.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Wt(e){let t=e.name;if(Ht.has(t))return ut.debug(`There were multiple attempts to register component ${t}.`),!1;Ht.set(t,e);for(let t of Bt.values())Ut(t,e);for(let t of Vt.values())Ut(t,e);return!0}function Gt(e,t){let n=e.container.getProvider(`heartbeat`).getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function C(e){return e==null?!1:e.settings!==void 0}var w=new fe(`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`,"server-app-deleted":`Firebase Server App has been 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}.`,"finalization-registry-not-supported":`FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.`,"invalid-server-app-environment":`FirebaseServerApp is not for use in browser environments.`}),Kt=class{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new De(`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 w.create(`app-deleted`,{appName:this._name})}},qt=Lt;function Jt(e,t={}){let n=e;typeof t!=`object`&&(t={name:t});let r={name:Rt,automaticDataCollectionEnabled:!0,...t},i=r.name;if(typeof i!=`string`||!i)throw w.create(`bad-app-name`,{appName:String(i)});if(n||=h(),!n)throw w.create(`no-options`);let a=Bt.get(i);if(a){if(ge(n,a.options)&&ge(r,a.config))return a;throw w.create(`duplicate-app`,{appName:i})}let o=new Me(i);for(let e of Ht.values())o.addComponent(e);let s=new Kt(n,r,o);return Bt.set(i,s),s}function Yt(e=Rt){let t=Bt.get(e);if(!t&&e===`[DEFAULT]`&&h())return Jt();if(!t)throw w.create(`no-app`,{appName:e});return t}function Xt(e,t,n){let r=zt[e]??e;n&&(r+=`-${n}`);let i=r.match(/\s|\//),a=t.match(/\s|\//);if(i||a){let e=[`Unable to register library "${r}" with version "${t}":`];i&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&a&&e.push(`and`),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),ut.warn(e.join(` `));return}Wt(new De(`${r}-version`,()=>({library:r,version:t}),`VERSION`))}var Zt=`firebase-heartbeat-database`,Qt=1,$t=`firebase-heartbeat-store`,en=null;function tn(){return en||=tt(Zt,Qt,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore($t)}catch(e){console.warn(e)}}}}).catch(e=>{throw w.create(`idb-open`,{originalErrorMessage:e.message})}),en}async function nn(e){try{let t=(await tn()).transaction($t),n=await t.objectStore($t).get(an(e));return await t.done,n}catch(e){if(e instanceof de)ut.warn(e.message);else{let t=w.create(`idb-get`,{originalErrorMessage:e?.message});ut.warn(t.message)}}}async function rn(e,t){try{let n=(await tn()).transaction($t,`readwrite`);await n.objectStore($t).put(t,an(e)),await n.done}catch(e){if(e instanceof de)ut.warn(e.message);else{let t=w.create(`idb-set`,{originalErrorMessage:e?.message});ut.warn(t.message)}}}function an(e){return`${e.name}!${e.options.appId}`}var on=1024,sn=30,cn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider(`app`).getImmediate();this._storage=new dn(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{let e=this.container.getProvider(`platform-logger`).getImmediate().getPlatformInfoString(),t=ln();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>sn){let e=pn(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ut.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return``;let e=ln(),{heartbeatsToSend:t,unsentEntries:n}=un(this._heartbeatsCache.heartbeats),r=o(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)),r}catch(e){return ut.warn(e),``}}};function ln(){return new Date().toISOString().substring(0,10)}function un(e,t=on){let n=[],r=e.slice();for(let i of e){let e=n.find(e=>e.agent===i.agent);if(!e){if(n.push({agent:i.agent,dates:[i.date]}),fn(n)>t){n.pop();break}}else if(e.dates.push(i.date),fn(n)>t){e.dates.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var dn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return v()?le().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let e=await nn(this.app);return e?.heartbeats?e:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return rn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return rn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}else return}};function fn(e){return o(JSON.stringify({version:2,heartbeats:e})).length}function pn(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}function mn(e){Wt(new De(`platform-logger`,e=>new ot(e),`PRIVATE`)),Wt(new De(`heartbeat`,e=>new cn(e),`PRIVATE`)),Xt(ct,lt,e),Xt(ct,lt,`esm2020`),Xt(`fire-js`,``)}
vendor: 4,186 bytes, line 1
1mn(``),Xt(`firebase`,`12.13.0`,`app`);function hn(){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."}}var gn=hn,_n=new fe(`auth`,`Firebase`,hn()),vn=new Ie(`@firebase/auth`);function yn(e,...t){vn.logLevel<=b.WARN&&vn.warn(`Auth (${qt}): ${e}`,...t)}function bn(e,...t){vn.logLevel<=b.ERROR&&vn.error(`Auth (${qt}): ${e}`,...t)}function xn(e,...t){throw wn(e,...t)}function T(e,...t){return wn(e,...t)}function Sn(e,t,n){return new fe(`auth`,`Firebase`,{...gn(),[t]:n}).create(t,{appName:e.name})}function Cn(e){return Sn(e,`operation-not-supported-in-this-environment`,`Operations that alter the current user are not supported in conjunction with FirebaseServerApp`)}function wn(e,...t){if(typeof e!=`string`){let n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return _n.create(e,...t)}function E(e,t,...n){if(!e)throw wn(t,...n)}function Tn(e){let t=`INTERNAL ASSERTION FAILED: `+e;throw bn(t),Error(t)}function En(e,t){e||Tn(t)}function Dn(){return typeof self<`u`&&self.location?.href||``}function On(){return kn()===`http:`||kn()===`https:`}function kn(){return typeof self<`u`&&self.location?.protocol||null}function An(){return typeof navigator<`u`&&navigator&&`onLine`in navigator&&typeof navigator.onLine==`boolean`&&(On()||ae()||`connection`in navigator)?navigator.onLine:!0}function jn(){if(typeof navigator>`u`)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}var Mn=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,En(t>e,`Short delay should be less than long delay!`),this.isMobile=ne()||oe()}get(){return An()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Nn(e,t){En(e.emulator,`Emulator should always be set here`);let{url:n}=e.emulator;return t?`${n}${t.startsWith(`/`)?t.slice(1):t}`:n}var Pn=class{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<`u`&&`fetch`in self)return self.fetch;if(typeof globalThis<`u`&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<`u`)return fetch;Tn(`Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<`u`&&`Headers`in self)return self.Headers;if(typeof globalThis<`u`&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<`u`)return Headers;Tn(`Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<`u`&&`Response`in self)return self.Response;if(typeof globalThis<`u`&&globalThis.Response)return globalThis.Response;if(typeof Response<`u`)return Response;Tn(`Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}},Fn={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`,INVALID_LOGIN_CREDENTIALS:`invalid-credential`,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`,PASSWORD_DOES_NOT_MEET_REQUIREMENTS:`password-does-not-meet-requirements`,INVALID_CODE:`invali
1d-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-recaptcha-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:`invali
1d-recaptcha-version`,INVALID_REQ_TYPE:`invalid-req-type`},In=[`/v1/accounts:signInWithCustomToken`,`/v1/accounts:signInWithEmailLink`,`/v1/accounts:signInWithIdp`,`/v1/accounts:signInWithPassword`,`/v1/accounts:signInWithPhoneNumber`,`/v1/token`],Ln=new Mn(3e4,6e4);function D(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function O(e,t,n,r,i={}){return Rn(e,i,async()=>{let i={},a={};r&&(t===`GET`?a=r:i={body:JSON.stringify(r)});let o=ve({key:e.config.apiKey,...a}).slice(1),s=await e._getAdditionalHeaders();s[`Content-Type`]=`application/json`,e.languageCode&&(s[`X-Firebase-Locale`]=e.languageCode);let c={method:t,headers:s,...i};return ie()||(c.referrerPolicy=`no-referrer`),e.emulatorConfig&&Te(e.emulatorConfig.host)&&(c.credentials=`include`),Pn.fetch()(await Bn(e,e.config.apiHost,n,o),c)})}async function Rn(e,t,n){e._canInitEmulator=!1;let r={...Fn,...t};try{let t=new Hn(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let a=await i.json();if(`needConfirmation`in a)throw Un(e,`account-exists-with-different-credential`,a);if(i.ok&&!(`errorMessage`in a))return a;{let[t,n]=(i.ok?a.errorMessage:a.error.message).split(` : `);if(t===`FEDERATED_USER_ID_ALREADY_LINKED`)throw Un(e,`credential-already-in-use`,a);if(t===`EMAIL_EXISTS`)throw Un(e,`email-already-in-use`,a);if(t===`USER_DISABLED`)throw Un(e,`user-disabled`,a);let o=r[t]||t.toLowerCase().replace(/[_\s]+/g,`-`);if(n)throw Sn(e,o,n);xn(e,o)}}catch(t){if(t instanceof de)throw t;xn(e,`network-request-failed`,{message:String(t)})}}async function zn(e,t,n,r,i={}){let a=await O(e,t,n,r,i);return`mfaPendingCredential`in a&&xn(e,`multi-factor-auth-required`,{_serverResponse:a}),a}async function Bn(e,t,n,r){let i=`${t}${n}?${r}`,a=e,o=a.config.emulator?Nn(e.config,i):`${e.config.apiScheme}://${i}`;return In.includes(n)&&(await a._persistenceManagerAvailable,a._getPersistenceType()===`COOKIE`)?a._getPersistence()._getFinalTarget(o).toString():o}function Vn(e){switch(e){case`ENFORCE`:return`ENFORCE`;case`AUDIT`:return`AUDIT`;case`OFF`:return`OFF`;default:return`ENFORCEMENT_STATE_UNSPECIFIED`}}var Hn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(T(this.auth,`network-request-failed`)),Ln.get())})}};function Un(e,t,n){let r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=T(e,t,r);return i.customData._tokenResponse=n,i}function Wn(e){return e!==void 0&&e.enterprise!==void 0}var Gn=class{constructor(e){if(this.siteKey=``,this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw Error(`recaptchaKey undefined`);this.siteKey=e.recaptchaKey.split(`/`)[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Vn(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)===`ENFORCE`||this.getProviderEnforcementState(e)===`AUDIT`}isAnyProviderEnabled(){return this.isProviderEnabled(`EMAIL_PASSWORD_PROVIDER`)||this.isProviderEnabled(`PHONE_PROVIDER`)}};async function Kn(e,t){return O(e,`GET`,`/v2/recaptchaConfig`,D(e,t))}async function qn(e,t){return O(e,`POST`,`/v1/accounts:delete`,t)}async function Jn(e,t){return O(e,`POST`,`/v1/accounts:lookup`,t)}function Yn(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function Xn(e,t=!1){let n=y(e),r=await n.getIdToken(t),i=Zn(r);E(i&&i.exp&&i.auth_time&&i.iat,n.auth,`internal-error`);let a=typeof i.firebase==`object`?i.firebase:void 0,o=a?.sign_in_provider;return{claims:i,token:r,authTime:Yn(k(i.auth_time)),issuedAtTime:Yn(k(i.iat)),expirationTime:Yn(k(i.exp)),signInProvider:o||null,signInSecondFactor:a?.sign_in_second_factor||null}}function k(e){return Number(e)*1e3}function Zn(e){let[t,n,r]=e.split(`.`);if(t===void 0||n===void 0||r===void 0)return bn(`JWT malformed, contained fewer than 3 sections`),null;try{let e=s(n);return e?JSON.parse(e):(bn(`Failed to decode base64 JWT payload`),null)}catch(e){return bn(`Caught error parsing JWT payload as JSON`,e?.toString()),null}}function Qn(e){let t=Zn(e);return E(t,`internal-error`),E(t.exp!==void 0,`internal-error`),E(t.iat!==void 0,`internal-error`),Number(t.exp)-Number(t.iat)}async function $n(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof de&&er(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}function er({code:e}){return e===`auth/user-disabled`||e===`auth/user-token-expired`}var tr=class{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let e=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),e}else{this.errorBackoff=3e4;let e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,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){e?.code===`auth/network-request-failed`&&this.schedule(!0);return}this.schedule()}},nr=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Yn(this.lastLoginAt),this.creationTime=Yn(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function rr(e){let t=e.auth,n=await $n(e,Jn(t,{idToken:await e.getIdToken()}));E(n?.users.length,t,`internal-error`);let r=n.users[0];e._notifyReloadListener(r);let i=r.providerUserInfo?.length?or(r.providerUserInfo):[],a=ar(e.providerData,i),o=e.isAnonymous,s=!(e.email&&r.passwordHash)&&!a?.length,c=o?s:!1,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new nr(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(e,l)}async function ir(e){let t=y(e);await rr(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function ar(e,t){return[...e.filter(e=>!t.some(t=>t.providerId===e.providerId)),...t]}function or(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||``,displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function sr(e,t){let n=await Rn(e,{},async()=>{let n=ve({grant_type:`refresh_token`,refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,a=await Bn(e,r,`/v1/token`,`key=${i}`),o=await e._getAdditionalHeaders();o[`Content-Type`]=`application/x-www-form-urlencoded`;let s={method:`POST`,headers:o,body:n};return e.emulatorConfig&&Te(e.emulatorConfig.host)&&(s.credentials=`include`),Pn.fetch()(a,s)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function cr(e,t){return O(e,`POST`,`/v2/accounts:revokeToken`,D(e,t))}var lr=class e{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){E(e.idToken,`internal-error`),E(e.idToken!==void 0,`internal-error`),E(e.refreshToken!==void 0,`internal-error`);
1let t=`expiresIn`in e&&e.expiresIn!==void 0?Number(e.expiresIn):Qn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){E(e.length!==0,`internal-error`);let t=Qn(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(E(this.refreshToken,e,`user-token-expired`),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:r,expiresIn:i}=await sr(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+n*1e3}static fromJSON(t,n){let{refreshToken:r,accessToken:i,expirationTime:a}=n,o=new e;return r&&(E(typeof r==`string`,`internal-error`,{appName:t}),o.refreshToken=r),i&&(E(typeof i==`string`,`internal-error`,{appName:t}),o.accessToken=i),a&&(E(typeof a==`number`,`internal-error`,{appName:t}),o.expirationTime=a),o}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 e,this.toJSON())}_performRefresh(){return Tn(`not implemented`)}};function ur(e,t){E(typeof e==`string`||e===void 0,`internal-error`,{appName:t})}var dr=class e{constructor({uid:e,auth:t,stsTokenManager:n,...r}){this.providerId=`firebase`,this.proactiveRefresh=new tr(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.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 nr(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await $n(this,this.stsTokenManager.getToken(this.auth,e));return E(t,this.auth,`internal-error`),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Xn(this,e)}reload(){return ir(this)}_assign(e){this!==e&&(E(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=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(t){let n=new e({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){E(!this.reloadListener,this.auth,`internal-error`),this.reloadListener=e,this.reloadUserInfo&&=(this._notifyReloadListener(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 rr(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(C(this.auth.app))return Promise.reject(Cn(this.auth));let e=await this.getIdToken();return await $n(this,qn(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...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(t,n){let r=n.displayName??void 0,i=n.email??void 0,a=n.phoneNumber??void 0,o=n.photoURL??void 0,s=n.tenantId??void 0,c=n._redirectEventId??void 0,l=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:d,emailVerified:f,isAnonymous:p,providerData:m,stsTokenManager:h}=n;E(d&&h,t,`internal-error`);let g=lr.fromJSON(this.name,h);E(typeof d==`string`,t,`internal-error`),ur(r,t.name),ur(i,t.name),E(typeof f==`boolean`,t,`internal-error`),E(typeof p==`boolean`,t,`internal-error`),ur(a,t.name),ur(o,t.name),ur(s,t.name),ur(c,t.name),ur(l,t.name),ur(u,t.name);let ee=new e({uid:d,auth:t,email:i,emailVerified:f,displayName:r,isAnonymous:p,photoURL:o,phoneNumber:a,tenantId:s,stsTokenManager:g,createdAt:l,lastLoginAt:u});return m&&Array.isArray(m)&&(ee.providerData=m.map(e=>({...e}))),c&&(ee._redirectEventId=c),ee}static async _fromIdTokenResponse(t,n,r=!1){let i=new lr;i.updateFromServerResponse(n);let a=new e({uid:n.localId,auth:t,stsTokenManager:i,isAnonymous:r});return await rr(a),a}static async _fromGetAccountInfoResponse(t,n,r){let i=n.users[0];E(i.localId!==void 0,`internal-error`);let a=i.providerUserInfo===void 0?[]:or(i.providerUserInfo),o=!(i.email&&i.passwordHash)&&!a?.length,s=new lr;s.updateFromIdToken(r);let c=new e({uid:i.localId,auth:t,stsTokenManager:s,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new nr(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!a?.length};return Object.assign(c,l),c}},fr=new Map;function pr(e){En(e instanceof Function,`Expected a class definition`);let t=fr.get(e);return t?(En(t instanceof e,`Instance stored in cache mismatched with class`),t):(t=new e,fr.set(e,t),t)}var mr=class{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 t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};mr.type=`NONE`;var hr=mr;function gr(e,t,n){return`firebase:${e}:${t}:${n}`}var _r=class e{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:r,name:i}=this.auth;this.fullUserKey=gr(this.userKey,r.apiKey,i),this.fullPersistenceKey=gr(`persistence`,r.apiKey,i),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);if(!e)return null;if(typeof e==`string`){let t=await Jn(this.auth,{idToken:e}).catch(()=>void 0);return t?dr._fromGetAccountInfoResponse(this.auth,t,e):null}return dr._fromJSON(this.auth,e)}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(t,n,r=`authUser`){if(!n.length)return new e(pr(hr),t,r);let i=(await Promise.all(n.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),a=i[0]||pr(hr),o=gr(r,t.config.apiKey,t.name),s=null;for(let e of n)try{let n=await e._get(o);if(n){let r;if(typeof n==`string`){let e=await Jn(t,{idToken:n}).catch(()=>void 0);if(!e)break;r=await dr._fromGetAccountInfoResponse(t,e,n)}else r=dr._fromJSON(t,n);e!==a&&(s=r),a=e;break}}catch{}let c=i.filter(e=>e._shouldAllowMigration);return!a._shouldAllowMigration||!c.length?new e(a,t,r):(a=c[0],s&&await a._set(o,s.toJSON()),await Promise.all(n.map(async e=>{if(e!==a)try{await e._remove(o)}catch{}})),new e(a,t,r))}};function vr(e){let t=e.toLowerCase();if(t.includes(`opera/`)||t.includes(`opr/`)||t.includes(`opios/`))return`Opera`;if(Sr(t))return`IEMobile`;if(t.includes(`msie`)||t.includes(`trident/`))return`IE`;if(t.includes(`edge/`))return`Edge`;if(yr(t))return`Firefox`;if(t.includes(`silk/`))return`Silk`;if(wr(t))return`Blackberry`;if(Tr(t))return`Webos`;if(br(t))return`Safari`;if((t.includes(`chrome/`)||xr(t))&&!t.includes(`edge/`))return`Chrome`;if(Cr(t))return`Android`;{let t=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if(t?.length===2)return t[1]}return`Other`}function yr(e=_()){return/firefox\//i.test(e)}function br(e=_()){let t=e.toLowerCase();return t.includes(`safari/`)&&!t.includes(`chrome/`)&&!t.includes(`crios/`)&&!t.includes(`android`)}function xr(e=_()){return/crios\//i.test(e)}function Sr(e=_()){return/iemobile/i.test(e)}function Cr(e=_()){return/android/i.test(e)}function wr(e=_()){return/blackberry/i.test(e)}function Tr(e=_()){return/webos/i.test(e)}function Er(e=_()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Dr(e=_()){return Er(e)&&!!window.navigator?.standalone}function Or(){return se()&&document.documentMode===10}function kr(e=_()){return Er(e)||Cr(e)||Tr(e)||wr(e)||/windows phone/i.test(e)||Sr(e)}function Ar(e,t=[]){let n;switch(e){case`Browser`:n=vr(_());break;case`Worker`:n=`${vr(_())}-${e}`;break;default:n=e}let r=t.length?t.join(`,`):`FirebaseCore-web`;return`${n}/JsCore/${qt}/${r}`}var jr=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let n=t=>new Promise((n,r)=>{try{n(e(t))}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);let r=this.queue.length-1;return()=>{this.queue[r]=()=>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){t.reverse();for(let e of t)try{e()}catch{}throw this.auth._errorFactory.create(`login-blocked`,{originalMessage:e?.message})}}};
1async function Mr(e,t={}){return O(e,`GET`,`/v2/passwordPolicy`,D(e,t))}var Nr=6,Pr=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??Nr,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState===`ENFORCEMENT_STATE_UNSPECIFIED`&&(this.enforcementState=`OFF`),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join(``)??``,this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&=t.meetsMinPasswordLength??!0,t.isValid&&=t.meetsMaxPasswordLength??!0,t.isValid&&=t.containsLowercaseLetter??!0,t.isValid&&=t.containsUppercaseLetter??!0,t.isValid&&=t.containsNumericCharacter??!0,t.isValid&&=t.containsNonAlphanumericCharacter??!0,t}validatePasswordLengthOptions(e,t){let n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let n;for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>=`a`&&n<=`z`,n>=`A`&&n<=`Z`,n>=`0`&&n<=`9`,this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||=t),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||=n),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||=r),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||=i)}},Fr=class{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Lr(this),this.idTokenSubscription=new Lr(this),this.beforeStateQueue=new jr(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=_n,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=pr(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await _r.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.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 initializeCurrentUserFromIdToken(e){try{let t=await Jn(this,{idToken:e}),n=await dr._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn(`FirebaseServerApp could not login user with provided authIdToken: `,e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(C(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),n=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let t=this.redirectUser?._redirectEventId,i=n?._redirectEventId,a=await this.tryRedirectSignIn(e);(!t||t===i)&&a?.user&&(n=a.user,r=!0)}if(!n)return this.directlySetCurrentUser(null);
1if(!n._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return E(this._popupRedirectResolver,this,`argument-error`),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await rr(e)}catch(e){if(e?.code!==`auth/network-request-failed`)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=jn()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(C(this.app))return Promise.reject(Cn(this));let t=e?y(e):null;return t&&E(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&&E(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 C(this.app)?Promise.reject(Cn(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return C(this.app)?Promise.reject(Cn(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(pr(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion===this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?t.validatePassword(e):Promise.reject(this._errorFactory.create(`unsupported-password-policy-schema-version`,{}))}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new Pr(await Mr(this));this.tenantId===null?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new fe(`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)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:`apple.com`,tokenType:`ACCESS_TOKEN`,token:e,idToken:await this.currentUser.getIdToken()};this.tenantId!=null&&(t.tenantId=this.tenantId),await cr(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return e===null?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&pr(e)||this._popupRedirectResolver;E(t,this,`argument-error`),this.redirectPersistenceManager=await _r.create(this,[pr(t._redirectPersistence)],`redirectUser`),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};let i=typeof t==`function`?t:t.next.bind(t),a=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(E(o,this,`internal-error`),o.then(()=>{a||i(this.currentUser)}),typeof t==`function`){let i=e.addObserver(t,n,r);return()=>{a=!0,i()}}else{let n=e.addObserver(t);return()=>{a=!0,n()}}}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 E(this.persistenceManager,this,`internal-error`),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ar(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e[`X-Firebase-gmpid`]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e[`X-Firebase-Client`]=t);let n=await this._getAppCheckToken();return n&&(e[`X-Firebase-AppCheck`]=n),e}async _getAppCheckToken(){if(C(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&yn(`Error while retrieving App Check token: ${e.error}`),e?.token}};function Ir(e){return y(e)}var Lr=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=xe(e=>this.observer=e)}get next(){return E(this.observer,this.auth,`internal-error`),this.observer.next.bind(this.observer)}},Rr={async loadJS(){throw Error(`Unable to load external scripts`)},recaptchaV2Script:``,recaptchaEnterpriseScript:``,gapiScript:``};function zr(e){Rr=e}function Br(e){return Rr.loadJS(e)}function Vr(){return Rr.recaptchaEnterpriseScript}function Hr(){return Rr.gapiScript}function Ur(e){return`__${e}${Math.floor(Math.random()*1e6)}`}var Wr=class{constructor(){this.enterprise=new Gr}ready(e){e()}execute(e,t){return Promise.resolve(`token`)}render(e,t){return``}},Gr=class{ready(e){e()}execute(e,t){return Promise.resolve(`token`)}render(e,t){return``}},Kr=`recaptcha-enterprise`,qr=`NO_RECAPTCHA`,Jr=class{constructor(e){this.type=Kr,this.auth=Ir(e)}async verify(e=`verify`,t=!1){async function n(e){if(!t){if(e.tenantId==null&&e._agentRecaptchaConfig!=null)return e._agentRecaptchaConfig.siteKey;if(e.tenantId!=null&&e._tenantRecaptchaConfigs[e.tenantId]!==void 0)return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{Kn(e,{clientType:`CLIENT_TYPE_WEB`,version:`RECAPTCHA_ENTERPRISE`}).then(r=>{if(r.recaptchaKey===void 0)n(Error(`recaptcha Enterprise site key undefined`));else{let n=new Gn(r);return e.tenantId==null?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function r(t,n,r){let i=window.grecaptcha;Wn(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(qr)})}):r(Error(`No reCAPTCHA enterprise script loaded.`))}return this.auth.settings.appVerificationDisabledForTesting?new Wr().execute(`siteKey`,{action:`verify`}):new Promise((e,i)=>{n(this.auth).then(n=>{if(!t&&Wn(window.grecaptcha))r(n,e,i);else{if(typeof window>`u`){i(Error(`RecaptchaVerifier is only supported in browser`));return}let t=Vr();t.length!==0&&(t+=n),Br(t).then(()=>{r(n,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}};async function Yr(e,t,n,r=!1,i=!1){let a=new Jr(e),o;if(i)o=qr;else try{o=await a.verify(n)}
1catch{o=await a.verify(n,!0)}let s={...t};if(n===`mfaSmsEnrollment`||n===`mfaSmsSignIn`){if(`phoneEnrollmentInfo`in s){let e=s.phoneEnrollmentInfo.phoneNumber,t=s.phoneEnrollmentInfo.recaptchaToken;Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:`CLIENT_TYPE_WEB`,recaptchaVersion:`RECAPTCHA_ENTERPRISE`}})}else if(`phoneSignInInfo`in s){let e=s.phoneSignInInfo.recaptchaToken;Object.assign(s,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:`CLIENT_TYPE_WEB`,recaptchaVersion:`RECAPTCHA_ENTERPRISE`}})}return s}return r?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:`CLIENT_TYPE_WEB`}),Object.assign(s,{recaptchaVersion:`RECAPTCHA_ENTERPRISE`}),s}async function Xr(e,t,n,r,i){return i===`EMAIL_PASSWORD_PROVIDER`?e._getRecaptchaConfig()?.isProviderEnabled(`EMAIL_PASSWORD_PROVIDER`)?r(e,await Yr(e,t,n,n===`getOobCode`)):r(e,t).catch(async i=>i.code===`auth/missing-recaptcha-token`?(console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`),r(e,await Yr(e,t,n,n===`getOobCode`))):Promise.reject(i)):i===`PHONE_PROVIDER`?e._getRecaptchaConfig()?.isProviderEnabled(`PHONE_PROVIDER`)?r(e,await Yr(e,t,n)).catch(async i=>e._getRecaptchaConfig()?.getProviderEnforcementState(`PHONE_PROVIDER`)===`AUDIT`&&(i.code===`auth/missing-recaptcha-token`||i.code===`auth/invalid-app-credential`)?(console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`),r(e,await Yr(e,t,n,!1,!0))):Promise.reject(i)):r(e,await Yr(e,t,n,!1,!0)):Promise.reject(i+` provider is not supported.`)}async function Zr(e){let t=Ir(e),n=new Gn(await Kn(t,{clientType:`CLIENT_TYPE_WEB`,version:`RECAPTCHA_ENTERPRISE`}));t.tenantId==null?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,n.isAnyProviderEnabled()&&new Jr(t).verify()}function Qr(e,t){let n=Gt(e,`auth`);if(n.isInitialized()){let e=n.getImmediate();if(ge(n.getOptions(),t??{}))return e;xn(e,`already-initialized`)}return n.initialize({options:t})}function $r(e,t){let n=t?.persistence||[],r=(Array.isArray(n)?n:[n]).map(pr);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t?.popupRedirectResolver)}function ei(e,t,n){let r=Ir(e);E(/^https?:\/\//.test(t),r,`invalid-emulator-scheme`);let i=!!n?.disableWarnings,a=ti(t),{host:o,port:s}=ni(t),c=s===null?``:`:${s}`,l={url:`${a}//${o}${c}/`},u=Object.freeze({host:o,port:s,protocol:a.replace(`:`,``),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){E(r.config.emulator&&r.emulatorConfig,r,`emulator-config-failed`),E(ge(l,r.config.emulator)&&ge(u,r.emulatorConfig),r,`emulator-config-failed`);return}r.config.emulator=l,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,Te(o)?Ee(`${a}//${o}${c}`):i||ii()}function ti(e){let t=e.indexOf(`:`);return t<0?``:e.substr(0,t+1)}function ni(e){let t=ti(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:``,port:null};let r=n[2].split(`@`).pop()||``,i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let e=i[1];return{host:e,port:ri(r.substr(e.length+1))}}else{let[e,t]=r.split(`:`);return{host:e,port:ri(t)}}}function ri(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}function ii(){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)}typeof console<`u`&&typeof console.info==`function`&&console.info(`WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials.`),typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?window.addEventListener(`DOMContentLoaded`,e):e())}var ai=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Tn(`not implemented`)}_getIdTokenResponse(e){return Tn(`not implemented`)}_linkToIdToken(e,t){return Tn(`not implemented`)}_getReauthenticationResolver(e){return Tn(`not implemented`)}};async function oi(e,t){return O(e,`POST`,`/v1/accounts:signUp`,t)}async function si(e,t){return zn(e,`POST`,`/v1/accounts:signInWithPassword`,D(e,t))}async function ci(e,t){return O(e,`POST`,`/v1/accounts:sendOobCode`,D(e,t))}async function li(e,t){return ci(e,t)}async function ui(e,t){return zn(e,`POST`,`/v1/accounts:signInWithEmailLink`,D(e,t))}async function di(e,t){return zn(e,`POST`,`/v1/accounts:signInWithEmailLink`,D(e,t))}var fi=class e extends ai{constructor(e,t,n,r=null){super(`password`,n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(t,n){return new e(t,n,`password`)}static _fromEmailAndCode(t,n,r=null){return new e(t,n,`emailLink`,r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e==`string`?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod===`password`)return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod===`emailLink`)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case`password`:return Xr(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:`CLIENT_TYPE_WEB`},`signInWithPassword`,si,`EMAIL_PASSWORD_PROVIDER`);case`emailLink`:return ui(e,{email:this._email,oobCode:this._password});default:xn(e,`internal-error`)}}async _linkToIdToken(e,t){switch(this.signInMethod){case`password`:return Xr(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:`CLIENT_TYPE_WEB`},`signUpPassword`,oi,`EMAIL_PASSWORD_PROVIDER`);case`emailLink`:return di(e,{idToken:t,email:this._email,oobCode:this._password});default:xn(e,`internal-error`)}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function pi(e,t){return zn(e,`POST`,`/v1/accounts:signInWithIdp`,D(e,t))}var mi=`http://localhost`,hi=class e extends ai{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){let n=new e(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pen
1dingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):xn(`argument-error`),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){let{providerId:n,signInMethod:r,...i}=typeof t==`string`?JSON.parse(t):t;if(!n||!r)return null;let a=new e(n,r);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){return pi(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,pi(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,pi(e,t)}buildRequest(){let e={requestUri:mi,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=ve(t)}return e}};async function gi(e,t){return O(e,`POST`,`/v1/accounts:sendVerificationCode`,D(e,t))}async function _i(e,t){return zn(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,D(e,t))}async function vi(e,t){let n=await zn(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,D(e,t));if(n.temporaryProof)throw Un(e,`account-exists-with-different-credential`,n);return n}var yi={USER_NOT_FOUND:`user-not-found`};async function bi(e,t){return zn(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,D(e,{...t,operation:`REAUTH`}),yi)}var xi=class e extends ai{constructor(e){super(`phone`,`phone`),this.params=e}static _fromVerification(t,n){return new e({verificationId:t,verificationCode:n})}static _fromTokenResponse(t,n){return new e({phoneNumber:t,temporaryProof:n})}_getIdTokenResponse(e){return _i(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return vi(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return bi(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}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(t){typeof t==`string`&&(t=JSON.parse(t));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:a}=t;return!r&&!n&&!i&&!a?null:new e({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:a})}};function Si(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}}function Ci(e){let t=ye(be(e)).link,n=t?ye(be(t)).deep_link_id:null,r=ye(be(e)).deep_link_id;return(r?ye(be(r)).link:null)||r||n||t||e}var wi=class e{constructor(e){let t=ye(be(e)),n=t.apiKey??null,r=t.oobCode??null,i=Si(t.mode??null);E(n&&r&&i,`argument-error`),this.apiKey=n,this.operation=i,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(t){let n=Ci(t);try{return new e(n)}catch{return null}}},Ti=class e{constructor(){this.providerId=e.PROVIDER_ID}static credential(e,t){return fi._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=wi.parseLink(t);return E(n,`argument-error`),fi._fromEmailAndCode(e,n.code,n.tenantId)}};Ti.PROVIDER_ID=`password`,Ti.EMAIL_PASSWORD_SIGN_IN_METHOD=`password`,Ti.EMAIL_LINK_SIGN_IN_METHOD=`emailLink`;var Ei=class{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}}
1,Di=class extends Ei{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Oi=class e extends Di{constructor(){super(`facebook.com`)}static credential(t){return hi._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!(`oauthAccessToken`in t)||!t.oauthAccessToken)return null;try{return e.credential(t.oauthAccessToken)}catch{return null}}};Oi.FACEBOOK_SIGN_IN_METHOD=`facebook.com`,Oi.PROVIDER_ID=`facebook.com`;var ki=class e extends Di{constructor(){super(`google.com`),this.addScope(`profile`)}static credential(t,n){return hi._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;let{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return e.credential(n,r)}catch{return null}}};ki.GOOGLE_SIGN_IN_METHOD=`google.com`,ki.PROVIDER_ID=`google.com`;var Ai=class e extends Di{constructor(){super(`github.com`)}static credential(t){return hi._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!(`oauthAccessToken`in t)||!t.oauthAccessToken)return null;try{return e.credential(t.oauthAccessToken)}catch{return null}}};Ai.GITHUB_SIGN_IN_METHOD=`github.com`,Ai.PROVIDER_ID=`github.com`;var ji=class e extends Di{constructor(){super(`twitter.com`)}static credential(t,n){return hi._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return e.credential(n,r)}catch{return null}}};ji.TWITTER_SIGN_IN_METHOD=`twitter.com`,ji.PROVIDER_ID=`twitter.com`;async function Mi(e,t){return zn(e,`POST`,`/v1/accounts:signUp`,D(e,t))}var Ni=class e{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(t,n,r,i=!1){let a=await dr._fromIdTokenResponse(t,r,i),o=Pi(r);return new e({user:a,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);let i=Pi(r);return new e({user:t,providerId:i,_tokenResponse:r,operationType:n})}};function Pi(e){return e.providerId?e.providerId:`phoneNumber`in e?`phone`:null}var Fi=class e extends de{constructor(t,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,e.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,i){return new e(t,n,r,i)}};function Ii(e,t,n,r){return(t===`reauthenticate`?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{throw n.code===`auth/multi-factor-auth-required`?Fi._fromErrorAndOperation(e,n,t,r):n})}async function Li(e,t,n=!1){let r=await $n(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Ni._forOperation(e,`link`,r)}async function Ri(e,t,n=!1){let{auth:r}=e;if(C(r.app))return Promise.reject(Cn(r));let i=`reauthenticate`;try{let a=await $n(e,Ii(r,i,t,e),n);E(a.idToken,r,`internal-error`);let o=Zn(a.idToken);E(o,r,`internal-error`);let{sub:s}=o;return E(e.uid===s,r,`user-mismatch`),Ni._forOperation(e,i,a)}catch(e){throw e?.code===`auth/user-not-found`&&xn(r,`user-mismatch`),e}}async function zi(e,t,n=!1){if(C(e.app))return Promise.reject(Cn(e));let r=`signIn`,i=await Ii(e,r,t),a=await Ni._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(a.user),a}async function Bi(e,t){return zi(Ir(e),t)}function Vi(e,t,n){E(n.url?.length>0,e,`invalid-continue-uri`),E(n.dynamicLinkDomain===void 0||n.dynamicLinkDomain.length>0,e,`invalid-dynamic-link-domain`),E(n.linkDomain===void 0||n.linkDomain.length>0,e,`invalid-hosting-link-domain`),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.linkDomain=n.linkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(E(n.iOS.bundleId.length>0,e,`missing-ios-bundle-id`),t.iOSBundleId=n.iOS.bundleId),n.android&&(E(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 Hi(e){let t=Ir(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function Ui(e,t,n){let r=Ir(e),i={requestType:`PASSWORD_RESET`,email:t,clientType:`CLIENT_TYPE_WEB`};
1n&&Vi(r,i,n),await Xr(r,i,`getOobCode`,li,`EMAIL_PASSWORD_PROVIDER`)}async function Wi(e,t,n){if(C(e.app))return Promise.reject(Cn(e));let r=Ir(e),i=await Xr(r,{returnSecureToken:!0,email:t,password:n,clientType:`CLIENT_TYPE_WEB`},`signUpPassword`,Mi,`EMAIL_PASSWORD_PROVIDER`).catch(t=>{throw t.code===`auth/password-does-not-meet-requirements`&&Hi(e),t}),a=await Ni._fromIdTokenResponse(r,`signIn`,i);return await r._updateCurrentUser(a.user),a}function Gi(e,t,n){return C(e.app)?Promise.reject(Cn(e)):Bi(y(e),Ti.credential(t,n)).catch(async t=>{throw t.code===`auth/password-does-not-meet-requirements`&&Hi(e),t})}async function Ki(e,t){return O(e,`POST`,`/v1/accounts:update`,t)}async function qi(e,{displayName:t,photoURL:n}){if(t===void 0&&n===void 0)return;let r=y(e),i={idToken:await r.getIdToken(),displayName:t,photoUrl:n,returnSecureToken:!0},a=await $n(r,Ki(r.auth,i));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let o=r.providerData.find(({providerId:e})=>e===`password`);o&&(o.displayName=r.displayName,o.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function Ji(e,t,n,r){return y(e).onIdTokenChanged(t,n,r)}function Yi(e,t,n){return y(e).beforeAuthStateChanged(t,n)}function Xi(e,t,n,r){return y(e).onAuthStateChanged(t,n,r)}function Zi(e){return y(e).signOut()}function Qi(e,t){return O(e,`POST`,`/v2/accounts/mfaEnrollment:start`,D(e,t))}function $i(e,t){return O(e,`POST`,`/v2/accounts/mfaEnrollment:finalize`,D(e,t))}function ea(e,t){return O(e,`POST`,`/v2/accounts/mfaEnrollment:start`,D(e,t))}function ta(e,t){return O(e,`POST`,`/v2/accounts/mfaEnrollment:finalize`,D(e,t))}var na=`__sak`,ra=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(na,`1`),this.storage.removeItem(na),Promise.resolve(!0)):Promise.resolve(!1)}catch{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()}},ia=1e3,aa=10,oa=class extends ra{constructor(){super(()=>window.localStorage,`LOCAL`),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=kr(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});return}let n=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let e=this.storage.getItem(n);!t&&this.localCache[n]===e||this.notifyListeners(n,e)},i=this.storage.getItem(n);Or()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,aa):r()}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))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent(`storage`,{key:e,oldValue:t,newValue:n}),!0)})},ia)}stopPolling(){this.pollTimer&&=(clearInterval(this.pollTimer),null)}attachListener(){window.addEventListener(`storage`,this.boundEventHandler)}detachListener(){window.removeEventListener(`storage`,this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Ob
1ject.keys(this.listeners).length===0&&(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]}};oa.type=`LOCAL`;var sa=oa,ca=1e3;function la(e){let t=e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),n=RegExp(`${t}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function ua(e){return`${window.location.protocol===`http:`?`__dev_`:`__HOST-`}FIREBASE_${e.split(`:`)[3]}`}var da=class{constructor(){this.type=`COOKIE`,this.listenerUnsubscribes=new Map}_getFinalTarget(e){let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set(`finalTarget`,e),t}async _isAvailable(){return typeof isSecureContext==`boolean`&&!isSecureContext||typeof navigator>`u`||typeof document>`u`?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=ua(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:la(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let t=ua(e);document.cookie=`${t}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch(`/__cookies__`,{method:`DELETE`}).catch(()=>void 0)}_addListener(e,t){if(!this._isAvailable())return;let n=ua(e);if(window.cookieStore){let e=(e=>{let r=e.changed.find(e=>e.name===n);r&&t(r.value),e.deleted.find(e=>e.name===n)&&t(null)});return this.listenerUnsubscribes.set(t,()=>window.cookieStore.removeEventListener(`change`,e)),window.cookieStore.addEventListener(`change`,e)}let r=la(n),i=setInterval(()=>{let e=la(n);e!==r&&(t(e),r=e)},ca);this.listenerUnsubscribes.set(t,()=>clearInterval(i))}_removeListener(e,t){let n=this.listenerUnsubscribes.get(t);n&&(n(),this.listenerUnsubscribes.delete(t))}};da.type=`COOKIE`;var fa=class extends ra{constructor(){super(()=>window.sessionStorage,`SESSION`)}_addListener(e,t){}_removeListener(e,t){}};fa.type=`SESSION`;var pa=fa;function ma(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}var ha=class e{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){let n=this.receivers.find(e=>e.isListeningto(t));if(n)return n;let r=new e(t);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:n,eventType:r,data:i}=t.data,a=this.handlersMap[r];if(!a?.size)return;t.ports[0].postMessage({status:`ack`,eventId:n,eventType:r});let o=await ma(Array.from(a).map(async e=>e(t.origin,i)));t.ports[0].postMessage({status:`done`,eventId:n,eventType:r,response:o})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener(`message`,this.boundEventHandler)}};ha.receivers=[];function ga(e=``,t=10){let n=``;for(let e=0;e<t;e++)n+=Math.floor(Math.random()*10);return e+n}var _a=class{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 r=typeof MessageChannel<`u`?new MessageChannel:null;if(!r)throw Error(`connection_unavailable`);let i,a;return new Promise((o,s)=>{let c=ga(``,20);r.port1.start();let l=setTimeout(()=>{s(Error(`unsupported_event`))},n);a={messageChannel:r,onMessage(e){let t=e;if(t.data.eventId===c)switch(t.data.status){case`ack`:clearTimeout(l),i=setTimeout(()=>{s(Error(`timeout`))},3e3);break;case`done`:clearTimeout(i),o(t.data.response);break;default:clearTimeout(l),clearTimeout(i),s(Error(`invalid_response`));break}}},this.handlers.add(a),r.port1.addEventListener(`message`,a.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};function va(){return window}
1function ya(e){va().location.href=e}function ba(){return va().WorkerGlobalScope!==void 0&&typeof va().importScripts==`function`}async function xa(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Sa(){return navigator?.serviceWorker?.controller||null}function Ca(){return ba()?self:null}var wa=`firebaseLocalStorageDb`,Ta=1,Ea=`firebaseLocalStorage`,Da=`fbase_key`,Oa=class{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 ka(e,t){return e.transaction([Ea],t?`readwrite`:`readonly`).objectStore(Ea)}function Aa(){return new Oa(indexedDB.deleteDatabase(wa)).toPromise()}function ja(){let e=indexedDB.open(wa,Ta);return new Promise((t,n)=>{e.addEventListener(`error`,()=>{n(e.error)}),e.addEventListener(`upgradeneeded`,()=>{let t=e.result;try{t.createObjectStore(Ea,{keyPath:Da})}catch(e){n(e)}}),e.addEventListener(`success`,async()=>{let n=e.result;n.objectStoreNames.contains(Ea)?t(n):(n.close(),await Aa(),t(await ja()))})})}async function Ma(e,t,n){return new Oa(ka(e,!0).put({[Da]:t,value:n})).toPromise()}async function Na(e,t){let n=await new Oa(ka(e,!1).get(t)).toPromise();return n===void 0?null:n.value}function Pa(e,t){return new Oa(ka(e,!0).delete(t)).toPromise()}var Fa=800,Ia=3,La=class{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||=await ja(),this.db}async _withRetries(e){let t=0;for(;;)try{return await e(await this._openDb())}catch(e){if(t++>Ia)throw e;this.db&&=(this.db.close(),void 0)}}async initializeServiceWorkerMessaging(){return ba()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ha._getInstance(Ca()),this.receiver._subscribe(`keyChanged`,async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe(`ping`,async(e,t)=>[`keyChanged`])}async initializeSender(){if(this.activeServiceWorker=await xa(),!this.activeServiceWorker)return;this.sender=new _a(this.activeServiceWorker);let e=await this.sender._send(`ping`,{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes(`keyChanged`)&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Sa()!==this.activeServiceWorker))try{await this.sender._send(`keyChanged`,{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await ja();return await Ma(e,na,`1`),await Pa(e,na),!0}catch{}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=>Ma(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>Na(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Pa(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new Oa(ka(e,!1).getAll()).toPromise());if(!e||this.pendingWrites!==0)return[];let t=[],n=new Set;if(e.length!==0)for(let{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));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(),Fa)}stopPolling(){this.pollTimer&&=(clearInterval(this.pollTimer),null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Ob
1ject.keys(this.listeners).length===0&&this.stopPolling()}};La.type=`LOCAL`;var Ra=La;function za(e,t){return O(e,`POST`,`/v2/accounts/mfaSignIn:start`,D(e,t))}function Ba(e,t){return O(e,`POST`,`/v2/accounts/mfaSignIn:finalize`,D(e,t))}function Va(e,t){return O(e,`POST`,`/v2/accounts/mfaSignIn:finalize`,D(e,t))}Ur(`rcb`),new Mn(3e4,6e4);var Ha=`recaptcha`;async function Ua(e,t,n){if(!e._getRecaptchaConfig())try{await Zr(e)}catch{console.log(`Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.`)}try{let r;if(r=typeof t==`string`?{phoneNumber:t}:t,`session`in r){let t=r.session;if(`phoneNumber`in r)return E(t.type===`enroll`,e,`internal-error`),(await Xr(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:`CLIENT_TYPE_WEB`}},`mfaSmsEnrollment`,async(e,t)=>t.phoneEnrollmentInfo.captchaResponse===qr?(E(n?.type===Ha,e,`argument-error`),Qi(e,await Wa(e,t,n))):Qi(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo;{E(t.type===`signin`,e,`internal-error`);let i=r.multiFactorHint?.uid||r.multiFactorUid;return E(i,e,`missing-multi-factor-info`),(await Xr(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:`CLIENT_TYPE_WEB`}},`mfaSmsSignIn`,async(e,t)=>t.phoneSignInInfo.captchaResponse===qr?(E(n?.type===Ha,e,`argument-error`),za(e,await Wa(e,t,n))):za(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}else return(await Xr(e,{phoneNumber:r.phoneNumber,clientType:`CLIENT_TYPE_WEB`},`sendVerificationCode`,async(e,t)=>t.captchaResponse===qr?(E(n?.type===Ha,e,`argument-error`),gi(e,await Wa(e,t,n))):gi(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).sessionInfo}finally{n?._reset()}}
1async function Wa(e,t,n){E(n.type===Ha,e,`argument-error`);let r=await n.verify();E(typeof r==`string`,e,`argument-error`);let i={...t};if(`phoneEnrollmentInfo`in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,n=i.phoneEnrollmentInfo.clientType,a=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:a}}),i}else if(`phoneSignInInfo`in i){let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,n=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:e,clientType:t,recaptchaVersion:n}}),i}else return Object.assign(i,{recaptchaToken:r}),i}var Ga=class e{constructor(t){this.providerId=e.PROVIDER_ID,this.auth=Ir(t)}verifyPhoneNumber(e,t){return Ua(this.auth,e,y(t))}static credential(e,t){return xi._fromVerification(e,t)}static credentialFromResult(t){let n=t;return e.credentialFromTaggedObject(n)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:n}=e;return t&&n?xi._fromTokenResponse(t,n):null}};Ga.PROVIDER_ID=`phone`,Ga.PHONE_SIGN_IN_METHOD=`phone`;function Ka(e,t){return t?pr(t):(E(e._popupRedirectResolver,e,`argument-error`),e._popupRedirectResolver)}var qa=class extends ai{constructor(e){super(`custom`,`custom`),this.params=e}_getIdTokenResponse(e){return pi(e,this._buildIdpRequest())}_linkToIdToken(e,t){return pi(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return pi(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 Ja(e){return zi(e.auth,new qa(e),e.bypassAuthState)}function Ya(e){let{auth:t,user:n}=e;return E(n,t,`internal-error`),Ri(n,new qa(e),e.bypassAuthState)}async function Xa(e){let{auth:t,user:n}=e;return E(n,t,`internal-error`),Li(n,new qa(e),e.bypassAuthState)}var Za=class{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:a,type:o}=e;if(a){this.reject(a);return}let s={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(s))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case`signInViaPopup`:case`signInViaRedirect`:return Ja;case`linkViaPopup`:case`linkViaRedirect`:return Xa;case`reauthViaPopup`:case`reauthViaRedirect`:return Ya;default:xn(this.auth,`internal-error`)}}resolve(e){En(this.pendingPromise,`Pending promise was never set`),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){En(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()}},Qa=new Mn(2e3,1e4),$a=class e extends Za{constructor(t,n,r,i,a){super(t,n,i,a),this.provider=r,this.authWindow=null,this.pollId=null,e.currentPopupAction&&e.currentPopupAction.cancel(),e.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return E(e,this.auth,`internal-error`),e}async onExecution(){En(this.filter.length===1,`Popup operations only handle one event`);let e=ga();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(T(this.auth,`web-storage-unsupported`))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(T(this.auth,`cancelled-popup-request`))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,e.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(T(this.auth,`popup-closed-by-user`))},8e3);return}this.pollId=window.setTimeout(e,Qa.get())};e()}};$a.currentPopupAction=null;var eo=`pendingRedirect`,to=new Map,no=class extends Za{constructor(e,t,n=!1){super(e,[`signInViaRedirect`,`linkViaRedirect`,`reauthViaRedirect`,`unknown`],t,void 0,n),this.eventId=null}async execute(){let e=to.get(this.auth._key());if(!e){try{let t=await ro(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}to.set(this.auth._key(),e)}return this.bypassAuthState||to.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type===`signInViaRedirect`)return super.onAuthEvent(e);
1if(e.type===`unknown`){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 ro(e,t){let n=oo(t),r=ao(e);if(!await r._isAvailable())return!1;let i=await r._get(n)===`true`;return await r._remove(n),i}function io(e,t){to.set(e._key(),t)}function ao(e){return pr(e._redirectPersistence)}function oo(e){return gr(eo,e.config.apiKey,e.name)}async function so(e,t,n=!1){if(C(e.app))return Promise.reject(Cn(e));let r=Ir(e),i=await new no(r,Ka(r,t),n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}var co=600*1e3,lo=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(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||!po(e)?t:(this.hasHandledPotentialRedirect=!0,t||=(this.queuedRedirectEvent=e,!0),t)}sendToConsumer(e,t){if(e.error&&!fo(e)){let n=e.error.code?.split(`auth/`)[1]||`internal-error`;t.onError(T(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=co&&this.cachedEventUids.clear(),this.cachedEventUids.has(uo(e))}saveEventToCache(e){this.cachedEventUids.add(uo(e)),this.lastProcessedEventTime=Date.now()}};function uo(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join(`-`)}function fo({type:e,error:t}){return e===`unknown`&&t?.code===`auth/no-auth-event`}function po(e){switch(e.type){case`signInViaRedirect`:case`linkViaRedirect`:case`reauthViaRedirect`:return!0;case`unknown`:return fo(e);default:return!1}}async function mo(e,t={}){return O(e,`GET`,`/v1/projects`,t)}var ho=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,go=/^https?/;async function _o(e){if(e.config.emulator)return;let{authorizedDomains:t}=await mo(e);for(let e of t)try{if(vo(e))return}catch{}xn(e,`unauthorized-domain`)}function vo(e){let t=Dn(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith(`chrome-extension://`)){let i=new URL(e);return i.hostname===``&&r===``?n===`chrome-extension:`&&e.replace(`chrome-extension://`,``)===t.replace(`chrome-extension://`,``):n===`chrome-extension:`&&i.hostname===r}if(!go.test(n))return!1;if(ho.test(e))return r===e;let i=e.replace(/\./g,`\\.`);return RegExp(`^(.+\\.`+i+`|`+i+`)$`,`i`).test(r)}var yo=new Mn(3e4,6e4);function bo(){let e=va().___jsl;if(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}}function xo(e){return new Promise((t,n)=>{function r(){bo(),gapi.load(`gapi.iframes`,{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{bo(),n(T(e,`network-request-failed`))},timeout:yo.get()})}if(va().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else if(va().gapi?.load)r();else{let t=Ur(`iframefcb`);return va()[t]=()=>{gapi.load?r():n(T(e,`network-request-failed`))},Br(`${Hr()}?onload=${t}`).catch(e=>n(e))}}).catch(e=>{throw So=null,e})}var So=null;function Co(e){return So||=xo(e),So}var wo=new Mn(5e3,15e3),To=`__/auth/iframe`,Eo=`emulator/auth/iframe`,Do={style:{position:`absolute`,top:`-100px`,width:`1px`,height:`1px`},"aria-hidden":`true`,tabindex:`-1`},Oo=new Map([[`identitytoolkit.googleapis.com`,`p`],[`staging-identitytoolkit.sandbox.googleapis.com`,`s`],[`test-identitytoolkit.sandbox.googleapis.com`,`t`]]);function ko(e){let t=e.config;E(t.authDomain,e,`auth-domain-config-required`);let n=t.emulator?Nn(t,Eo):`https://${e.config.authDomain}/${To}
1`,r={apiKey:t.apiKey,appName:e.name,v:qt},i=Oo.get(e.config.apiHost);i&&(r.eid=i);let a=e._getFrameworks();return a.length&&(r.fw=a.join(`,`)),`${n}?${ve(r).slice(1)}`}async function Ao(e){let t=await Co(e),n=va().gapi;return E(n,e,`internal-error`),t.open({where:document.body,url:ko(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Do,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});let i=T(e,`network-request-failed`),a=va().setTimeout(()=>{r(i)},wo.get());function o(){va().clearTimeout(a),n(t)}t.ping(o).then(o,()=>{r(i)})}))}var jo={location:`yes`,resizable:`yes`,statusbar:`yes`,toolbar:`no`},Mo=500,No=600,Po=`_blank`,Fo=`http://localhost`,Io=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function Lo(e,t,n,r=Mo,i=No){let a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString(),s=``,c={...jo,width:r.toString(),height:i.toString(),top:a,left:o},l=_().toLowerCase();n&&(s=xr(l)?Po:n),yr(l)&&(t||=Fo,c.scrollbars=`yes`);let u=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,``);if(Dr(l)&&s!==`_self`)return Ro(t||``,s),new Io(null);let d=window.open(t||``,s,u);E(d,e,`popup-blocked`);try{d.focus()}catch{}return new Io(d)}function Ro(e,t){let n=document.createElement(`a`);n.href=e,n.target=t;let r=document.createEvent(`MouseEvent`);r.initMouseEvent(`click`,!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}var zo=`__/auth/handler`,Bo=`emulator/auth/handler`,Vo=`fac`;async function Ho(e,t,n,r,i,a){E(e.config.authDomain,e,`auth-domain-config-required`),E(e.config.apiKey,e,`invalid-api-key`);let o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:qt,eventId:i};if(t instanceof Ei){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||``,he(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(let[e,t]of Object.entries(a||{}))o[e]=t}if(t instanceof Di){let e=t.getScopes().filter(e=>e!==``);e.length>0&&(o.scopes=e.join(`,`))}e.tenantId&&(o.tid=e.tenantId);let s=o;for(let e of Object.keys(s))s[e]===void 0&&delete s[e];let c=await e._getAppCheckToken(),l=c?`#${Vo}=${encodeURIComponent(c)}`:``;return`${Uo(e)}?${ve(s).slice(1)}${l}`}function Uo({config:e}){return e.emulator?Nn(e,Bo):`https://${e.authDomain}/${zo}`}var Wo=`webStorageSupport`,Go=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=pa,this._completeRedirectFn=so,this._overrideRedirectResult=io}async _openPopup(e,t,n,r){return En(this.eventManagers[e._key()]?.manager,`_initialize() not called before _openPopup()`),Lo(e,await Ho(e,t,n,Dn(),r),ga())}async _openRedirect(e,t,n,r){return await this._originValidation(e),ya(await Ho(e,t,n,Dn(),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):(En(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 Ao(e),n=new lo(e);return t.register(`authEvent`,t=>(E(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(Wo,{type:Wo},n=>{let r=n?.[0]?.[Wo];r!==void 0&&t(!!r),xn(e,`internal-error`)},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=_o(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return kr()||br()||Er()}},Ko=class{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case`enroll`:return this._finalizeEnroll(e,t.credential,n);case`signin`:return this._finalizeSignIn(e,t.credential);default:return Tn(`unexpected MultiFactorSessionType`)}}}
1,qo=class e extends Ko{constructor(e){super(`phone`),this.credential=e}static _fromCredential(t){return new e(t)}_finalizeEnroll(e,t,n){return $i(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return Ba(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Jo=class{constructor(){}static assertion(e){return qo._fromCredential(e)}};Jo.FACTOR_ID=`phone`;var Yo=class{static assertionForEnrollment(e,t){return Xo._fromSecret(e,t)}static assertionForSignIn(e,t){return Xo._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;E(t.user?.auth!==void 0,`internal-error`);let n=await ea(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Zo._fromStartTotpMfaEnrollmentResponse(n,t.user.auth)}};Yo.FACTOR_ID=`totp`;var Xo=class e extends Ko{constructor(e,t,n){super(`totp`),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(t,n){return new e(n,void 0,t)}static _fromEnrollmentId(t,n){return new e(n,t)}async _finalizeEnroll(e,t,n){return E(this.secret!==void 0,e,`argument-error`),ta(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){E(this.enrollmentId!==void 0&&this.otp!==void 0,e,`argument-error`);let n={verificationCode:this.otp};return Va(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n})}},Zo=class e{constructor(e,t,n,r,i,a,o){this.sessionInfo=a,this.auth=o,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=n,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(t,n){return new e(t.totpSessionInfo.sharedSecretKey,t.totpSessionInfo.hashingAlgorithm,t.totpSessionInfo.verificationCodeLength,t.totpSessionInfo.periodSec,new Date(t.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),t.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let n=!1;return(Qo(e)||Qo(t))&&(n=!0),n&&(Qo(e)&&(e=this.auth.currentUser?.email||`unknownuser`),Qo(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Qo(e){return e===void 0||e?.length===0}var $o=`@firebase/auth`,es=`1.13.1`,ts=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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(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(){E(this.auth._initializationPromise,`dependent-sdk-initialized-before-auth`)}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function ns(e){switch(e){case`Node`:return`node`;case`ReactNative`:return`rn`;case`Worker`:return`webworker`;case`Cordova`:return`cordova`;case`WebExtension`:return`web-extension`;default:return}}function rs(e){Wt(new De(`auth`,(t,{options:n})=>{let r=t.getProvider(`app`).getImmediate(),i=t.getProvider(`heartbeat`),a=t.getProvider(`app-check-internal`),{apiKey:o,authDomain:s}=r.options;E(o&&!o.includes(`:`),`invalid-api-key`,{appName:r.name});let c=new Fr(r,i,a,{apiKey:o,authDomain:s,clientPlatform:e,apiHost:`identitytoolkit.googleapis.com`,tokenApiHost:`securetoken.googleapis.com`,apiScheme:`https`,sdkClientVersion:Ar(e)});return $r(c,n),c},`PUBLIC`).setInstantiationMode(`EXPLICIT`).setInstanceCreatedCallback((e,t,n)=>{e.getProvider(`auth-internal`).initialize()})),Wt(new De(`auth-internal`,e=>(e=>new ts(e))(Ir(e.getProvider(`auth`).getImmediate())),`PRIVATE`).setInstantiationMode(`EXPLICIT`)),Xt($o,es,ns(e)),Xt($o,es,`esm2020`)}var is=g(`authIdTokenMaxAge`)||300,as=null,os=e=>async t=>{let n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>is)return;let i=n?.token;
1as!==i&&(as=i,await fetch(e,{method:i?`POST`:`DELETE`,headers:i?{Authorization:`Bearer ${i}`}:{}}))};function ss(e=Yt()){let t=Gt(e,`auth`);if(t.isInitialized())return t.getImmediate();let n=Qr(e,{popupRedirectResolver:Go,persistence:[Ra,sa,pa]}),r=g(`authTokenSyncURL`);if(r&&typeof isSecureContext==`boolean`&&isSecureContext){let e=new URL(r,location.origin);if(location.origin===e.origin){let t=os(e.toString());Yi(n,t,()=>t(n.currentUser)),Ji(n,e=>t(e))}}let i=p(`auth`);return i&&ei(n,`http://${i}`),n}function cs(){return document.getElementsByTagName(`head`)?.[0]??document}zr({loadJS(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.setAttribute(`src`,e),r.onload=t,r.onerror=e=>{let t=T(`internal-error`);t.customData=e,n(t)},r.type=`text/javascript`,r.charset=`UTF-8`,cs().appendChild(r)})},gapiScript:`https://apis.google.com/js/api.js`,recaptchaV2Script:`https://www.google.com/recaptcha/api.js`,recaptchaEnterpriseScript:`https://www.google.com/recaptcha/enterprise.js?render=`}),rs(`Browser`);var ls=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},us={},ds,fs;(function(){var e;function t(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.C=Array(this.blockSize),this.o=this.h=0,this.u()}t(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(e,t,n){n||=0;let r=Array(16);if(typeof t==`string`)for(var i=0;i<16;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;i<16;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];let a=e.g[3],o;o=t+(a^n&(i^a))+r[0]+3614090360&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[1]+3905402710&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[2]+606105819&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[4]+4118548399&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[5]+1200080426&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[6]+2821735955&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[8]+1770035416&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[9]+2336552879&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[10]+4294925233&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[12]+1804603682&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[13]+4254626195&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[14]+2792965006&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(i^a&(n^i))+r[1]+4129170786&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[6]+3225465664&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[11]+643717713&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[5]+3593408605&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[10]+38016083&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[15]+3634488961&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[9]+568446438&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[14]+3275163606&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[3]+4107603335&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[13]+2850285829&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[2]+4243563512&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[7]+1735328473&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(n^i^a)+r[5]+4294588738&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[8]+2272392833&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[11]+1839030562&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[1]+2763975236&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[4]+1272893353&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[7]+4139469664&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[13]+681279174&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[0]+3936430074&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[3]+3572445317&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[9]+3654602809&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[12]+3873151461&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[15]+530742520&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(i^(n|~a))+r[0]+4096336452&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[7]+1126891415&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[14]+2878612391&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[12]+1700485571&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[3]+2399980690&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[10]+4293915773&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[8]+1873313359&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[15]+4264355552&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[6]+2734768916&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[4]+4149444226&4294967295,t=n+(o<<6&4294967295|o>>>
126),o=a+(n^(t|~i))+r[11]+3174756917&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[2]+718787259&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}r.prototype.v=function(e,t){t===void 0&&(t=e.length);let n=t-this.blockSize,r=this.C,a=this.h,o=0;for(;o<t;){if(a==0)for(;o<=n;)i(this,e,o),o+=this.blockSize;if(typeof e==`string`){for(;o<t;)if(r[a++]=e.charCodeAt(o++),a==this.blockSize){i(this,r),a=0;break}}else for(;o<t;)if(r[a++]=e[o++],a==this.blockSize){i(this,r),a=0;break}}this.h=a,this.o+=t},r.prototype.A=function(){var e=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=this.o*8;for(var n=e.length-8;n<e.length;++n)e[n]=t&255,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};function a(e,t){var n=s;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}function o(e,t){this.h=t;let n=[],r=!0;for(let i=e.length-1;i>=0;i--){let a=e[i]|0;r&&a==t||(n[i]=a,r=!1)}this.g=n}var s={};function c(e){return-128<=e&&e<128?a(e,function(e){return new o([e|0],e<0?-1:0)}):new o([e|0],e<0?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return d;if(e<0)return g(l(-e));let t=[],n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new o(t,0)}function u(e,t){if(e.length==0)throw Error(`number format error: empty string`);if(t||=10,t<2||36<t)throw Error(`radix out of range: `+t);if(e.charAt(0)==`-`)return g(u(e.substring(1),t));if(e.indexOf(`-`)>=0)throw Error(`number format error: interior "-" character`);let n=l(t**8),r=d;for(let a=0;a<e.length;a+=8){var i=Math.min(8,e.length-a);let o=parseInt(e.substring(a,a+i),t);i<8?(i=l(t**+i),r=r.j(i).add(l(o))):(r=r.j(n),r=r.add(l(o)))}return r}var d=c(0),f=c(1),p=c(16777216);e=o.prototype,e.m=function(){if(h(this))return-g(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){let r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(e||=10,e<2||36<e)throw Error(`radix out of range: `+e);if(m(this))return`0`;if(h(this))return`-`+g(this).toString(e);let t=l(e**6);var n=this;let r=``;for(;;){let i=ne(n,t).g;n=ee(n,i.j(t));let a=((n.g.length>0?n.g[0]:n.h)>>>0).toString(e);if(n=i,m(n))return a+r;for(;a.length<6;)a=`0`+a;r=a+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h};function m(e){if(e.h!=0)return!1;for(let t=0;t<e.g.length;t++)if(e.g[t]!=0)return!1;return!0}function h(e){return e.h==-1}e.l=function(e){return e=ee(this,e),h(e)?-1:+!m(e)};function g(e){let t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new o(n,~e.h).add(f)}e.abs=function(){return h(this)?g(this):this},e.add=function(e){let t=Math.max(this.g.length,e.g.length),n=[],r=0;for(let i=0;i<=t;i++){let t=r+(this.i(i)&65535)+(e.i(i)&65535),a=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=a>>>16,t&=65535,a&=65535,n[i]=a<<16|t}return new o(n,n[n.length-1]&-2147483648?-1:0)};function ee(e,t){return e.add(g(t))}e.j=function(e){if(m(this)||m(e))return d;if(h(this))return h(e)?g(this).j(g(e)):g(g(this).j(e));if(h(e))return g(this.j(g(e)));if(this.l(p)<0&&e.l(p)<0)return l(this.m()*e.m());let t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){let i=this.i(r)>>>16,a=this.i(r)&65535,o=e.i(t)>>>16,s=e.i(t)&65535;n[2*r+2*t]+=a*s,te(n,2*r+2*t),n[2*r+2*t+1]+=i*s,te(n,2*r+2*t+1),n[2*r+2*t+1]+=a*o,te(n,2*r+2*t+1),n[2*r+2*t+2]+=i*o,te(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new o(n,0)};function te(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function _(e,t){this.g=e,this.h=t}function ne(e,t){if(m(t))throw Error(`division by zero`);if(m(e))return new _(d,d);if(h(e))return t=ne(g(e),t),new _(g(t.g),g(t.h));if(h(t))return t=ne(e,g(t)),new _(g(t.g),t.h);if(e.g.length>30){if(h(e)||h(t))throw Error(`slowDivide_ only works with positive integers.`);for(var n=f,r=t;r.l(e)<=0;)n=re(n),r=re(r);var i=ie(n,1),a=ie(r,1);for(r=ie(r,2),n=ie(n,2);!m(r);){var o=a.add(r);o.l(e)<=0&&(i=i.add(n),a=o),r=ie(r,1),n=ie(n,1)}return t=ee(e,i.j(t)),new _(i,t)}for(i=d;
1e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=Math.ceil(Math.log(n)/Math.LN2),r=r<=48?1:2**(r-48),a=l(n),o=a.j(t);h(o)||o.l(e)>0;)n-=r,a=l(n),o=a.j(t);m(a)&&(a=f),i=i.add(a),e=ee(e,o)}return new _(i,e)}e.B=function(e){return ne(this,e).h},e.and=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new o(n,this.h&e.h)},e.or=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new o(n,this.h|e.h)},e.xor=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new o(n,this.h^e.h)};function re(e){let t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new o(n,e.h)}function ie(e,t){let n=t>>5;t%=32;let r=e.g.length-n,i=[];for(let a=0;a<r;a++)i[a]=t>0?e.i(a+n)>>>t|e.i(a+n+1)<<32-t:e.i(a+n);return new o(i,e.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,fs=us.Md5=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=u,ds=us.Integer=o}).apply(ls===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:ls);var ps=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},ms={},hs,gs,_s,vs,ys,bs,xs,Ss;(function(){var e,t=Object.defineProperty;function n(e){e=[typeof globalThis==`object`&&globalThis,e,typeof window==`object`&&window,typeof self==`object`&&self,typeof ps==`object`&&ps];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error(`Cannot find global object`)}var r=n(this);function i(e,n){if(n)a:{var i=r;e=e.split(`.`);for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break a;i=i[o]}e=e[e.length-1],a=i[e],n=n(a),n!=a&&n!=null&&t(i,e,{configurable:!0,writable:!0,value:n})}}i(`Symbol.dispose`,function(e){return e||Symbol(`Symbol.dispose`)}),i(`Array.prototype.values`,function(e){return e||function(){return this[Symbol.iterator]()}}),i(`Object.entries`,function(e){return e||function(e){var t=[],n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,e[n]]);return t}});var a=a||{},o=this||self;function s(e){var t=typeof e;return t==`object`&&e!=null||t==`function`}function c(e,t,n){return e.call.apply(e.bind,arguments)}function l(e,t,n){return l=c,l.apply(null,arguments)}function u(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 d(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}var f=typeof AsyncContext<`u`&&typeof AsyncContext.Snapshot==`function`?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function p(e){let t=e.length;if(t>0){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function m(e,t){for(let t=1;t<arguments.length;t++){let r=arguments[t];var n=typeof r;if(n=n==`object`?r?Array.isArray(r)?`array`:n:`null`:n,n==`array`||n==`object`&&typeof r.length==`number`){n=e.length||0;let t=r.length||0;e.length=n+t;for(let i=0;i<t;i++)e[n+i]=r[i]}else e.push(r)}}class h{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function g(e){o.setTimeout(()=>{throw e},0)}function ee(){var e=ae;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}class te{constructor(){this.h=this.g=null}add(e,t){let n=_.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var _=new h(()=>new ne,e=>e.reset());class ne{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 re,ie=!1,ae=new te,oe=()=>{let e=Promise.resolve(void 0);re=()=>{e.then(se)}};function se(){for(var e;e=ee();){try{e.h.call(e.g)}catch(e){g(e)}var t=_;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}ie=!1}function ce(){this.u=this.u,this.C=this.C}ce.prototype.u=!1,ce.prototype.dispose=function(){this.u||(this.u=!0,this.N())},ce.prototype[Symbol.dispose]=function(){this.dispose()},ce.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function v(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}v.prototype.h=function(){this.defaultPrevented=!0};var le=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};o.addEventListener(`test`,e,t),o.removeEventListener(`test`,e,t)}catch{}return e}();function ue(e){return/^[\s\xa0]*$/.test(e)}function de(e,t){v.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&&this.init(e,t)}d(de,v),de.prototype.init=function(e,t){let n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget,t||(n==`mouseover`?t=e.fromElement:n==`mouseout`&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=r.clientX===void 0?r.pageX:r.clientX,this.clientY=r.clientY===void 0?r.pageY:r.clientY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX===void 0?e.pageX:e.clientX,this.clientY=e.clientY===void 0?e.pageY:e.clientY,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=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&de.Z.h.call(this)},de.prototype.h=function(){de.Z.h.call(this);let e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var fe=`closure_listenable_`+(Math.random()*1e6|0),pe=0;function me(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++pe,this.da=this.fa=!1}function he(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function ge(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function _e(e,t){for(let n in e)t.call(void 0,e[n],n,e)}function ve(e){let t={};for(let n in e)t[n]=e[n];return t}let ye=`constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1ing toString valueOf`.split(` `);function be(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<ye.length;t++)n=ye[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function xe(e){this.src=e,this.g={},this.h=0}xe.prototype.add=function(e,t,n,r,i){let a=e.toString();e=this.g[a],e||(e=this.g[a]=[],this.h++);let o=Ce(e,t,r,i);return o>-1?(t=e[o],n||(t.fa=!1)):(t=new me(t,this.src,a,!!r,i),t.fa=n,e.push(t)),t};function Se(e,t){let n=t.type;if(n in e.g){var r=e.g[n],i=Array.prototype.indexOf.call(r,t,void 0),a;(a=i>=0)&&Array.prototype.splice.call(r,i,1),a&&(he(t),e.g[n].length==0&&(delete e.g[n],e.h--))}}function Ce(e,t,n,r){for(let i=0;i<e.length;++i){let a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}var we=`closure_lm_`+(Math.random()*1e6|0),y={};function Te(e,t,n,r,i){if(r&&r.once)return Oe(e,t,n,r,i);if(Array.isArray(t)){for(let a=0;a<t.length;a++)Te(e,t[a],n,r,i);return null}return n=Pe(n),e&&e[fe]?e.J(t,n,s(r)?!!r.capture:!!r,i):Ee(e,t,n,!1,r,i)}function Ee(e,t,n,r,i,a){if(!t)throw Error(`Invalid event type`);let o=s(i)?!!i.capture:!!i,c=Ne(e);if(c||(e[we]=c=new xe(e)),n=c.add(t,n,r,o,a),n.proxy)return n;if(r=De(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)le||(i=o),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(je(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error(`addEventListener and attachEvent are unavailable.`);return n}function De(){function e(n){return t.call(e.src,e.listener,n)}let t=Me;return e}function Oe(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)Oe(e,t[a],n,r,i);return null}return n=Pe(n),e&&e[fe]?e.K(t,n,s(r)?!!r.capture:!!r,i):Ee(e,t,n,!0,r,i)}function ke(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)ke(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=Pe(n),e&&e[fe]?(e=e.i,a=String(t).toString(),a in e.g&&(t=e.g[a],n=Ce(t,n,r,i),n>-1&&(he(t[n]),Array.prototype.splice.call(t,n,1),t.length==0&&(delete e.g[a],e.h--)))):(e&&=Ne(e))&&(t=e.g[t.toString()],e=-1,t&&(e=Ce(t,n,r,i)),(n=e>-1?t[e]:null)&&Ae(n))}function Ae(e){if(typeof e!=`number`&&e&&!e.da){var t=e.src;if(t&&t[fe])Se(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(je(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Ne(t))?(Se(n,e),n.h==0&&(n.src=null,t[we]=null)):he(e)}}}function je(e){return e in y?y[e]:y[e]=`on`+e}function Me(e,t){if(e.da)e=!0;else{t=new de(t,this);let n=e.listener,r=e.ha||e.src;e.fa&&Ae(e),e=n.call(r,t)}return e}function Ne(e){return e=e[we],e instanceof xe?e:null}var b=`__closure_events_fn_`+(Math.random()*1e9>>>0);function Pe(e){return typeof e==`function`?e:(e[b]||(e[b]=function(t){return e.handleEvent(t)}),e[b])}function x(){ce.call(this),this.i=new xe(this),this.M=this,this.G=null}d(x,ce),x.prototype[fe]=!0,x.prototype.removeEventListener=function(e,t,n,r){ke(this,e,t,n,r)};function S(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,typeof t==`string`)t=new v(t,e);else if(t instanceof v)t.target=t.target||e;else{var i=t;t=new v(r,e),be(t,i)}i=!0;let a,o;if(n)for(o=n.length-1;o>=0;o--)a=t.g=n[o],i=Fe(a,r,!0,t)&&i;if(a=t.g=e,i=Fe(a,r,!0,t)&&i,i=Fe(a,r,!1,t)&&i,n)for(o=0;o<n.length;o++)a=t.g=n[o],i=Fe(a,r,!1,t)&&i}x.prototype.N=function(){if(x.Z.N.call(this),this.i){var e=this.i;for(let t in e.g){let n=e.g[t];for(let e=0;e<n.length;e++)he(n[e]);delete e.g[t],e.h--}}this.G=null},x.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},x.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};function Fe(e,t,n,r){if(t=e.i.g[String(t)],!t)return!0;t=t.concat();let i=!0;for(let a=0;a<t.length;++a){let o=t[a];if(o&&!o.da&&o.capture==n){let t=o.listener,n=o.ha||o.src;o.fa&&Se(e.i,o),i=t.call(n,r)!==!1&&i}}return i&&!r.defaultPrevented}function Ie(e,t){if(typeof e!=`function`)if(e&&typeof e.handleEvent==`function`)e=l(e.handleEvent,e);else throw Error(`Invalid listener argument`);return Number(t)>2147483647?-1:o.setTimeout(e,t||0)}function Le(e){e.g=Ie(()=>{e.g=null,e.i&&(e.i=!1,Le(e))},e.l);let t=e.h;e.h=null,e.m.apply(null,t)}class Re extends ce{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:Le(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ze(e){ce.call(this),this.h=e,this.g={}}d(ze,ce);var Be=[];function Ve(e){ge(e.g,function(e,t){this.g.hasOwnProperty(t)&&Ae(e)},e),e.g={}}ze.prototype.N=function(){ze.Z.N.call(this),Ve(this)},ze.prototype.handleEvent=function(){throw Error(`EventHandler.handleEvent not implemented`)};var He=o.JSON.stringify,Ue=o.JSON.parse,We=class{stringify(e){return o.JSON.stringify(e,void 0)}parse(e){return o.JSON.parse(e,void 0)}};function Ge(){}function Ke(){}var qe={OPEN:`a`,hb:`b`,ERROR:`c`,tb:`d`};function Je(){v.call(this,`d`)}d(Je,v);function Ye(){v.call(this,`c`)}d(Ye,v);var Xe={},Ze=null;function Qe(){return Ze||=new x}Xe.Ia=`serverreachability`;function $e(e){v.call(this,Xe.Ia,e)}d($e,v);function et(e){let t=Qe();S(t,new $e(t))}Xe.STAT_EVENT=`statevent`;function tt(e,t){v.call(this,Xe.STAT_EVENT,e),this.stat=t}d(tt,v);function nt(e){let t=Qe();S(t,new tt(t,e))}Xe.Ja=`timingevent`;function rt(e,t){v.call(this,Xe.Ja,e),this.size=t}d(rt,v);function it(e,t){if(typeof e!=`function`)throw Error(`Fn must not be null and must be a function`);return o.setTimeout(function(){e()},t)}function at(){this.g=!0}at.prototype.ua=function(){this.g=!1};function ot(e,t,n,r,i,a){e.info(function(){if(e.g)if(a){var o=``,s=a.split(`&`);for(let e=0;e<s.length;e++){var c=s[e].split(`=`);
1if(c.length>1){let e=c[0];c=c[1];let t=e.split(`_`);o=t.length>=2&&t[1]==`type`?o+(e+`=`+c+`&`):o+(e+`=redacted&`)}}}else o=null;else o=a;return`XMLHTTP REQ (`+r+`) [attempt `+i+`]: `+t+`
2`+n+`
3`+o})}function st(e,t,n,r,i,a,o){e.info(function(){return`XMLHTTP RESP (`+r+`) [ attempt `+i+`]: `+t+`
4`+n+`
5`+a+` `+o})}function ct(e,t,n,r){e.info(function(){return`XMLHTTP TEXT (`+t+`): `+ut(e,n)+(r?` `+r:``)})}function lt(e,t){e.info(function(){return`TIMEOUT: `+t})}at.prototype.info=function(){};function ut(e,t){if(!e.g)return t;if(!t)return null;try{let a=JSON.parse(t);if(a){for(e=0;e<a.length;e++)if(Array.isArray(a[e])){var n=a[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var i=r[0];if(i!=`noop`&&i!=`stop`&&i!=`close`)for(let e=1;e<r.length;e++)r[e]=``}}}}return He(a)}catch{return t}}var dt={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},ft={ib:`complete`,Fb:`success`,ERROR:`error`,Ga:`abort`,xb:`ready`,yb:`readystatechange`,TIMEOUT:`timeout`,sb:`incrementaldata`,wb:`progress`,lb:`downloadprogress`,Nb:`uploadprogress`},pt;function mt(){}d(mt,Ge),mt.prototype.g=function(){return new XMLHttpRequest},pt=new mt;function ht(e){return encodeURIComponent(String(e))}function gt(e){var t=1;e=e.split(`:`);let n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(`:`)),n}function _t(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new ze(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new vt}function vt(){this.i=null,this.g=``,this.h=!1}var yt={},bt={};function xt(e,t,n){e.M=1,e.A=Kt(Ut(t)),e.u=n,e.R=!0,St(e,null)}function St(e,t){e.F=Date.now(),Et(e),e.B=Ut(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),sn(n.i,`t`,r),e.C=0,n=e.j.L,e.h=new vt,e.g=Jn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Re(l(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var i=`readystatechange`;Array.isArray(i)||(i&&(Be[0]=i.toString()),i=Be);for(let e=0;e<i.length;e++){let a=Te(n,i[e],r||t.handleEvent,!1,t.h||t);if(!a)break;t.g[a.key]=a}t=e.J?ve(e.J):{},e.u?(e.v||=`POST`,t[`Content-Type`]=`application/x-www-form-urlencoded`,e.g.ea(e.B,e.v,e.u,t)):(e.v=`GET`,e.g.ea(e.B,e.v,null,t)),et(),ot(e.i,e.v,e.B,e.l,e.S,e.u)}_t.prototype.ba=function(e){e=e.target;let t=this.O;t&&Dn(e)==3?t.j():this.Y(e)},_t.prototype.Y=function(e){try{if(e==this.g)a:{let s=Dn(this.g),c=this.g.ya(),l=this.g.ca();if(!(s<3)&&(s!=3||this.g&&(this.h.h||this.g.la()||On(this.g)))){this.K||s!=4||c==7||et(c==8||l<=0?3:2),Ot(this);var t=this.g.ca();this.X=t;var n=Ct(this);if(this.o=t==200,st(this.i,this.v,this.B,this.l,this.S,s,t),this.o){if(this.U&&!this.L){b:{if(this.g){var r,i=this.g;if((r=i.g?i.g.getResponseHeader(`X-HTTP-Initial-Response`):null)&&!ue(r)){var a=r;break b}}a=null}if(e=a)ct(this.i,this.l,e,`Initial handshake response via X-HTTP-Initial-Response`),this.L=!0,jt(this,e);else{this.o=!1,this.m=3,nt(12),At(this),kt(this);break a}}if(this.R){e=!0;let t;for(;!this.K&&this.C<n.length;)if(t=Tt(this,n),t==bt){s==4&&(this.m=4,nt(14),e=!1),ct(this.i,this.l,null,`[Incomplete Response]`);break}else if(t==yt){this.m=4,nt(15),ct(this.i,this.l,n,`[Invalid Chunk]`),e=!1;break}else ct(this.i,this.l,t,null),jt(this,t);if(wt(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),s!=4||n.length!=0||this.h.h||(this.m=1,nt(16),e=!1),this.o=this.o&&e,!e)ct(this.i,this.l,n,`[Invalid Chunked Response]`),At(this),kt(this);else if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info(`Great, no buffering proxy detected. Bytes received: `+n.length),Bn(o),o.P=!0,nt(11))}}else ct(this.i,this.l,n,null),jt(this,n);s==4&&At(this),this.o&&!this.K&&(s==4?Un(this.j,this):(this.o=!1,Et(this)))}else kn(this.g),t==400&&n.indexOf(`Unknown SID`)>0?(this.m=3,nt(12)):(this.m=0,nt(13)),At(this),kt(this)}}}catch{}};function Ct(e){if(!wt(e))return e.g.la();let t=On(e.g);if(t===``)return``;let n=``,r=t.length,i=Dn(e.g)==4;if(!e.h.i){if(typeof TextDecoder>`u`)return At(e),kt(e),``;e.h.i=new o.TextDecoder}for(let a=0;a<r;a++)e.h.h=!0,n+=e.h.i.decode(t[a],{stream:!(i&&a==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}function wt(e){return e.g?e.v==`GET`&&e.M!=2&&e.j.Aa:!1}function Tt(e,t){var n=e.C,r=t.indexOf(`
6`,n);return r==-1?bt:(n=Number(t.substring(n,r)),isNaN(n)?yt:(r+=1,r+n>t.length?bt:(t=t.slice(r,r+n),e.C=r+n,t)))}_t.prototype.cancel=function(){this.K=!0,At(this)};function Et(e){e.T=Date.now()+e.H,Dt(e,e.H)}function Dt(e,t){if(e.D!=null)throw Error(`WatchDog timer not null`);e.D=it(l(e.aa,e),t)}function Ot(e){e.D&&=(o.clearTimeout(e.D),null)}_t.prototype.aa=function(){this.D=null;let e=Date.now();e-this.T>=0?(lt(this.i,this.B),this.M!=2&&(et(),nt(17)),At(this),this.m=2,kt(this)):Dt(this,this.T-e)};function kt(e){e.j.I==0||e.K||Un(e.j,e)}function At(e){Ot(e);var t=e.O;t&&typeof t.dispose==`function`&&t.dispose(),e.O=null,Ve(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dis
6pose())}function jt(e,t){try{var n=e.j;if(n.I!=0&&(n.g==e||It(n.h,e))){if(!e.L&&It(n.h,e)&&n.I==3){try{var r=n.Ba.g.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){a:if(!n.v){if(n.g)if(n.g.F+3e3<e.F)Hn(n),Nn(n);else break a;zn(n),nt(18)}}else n.xa=i[1],0<n.xa-n.K&&i[2]<37500&&n.F&&n.A==0&&!n.C&&(n.C=it(l(n.Va,n),6e3));Ft(n.h)<=1&&n.ta&&(n.ta=void 0)}else Gn(n,11)}else if((e.L||n.g==e)&&Hn(n),!ue(t))for(i=n.Ba.g.parse(t),t=0;t<i.length;t++){let l=i[t],u=l[0];if(!(u<=n.K))if(n.K=u,l=l[1],n.I==2)if(l[0]==`c`){n.M=l[1],n.ba=l[2];let t=l[3];t!=null&&(n.ka=t,n.j.info(`VER=`+n.ka));let i=l[4];i!=null&&(n.za=i,n.j.info(`SVER=`+n.za));let u=l[5];u!=null&&typeof u==`number`&&u>0&&(r=1.5*u,n.O=r,n.j.info(`backChannelRequestTimeoutMs_=`+r)),r=n;let d=e.g;if(d){let e=d.g?d.g.getResponseHeader(`X-Client-Wire-Protocol`):null;if(e){var a=r.h;a.g||e.indexOf(`spdy`)==-1&&e.indexOf(`quic`)==-1&&e.indexOf(`h2`)==-1||(a.j=a.l,a.g=new Set,a.h&&=(Lt(a,a.h),null))}if(r.G){let e=d.g?d.g.getResponseHeader(`X-HTTP-Session-Id`):null;e&&(r.wa=e,w(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info(`Handshake RTT: `+n.T+`ms`)),r=n;var o=e;if(r.na=qn(r,r.L?r.ba:null,r.W),o.L){Rt(r.h,o);var s=o,c=r.O;c&&(s.H=c),s.D&&(Ot(s),Et(s)),r.g=o}else Rn(r);n.i.length>0&&Fn(n)}else l[0]!=`stop`&&l[0]!=`close`||Gn(n,7);else n.I==3&&(l[0]==`stop`||l[0]==`close`?l[0]==`stop`?Gn(n,7):Mn(n):l[0]!=`noop`&&n.l&&n.l.qa(l),n.A=0)}}et(4)}catch{}}var Mt=class{constructor(e,t){this.g=e,this.map=t}};function Nt(e){this.l=e||10,o.PerformanceNavigationTiming?(e=o.performance.getEntriesByType(`navigation`),e=e.length>0&&(e[0].nextHopProtocol==`hq`||e[0].nextHopProtocol==`h2`)):e=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Pt(e){return e.h?!0:e.g?e.g.size>=e.j:!1}function Ft(e){return e.h?1:e.g?e.g.size:0}function It(e,t){return e.h?e.h==t:e.g?e.g.has(t):!1}function Lt(e,t){e.g?e.g.add(t):e.h=t}function Rt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}Nt.prototype.cancel=function(){if(this.i=zt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let e of this.g.values())e.cancel();this.g.clear()}};function zt(e){if(e.h!=null)return e.i.concat(e.h.G);if(e.g!=null&&e.g.size!==0){let t=e.i;for(let n of e.g.values())t=t.concat(n.G);return t}return p(e.i)}var Bt=RegExp(`^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$`);function Vt(e,t){if(e){e=e.split(`&`);for(let n=0;n<e.length;n++){let r=e[n].indexOf(`=`),i,a=null;r>=0?(i=e[n].substring(0,r),a=e[n].substring(r+1)):i=e[n],t(i,a?decodeURIComponent(a.replace(/\+/g,` `)):``)}}}function Ht(e){this.g=this.o=this.j=``,this.u=null,this.m=this.h=``,this.l=!1;let t;e instanceof Ht?(this.l=e.l,Wt(this,e.j),this.o=e.o,this.g=e.g,Gt(this,e.u),this.h=e.h,C(this,cn(e.i)),this.m=e.m):e&&(t=String(e).match(Bt))?(this.l=!1,Wt(this,t[1]||``,!0),this.o=qt(t[2]||``),this.g=qt(t[3]||``,!0),Gt(this,t[4]),this.h=qt(t[5]||``,!0),C(this,t[6]||``,!0),this.m=qt(t[7]||``)):(this.l=!1,this.i=new tn(null,this.l))}Ht.prototype.toString=function(){let e=[];var t=this.j;t&&e.push(Jt(t,Xt,!0),`:`);var n=this.g;return(n||t==`file`)&&(e.push(`//`),(t=this.o)&&e.push(Jt(t,Xt,!0),`@`),e.push(ht(n).replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),n=this.u,n!=null&&e.push(`:`,String(n))),(n=this.h)&&(this.g&&n.charAt(0)!=`/`&&e.push(`/`),e.push(Jt(n,n.charAt(0)==`/`?Qt:Zt,!0))),(n=this.i.toString())&&e.push(`?`,n),(n=this.m)&&e.push(`#`,Jt(n,en)),e.join(``)},Ht.prototype.resolve=function(e){let t=Ut(this),n=!!e.j;n?Wt(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=e.u!=null;var r=e.h;if(n)Gt(t,e.u);else if(n=!!e.h){if(r.charAt(0)!=`/`)if(this.g&&!this.h)r=`/`+r;else{var i=t.h.lastIndexOf(`/`);i!=-1&&(r=t.h.slice(0,i+1)+r)}if(i=r,i==`..`||i==`.`)r=``;else if(i.indexOf(`./`)!=-1||i.indexOf(`/.`)!=-1){r=i.lastIndexOf(`/`,0)==0,i=i.split(`/`);let e=[];for(let t=0;t<i.length;){let n=i[t++];n==`.`?r&&t==i.length&&e.push(``):n==`..`?((e.length>1||e.length==1&&e[0]!=``)&&e.pop(),r&&t==i.length&&e.push(``)):(e.push(n),r=!0)}r=e.join(`/`)}else r=i}return n?t.h=r:n=e.i.toString()!==``,n?C(t,cn(e.i)):n=!!e.m,n&&(t.m=e.m),t};function Ut(e){return new Ht(e)}function Wt(e,t,n){e.j=n?qt(t,!0):t,e.j&&=e.j.replace(/:$/,``)}function Gt(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error(`Bad port number `+t);e.u=t}else e.u=null}
6function C(e,t,n){t instanceof tn?(e.i=t,un(e.i,e.l)):(n||(t=Jt(t,$t)),e.i=new tn(t,e.l))}function w(e,t,n){e.i.set(t,n)}function Kt(e){return w(e,`zx`,Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),e}function qt(e,t){return e?t?decodeURI(e.replace(/%25/g,`%2525`)):decodeURIComponent(e):``}function Jt(e,t,n){return typeof e==`string`?(e=encodeURI(e).replace(t,Yt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),e):null}function Yt(e){return e=e.charCodeAt(0),`%`+(e>>4&15).toString(16)+(e&15).toString(16)}var Xt=/[#\/\?@]/g,Zt=/[#\?:]/g,Qt=/[#\?]/g,$t=/[#\?@]/g,en=/#/g;function tn(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function nn(e){e.g||(e.g=new Map,e.h=0,e.i&&Vt(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g,` `)),n)}))}e=tn.prototype,e.add=function(e,t){nn(this),this.i=null,e=ln(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this};function rn(e,t){nn(e),t=ln(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function an(e,t){return nn(e),t=ln(e,t),e.g.has(t)}e.forEach=function(e,t){nn(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)};function on(e,t){nn(e);let n=[];if(typeof t==`string`)an(e,t)&&(n=n.concat(e.g.get(ln(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}e.set=function(e,t){return nn(this),this.i=null,e=ln(this,e),an(this,e)&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e?(e=on(this,e),e.length>0?String(e[0]):t):t};function sn(e,t,n){rn(e,t),n.length>0&&(e.i=null,e.g.set(ln(e,t),p(n)),e.h+=n.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return``;let e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];let i=ht(n);n=on(this,n);for(let t=0;t<n.length;t++){let r=i;n[t]!==``&&(r+=`=`+ht(n[t])),e.push(r)}}return this.i=e.join(`&`)};function cn(e){let t=new tn;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function ln(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function un(e,t){t&&!e.j&&(nn(e),e.i=null,e.g.forEach(function(e,t){let n=t.toLowerCase();t!=n&&(rn(this,t),sn(this,n,e))},e)),e.j=t}function dn(e,t){let n=new at;if(o.Image){let r=new Image;r.onload=u(pn,n,`TestLoadImage: loaded`,!0,t,r),r.onerror=u(pn,n,`TestLoadImage: error`,!1,t,r),r.onabort=u(pn,n,`TestLoadImage: abort`,!1,t,r),r.ontimeout=u(pn,n,`TestLoadImage: timeout`,!1,t,r),o.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function fn(e,t){let n=new at,r=new AbortController,i=setTimeout(()=>{r.abort(),pn(n,`TestPingServer: timeout`,!1,t)},1e4);fetch(e,{signal:r.signal}).then(e=>{clearTimeout(i),e.ok?pn(n,`TestPingServer: ok`,!0,t):pn(n,`TestPingServer: server error`,!1,t)}).catch(()=>{clearTimeout(i),pn(n,`TestPingServer: error`,!1,t)})}function pn(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch{}}function mn(){this.g=new We}function hn(e){this.i=e.Sb||null,this.h=e.ab||!1}d(hn,Ge),hn.prototype.g=function(){return new gn(this.i,this.h)};function gn(e,t){x.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText=``,this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F=`GET`,this.D=``,this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(gn,x),e=gn.prototype,e.open=function(e,t){if(this.readyState!=0)throw this.abort(),Error(`Error reopening a connection`);this.F=e,this.D=t,this.readyState=1,yn(this)},e.send=function(e){if(this.readyState!=1)throw this.abort(),Error(`need to call open() first. `);if(this.v.signal.aborted)throw this.abort(),Error(`Request was aborted.`);this.g=!0;let t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||o).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText=``,this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel(`Request was aborted.`).cat
vendor: 4,840 bytes, lines 6-8
6ch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,vn(this)),this.readyState=0},e.Pa=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,yn(this)),this.g&&(this.readyState=3,yn(this),this.g)))if(this.responseType===`arraybuffer`)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(o.ReadableStream!==void 0&&`body`in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error(`responseType must be empty for "streamBinaryChunks" mode responses.`);this.response=[]}else this.response=this.responseText=``,this.B=new TextDecoder;_n(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))};function _n(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array;(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?vn(this):yn(this),this.readyState==3&&_n(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,vn(this))},e.Na=function(e){this.g&&(this.response=e,vn(this))},e.ga=function(){this.g&&vn(this)};function vn(e){e.readyState=4,e.l=null,e.j=null,e.B=null,yn(e)}e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||``},e.getAllResponseHeaders=function(){if(!this.h)return``;let e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+`: `+n[1]),n=t.next();return e.join(`\r
7`)};function yn(e){e.onreadystatechange&&e.onreadystatechange.call(e)}Object.defineProperty(gn.prototype,"withCredentials",{get:function(){return this.m===`include`},set:function(e){this.m=e?`include`:`same-origin`}});function bn(e){let t=``;return ge(e,function(e,n){t+=n,t+=`:`,t+=e,t+=`\r
8`}),t}function xn(e,t,n){a:{for(r in n){var r=!1;break a}r=!0}r||(n=bn(n),typeof e==`string`||w(e,t,n))}function T(e){x.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D=``,this.o=0,this.l=``,this.j=this.B=this.v=this.A=!1,this.m=null,this.F=``,this.H=!1}d(T,x);var Sn=/^https?$/i,Cn=[`POST`,`PUT`];e=T.prototype,e.Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error(`[goog.net.XhrIo] Object is active with another request=`+this.D+`; newUri=`+e);t=t?t.toUpperCase():`GET`,this.D=e,this.l=``,this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():pt.g(),this.g.onreadystatechange=f(l(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){wn(this,e);return}if(e=n||``,n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys==`function`&&typeof r.get==`function`)for(let e of r.keys())n.set(e,r.get(e));else throw Error(`Unknown input type for opt_headers: `+String(r));r=Array.from(n.keys()).find(e=>e.toLowerCase()==`content-type`),i=o.FormData&&e instanceof o.FormData,!(Array.prototype.indexOf.call(Cn,t,void 0)>=0)||r||i||n.set(`Content-Type`,`application/x-www-form-urlencoded;charset=utf-8`);for(let[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),`withCredentials`in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&=(clearTimeout(this.m),null),this.v=!0,this.g.send(e),this.v=!1}catch(e){wn(this,e)}};function wn(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,E(e),En(e)}function E(e){e.A||(e.A=!0,S(e,`complete`),S(e,`error`))}e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,S(this,`complete`),S(this,`abort`),En(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),En(this,!0)),T.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Tn(this):this.Xa())},e.Xa=function(){Tn(this)};function Tn(e){if(e.h&&a!==void 0){if(e.v&&Dn(e)==4)setTimeout(e.Ca.bind(e),0);else if(S(e,`readystatechange`),Dn(e)==4){e.h=!1;try{let a=e.ca();a:switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break a;default:t=!1}var n;if(!(n=t)){var r;if(r=a===0){let t=String(e.D).match(Bt)[1]||null;!t&&o.self&&o.self.location&&(t=o.self.location.protocol.slice(0,-1)),r=!Sn.test(t?t.toLowerCase():``)}n=r}if(n)S(e,`complete`),S(e,`success`);else{e.o=6;try{var i=Dn(e)>2?e.g.statusText:``}catch{i=``}e.l=i+` [`+e.ca()+`]`,E(e)}}finally{En(e)}}}}function En(e,t){if(e.g){e.m&&=(clearTimeout(e.m),null);let n=e.g;e.g=null,t||S(e,`ready`);try{n.onreadystatechange=null}catch{}}}e.isActive=function(){return!!this.g};function Dn(e){return e.g?e.g.readyState:0}e.ca=function(){try{return Dn(this)>2?this.g.status:-1}catch{return-1}},e.la=function(){try{return this.g?this.g.responseText:``}catch{return``}},e.La=function(e){if(this.g){var t=this.g.responseText;
vendor: 4,748 bytes, lines 8-9
8return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Ue(t)}};function On(e){try{if(!e.g)return null;if(`response`in e.g)return e.g.response;switch(e.F){case``:case`text`:return e.g.responseText;case`arraybuffer`:if(`mozResponseArrayBuffer`in e.g)return e.g.mozResponseArrayBuffer}return null}catch{return null}}function kn(e){let t={};e=(e.g&&Dn(e)>=2&&e.g.getAllResponseHeaders()||``).split(`\r
9`);for(let r=0;r<e.length;r++){if(ue(e[r]))continue;var n=gt(e[r]);let i=n[0];if(n=n[1],typeof n!=`string`)continue;n=n.trim();let a=t[i]||[];t[i]=a,a.push(n)}_e(t,function(e){return e.join(`, `)})}e.ya=function(){return this.o},e.Ha=function(){return typeof this.l==`string`?this.l:String(this.l)};function An(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function jn(e){this.za=0,this.i=[],this.j=new at,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=An(`failFast`,!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=An(`baseRetryDelayMs`,5e3,e),this.Za=An(`retryDelaySeedMs`,1e4,e),this.Ta=An(`forwardChannelMaxRetries`,2,e),this.va=An(`forwardChannelRequestTimeoutMs`,2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M=``,this.h=new Nt(e&&e.concurrentRequestLimit),this.Ba=new mn,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}e=jn.prototype,e.ka=8,e.I=1,e.connect=function(e,t,n,r){nt(0),this.W=e,this.H=t||{},n&&r!==void 0&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=qn(this,null,this.W),Fn(this)};function Mn(e){if(Pn(e),e.I==3){var t=e.V++,n=Ut(e.J);if(w(n,`SID`,e.M),w(n,`RID`,t),w(n,`TYPE`,`terminate`),D(e,n),t=new _t(e,e.j,t),t.M=2,t.A=Kt(Ut(n)),n=!1,o.navigator&&o.navigator.sendBeacon)try{n=o.navigator.sendBeacon(t.A.toString(),``)}catch{}!n&&o.Image&&(new Image().src=t.A,n=!0),n||(t.g=Jn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),Et(t)}Kn(e)}function Nn(e){e.g&&=(Bn(e),e.g.cancel(),null)}function Pn(e){Nn(e),e.v&&=(o.clearTimeout(e.v),null),Hn(e),e.h.cancel(),e.m&&=(typeof e.m==`number`&&o.clearTimeout(e.m),null)}function Fn(e){if(!Pt(e.h)&&!e.m){e.m=!0;var t=e.Ea;re||oe(),ie||=(re(),!0),ae.add(t,e),e.D=0}}function In(e,t){return Ft(e.h)>=e.h.j-+!!e.m?!1:e.m?(e.i=t.G.concat(e.i),!0):e.I==1||e.I==2||e.D>=(e.Sa?0:e.Ta)?!1:(e.m=it(l(e.Ea,e,t),Wn(e,e.D)),e.D++,!0)}e.Ea=function(e){if(this.m)if(this.m=null,this.I==1){if(!e){this.V=Math.floor(Math.random()*1e5),e=this.V++;let i=new _t(this,this.j,e),a=this.o;if(this.U&&(a?(a=ve(a),be(a,this.U)):a=this.U),this.u!==null||this.R||(i.J=a,a=null),this.S)a:{for(var t=0,n=0;n<this.i.length;n++){b:{var r=this.i[n];if(`__data__`in r.map&&(r=r.map.__data__,typeof r==`string`)){r=r.length;break b}r=void 0}if(r===void 0)break;if(t+=r,t>4096){t=n;break a}if(t===4096||n===this.i.length-1){t=n+1;break a}}t=1e3}else t=1e3;t=O(this,i,t),n=Ut(this.J),w(n,`RID`,e),w(n,`CVER`,22),this.G&&w(n,`X-HTTP-Session-Id`,this.G),D(this,n),a&&(this.R?t=`headers=`+ht(bn(a))+`&`+t:this.u&&xn(n,this.u,a)),Lt(this.h,i),this.Ra&&w(n,`TYPE`,`init`),this.S?(w(n,`$req`,t),w(n,`SID`,`null`),i.U=!0,xt(i,n,null)):xt(i,n,t),this.I=2}}else this.I==3&&(e?Ln(this,e):this.i.length==0||Pt(this.h)||Ln(this))};function Ln(e,t){var n=t?t.l:e.V++;let r=Ut(e.J);w(r,`SID`,e.M),w(r,`RID`,n),w(r,`AID`,e.K),D(e,r),e.u&&e.o&&xn(r,e.u,e.o),n=new _t(e,e.j,n,e.D+1),e.u===null&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=O(e,n,1e3),n.H=Math.round(e.va*.5)+Math.round(e.va*.5*Math.random()),Lt(e.h,n),xt(n,r,t)}function D(e,t){e.H&&ge(e.H,function(e,n){w(t,n,e)}),e.l&&ge({},function(e,n){w(t,n,e)})}function O(e,t,n){n=Math.min(e.i.length,n);let r=e.l?l(e.l.Ka,e.l,e):null;a:{var i=e.i;let t=-1;for(;;){let e=[`count=`+n];t==-1?n>0?(t=i[0].g,e.push(`ofs=`+t)):t=0:e.push(`ofs=`+t);let c=!0;for(let l=0;l<n;l++){var a=i[l].g;let n=i[l].map;if(a-=t,a<0)t=Math.max(0,i[l].g-100),c=!1;else try{a=`req`+a+`_`||``;try{var o=n instanceof Map?n:Object.entries(n);for(let[t,n]of o){let r=n;s(n)&&(r=He(n)),e.push(a+t+`=`+encodeURIComponent(r))}}catch(t){throw e.push(a+`type=_badmap`),t}}catch{r&&r(n)}}if(c){o=e.join(`&`);break a}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function Rn(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;re||oe(),ie||=(re(),!0),ae.add(t,e),e.A=0}}function zn(e){return e.g||e.v||e.A>=3?!1:(e.Y++,e.v=it(l(e.Da,e),Wn(e,e.A)),e.A++,!0)}
vendor: 4,263 bytes, line 9
9e.Da=function(){if(this.v=null,Vn(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var e=4*this.T;this.j.info(`BP detection timer enabled: `+e),this.B=it(l(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info(`BP detection timeout reached.`),this.j.info(`Buffering proxy detected and switch to long-polling!`),this.F=!1,this.P=!0,nt(10),Nn(this),Vn(this))};function Bn(e){e.B!=null&&(o.clearTimeout(e.B),e.B=null)}function Vn(e){e.g=new _t(e,e.j,`rpc`,e.Y),e.u===null&&(e.g.J=e.o),e.g.P=0;var t=Ut(e.na);w(t,`RID`,`rpc`),w(t,`SID`,e.M),w(t,`AID`,e.K),w(t,`CI`,e.F?`0`:`1`),!e.F&&e.ia&&w(t,`TO`,e.ia),w(t,`TYPE`,`xmlhttp`),D(e,t),e.u&&e.o&&xn(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=Kt(Ut(t)),n.u=null,n.R=!0,St(n,e)}e.Va=function(){this.C!=null&&(this.C=null,Nn(this),zn(this),nt(19))};function Hn(e){e.C!=null&&(o.clearTimeout(e.C),e.C=null)}function Un(e,t){var n=null;if(e.g==t){Hn(e),Bn(e),e.g=null;var r=2}else if(It(e.h,t))n=t.G,Rt(e.h,t),r=1;else return;if(e.I!=0){if(t.o)if(r==1){n=t.u?t.u.length:0,t=Date.now()-t.F;var i=e.D;r=Qe(),S(r,new rt(r,n)),Fn(e)}else Rn(e);else if(i=t.m,i==3||i==0&&t.X>0||!(r==1&&In(e,t)||r==2&&zn(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),i){case 1:Gn(e,5);break;case 4:Gn(e,10);break;case 3:Gn(e,6);break;default:Gn(e,2)}}}function Wn(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function Gn(e,t){if(e.j.info(`Error code `+t),t==2){var n=l(e.bb,e),r=e.Ua;let t=!r;r=new Ht(r||`//www.google.com/images/cleardot.gif`),o.location&&o.location.protocol==`http`||Wt(r,`https`),Kt(r),t?dn(r.toString(),n):fn(r.toString(),n)}else nt(2);e.I=0,e.l&&e.l.pa(t),Kn(e),Pn(e)}e.bb=function(e){e?(this.j.info(`Successfully pinged google.com`),nt(2)):(this.j.info(`Failed to ping google.com`),nt(1))};function Kn(e){if(e.I=0,e.ja=[],e.l){let t=zt(e.h);(t.length!=0||e.i.length!=0)&&(m(e.ja,t),m(e.ja,e.i),e.h.i.length=0,p(e.i),e.i.length=0),e.l.oa()}}function qn(e,t,n){var r=n instanceof Ht?Ut(n):new Ht(n);if(r.g!=``)t&&(r.g=t+`.`+r.g),Gt(r,r.u);else{var i=o.location;r=i.protocol,t=t?t+`.`+i.hostname:i.hostname,i=+i.port;let e=new Ht(null);r&&Wt(e,r),t&&(e.g=t),i&&Gt(e,i),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&w(r,n,t),w(r,`VER`,e.ka),D(e,r),r}function Jn(e,t,n){if(t&&!e.L)throw Error(`Can't create secondary domain capable XhrIo object.`);return t=e.Aa&&!e.ma?new T(new hn({ab:n})):new T(e.ma),t.Fa(e.L),t}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function Yn(){}e=Yn.prototype,e.ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){};function Xn(){}Xn.prototype.g=function(e,t){return new k(e,t)};function k(e,t){x.call(this),this.g=new jn(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.o=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.sa&&(e?e[`X-WebChannel-Client-Profile`]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!ue(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t&&=t.httpSessionIdParam)&&!ue(t)&&(this.g.G=t,e=this.h,e!==null&&t in e&&(e=this.h,t in e&&delete e[t])),this.j=new $n(this)}d(k,x),k.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},k.prototype.close=function(){Mn(this.g)},k.prototype.o=function(e){var t=this.g;if(typeof e==`string`){var n={};n.__data__=e,e=n}else this.v&&(n={},n.__data__=He(e),e=n);t.i.push(new Mt(t.Ya++,e)),t.I==3&&Fn(t)},k.prototype.N=function(){this.g.l=null,delete this.j,Mn(this.g),delete this.g,k.Z.N.call(this)};function Zn(e){Je.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){a:{for(let n in t){e=n;break a}e=void 0}(this.i=e)&&(e=this.i,t=t!==null&&e in t?t[e]:void 0),this.data=t}else this.data=e}d(Zn,Je);function Qn(){Ye.call(this),this.status=1}d(Qn,Ye);function $n(e){this.g=e}d($n,Yn),$n.prototype.ra=function(){S(this.g,`a`)}
9,$n.prototype.qa=function(e){S(this.g,new Zn(e))},$n.prototype.pa=function(e){S(this.g,new Qn)},$n.prototype.oa=function(){S(this.g,`b`)},Xn.prototype.createWebChannel=Xn.prototype.g,k.prototype.send=k.prototype.o,k.prototype.open=k.prototype.m,k.prototype.close=k.prototype.close,Ss=ms.createWebChannelTransport=function(){return new Xn},xs=ms.getStatEventTarget=function(){return Qe()},bs=ms.Event=Xe,ys=ms.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},dt.NO_ERROR=0,dt.TIMEOUT=8,dt.HTTP_ERROR=6,vs=ms.ErrorCode=dt,ft.COMPLETE=`complete`,_s=ms.EventType=ft,Ke.EventType=qe,qe.OPEN=`a`,qe.CLOSE=`b`,qe.ERROR=`c`,qe.MESSAGE=`d`,x.prototype.listen=x.prototype.J,gs=ms.WebChannel=Ke,ms.FetchXmlHttpFactory=hn,T.prototype.listenOnce=T.prototype.K,T.prototype.getLastError=T.prototype.Ha,T.prototype.getLastErrorCode=T.prototype.ya,T.prototype.getStatus=T.prototype.ca,T.prototype.getResponseJson=T.prototype.La,T.prototype.getResponseText=T.prototype.la,T.prototype.send=T.prototype.ea,T.prototype.setWithCredentials=T.prototype.Fa,hs=ms.XhrIo=T}).apply(ps===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:ps);var A=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?`uid:`+this.uid:`anonymous-user`}isEqual(e){return e.uid===this.uid}};A.UNAUTHENTICATED=new A(null),A.GOOGLE_CREDENTIALS=new A(`google-credentials-uid`),A.FIRST_PARTY=new A(`first-party-uid`),A.MOCK_USER=new A(`mock-user`);var Cs=`12.13.0`;function ws(e){Cs=e}var Ts=new Ie(`@firebase/firestore`);function Es(){return Ts.logLevel}function j(e,...t){if(Ts.logLevel<=b.DEBUG){let n=t.map(ks);Ts.debug(`Firestore (${Cs}): ${e}`,...n)}}function Ds(e,...t){if(Ts.logLevel<=b.ERROR){let n=t.map(ks);Ts.error(`Firestore (${Cs}): ${e}`,...n)}}function Os(e,...t){if(Ts.logLevel<=b.WARN){let n=t.map(ks);Ts.warn(`Firestore (${Cs}): ${e}`,...n)}}function ks(e){if(typeof e==`string`)return e;try{return function(e){return JSON.stringify(e)}(e)}catch{return e}}function M(e,t,n){let r=`Unexpected state`;typeof t==`string`?r=t:n=t,As(e,r,n)}function As(e,t,n){let r=`FIRESTORE (${Cs}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(n!==void 0)try{r+=` CONTEXT: `+JSON.stringify(n)}catch{r+=` CONTEXT: `+n}throw Ds(r),Error(r)}function N(e,t,n,r){let i=`Unexpected state`;typeof n==`string`?i=n:r=n,e||As(t,i,r)}function P(e,t){return e}var F={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`,UNIMPLEMENTED:`unimplemented`,INTERNAL:`internal`,UNAVAILABLE:`unavailable`,DATA_LOSS:`data-loss`},I=class extends de{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}},js=class{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}},Ms=class{constructor(e,t){this.user=t,this.type=`OAuth`,this.headers=new Map,this.headers.set(`Authorization`,`Bearer ${e}`)}},Ns=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(A.UNAUTHENTICATED)))}shutdown(){}},Ps=class{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}},Fs=class{constructor(e){this.t=e,this.currentUser=A.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){N(this.o===void 0,42304);let n=this.i,r=e=>this.i===n?Promise.resolve():(n=this.i,t(e)),i=new js;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new js,e.enqueueRetryable((()=>r(this.currentUser)))};let a=()=>{let t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},o=e=>{j(`FirebaseAuthCredentialsProvider`,`Auth detected`),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((e=>o(e))),setTimeout((()=>
9{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(j(`FirebaseAuthCredentialsProvider`,`Auth not yet detected`),i.resolve(),i=new js)}}),0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i===e?t?(N(typeof t.accessToken==`string`,31837,{l:t}),new Ms(t.accessToken,this.currentUser)):null:(j(`FirebaseAuthCredentialsProvider`,`getToken aborted due to token change.`),this.getToken()))):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return N(e===null||typeof e==`string`,2055,{h:e}),new A(e)}},Is=class{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type=`FirstParty`,this.user=A.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set(`X-Goog-AuthUser`,this.P);let e=this.A();return e&&this.R.set(`Authorization`,e),this.T&&this.R.set(`X-Goog-Iam-Authorization-Token`,this.T),this.R}},Ls=class{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new Is(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable((()=>t(A.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},Rs=class{constructor(e){this.value=e,this.type=`AppCheck`,this.headers=new Map,e&&e.length>0&&this.headers.set(`x-firebase-appcheck`,this.value)}},zs=class{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,C(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){N(this.o===void 0,3512);let n=e=>{e.error!=null&&j(`FirebaseAppCheckTokenProvider`,`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.m;return this.m=e.token,j(`FirebaseAppCheckTokenProvider`,`Received ${n?`new`:`existing`} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};let r=e=>{j(`FirebaseAppCheckTokenProvider`,`AppCheck detected`),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?r(e):j(`FirebaseAppCheckTokenProvider`,`AppCheck not yet detected`)}}),0)}getToken(){if(this.p)return Promise.resolve(new Rs(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(N(typeof e.token==`string`,44558,{tokenResult:e}),this.m=e.token,new Rs(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Bs(e){let t=typeof self<`u`&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues==`function`)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}var Vs=class{static newId(){let e=``;for(;e.length<20;){let t=Bs(40);for(let n=0;n<t.length;++n)e.length<20&&t[n]<248&&(e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(t[n]%62))}return e}};function L(e,t){return e<t?-1:+(e>t)}function Hs(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e.charAt(r),i=t.charAt(r);if(n!==i)return Gs(n)===Gs(i)?L(n,i):Gs(n)?1:-1}return L(e.length,t.length)}var Us=55296,Ws=57343;function Gs(e){let t=e.charCodeAt(0);return t>=Us&&t<=Ws}function Ks(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}var qs=`__name__`,Js=class e{constructor(e,t,n){t===void 0?t=0:t>e.length&&M(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&M(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(t){return e.comparator(this,t)===0}child(t){let n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((e=>{n.push(e)})):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?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 this.length===0}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(t,n){let r=Math.min(t.length,n.length);for(let i=0;i<r;i++){let r=e.compareSegments(t.get(i),n.get(i));if(r!==0)return r}return L(t.length,n.length)}static compareSegments(t,n){let r=e.isNumericId(t),i=e.isNumericId(n);return r&&!i?-1:!r&&i?1:r&&i?e.extractNumericId(t).compare(e.extractNumericId(n)):Hs(t,n)}static isNumericId(e){return e.startsWith(`__id`)&&e.endsWith(`__`)}static extractNumericId(e){return ds.fromString(e.substring(4,e.length-2))}},R=class e extends Js{construct(t,n,r){return new e(t,n,r)}canonicalString(){return this.toArray().join(`/`)}toString(){return this.canonicalString()}
vendor: 6,215 bytes, line 9
9toUriEncodedString(){return this.toArray().map(encodeURIComponent).join(`/`)}static fromString(...t){let n=[];for(let e of t){if(e.indexOf(`//`)>=0)throw new I(F.INVALID_ARGUMENT,`Invalid segment (${e}). Paths must not contain // in them.`);n.push(...e.split(`/`).filter((e=>e.length>0)))}return new e(n)}static emptyPath(){return new e([])}},Ys=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Xs=class e extends Js{construct(t,n,r){return new e(t,n,r)}static isValidIdentifier(e){return Ys.test(e)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(`.`)}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===`__name__`}static keyField(){return new e([qs])}static fromServerFormat(t){let n=[],r=``,i=0,a=()=>{if(r.length===0)throw new I(F.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=``},o=!1;for(;i<t.length;){let e=t[i];if(e===`\\`){if(i+1===t.length)throw new I(F.INVALID_ARGUMENT,`Path has trailing escape character: `+t);let e=t[i+1];if(e!==`\\`&&e!==`.`&&e!=="`")throw new I(F.INVALID_ARGUMENT,`Path has invalid escape sequence: `+t);r+=e,i+=2}else e==="`"?(o=!o,i++):e!==`.`||o?(r+=e,i++):(a(),i++)}if(a(),o)throw new I(F.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)}static emptyPath(){return new e([])}},z=class e{constructor(e){this.path=e}static fromPath(t){return new e(R.fromString(t))}static fromName(t){return new e(R.fromString(t).popFirst(5))}static empty(){return new e(R.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 e!==null&&R.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return R.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(t){return new e(new R(t.slice()))}};function Zs(e,t,n){if(!n)throw new I(F.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Qs(e,t,n,r){if(!0===t&&!0===r)throw new I(F.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function $s(e){if(!z.isDocumentKey(e))throw new I(F.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function ec(e){if(z.isDocumentKey(e))throw new I(F.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function tc(e){return typeof e==`object`&&!!e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function nc(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`string`)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`)return``+e;if(typeof e==`object`){if(e instanceof Array)return`an array`;{let t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:`an object`}}return typeof e==`function`?`a function`:M(12329,{type:typeof e})}function rc(e,t){if(`_delegate`in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new I(F.INVALID_ARGUMENT,`Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?`);{let n=nc(e);throw new I(F.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function ic(e,t){if(t<=0)throw new I(F.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}function B(e,t){let n={typeString:e};return t&&(n.value=t),n}function ac(e,t){if(!tc(e))throw new I(F.INVALID_ARGUMENT,`JSON must be an object`);let n;for(let r in t)if(t[r]){let i=t[r].typeString,a=`value`in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}let o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(a!==void 0&&o!==a.value){n=`Expected '${r}' field to equal '${a.value}'`;break}}if(n)throw new I(F.INVALID_ARGUMENT,n);return!0}var oc=-62135596800,sc=1e6,V=class e{static now(){return e.fromMillis(Date.now())}static fromDate(t){return e.fromMillis(t.getTime())}static fromMillis(t){let n=Math.floor(t/1e3),r=Math.floor((t-1e3*n)*sc);return new e(n,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new I(F.INVALID_ARGUMENT,`Timestamp nanoseconds out of range: `+t);if(e<oc||e>=253402300800)throw new I(F.INVALID_ARGUMENT,`Timestamp seconds out of range: `+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/sc}_compareTo(e){return this.seconds===e.seconds?L(this.nanoseconds,e.nanoseconds):L(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{type:e._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(ac(t,e._jsonSchema))return new e(t.seconds,t.nanoseconds)}valueOf(){let e=this.seconds-oc;return String(e).padStart(12,`0`)+`.`+String(this.nanoseconds).padStart(9,`0`)}};V._jsonSchemaVersion=`firestore/timestamp/1.0`,V._jsonSchema={type:B(`string`,V._jsonSchemaVersion),seconds:B(`number`),nanoseconds:B(`number`)};var H=class e{static fromTimestamp(t){return new e(t)}static min(){return new e(new V(0,0))}static max(){return new e(new V(253402300799,999999999))}constructor(e){this.timestamp=e}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}},cc=-1,lc=class{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}};lc.UNKNOWN_ID=-1;function uc(e,t){let n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1;
9return new fc(H.fromTimestamp(r===1e9?new V(n+1,0):new V(n,r)),z.empty(),t)}function dc(e){return new fc(e.readTime,e.key,cc)}var fc=class e{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new e(H.min(),z.empty(),cc)}static max(){return new e(H.max(),z.empty(),cc)}};function pc(e,t){let n=e.readTime.compareTo(t.readTime);return n===0?(n=z.comparator(e.documentKey,t.documentKey),n===0?L(e.largestBatchId,t.largestBatchId):n):n}var mc=`The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.`,hc=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function gc(e){if(e.code!==F.FAILED_PRECONDITION||e.message!==mc)throw e;j(`LocalStore`,`Unexpectedly lost primary lease`)}var U=class e{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(t,n){return this.callbackAttached&&M(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(((e,r)=>{this.nextCallback=n=>{this.wrapSuccess(t,n).next(e,r)},this.catchCallback=t=>{this.wrapFailure(n,t).next(e,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(t){try{let n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}wrapSuccess(t,n){return t?this.wrapUserFunction((()=>t(n))):e.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction((()=>t(n))):e.reject(n)}static resolve(t){return new e(((e,n)=>{e(t)}))}static reject(t){return new e(((e,n)=>{n(t)}))}static waitFor(t){return new e(((e,n)=>{let r=0,i=0,a=!1;t.forEach((t=>{++r,t.next((()=>{++i,a&&i===r&&e()}),(e=>n(e)))})),a=!0,i===r&&e()}))}static or(t){let n=e.resolve(!1);for(let r of t)n=n.next((t=>t?e.resolve(t):r()));return n}static forEach(e,t){let n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(t,n){return new e(((e,r)=>{let i=t.length,a=Array(i),o=0;for(let s=0;s<i;s++){let c=s;n(t[c]).next((t=>{a[c]=t,++o,o===i&&e(a)}),(e=>r(e)))}}))}static doWhile(t,n){return new e(((e,r)=>{let i=()=>{!0===t()?n().next((()=>{i()}),r):e()};i()}))}};function _c(e){let t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(`.`).slice(0,2).join(`.`):`-1`;return Number(n)}function vc(e){return e.name===`IndexedDbTransactionError`}var yc=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};yc.ce=-1;var bc=-1;function xc(e){return e==null}function Sc(e){return e===0&&1/e==-1/0}function Cc(e){return typeof e==`number`&&Number.isInteger(e)&&!Sc(e)&&e<=2**53-1&&e>=-(2**53-1)}var wc=`�`;function Tc(e){let t=``;for(let n=0;n<e.length;n++)t.length>0&&(t=Dc(t)),t=Ec(e.get(n),t);return Dc(t)}function Ec(e,t){let n=t,r=e.length;for(let t=0;t<r;t++){let r=e.charAt(t);switch(r){case`\0`:n+=`��`;break;case wc:n+=`��`;break;default:n+=r}}return n}function Dc(e){return e+`��`}function Oc(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function kc(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Ac(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var W=class e{constructor(e,t){this.comparator=e,this.root=t||Mc.EMPTY}insert(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,Mc.BLACK,null,null))}remove(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Mc.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();
vendor: 4,296 bytes, line 9
9){let n=this.comparator(e,t.key);if(n===0)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 r=this.comparator(e,n.key);if(r===0)return t+n.left.size;r<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 jc(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new jc(this.root,e,this.comparator,!1)}getReverseIterator(){return new jc(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new jc(this.root,e,this.comparator,!0)}},jc=class{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){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(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},Mc=class e{constructor(t,n,r,i,a){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??e.EMPTY,this.right=a??e.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,r,i,a){return new e(t??this.key,n??this.value,r??this.color,i??this.left,a??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 r=this,i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):i===0?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return e.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(t,i.key)===0){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}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.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){let t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}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 2**this.check()<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw M(43730,{key:this.key,value:this.value});if(this.right.isRed())throw M(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw M(27949);return e+ +!this.isRed()}};
9Mc.EMPTY=null,Mc.RED=!0,Mc.BLACK=!1,Mc.EMPTY=new class{constructor(){this.size=0}get key(){throw M(57766)}get value(){throw M(16141)}get color(){throw M(16727)}get left(){throw M(29726)}get right(){throw M(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new Mc(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}};var Nc=class e{constructor(e){this.comparator=e,this.data=new W(this.comparator)}has(e){return this.data.get(e)!==null}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 r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=t===void 0?this.data.getIterator():this.data.getIteratorFrom(t);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 Pc(this.data.getIterator())}getIteratorFrom(e){return new Pc(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(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.data.getIterator(),r=t.data.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(this.comparator(e,t)!==0)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(t){let n=new e(this.comparator);return n.data=t,n}},Pc=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}},Fc=class e{constructor(e){this.fields=e,e.sort(Xs.comparator)}static empty(){return new e([])}
vendor: 14,658 bytes, line 9
9unionWith(t){let n=new Nc(Xs.comparator);for(let e of this.fields)n=n.add(e);for(let e of t)n=n.add(e);return new e(n.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Ks(this.fields,e.fields,((e,t)=>e.isEqual(t)))}},Ic=class extends Error{constructor(){super(...arguments),this.name=`Base64DecodeError`}},Lc=class e{constructor(e){this.binaryString=e}static fromBase64String(t){let n=function(e){try{return atob(e)}catch(e){throw typeof DOMException<`u`&&e instanceof DOMException?new Ic(`Invalid base64 string: `+e):e}}(t);return new e(n)}static fromUint8Array(t){let n=function(e){let t=``;for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}[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 function(e){return btoa(e)}(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 L(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Lc.EMPTY_BYTE_STRING=new Lc(``);var Rc=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function zc(e){if(N(!!e,39018),typeof e==`string`){let t=0,n=Rc.exec(e);if(N(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+`000000000`).substr(0,9),t=Number(e)}let r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:G(e.seconds),nanos:G(e.nanos)}}function G(e){return typeof e==`number`?e:typeof e==`string`?Number(e):0}function Bc(e){return typeof e==`string`?Lc.fromBase64String(e):Lc.fromUint8Array(e)}var Vc=`server_timestamp`,Hc=`__type__`,Uc=`__previous_value__`,Wc=`__local_write_time__`;function Gc(e){return(e?.mapValue?.fields||{})[Hc]?.stringValue===Vc}function Kc(e){let t=e.mapValue.fields[Uc];return Gc(t)?Kc(t):t}function qc(e){let t=zc(e.mapValue.fields[Wc].timestampValue);return new V(t.seconds,t.nanos)}var Jc=class{constructor(e,t,n,r,i,a,o,s,c,l,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=o,this.longPollingOptions=s,this.useFetchStreams=c,this.isUsingEmulator=l,this.apiKey=u}},Yc=`(default)`,Xc=class e{constructor(e,t){this.projectId=e,this.database=t||Yc}static empty(){return new e(``,``)}get isDefaultDatabase(){return this.database===Yc}isEqual(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}};function Zc(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,[`projectId`]))throw new I(F.INVALID_ARGUMENT,`"projectId" not provided in firebase.initializeApp.`);return new Xc(e.options.projectId,t)}var Qc=`__type__`,$c=`__max__`,el={mapValue:{fields:{__type__:{stringValue:$c}}}},tl=`__vector__`,nl=`value`;function rl(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?Gc(e)?4:bl(e)?9007199254740991:vl(e)?10:11:M(28295,{value:e})}function il(e,t){if(e===t)return!0;let n=rl(e);if(n!==rl(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return qc(e).isEqual(qc(t));case 3:return function(e,t){if(typeof e.timestampValue==`string`&&typeof t.timestampValue==`string`&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=zc(e.timestampValue),r=zc(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Bc(e.bytesValue).isEqual(Bc(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return G(e.geoPointValue.latitude)===G(t.geoPointValue.latitude)&&G(e.geoPointValue.longitude)===G(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if(`integerValue`in e&&`integerValue`in t)return G(e.integerValue)===G(t.integerValue);if(`doubleValue`in e&&`doubleValue`in t){let n=G(e.doubleValue),r=G(t.doubleValue);return n===r?Sc(n)===Sc(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Ks(e.arrayValue.values||[],t.arrayValue.values||[],il);case 10:case 11:return function(e,t){let n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(Oc(n)!==Oc(r))return!1;for(let e in n)if(n.hasOwnProperty(e)&&(r[e]===void 0||!il(n[e],r[e])))return!1;return!0}(e,t);default:return M(52216,{left:e})}}function al(e,t){return(e.values||[]).find((e=>il(e,t)))!==void 0}function ol(e,t){if(e===t)return 0;let n=rl(e),r=rl(t);if(n!==r)return L(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return L(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=G(e.integerValue||e.doubleValue),r=G(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return sl(e.timestampValue,t.timestampValue);case 4:return sl(qc(e),qc(t));case 5:return Hs(e.stringValue,t.stringValue);case 6:return function(e,t){let n=Bc(e),r=Bc(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split(`/`),r=t.split(`/`);for(let e=0;e<n.length&&e<r.length;e++){let t=L(n[e],r[e]);if(t!==0)return t}return L(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=L(G(e.latitude),G(t.latitude));return n===0?L(G(e.longitude),G(t.longitude)):n}(e.geoPointValue,t.geoPointValue);case 9:return cl(e.arrayValue,t.arrayValue);case 10:return function(e,t){let n=e.fields||{},r=t.fields||{},i=n[nl]?.arrayValue,a=r[nl]?.arrayValue,o=L(i?.values?.length||0,a?.values?.length||0);return o===0?cl(i,a):o}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===el.mapValue&&t===el.mapValue)return 0;if(e===el.mapValue)return 1;if(t===el.mapValue)return-1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(let e=0;e<r.length&&e<a.length;++e){let t=Hs(r[e],a[e]);if(t!==0)return t;let o=ol(n[r[e]],i[a[e]]);if(o!==0)return o}return L(r.length,a.length)}(e.mapValue,t.mapValue);default:throw M(23264,{he:n})}}function sl(e,t){if(typeof e==`string`&&typeof t==`string`&&e.length===t.length)return L(e,t);let n=zc(e),r=zc(t),i=L(n.seconds,r.seconds);return i===0?L(n.nanos,r.nanos):i}function cl(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=ol(n[e],r[e]);if(t)return t}return L(n.length,r.length)}function ll(e){return ul(e)}function ul(e){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=zc(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):`stringValue`in e?e.stringValue:`bytesValue`in e?function(e){return Bc(e).toBase64()}(e.bytesValue):`referenceValue`in e?function(e){return z.fromName(e).toString()}(e.referenceValue):`geoPointValue`in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):`arrayValue`in e?function(e){let t=`[`,n=!0;for(let r of e.values||[])n?n=!1:t+=`,`,t+=ul(r);return t+`]`}(e.arrayValue):`mapValue`in e?function(e){let t=Object.keys(e.fields||{}).sort(),n=`{`,r=!0;for(let i of t)r?r=!1:n+=`,`,n+=`${i}:${ul(e.fields[i])}`;return n+`}`}(e.mapValue):M(61005,{value:e})}function dl(e){switch(rl(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let t=Kc(e);return t?16+dl(t):16;case 5:return 2*e.stringValue.length;case 6:return Bc(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce(((e,t)=>e+dl(t)),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return kc(e.fields,((e,n)=>{t+=e.length+dl(n)})),t}(e.mapValue);default:throw M(13486,{value:e})}}function fl(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function pl(e){return!!e&&`integerValue`in e}function ml(e){return!!e&&`arrayValue`in e}function hl(e){return!!e&&`nullValue`in e}function gl(e){return!!e&&`doubleValue`in e&&isNaN(Number(e.doubleValue))}function _l(e){return!!e&&`mapValue`in e}function vl(e){return(e?.mapValue?.fields||{})[Qc]?.stringValue===tl}function yl(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&typeof e.timestampValue==`object`)return{timestampValue:{...e.timestampValue}};if(e.mapValue){let t={mapValue:{fields:{}}};return kc(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=yl(n))),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=yl(e.arrayValue.values[n]);return t}return{...e}}function bl(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===$c}var xl=class e{constructor(e){this.value=e}static empty(){return new e({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!_l(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=yl(t)}setAll(e){let t=Xs.emptyPath(),n={},r=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=yl(e):r.push(i.lastSegment())}));let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());_l(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return il(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 r=t.mapValue.fields[e.get(n)];_l(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){kc(t,((t,n)=>e[t]=n));for(let t of n)delete e[t]}clone(){return new e(yl(this.value))}};function Sl(e){let t=[];return kc(e.fields,((e,n)=>{let r=new Xs([e]);if(_l(n)){let e=Sl(n.mapValue).fields;if(e.length===0)t.push(r);else for(let n of e)t.push(r.child(n))}else t.push(r)})),new Fc(t)}var Cl=class e{constructor(e,t,n,r,i,a,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=a,this.documentState=o}static newInvalidDocument(t){return new e(t,0,H.min(),H.min(),H.min(),xl.empty(),0)}static newFoundDocument(t,n,r,i){return new e(t,1,n,H.min(),r,i,0)}static newNoDocument(t,n){return new e(t,2,n,H.min(),H.min(),xl.empty(),0)}static newUnknownDocument(t,n){return new e(t,3,n,H.min(),H.min(),xl.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(H.min())||this.documentType!==2&&this.documentType!==0||(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=xl.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=xl.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=H.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new e(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}})`}},wl=class{constructor(e,t){this.position=e,this.inclusive=t}};function Tl(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let a=t[i],o=e.position[i];if(r=a.field.isKeyField()?z.comparator(z.fromName(o.referenceValue),n.key):ol(o,n.data.field(a.field)),a.dir===`desc`&&(r*=-1),r!==0)break}return r}function El(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!il(e.position[n],t.position[n]))return!1;return!0}var Dl=class{constructor(e,t=`asc`){this.field=e,this.dir=t}};function Ol(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var kl=class{},K=class e extends kl{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(t,n,r){return t.isKeyField()?n===`in`||n===`not-in`?this.createKeyFieldInFilter(t,n,r):new Ll(t,n,r):n===`array-contains`?new Vl(t,r):n===`in`?new Hl(t,r):n===`not-in`?new Ul(t,r):n===`array-contains-any`?new Wl(t,r):new e(t,n,r)}static createKeyFieldInFilter(e,t,n){return t===`in`?new Rl(e,n):new zl(e,n)}matches(e){let t=e.data.field(this.field);return this.op===`!=`?t!==null&&t.nullValue===void 0&&this.matchesComparison(ol(t,this.value)):t!==null&&rl(this.value)===rl(t)&&this.matchesComparison(ol(t,this.value))}matchesComparison(e){switch(this.op){case`<`:return e<0;case`<=`:return e<=0;case`==`:return e===0;case`!=`:return e!==0;case`>`:return e>0;case`>=`:return e>=0;default:return M(47266,{operator:this.op})}}isInequality(){return[`<`,`<=`,`>`,`>=`,`!=`,`not-in`].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},Al=class e extends kl{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(t,n){return new e(t,n)}matches(e){return jl(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}};function jl(e){return e.op===`and`}function Ml(e){return Nl(e)&&jl(e)}function Nl(e){for(let t of e.filters)if(t instanceof Al)return!1;return!0}function Pl(e){if(e instanceof K)return e.field.canonicalString()+e.op.toString()+ll(e.value);if(Ml(e))return e.filters.map((e=>Pl(e))).join(`,`);{let t=e.filters.map((e=>Pl(e))).join(`,`);
9return`${e.op}(${t})`}}function Fl(e,t){return e instanceof K?function(e,t){return t instanceof K&&e.op===t.op&&e.field.isEqual(t.field)&&il(e.value,t.value)}(e,t):e instanceof Al?function(e,t){return t instanceof Al&&e.op===t.op&&e.filters.length===t.filters.length?e.filters.reduce(((e,n,r)=>e&&Fl(n,t.filters[r])),!0):!1}(e,t):void M(19439)}function Il(e){return e instanceof K?function(e){return`${e.field.canonicalString()} ${e.op} ${ll(e.value)}`}(e):e instanceof Al?function(e){return e.op.toString()+` {`+e.getFilters().map(Il).join(` ,`)+`}`}(e):`Filter`}var Ll=class extends K{constructor(e,t,n){super(e,t,n),this.key=z.fromName(n.referenceValue)}matches(e){let t=z.comparator(e.key,this.key);return this.matchesComparison(t)}},Rl=class extends K{constructor(e,t){super(e,`in`,t),this.keys=Bl(`in`,t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}},zl=class extends K{constructor(e,t){super(e,`not-in`,t),this.keys=Bl(`not-in`,t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}};function Bl(e,t){return(t.arrayValue?.values||[]).map((e=>z.fromName(e.referenceValue)))}var Vl=class extends K{constructor(e,t){super(e,`array-contains`,t)}matches(e){let t=e.data.field(this.field);return ml(t)&&al(t.arrayValue,this.value)}},Hl=class extends K{constructor(e,t){super(e,`in`,t)}matches(e){let t=e.data.field(this.field);return t!==null&&al(this.value.arrayValue,t)}},Ul=class extends K{constructor(e,t){super(e,`not-in`,t)}matches(e){if(al(this.value.arrayValue,{nullValue:`NULL_VALUE`}))return!1;let t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!al(this.value.arrayValue,t)}},Wl=class extends K{constructor(e,t){super(e,`array-contains-any`,t)}matches(e){let t=e.data.field(this.field);return!(!ml(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>al(this.value.arrayValue,e)))}},Gl=class{constructor(e,t=null,n=[],r=[],i=null,a=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=a,this.endAt=o,this.Te=null}};function Kl(e,t=null,n=[],r=[],i=null,a=null,o=null){return new Gl(e,t,n,r,i,a,o)}function ql(e){let t=P(e);if(t.Te===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+=`|cg:`+t.collectionGroup),e+=`|f:`,e+=t.filters.map((e=>Pl(e))).join(`,`),e+=`|ob:`,e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(`,`),xc(t.limit)||(e+=`|l:`,e+=t.limit),t.startAt&&(e+=`|lb:`,e+=t.startAt.inclusive?`b:`:`a:`,e+=t.startAt.position.map((e=>ll(e))).join(`,`)),t.endAt&&(e+=`|ub:`,e+=t.endAt.inclusive?`a:`:`b:`,e+=t.endAt.position.map((e=>ll(e))).join(`,`)),t.Te=e}return t.Te}function Jl(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!Ol(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Fl(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!El(e.startAt,t.startAt)&&El(e.endAt,t.endAt)}function Yl(e){return z.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}var Xl=class{constructor(e,t=null,n=[],r=[],i=null,a=`F`,o=null,s=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=a,this.startAt=o,this.endAt=s,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}};function Zl(e,t,n,r,i,a,o,s){return new Xl(e,t,n,r,i,a,o,s)}function Ql(e){return new Xl(e)}function $l(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function eu(e){return z.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}function tu(e){return e.collectionGroup!==null}function nu(e){let t=P(e);if(t.Ie===null){t.Ie=[];let e=new Set;for(let n of t.explicitOrderBy)t.Ie.push(n),e.add(n.field.canonicalString());let n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:`asc`;(function(e){let t=new Nc(Xs.comparator);
9return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t})(t).forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.Ie.push(new Dl(r,n))})),e.has(Xs.keyField().canonicalString())||t.Ie.push(new Dl(Xs.keyField(),n))}return t.Ie}function ru(e){let t=P(e);return t.Ee||=iu(t,nu(e)),t.Ee}function iu(e,t){if(e.limitType===`F`)return Kl(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{let t=e.dir===`desc`?`asc`:`desc`;return new Dl(e.field,t)}));let n=e.endAt?new wl(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new wl(e.startAt.position,e.startAt.inclusive):null;return Kl(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function au(e,t){let n=e.filters.concat([t]);return new Xl(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function ou(e,t){let n=e.explicitOrderBy.concat([t]);return new Xl(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}function su(e,t,n){return new Xl(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function cu(e,t){return new Xl(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,t,e.endAt)}function lu(e,t){return Jl(ru(e),ru(t))&&e.limitType===t.limitType}function uu(e){return`${ql(ru(e))}|lt:${e.limitType}`}function du(e){return`Query(target=${function(e){let t=e.path.canonicalString();return e.collectionGroup!==null&&(t+=` collectionGroup=`+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>Il(e))).join(`, `)}]`),xc(e.limit)||(t+=`, limit: `+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(`, `)}]`),e.startAt&&(t+=`, startAt: `,t+=e.startAt.inclusive?`b:`:`a:`,t+=e.startAt.position.map((e=>ll(e))).join(`,`)),e.endAt&&(t+=`, endAt: `,t+=e.endAt.inclusive?`a:`:`b:`,t+=e.endAt.position.map((e=>ll(e))).join(`,`)),`Target(${t})`}(ru(e))}; limitType=${e.limitType})`}function fu(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return e.collectionGroup===null?z.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n):t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n)}(e,t)&&function(e,t){for(let n of nu(e))if(!n.field.isKeyField()&&t.data.field(n.field)===null)return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){let r=Tl(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,nu(e),t)||e.endAt&&!function(e,t,n){let r=Tl(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,nu(e),t))}(e,t)}function pu(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function mu(e){return(t,n)=>{let r=!1;for(let i of nu(e)){let e=hu(i,t,n);if(e!==0)return e;r||=i.field.isKeyField()}return 0}}function hu(e,t,n){let r=e.field.isKeyField()?z.comparator(t.key,n.key):function(e,t,n){let r=t.data.field(e),i=n.data.field(e);return r!==null&&i!==null?ol(r,i):M(42886)}(e.field,t,n);switch(e.dir){case`asc`:return r;case`desc`:return-1*r;default:return M(19790,{direction:e.dir})}}var gu=class{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(n!==void 0){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return n.length===1?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){kc(this.inner,((t,n)=>{for(let[t,r]of n)e(t,r)}))}isEmpty(){return Ac(this.inner)}size(){return this.innerSize}},_u=new W(z.comparator);function vu(){return _u}var yu=new W(z.comparator);function bu(...e){let t=yu;for(let n of e)t=t.insert(n.key,n);return t}function xu(e){let t=yu;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function Su(){return wu()}function Cu(){return wu()}function wu(){return new gu((e=>e.toString()),((e,t)=>e.isEqual(t)))}var Tu=new W(z.comparator),Eu=new Nc(z.comparator);function q(...e){let t=Eu;for(let n of e)t=t.add(n);return t}var Du=new Nc(L);function Ou(){return Du}function ku(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:Sc(t)?`-0`:t}}function Au(e){return{integerValue:``+e}}function ju(e,t){return Cc(t)?Au(t):ku(e,t)}var Mu=class{constructor(){this._=void 0}};function Nu(e,t,n){return e instanceof Iu?function(e,t){let n={fields:{[Hc]:{stringValue:Vc},[Wc]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Gc(t)&&(t=Kc(t)),t&&(n.fields[Uc]=t),{mapValue:n}}(n,t):e instanceof Lu?Ru(e,t):e instanceof zu?Bu(e,t):function(e,t){let n=Fu(e,t),r=Hu(n)+Hu(e.Ae);return pl(n)&&pl(e.Ae)?Au(r):ku(e.serializer,r)}(e,t)}function Pu(e,t,n){return e instanceof Lu?Ru(e,t):e instanceof zu?Bu(e,t):n}function Fu(e,t){return e instanceof Vu?function(e){return pl(e)||function(e){return!!e&&`doubleValue`in e}(e)}(t)?t:{integerValue:0}:null}var Iu=class extends Mu{},Lu=class extends Mu{constructor(e){super(),this.elements=e}};function Ru(e,t){let n=Uu(t);for(let t of e.elements)n.some((e=>il(e,t)))||n.push(t);return{arrayValue:{values:n}}}var zu=class extends Mu{constructor(e){super(),this.elements=e}};function Bu(e,t){let n=Uu(t);for(let t of e.elements)n=n.filter((e=>!il(e,t)));return{arrayValue:{values:n}}}var Vu=class extends Mu{constructor(e,t){super(),this.serializer
vendor: 1,249 bytes, line 9
9=e,this.Ae=t}};function Hu(e){return G(e.integerValue||e.doubleValue)}function Uu(e){return ml(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var Wu=class{constructor(e,t){this.field=e,this.transform=t}};function Gu(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Lu&&t instanceof Lu||e instanceof zu&&t instanceof zu?Ks(e.elements,t.elements,il):e instanceof Vu&&t instanceof Vu?il(e.Ae,t.Ae):e instanceof Iu&&t instanceof Iu}(e.transform,t.transform)}var Ku=class{constructor(e,t){this.version=e,this.transformResults=t}},qu=class e{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new e}static exists(t){return new e(void 0,t)}static updateTime(t){return new e(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function Ju(e,t){return e.updateTime===void 0?e.exists===void 0||e.exists===t.isFoundDocument():t.isFoundDocument()&&t.version.isEqual(e.updateTime)}var Yu=class{};function Xu(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new od(e.key,qu.none()):new td(e.key,e.data,qu.none());
9{let n=e.data,r=xl.empty(),i=new Nc(Xs.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);t===null&&e.length>1&&(e=e.popLast(),t=n.field(e)),t===null?r.delete(e):r.set(e,t),i=i.add(e)}return new nd(e.key,r,new Fc(i.toArray()),qu.none())}}function Zu(e,t,n){e instanceof td?function(e,t,n){let r=e.value.clone(),i=id(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof nd?function(e,t,n){if(!Ju(e.precondition,t))return void t.convertToUnknownDocument(n.version);let r=id(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(rd(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Qu(e,t,n,r){return e instanceof td?function(e,t,n,r){if(!Ju(e.precondition,t))return n;let i=e.value.clone(),a=ad(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof nd?function(e,t,n,r){if(!Ju(e.precondition,t))return n;let i=ad(e.fieldTransforms,r,t),a=t.data;return a.setAll(rd(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),n===null?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return Ju(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function $u(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=Fu(r.transform,e||null);i!=null&&(n===null&&(n=xl.empty()),n.set(r.field,i))}return n||null}function ed(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return e===void 0&&t===void 0||!(!e||!t)&&Ks(e,t,((e,t)=>Gu(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var td=class extends Yu{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}},nd=class extends Yu{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function rd(e){let t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){let r=e.data.field(n);t.set(n,r)}})),t}function id(e,t,n){let r=new Map;N(e.length===n.length,32656,{Ve:n.length,de:e.length});for(let i=0;i<n.length;i++){let a=e[i],o=a.transform,s=t.data.field(a.field);r.set(a.field,Pu(o,s,n[i]))}return r}function ad(e,t,n){let r=new Map;for(let i of e){let e=i.transform,a=n.data.field(i.field);r.set(i.field,Nu(e,a,t))}return r}var od=class extends Yu{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},sd=class extends Yu{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}},cd=class{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];r.key.isEqual(e.key)&&Zu(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=Qu(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=Qu(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=Cu();return this.mutations.forEach((r=>{let i=e.get(r.key),a=i.overlayedDocument,o=this.applyToLocalView(a,i.mutatedFields);o=t.has(r.key)?null:o;let s=Xu(a,o);s!==null&&n.set(r.key,s),a.isValidDocument()||a.convertToNoDocument(H.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),q())}isEqual(e){return this.batchId===e.batchId&&Ks(this.mutations,e.mutations,((e,t)=>ed(e,t)))&&Ks(this.baseMutations,e.baseMutations,((e,t)=>ed(e,t)))}},ld=class e{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(t,n,r){N(t.mutations.length===r.length,58842,{me:t.mutations.length,fe:r.length});let i=function(){return Tu}(),a=t.mutations;for(let e=0;e<a.length;e++)i=i.insert(a[e].key,r[e].version);return new e(t,n,r,i)}},ud=class{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{\n      largestBatchId: ${this.largestBatchId},\n      mutation: ${this.mutation.toString()}\n    }`}},dd=class{constructor(e,t){this.count=e,this.unchangedNames=t}},J,Y;function fd(e){switch(e){case F.OK:return M(64938);case F.CANCELLED:case F.UNKNOWN:case F.DEADLINE_EXCEEDED:case F.RESOURCE_EXHAUSTED:case F.INTERNAL:case F.UNAVAILABLE:case F.UNAUTHENTICATED:return!1;case F.INVALID_ARGUMENT:case F.NOT_FOUND:case F.ALREADY_EXISTS:case F.PERMISSION_DENIED:case F.FAILED_PRECONDITION:case F.ABORTED:case F.OUT_OF_RANGE:case F.UNIMPLEMENT
vendor: 6,506 bytes, line 9
9ED:case F.DATA_LOSS:return!0;default:return M(15467,{code:e})}}function pd(e){if(e===void 0)return Ds(`GRPC error has no .code`),F.UNKNOWN;switch(e){case J.OK:return F.OK;case J.CANCELLED:return F.CANCELLED;case J.UNKNOWN:return F.UNKNOWN;case J.DEADLINE_EXCEEDED:return F.DEADLINE_EXCEEDED;case J.RESOURCE_EXHAUSTED:return F.RESOURCE_EXHAUSTED;case J.INTERNAL:return F.INTERNAL;case J.UNAVAILABLE:return F.UNAVAILABLE;case J.UNAUTHENTICATED:return F.UNAUTHENTICATED;case J.INVALID_ARGUMENT:return F.INVALID_ARGUMENT;case J.NOT_FOUND:return F.NOT_FOUND;case J.ALREADY_EXISTS:return F.ALREADY_EXISTS;case J.PERMISSION_DENIED:return F.PERMISSION_DENIED;case J.FAILED_PRECONDITION:return F.FAILED_PRECONDITION;case J.ABORTED:return F.ABORTED;case J.OUT_OF_RANGE:return F.OUT_OF_RANGE;case J.UNIMPLEMENTED:return F.UNIMPLEMENTED;case J.DATA_LOSS:return F.DATA_LOSS;default:return M(39323,{code:e})}}(Y=J||={})[Y.OK=0]=`OK`,Y[Y.CANCELLED=1]=`CANCELLED`,Y[Y.UNKNOWN=2]=`UNKNOWN`,Y[Y.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,Y[Y.DEADLINE_EXCEEDED=4]=`DEADLINE_EXCEEDED`,Y[Y.NOT_FOUND=5]=`NOT_FOUND`,Y[Y.ALREADY_EXISTS=6]=`ALREADY_EXISTS`,Y[Y.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,Y[Y.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,Y[Y.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,Y[Y.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,Y[Y.ABORTED=10]=`ABORTED`,Y[Y.OUT_OF_RANGE=11]=`OUT_OF_RANGE`,Y[Y.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,Y[Y.INTERNAL=13]=`INTERNAL`,Y[Y.UNAVAILABLE=14]=`UNAVAILABLE`,Y[Y.DATA_LOSS=15]=`DATA_LOSS`;var md=null;function hd(){return new TextEncoder}var gd=new ds([4294967295,4294967295],0);function _d(e){let t=hd().encode(e),n=new fs;return n.update(t),new Uint8Array(n.digest())}function vd(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new ds([n,r],0),new ds([i,a],0)]}var yd=class e{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new bd(`Invalid padding: ${t}`);if(n<0||e.length>0&&this.hashCount===0)throw new bd(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new bd(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.pe=ds.fromNumber(this.ge)}ye(e,t,n){let r=e.add(t.multiply(ds.fromNumber(n)));return r.compare(gd)===1&&(r=new ds([r.getBits(0),r.getBits(1)],0)),r.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let[t,n]=vd(_d(e));for(let e=0;e<this.hashCount;e++){let r=this.ye(t,n,e);if(!this.we(r))return!1}return!0}static create(t,n,r){let i=t%8==0?0:8-t%8,a=new Uint8Array(Math.ceil(t/8)),o=new e(a,i,n);return r.forEach((e=>o.insert(e))),o}insert(e){if(this.ge===0)return;let[t,n]=vd(_d(e));for(let e=0;e<this.hashCount;e++){let r=this.ye(t,n,e);this.Se(r)}}Se(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}},bd=class extends Error{constructor(){super(...arguments),this.name=`BloomFilterError`}},xd=class e{constructor(e,t,n,r,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(t,n,r){let i=new Map;return i.set(t,Sd.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(H.min(),i,new W(L),vu(),q())}},Sd=class e{constructor(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,n,r){return new e(r,n,q(),q(),q())}},Cd=class{constructor(e,t,n,r){this.be=e,this.removedTargetIds=t,this.key=n,this.De=r}},wd=class{constructor(e,t){this.targetId=e,this.Ce=t}},Td=class{constructor(e,t,n=Lc.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}},Ed=class{constructor(){this.ve=0,this.Fe=kd(),this.Me=Lc.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=q(),t=q(),n=q();return this.Fe.forEach(((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:M(38017,{changeType:i})}})),new Sd(this.Me,this.xe,e,t,n)}Ke(){this.Oe=!1,this.Fe=kd()}qe(e,t){this.Oe=!0,this.Fe=this.Fe.insert(e,t)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){--this.ve,N(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}},Dd=class{constructor(e){this.Ge=e,this.ze=new Map,this.je=vu(),this.Je=Od(),this.He=Od(),this.Ze=new W(L)}Xe(e){for(let t of e.be)e.De&&e.De.isFoundDocument()?this.Ye(t,e.De):this.et(t,e.key,e.De);for(let t of e.removedTargetIds)this.et(t,e.key,e.De)}tt(e){this.forEachTarget(e,(t=>{let n=this.nt(t);switch(e.state){case 0:this.rt(t)&&n.Le(e.resumeToken);break;case 1:n.We(),n.Ne||n.Ke(),n.Le(e.resumeToken);break;case 2:n.We(),n.Ne||this.removeTarget(t);break;case 3:this.rt(t)&&(n.Qe(),n.Le(e.resumeToken));break;case 4:this.rt(t)&&(this.it(t),n.Le(e.resumeToken));break;default:M(56790,{state:e.state})}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ze.forEach(((e,n)=>{this.rt(n)&&t(n)}))}st(e){let t=e.targetId,n=e.Ce.count,r=this.ot(t);if(r){let i=r.target;if(Yl(i))if(n===0){let e=new z(i.path);this.et(t,e,Cl.newNoDocument(e,H.min()))}else N(n===1,20013,{expectedCount:n});else{let r=this._t(t);if(r!==n){let n=this.ut(e),i=n?this.ct(n,e,r):1;if(i!==0){this.it(t);let e=i===2?`TargetPurposeExistenceFilterMismatchBloom`:`TargetPurposeExistenceFilterMismatch`;this.Ze=this.Ze.insert(t,e)}md?.o(function(e,t,n,r,i){let a={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},o=t.unchangedNames;return o&&(a.bloomFilter={applied:i===0,hashCount:o?.hashCount??0,bitmapLength:o?.bits?.bitmap?.length??0,padding:o?.bits?.padding??0,mightContain:e=>r?.mightContain(e)??!1}),a}(r,e.Ce,this.Ge.ht(),n,i))}}}}ut(e){let t=e.Ce.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n=``,padding:r=0},hashCount:i=0}=t,a,o;try{a=Bc(n).toUint8Array()}catch(e){if(e instanceof Ic)return Os(`Decoding the base64 bloom filter in existence filter failed (`+e.message+`); ignoring the bloom filter and falling back to full re-query.`),null;throw e}try{o=new yd(a,r,i)}catch(e){return Os(e instanceof bd?`BloomFilter error: `:`Applying bloom filter failed: `,e),null}return o.ge===0?null:o}ct(e,t,n){return t.Ce.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){let n=this.Ge.getRemoteKeysForTarget(t),r=0;
9return n.forEach((n=>{let i=this.Ge.ht(),a=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;e.mightContain(a)||(this.et(t,n,null),r++)})),r}Tt(e){let t=new Map;this.ze.forEach(((n,r)=>{let i=this.ot(r);if(i){if(n.current&&Yl(i.target)){let t=new z(i.target.path);this.It(t).has(r)||this.Et(r,t)||this.et(r,t,Cl.newNoDocument(t,e))}n.Be&&(t.set(r,n.ke()),n.Ke())}}));let n=q();this.He.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{let t=this.ot(e);return!t||t.purpose===`TargetPurposeLimboResolution`||(r=!1,!1)})),r&&(n=n.add(e))})),this.je.forEach(((t,n)=>n.setReadTime(e)));let r=new xd(e,t,this.Ze,this.je,n);return this.je=vu(),this.Je=Od(),this.He=Od(),this.Ze=new W(L),r}Ye(e,t){if(!this.rt(e))return;let n=this.Et(e,t.key)?2:0;this.nt(e).qe(t.key,n),this.je=this.je.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.He=this.He.insert(t.key,this.Rt(t.key).add(e))}et(e,t,n){if(!this.rt(e))return;let r=this.nt(e);this.Et(e,t)?r.qe(t,1):r.Ue(t),this.He=this.He.insert(t,this.Rt(t).delete(e)),this.He=this.He.insert(t,this.Rt(t).add(e)),n&&(this.je=this.je.insert(t,n))}removeTarget(e){this.ze.delete(e)}_t(e){let t=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let t=this.ze.get(e);return t||(t=new Ed,this.ze.set(e,t)),t}Rt(e){let t=this.He.get(e);return t||(t=new Nc(L),this.He=this.He.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new Nc(L),this.Je=this.Je.insert(e,t)),t}rt(e){let t=this.ot(e)!==null;return t||j(`WatchChangeAggregator`,`Detected inactive target`,e),t}ot(e){let t=this.ze.get(e);return t&&t.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Ed),this.Ge.getRemoteKeysForTarget(e).forEach((t=>{this.et(e,t,null)}))}Et(e,t){return this.Ge.getRemoteKeysForTarget(e).has(t)}};function Od(){return new W(z.comparator)}function kd(){return new W(z.comparator)}var Ad={asc:`ASCENDING`,desc:`DESCENDING`},jd={"<":`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`},Md={and:`AND`,or:`OR`},Nd=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function Pd(e,t){return e.useProto3Json||xc(t)?t:{value:t}}function Fd(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 Id(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Ld(e,t){return Fd(e,t.toTimestamp())}function Rd(e){return N(!!e,49232),H.fromTimestamp(function(e){let t=zc(e);return new V(t.seconds,t.nanos)}(e))}function zd(e,t){return Bd(e,t).canonicalString()}function Bd(e,t){let n=function(e){return new R([`projects`,e.projectId,`databases`,e.database])}(e).child(`documents`);return t===void 0?n:n.child(t)}function Vd(e){let t=R.fromString(e);return N(df(t),10190,{key:t.toString()}),t}function Hd(e,t){return zd(e.databaseId,t.path)}function Ud(e,t){let n=Vd(t);if(n.get(1)!==e.databaseId.projectId)throw new I(F.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 I(F.INVALID_ARGUMENT,`Tried to deserialize key from different database: `+n.get(3)+` vs `+e.databaseId.database);return new z(qd(n))}function Wd(e,t){return zd(e.databaseId,t)}function Gd(e){let t=Vd(e);return t.length===4?R.emptyPath():qd(t)}function Kd(e){return new R([`projects`,e.databaseId.projectId,`databases`,e.databaseId.database]).canonicalString()}function qd(e){return N(e.length>4&&e.get(4)===`documents`,29091,{key:e.toString()}),e.popFirst(5)}function Jd(e,t,n){return{name:Hd(e,t),fields:n.value.mapValue.fields}}function Yd(e,t){let n;if(`targetChange`in t){t.targetChange;let r=function(e){return e===`NO_CHANGE`?0:e===`ADD`?1:e===`REMOVE`?2:e===`CURRENT`?3:e===`RESET`?4:M(39313,{state:e})}(t.targetChange.targetChangeType||`NO_CHANGE`),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(N(t===void 0||typeof t==`string`,58123),Lc.fromBase64String(t||``)):(N(t===void 0||t instanceof Buffer||t instanceof Uint8Array,16193),Lc.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause;n=new Td(r,i,a,o&&function(e){return new I(e.code===void 0?F.UNKNOWN:pd(e.code),e.message||``)}(o)||null)}else if(`documentChange`in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=Ud(e,r.document.name),a=Rd(r.document.updateTime),o=r.document.createTime?Rd(r.document.createTime):H.min(),s=new xl({mapValue:{fields:r.document.fields}}),c=Cl.newFoundDocument(i,a,o,s);n=new Cd(r.targetIds||[],r.removedTargetIds||[],c.key,c)}else if(`documentDelete`in t){t.documentDelete;let r=t.documentDelete;r.document;let i=Ud(e,r.document),a=r.readTime?Rd(r.readTime):H.min(),o=Cl.newNoDocument(i,a);n=new Cd([],r.removedTargetIds||[],o.key,o)}else if(`documentRemove`in t){t.documentRemove;let r=t.documentRemove;r.document;let i=Ud(e,r.document);n=new Cd([],r.removedTargetIds||[],i,null)}else{if(!(`filter`in t))return M(11601,{Vt:t});{t.filter;let e=t.filter;e.targetId;
9let{count:r=0,unchangedNames:i}=e,a=new dd(r,i),o=e.targetId;n=new wd(o,a)}}return n}function Xd(e,t){let n;if(t instanceof td)n={update:Jd(e,t.key,t.value)};else if(t instanceof od)n={delete:Hd(e,t.key)};else if(t instanceof nd)n={update:Jd(e,t.key,t.data),updateMask:uf(t.fieldMask)};else{if(!(t instanceof sd))return M(16599,{dt:t.type});n={verify:Hd(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){let n=t.transform;if(n instanceof Iu)return{fieldPath:t.field.canonicalString(),setToServerValue:`REQUEST_TIME`};if(n instanceof Lu)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof zu)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Vu)return{fieldPath:t.field.canonicalString(),increment:n.Ae};throw M(20930,{transform:t.transform})}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return t.updateTime===void 0?t.exists===void 0?M(27497):{exists:t.exists}:{updateTime:Ld(e,t.updateTime)}}(e,t.precondition)),n}function Zd(e,t){return e&&e.length>0?(N(t!==void 0,14353),e.map((e=>function(e,t){let n=e.updateTime?Rd(e.updateTime):Rd(t);return n.isEqual(H.min())&&(n=Rd(t)),new Ku(n,e.transformResults||[])}(e,t)))):[]}function Qd(e,t){return{documents:[Wd(e,t.path)]}}function $d(e,t){let n={structuredQuery:{}},r=t.path,i;t.collectionGroup===null?(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]):(i=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]),n.parent=Wd(e,i);let a=function(e){if(e.length!==0)return lf(Al.create(e,`and`))}(t.filters);a&&(n.structuredQuery.where=a);let o=function(e){if(e.length!==0)return e.map((e=>function(e){return{field:sf(e.field),direction:rf(e.dir)}}(e)))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);let s=Pd(e,t.limit);return s!==null&&(n.structuredQuery.limit=s),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{ft:n,parent:i}}function ef(e){let t=Gd(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){N(r===1,65062);let e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let a=[];n.where&&(a=function(e){let t=nf(e);return t instanceof Al&&Ml(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map((e=>function(e){return new Dl(cf(e.field),function(e){switch(e){case`ASCENDING`:return`asc`;case`DESCENDING`:return`desc`;default:return}}(e.direction))}(e)))}(n.orderBy));let s=null;n.limit&&(s=function(e){let t;return t=typeof e==`object`?e.value:e,xc(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){let t=!!e.before;return new wl(e.values||[],t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){let t=!e.before;return new wl(e.values||[],t)}(n.endAt)),Zl(t,i,o,a,s,`F`,c,l)}function tf(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 M(28987,{purpose:e})}}(t.purpose);return n==null?null:{"goog-listen-tags":n}}function nf(e){return e.unaryFilter===void 0?e.fieldFilter===void 0?e.compositeFilter===void 0?M(30097,{filter:e}):function(e){return Al.create(e.compositeFilter.filters.map((e=>nf(e))),function(e){switch(e){case`AND`:return`and`;case`OR`:return`or`;default:return M(1026)}}(e.compositeFilter.op))}(e):function(e){return K.create(cf(e.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`;case`OPERATOR_UNSPECIFIED`:return M(58110);default:return M(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):function(e){switch(e.unaryFilter.op){case`IS_NAN`:let t=cf(e.unaryFilter.field);return K.create(t,`==`,{doubleValue:NaN});case`IS_NULL`:let n=cf(e.unaryFilter.field);return K.create(n,`==`,{nullValue:`NULL_VALUE`});
9case`IS_NOT_NAN`:let r=cf(e.unaryFilter.field);return K.create(r,`!=`,{doubleValue:NaN});case`IS_NOT_NULL`:let i=cf(e.unaryFilter.field);return K.create(i,`!=`,{nullValue:`NULL_VALUE`});case`OPERATOR_UNSPECIFIED`:return M(61313);default:return M(60726)}}(e)}function rf(e){return Ad[e]}function af(e){return jd[e]}function of(e){return Md[e]}function sf(e){return{fieldPath:e.canonicalString()}}function cf(e){return Xs.fromServerFormat(e.fieldPath)}function lf(e){return e instanceof K?function(e){if(e.op===`==`){if(gl(e.value))return{unaryFilter:{field:sf(e.field),op:`IS_NAN`}};if(hl(e.value))return{unaryFilter:{field:sf(e.field),op:`IS_NULL`}}}else if(e.op===`!=`){if(gl(e.value))return{unaryFilter:{field:sf(e.field),op:`IS_NOT_NAN`}};if(hl(e.value))return{unaryFilter:{field:sf(e.field),op:`IS_NOT_NULL`}}}return{fieldFilter:{field:sf(e.field),op:af(e.op),value:e.value}}}(e):e instanceof Al?function(e){let t=e.getFilters().map((e=>lf(e)));return t.length===1?t[0]:{compositeFilter:{op:of(e.op),filters:t}}}(e):M(54877,{filter:e})}function uf(e){let t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function df(e){return e.length>=4&&e.get(0)===`projects`&&e.get(2)===`databases`}function ff(e){return!!e&&typeof e._toProto==`function`&&e._protoValueType===`ProtoValue`}var pf=class e{constructor(e,t,n,r,i=H.min(),a=H.min(),o=Lc.EMPTY_BYTE_STRING,s=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=o,this.expectedCount=s}withSequenceNumber(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}},mf=class{constructor(e){this.yt=e}};function hf(e){let t=ef({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType===`LAST`?su(t,t.limit,`L`):t}var gf=class{constructor(){}Dt(e,t){this.Ct(e,t),t.vt()}Ct(e,t){if(`nullValue`in e)this.Ft(t,5);else if(`booleanValue`in e)this.Ft(t,10),t.Mt(+!!e.booleanValue);else if(`integerValue`in e)this.Ft(t,15),t.Mt(G(e.integerValue));else if(`doubleValue`in e){let n=G(e.doubleValue);isNaN(n)?this.Ft(t,13):(this.Ft(t,15),Sc(n)?t.Mt(0):t.Mt(n))}else if(`timestampValue`in e){let n=e.timestampValue;this.Ft(t,20),typeof n==`string`&&(n=zc(n)),t.xt(`${n.seconds||``}`),t.Mt(n.nanos||0)}else if(`stringValue`in e)this.Ot(e.stringValue,t),this.Nt(t);else if(`bytesValue`in e)this.Ft(t,30),t.Bt(Bc(e.bytesValue)),this.Nt(t);else if(`referenceValue`in e)this.Lt(e.referenceValue,t);else if(`geoPointValue`in e){let n=e.geoPointValue;this.Ft(t,45),t.Mt(n.latitude||0),t.Mt(n.longitude||0)}else`mapValue`in e?bl(e)?this.Ft(t,2**53-1):vl(e)?this.kt(e.mapValue,t):(this.Kt(e.mapValue,t),this.Nt(t)):`arrayValue`in e?(this.qt(e.arrayValue,t),this.Nt(t)):M(19022,{Ut:e})}Ot(e,t){this.Ft(t,25),this.$t(e,t)}$t(e,t){t.xt(e)}Kt(e,t){let n=e.fields||{};this.Ft(t,55);for(let e of Object.keys(n))this.Ot(e,t),this.Ct(n[e],t)}kt(e,t){let n=e.fields||{};this.Ft(t,53);let r=nl,i=n[r].arrayValue?.values?.length||0;this.Ft(t,15),t.Mt(G(i)),this.Ot(r,t),this.Ct(n[r],t)}qt(e,t){let n=e.values||[];this.Ft(t,50);for(let e of n)this.Ct(e,t)}Lt(e,t){this.Ft(t,37),z.fromName(e).path.forEach((e=>{this.Ft(t,60),this.$t(e,t)}))}Ft(e,t){e.Mt(t)}Nt(e){e.Mt(2)}};gf.Wt=new gf;var _f=class{constructor(){this.bn=new vf}addToCollectionParentIndex(e,t){return this.bn.add(t),U.resolve()}getCollectionParents(e,t){return U.resolve(this.bn.getEntries(t))}addFieldIndex(e,t){return U.resolve()}deleteFieldIndex(e,t){return U.resolve()}deleteAllFieldIndexes(e){return U.resolve()}createTargetIndexes(e,t){return U.resolve()}getDocumentsMatchingTarget(e,t){return U.resolve(null)}getIndexType(e,t){return U.resolve(0)}getFieldIndexes(e,t){return U.resolve([])}getNextCollectionGroupToUpdate(e){return U.resolve(null)}getMinOffset(e,t){return U.resolve(fc.min())}getMinOffsetFromCollectionGroup(e,t){return U.resolve(fc.min())}updateCollectionGroup(e,t,n){return U.resolve()}updateIndexEntries(e,t){return U.resolve()}},vf=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Nc(R.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new Nc(R.comparator)).toArray()}},yf={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},bf=41943040,xf=class e{static withCacheSize(t){return new e(t,e.DEFAULT_COLLECTION_PE
9RCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}};xf.DEFAULT_COLLECTION_PERCENTILE=10,xf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,xf.DEFAULT=new xf(bf,xf.DEFAULT_COLLECTION_PERCENTILE,xf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),xf.DISABLED=new xf(-1,0,0);var Sf=class e{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new e(0)}static ar(){return new e(-1)}},Cf=`LruGarbageCollector`,wf=1048576;function Tf([e,t],[n,r]){let i=L(e,n);return i===0?L(t,r):i}var Ef=class{constructor(e){this.Pr=e,this.buffer=new Nc(Tf),this.Tr=0}Ir(){return++this.Tr}Er(e){let t=[e,this.Ir()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();Tf(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}},Df=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Ar(6e4)}stop(){this.Rr&&=(this.Rr.cancel(),null)}get started(){return this.Rr!==null}Ar(e){j(Cf,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay(`lru_garbage_collection`,e,(async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){vc(e)?j(Cf,`Ignoring IndexedDB error during garbage collection: `,e):await gc(e)}await this.Ar(3e5)}))}},Of=class{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.dr(e).next((e=>Math.floor(t/100*e)))}nthSequenceNumber(e,t){if(t===0)return U.resolve(yc.ce);let n=new Ef(t);return this.Vr.forEachTarget(e,(e=>n.Er(e.sequenceNumber))).next((()=>this.Vr.mr(e,(e=>n.Er(e))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.Vr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(j(`LruGarbageCollector`,`Garbage collection skipped; disabled`),U.resolve(yf)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(j(`LruGarbageCollector`,`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),yf):this.gr(e,t)))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,t){let n,r,i,a,o,s,c,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((t=>(t>this.params.maximumSequenceNumbersToCollect?(j(`LruGarbageCollector`,`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),this.nthSequenceNumber(e,r)))).next((r=>(n=r,o=Date.now(),this.removeTargets(e,n,t)))).next((t=>(i=t,s=Date.now(),this.removeOrphanedDocuments(e,n)))).next((e=>(c=Date.now(),Es()<=b.DEBUG&&j(`LruGarbageCollector`,`LRU Garbage Collection\n\tCounted targets in ${a-l}ms\n\tDetermined least recently used ${r} in `+(o-a)+`ms
10\tRemoved ${i} targets in `+(s-o)+`ms
11\tRemoved ${e} documents in `+(c-s)+`ms
12Total Duration: ${c-l}ms`),U.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e}))))}};function kf(e,t){return new Of(e,t)}var Af=class{constructor(){this.changes=new gu((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,Cl.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n===void 0?this.getFromCache(e,t):U.resolve(n)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}},jf=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}},Mf=class{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(n!==null&&Qu(n.mutation,e,Fc.empty(),V.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,q()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=q()){let r=Su();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=bu();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){let n=Su();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,q())))}populateOverlays(e,t,n){let r=[];
12return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=vu(),a=wu(),o=function(){return wu()}();return t.forEach(((e,t)=>{let o=n.get(t.key);r.has(t.key)&&(o===void 0||o.mutation instanceof nd)?i=i.insert(t.key,t):o===void 0?a.set(t.key,Fc.empty()):(a.set(t.key,o.mutation.getFieldMask()),Qu(o.mutation,t,o.mutation.getFieldMask(),V.now()))})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>a.set(e,t))),t.forEach(((e,t)=>o.set(e,new jf(t,a.get(e)??null)))),o)))}recalculateAndSaveOverlays(e,t){let n=wu(),r=new W(((e,t)=>e-t)),i=q();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(let i of e)i.keys().forEach((e=>{let a=t.get(e);if(a===null)return;let o=n.get(e)||Fc.empty();o=i.applyToLocalView(a,o),n.set(e,o);let s=(r.get(i.batchId)||q()).add(e);r=r.insert(i.batchId,s)}))})).next((()=>{let a=[],o=r.getReverseIterator();for(;o.hasNext();){let r=o.getNext(),s=r.key,c=r.value,l=Cu();c.forEach((e=>{if(!i.has(e)){let r=Xu(t.get(e),n.get(e));r!==null&&l.set(e,r),i=i.add(e)}})),a.push(this.documentOverlayCache.saveOverlays(e,s,l))}return U.waitFor(a)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return eu(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):tu(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{let a=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):U.resolve(Su()),o=cc,s=i;return a.next((t=>U.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?U.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{s=s.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,s,t,q()))).next((e=>({batchId:o,changes:xu(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new z(t)).next((e=>{let t=bu();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,a=bu();return this.indexManager.getCollectionParents(e,i).next((o=>U.forEach(o,(o=>{let s=function(e,t){return new Xl(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return this.getDocumentsMatchingCollectionQuery(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>{i.forEach(((t,n)=>{let r=n.getKey();e.get(r)===null&&(e=e.insert(r,Cl.newInvalidDocument(r)))}));let n=bu();return e.forEach(((e,r)=>{let a=i.get(e);a!==void 0&&Qu(a.mutation,r,Fc.empty(),V.now()),fu(t,r)&&(n=n.insert(e,r))})),n}))}},Nf=class{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,t){return U.resolve(this.Nr.get(t))}saveBundleMetadata(e,t){return this.Nr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Rd(e.createTime)}}(t)),U.resolve()}getNamedQuery(e,t){return U.resolve(this.Br.get(t))}saveNamedQuery(e,t){return this.Br.set(t.name,function(e){return{name:e.name,query:hf(e.bundledQuery),readTime:Rd(e.readTime)}}(t)),U.resolve()}},Pf=class{constructor(){this.overlays=new W(z.comparator),this.Lr=new Map}getOverlay(e,t){return U.resolve(this.overlays.get(t))}getOverlays(e,t){let n=Su();return U.forEach(t,(t=>this.getOverlay(e,t).next((e=>{e!==null&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.St(e,t,r)})),U.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.Lr.get(n);return r!==void 0&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.Lr.delete(n)),U.resolve()}getOverlaysForCollection(e,t,n){let r=Su(),i=t.length+1,a=new z(t.child(``)),o=this.overlays.getIteratorFrom(a);for(;o.hasNext();){let e=o.getNext().value,a=e.getKey();if(!t.isPrefixOf(a.path))break;a.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return U.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new W(((e,t)=>e-t)),a=this.overlays.getIterator();for(;a.hasNext();){let e=a.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);t===null&&(t=Su(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=Su(),s=i.getIterator();for(;s.hasNext()&&(s.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=r)););return U.resolve(o)}St(e,t,n){let r=this.overlays.get(n.key);if(r!==null){let e=this.Lr.get(r.largestBatchId).delete(n.key);this.Lr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new ud(t,n));let i=this.Lr.get(t);i===void 0&&(i=q(),this.Lr.set(t,i)),this.Lr.set(t,i.add(n.key))}},Ff=class{constructor(){this.sessionToken=Lc.EMPTY_BYTE_STRING}getSessionToken(e){return U.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,U.resolve()}},If=class{constructor(){this.kr=new Nc(X.Kr),this.qr=new Nc(X.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,t){let n=new X(e,t);this.kr=this.kr.add(n),this.qr=this.qr.add(n)}$r(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.Wr(new X(e,t))}Qr(e,t){e.forEach((e=>this.removeReference(e,t)))}Gr(e){let t=new z(new R([])),n=new X(t,e),r=new X(t,e+1),i=[];return this.qr.forEachInRange([n,r],(e=>{this.Wr(e),i.push(e.key)})),i}zr(){this.kr.forEach((e=>this.Wr(e)))}Wr(e){this.kr=this.kr.delete(e),this.qr=this.qr.delete(e)}jr(e){let t=new z(new R([])),n=new X(t,e),r=new X(t,e+1),i=q();return this.qr.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){let t=new X(e,0),n=this.kr.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},X=class{constructor(e,t){this.key=e,this.Jr=t}static Kr(e,t){return z.comparator(e.key,t.key)||L(e.Jr,t.Jr)}static Ur(e,t){return L(e.Jr,t.Jr)||z.comparator(e.key,t.key)}},Lf=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutation
12Queue=[],this.Yn=1,this.Hr=new Nc(X.Kr)}checkEmpty(e){return U.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,r){let i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new cd(i,t,n,r);this.mutationQueue.push(a);for(let t of r)this.Hr=this.Hr.add(new X(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return U.resolve(a)}lookupMutationBatch(e,t){return U.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,r=this.Xr(n),i=r<0?0:r;return U.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return U.resolve(this.mutationQueue.length===0?bc:this.Yn-1)}getAllMutationBatches(e){return U.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new X(t,0),r=new X(t,1/0),i=[];return this.Hr.forEachInRange([n,r],(e=>{let t=this.Zr(e.Jr);i.push(t)})),U.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Nc(L);return t.forEach((e=>{let t=new X(e,0),r=new X(e,1/0);this.Hr.forEachInRange([t,r],(e=>{n=n.add(e.Jr)}))})),U.resolve(this.Yr(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;z.isDocumentKey(i)||(i=i.child(``));let a=new X(new z(i),0),o=new Nc(L);return this.Hr.forEachWhile((e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.Jr)),!0)}),a),U.resolve(this.Yr(o))}Yr(e){let t=[];return e.forEach((e=>{let n=this.Zr(e);n!==null&&t.push(n)})),t}removeMutationBatch(e,t){N(this.ei(t.batchId,`removed`)===0,55003),this.mutationQueue.shift();let n=this.Hr;return U.forEach(t.mutations,(r=>{let i=new X(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.Hr=n}))}nr(e){}containsKey(e,t){let n=new X(t,0),r=this.Hr.firstAfterOrEqual(n);return U.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,U.resolve()}ei(e,t){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){let t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}},Rf=class{constructor(e){this.ti=e,this.docs=function(){return new W(z.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.ti(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,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 U.resolve(n?n.document.mutableCopy():Cl.newInvalidDocument(t))}getEntries(e,t){let n=vu();return t.forEach((e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Cl.newInvalidDocument(e))})),U.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=vu(),a=t.path,o=new z(a.child(`__id-9223372036854775808__`)),s=this.docs.getIteratorFrom(o);for(;s.hasNext();){let{key:e,value:{document:o}}=s.getNext();if(!a.isPrefixOf(e.path))break;e.path.length>a.length+1||pc(dc(o),n)<=0||(r.has(o.key)||fu(t,o))&&(i=i.insert(o.key,o.mutableCopy()))}return U.resolve(i)}getAllFromCollectionGroup(e,t,n,r){M(9500)}ni(e,t){return U.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new zf(this)}getSize(e){return U.resolve(this.size)}},zf=class extends Af{constructor(e){super(),this.Mr=e}applyChanges(e){let t=[];
vendor: 9,022 bytes, line 12
12return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.Mr.addEntry(e,r)):this.Mr.removeEntry(n)})),U.waitFor(t)}getFromCache(e,t){return this.Mr.getEntry(e,t)}getAllFromCache(e,t){return this.Mr.getEntries(e,t)}},Bf=class{constructor(e){this.persistence=e,this.ri=new gu((e=>ql(e)),Jl),this.lastRemoteSnapshotVersion=H.min(),this.highestTargetId=0,this.ii=0,this.si=new If,this.targetCount=0,this.oi=Sf._r()}forEachTarget(e,t){return this.ri.forEach(((e,n)=>t(n))),U.resolve()}getLastRemoteSnapshotVersion(e){return U.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return U.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),U.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.ii&&(this.ii=t),U.resolve()}lr(e){this.ri.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.oi=new Sf(t),this.highestTargetId=t),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,t){return this.lr(t),this.targetCount+=1,U.resolve()}updateTargetData(e,t){return this.lr(t),U.resolve()}removeTargetData(e,t){return this.ri.delete(t.target),this.si.Gr(t.targetId),--this.targetCount,U.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.ri.forEach(((a,o)=>{o.sequenceNumber<=t&&n.get(o.targetId)===null&&(this.ri.delete(a),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)})),U.waitFor(i).next((()=>r))}getTargetCount(e){return U.resolve(this.targetCount)}getTargetData(e,t){let n=this.ri.get(t)||null;return U.resolve(n)}addMatchingKeys(e,t,n){return this.si.$r(t,n),U.resolve()}removeMatchingKeys(e,t,n){this.si.Qr(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),U.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.si.Gr(t),U.resolve()}getMatchingKeysForTargetId(e,t){let n=this.si.jr(t);return U.resolve(n)}containsKey(e,t){return U.resolve(this.si.containsKey(t))}},Vf=class{constructor(e,t){this._i={},this.overlays={},this.ai=new yc(0),this.ui=!1,this.ui=!0,this.ci=new Ff,this.referenceDelegate=e(this),this.li=new Bf(this),this.indexManager=new _f,this.remoteDocumentCache=function(e){return new Rf(e)}((e=>this.referenceDelegate.hi(e))),this.serializer=new mf(t),this.Pi=new Nf(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Pf,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this._i[e.toKey()];return n||(n=new Lf(t,this.referenceDelegate),this._i[e.toKey()]=n),n}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,t,n){j(`MemoryPersistence`,`Starting transaction:`,e);let r=new Hf(this.ai.next());return this.referenceDelegate.Ti(),n(r).next((e=>this.referenceDelegate.Ii(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}Ei(e,t){return U.or(Object.values(this._i).map((n=>()=>n.containsKey(e,t))))}},Hf=class extends hc{constructor(e){super(),this.currentSequenceNumber=e}},Uf=class e{constructor(e){this.persistence=e,this.Ri=new If,this.Ai=null}static Vi(t){return new e(t)}get di(){if(this.Ai)return this.Ai;throw M(60996)}addReference(e,t,n){return this.Ri.addReference(n,t),this.di.delete(n.toString()),U.resolve()}removeReference(e,t,n){return this.Ri.removeReference(n,t),this.di.add(n.toString()),U.resolve()}markPotentiallyOrphaned(e,t){return this.di.add(t.toString()),U.resolve()}removeTarget(e,t){this.Ri.Gr(t.targetId).forEach((e=>this.di.add(e.toString())));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.di.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Ti(){this.Ai=new Set}Ii(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return U.forEach(this.di,(n=>{let r=z.fromPath(n);return this.mi(e,r).next((e=>{e||t.removeEntry(r,H.min())}))})).next((()=>(this.Ai=null,t.apply(e))))}updateLimboDocument(e,t){return this.mi(e,t).next((e=>{e?this.di.delete(t.toString()):this.di.add(t.toString())}))}hi(e){return 0}mi(e,t){return U.or([()=>U.resolve(this.Ri.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}},Wf=class e{constructor(e,t){this.persistence=e,this.fi=new gu((e=>Tc(e.path)),((e,t)=>e.isEqual(t))),this.garbageCollector=kf(this,t)}static Vi(t,n){return new e(t,n)}Ti(){}Ii(e){return U.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}dr(e){let t=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next((e=>t.next((t=>e+t))))}pr(e){let t=0;return this.mr(e,(e=>{t++})).next((()=>t))}mr(e,t){return U.forEach(this.fi,((n,r)=>this.wr(e,n,r).next((e=>e?U.resolve():t(r)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.ni(e,(r=>this.wr(e,r,t).next((e=>{e||(n++,i.removeEntry(r,H.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.fi.set(t,e.currentSequenceNumber),U.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.fi.set(n,e.currentSequenceNumber),U.resolve()}removeReference(e,t,n){return this.fi.set(n,e.currentSequenceNumber),U.resolve()}updateLimboDocument(e,t){return this.fi.set(t,e.currentSequenceNumber),U.resolve()}hi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=dl(e.data.value)),t}wr(e,t,n){return U.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.fi.get(t);return U.resolve(e!==void 0&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}},Gf=class e{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.Ts=n,this.Is=r}static Es(t,n){let r=q(),i=q();for(let e of n.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new e(t,n.fromCache,r,i)}},Kf=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}},qf=class{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return ce()?8:_c(_())>0?6:4}()}initialize(e,t){this.fs=e,this.indexManager=t,this.Rs=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.gs(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.ps(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;let n=new Kf;return this.ys(e,t,n).next((r=>{if(i.result=r,this.As)return this.ws(e,t,n,r.size)}))})).next((()=>i.result))}ws(e,t,n,r){return n.documentReadCount<this.Vs?(Es()<=b.DEBUG&&j(`QueryEngine`,`SDK will not create cache indexes for query:`,du(t),`since it only creates cache indexes for collection contains`,`more than or equal to`,this.Vs,`documents`),U.resolve()):(Es()<=b.DEBUG&&j(`QueryEngine`,`Query:`,du(t),`scans`,n.documentReadCount,`local documents and returns`,r,`documents as results.`),n.documentReadCount>this.ds*r?(Es()<=b.DEBUG&&j(`QueryEngine`,`The SDK decides to create cache indexes for query:`,du(t),`as using cache indexes may help improve performance.`),this.indexManager.createTargetIndexes(e,ru(t))):U.resolve())}gs(e,t){if($l(t))return U.resolve(null);let n=ru(t);return this.indexManager.getIndexType(e,n).next((r=>r===0?null:(t.limit!==null&&r===1&&(t=su(t,null,`F`),n=ru(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((r=>{let i=q(...r);return this.fs.getDocuments(e,i).next((r=>this.indexManager.getMinOffset(e,n).next((n=>{let a=this.Ss(t,r);return this.bs(t,a,i,n.readTime)?this.gs(e,su(t,null,`F`)):this.Ds(e,a,t,n)}))))})))))}ps(e,t,n,r){return $l(t)||r.isEqual(H.min())?U.resolve(null):this.fs.getDocuments(e,n).next((i=>{let a=this.Ss(t,i);return this.bs(t,a,n,r)?U.resolve(null):(Es()<=b.DEBUG&&j(`QueryEngine`,`Re-using previous result from %s to execute query: %s`,r.toString(),du(t)),this.Ds(e,a,t,uc(r,cc)).next((e=>e)))}))}Ss(e,t){let n=new Nc(mu(e));return t.forEach(((t,r)=>{fu(e,r)&&(n=n.add(r))})),n}bs(e,t,n,r){if(e.limit===null)return!1;if(n.size!==t.size)return!0;let i=e.limitType===`F`?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}ys(e,t,n){return Es()<=b.DEBUG&&j(`QueryEngine`,`Using full collection scan to execute query:`,du(t)),this.fs.getDocumentsMatchingQuery(e,t,fc.min(),n)}Ds(e,t,n,r){return this.fs.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}},Jf=`LocalStore`,Yf=3e8,Xf=class{constructor(e,t,n,r){this.persistence=e,this.Cs=t,this.serializer
12=r,this.vs=new W(L),this.Fs=new gu((e=>ql(e)),Jl),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(n)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Mf(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction(`Collect garbage`,`readwrite-primary`,(t=>e.collect(t,this.vs)))}};function Zf(e,t,n,r){return new Xf(e,t,n,r)}async function Qf(e,t){let n=P(e);return await n.persistence.runTransaction(`Handle user change`,`readonly`,(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n.Os(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{let i=[],a=[],o=q();for(let e of r){i.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}for(let e of t){a.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({Ns:e,removedBatchIds:i,addedBatchIds:a})))}))}))}function $f(e,t){let n=P(e);return n.persistence.runTransaction(`Acknowledge batch`,`readwrite-primary`,(e=>{let r=t.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){let i=n.batch,a=i.keys(),o=U.resolve();return a.forEach((e=>{o=o.next((()=>r.getEntry(t,e))).next((t=>{let a=n.docVersions.get(e);N(a!==null,48541),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),o.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=q();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,r)))}))}function ep(e){let t=P(e);return t.persistence.runTransaction(`Get last remote snapshot version`,`readonly`,(e=>t.li.getLastRemoteSnapshotVersion(e)))}function tp(e,t){let n=P(e),r=t.snapshotVersion,i=n.vs;return n.persistence.runTransaction(`Apply remote event`,`readwrite-primary`,(e=>{let a=n.xs.newChangeBuffer({trackRemovals:!0});i=n.vs;let o=[];
12t.targetChanges.forEach(((a,s)=>{let c=i.get(s);if(!c)return;o.push(n.li.removeMatchingKeys(e,a.removedDocuments,s).next((()=>n.li.addMatchingKeys(e,a.addedDocuments,s))));let l=c.withSequenceNumber(e.currentSequenceNumber);t.targetMismatches.get(s)===null?a.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(a.resumeToken,r)):l=l.withResumeToken(Lc.EMPTY_BYTE_STRING,H.min()).withLastLimboFreeSnapshotVersion(H.min()),i=i.insert(s,l),function(e,t,n){return e.resumeToken.approximateByteSize()===0||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=Yf?!0:n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,l,a)&&o.push(n.li.updateTargetData(e,l))}));let s=vu(),c=q();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(np(e,a,t.documentUpdates).next((e=>{s=e.Bs,c=e.Ls}))),!r.isEqual(H.min())){let t=n.li.getLastRemoteSnapshotVersion(e).next((t=>n.li.setTargetsMetadata(e,e.currentSequenceNumber,r)));o.push(t)}return U.waitFor(o).next((()=>a.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,s,c))).next((()=>s))})).then((e=>(n.vs=i,e)))}
12function np(e,t,n){let r=q(),i=q();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=vu();return n.forEach(((n,a)=>{let o=e.get(n);a.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(H.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!o.isValidDocument()||a.version.compareTo(o.version)>0||a.version.compareTo(o.version)===0&&o.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):j(Jf,`Ignoring outdated watch update for `,n,`. Current version:`,o.version,` Watch version:`,a.version)})),{Bs:r,Ls:i}}))}function rp(e,t){let n=P(e);return n.persistence.runTransaction(`Get next mutation batch`,`readonly`,(e=>(t===void 0&&(t=bc),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function ip(e,t){let n=P(e);return n.persistence.runTransaction(`Allocate target`,`readwrite`,(e=>{let r;return n.li.getTargetData(e,t).next((i=>i?(r=i,U.resolve(r)):n.li.allocateTargetId(e).next((i=>(r=new pf(t,i,`TargetPurposeListen`,e.currentSequenceNumber),n.li.addTargetData(e,r).next((()=>r)))))))})).then((e=>{let r=n.vs.get(e.targetId);return(r===null||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.vs=n.vs.insert(e.targetId,e),n.Fs.set(t,e.targetId)),e}))}async function ap(e,t,n){let r=P(e),i=r.vs.get(t),a=n?`readwrite`:`readwrite-primary`;try{n||await r.persistence.runTransaction(`Release target`,a,(e=>r.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!vc(e))throw e;j(Jf,`Failed to update sequence numbers for target ${t}: ${e}`)}r.vs=r.vs.remove(t),r.Fs.delete(i.target)}function op(e,t,n){let r=P(e),i=H.min(),a=q();return r.persistence.runTransaction(`Execute query`,`readwrite`,(e=>function(e,t,n){let r=P(e),i=r.Fs.get(n);return i===void 0?r.li.getTargetData(t,n):U.resolve(r.vs.get(i))}(r,e,ru(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(e,t.targetId).next((e=>{a=e}))})).next((()=>r.Cs.getDocumentsMatchingQuery(e,t,n?i:H.min(),n?a:q()))).next((e=>(sp(r,pu(t),e),{documents:e,ks:a})))))}
12function sp(e,t,n){let r=e.Ms.get(t)||H.min();n.forEach(((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)})),e.Ms.set(t,r)}var cp=class{constructor(){this.activeTargetIds=Ou()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},lp=class{constructor(){this.vo=new cp,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.vo.Qs(e),this.Fo[e]||`not-current`}updateQueryState(e,t,n){this.Fo[e]=t}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new cp,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}},up=class{Mo(e){}shutdown(){}},dp=`ConnectivityMonitor`,fp=class{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener(`online`,this.xo),window.removeEventListener(`offline`,this.No)}ko(){window.addEventListener(`online`,this.xo),window.addEventListener(`offline`,this.No)}Oo(){j(dp,`Network connectivity changed: AVAILABLE`);for(let e of this.Lo)e(0)}Bo(){j(dp,`Network connectivity changed: UNAVAILABLE`);for(let e of this.Lo)e(1)}static v(){return typeof window<`u`&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}},pp=null;function mp(){return pp===null?pp=function(){return 268435456+Math.round(2147483648*Math.random())}():pp++,`0x`+pp.toString(16)}var hp=`RestConnection`,gp={BatchGetDocuments:`batchGet`,Commit:`commit`,RunQuery:`runQuery`,RunAggregationQuery:`runAggregationQuery`,ExecutePipeline:`executePipeline`},_p=class{get Ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?`https`:`http`,n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.qo=t+`://`+e.host,this.Uo=`projects/${n}/databases/${r}`,this.$o=this.databaseId.database===Yc?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Wo(e,t,n,r,i){let a=mp(),o=this.Qo(e,t.toUriEncodedString());j(hp,`Sending RPC '${e}' ${a}:`,o,n);let s={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(s,r,i);let{host:c}=new URL(o),l=Te(c);return this.zo(e,o,s,n,l).then((t=>(j(hp,`Received RPC '${e}' ${a}: `,t),t)),(t=>{throw Os(hp,`RPC '${e}' ${a} failed with error: `,t,`url: `,o,`request:`,n),t}))}jo(e,t,n,r,i,a){return this.Wo(e,t,n,r,i)}Go(e,t,n){e[`X-Goog-Api-Client`]=function(){return`gl-js/ fire/`+Cs}(),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))}Qo(e,t){let n=gp[e],r=`${this.qo}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}},vp=class{constructor(e){this.Jo=e.Jo,this.Ho=e.Ho}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Ho()}send(e){this.Jo(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}},yp=`WebChannelConnection`,bp=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))},xp=class e extends _p{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){e.c_||=(bp(xs(),bs.STAT_EVENT,(e=>{e.stat===ys.PROXY?j(yp,`STAT_EVENT: detected buffering proxy`):e.stat===ys.NOPROXY&&j(yp,`STAT_EVENT: detected no buffering proxy`)})),!0)}zo(e,t,n,r,i){let a=mp();return new Promise(((i,o)=>{let s=new hs;s.setWithCredentials(!0),s.listenOnce(_s.COMPLETE,(()=>{try{switch(s.getLastErrorCode()){case vs.NO_ERROR:let t=s.getResponseJson();j(yp,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(t)),i(t);break;case vs.TIMEOUT:j(yp,`RPC '${e}' ${a} timed out`),o(new I(F.DEADLINE_EXCEEDED,`Request time out`));break;case vs.HTTP_ERROR:let n=s.getStatus();if(j(yp,`RPC '${e}' ${a} failed with status:`,n,`response text:`,s.getResponseText()),n>0){let e=s.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=e?.error;t&&t.status&&t.message?o(new I(function(e){let t=e.toLowerCase().replace(/_/g,`-`);return Object.values(F).indexOf(t)>=0?t:F.UNKNOWN}(t.status),t.message)):o(new I(F.UNKNOWN,`Server responded with status `+s.getStatus()))}else o(new I(F.UNAVAILABLE,`Connection failed.`));break;
12default:M(9055,{l_:e,streamId:a,h_:s.getLastErrorCode(),P_:s.getLastError()})}}finally{j(yp,`RPC '${e}' ${a} completed.`)}}));let c=JSON.stringify(r);j(yp,`RPC '${e}' ${a} sending request:`,r),s.send(t,`POST`,c,n,15)}))}T_(t,n,r){let i=mp(),a=[this.qo,`/`,`google.firestore.v1.Firestore`,`/`,t,`/channel`],o=this.createWebChannelTransport(),s={httpSessionIdParam:`gsessionid`,initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(s.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(s.useFetchStreams=!0),this.Go(s.initMessageHeaders,n,r),s.encodeInitMessageHeaders=!0;let l=a.join(``);j(yp,`Creating RPC '${t}' stream ${i}: ${l}`,s);let u=o.createWebChannel(l,s);this.I_(u);let d=!1,f=!1,p=new vp({Jo:e=>{f?j(yp,`Not sending because RPC '${t}' stream ${i} is closed:`,e):(d||=(j(yp,`Opening RPC '${t}' stream ${i} transport.`),u.open(),!0),j(yp,`RPC '${t}' stream ${i} sending:`,e),u.send(e))},Ho:()=>u.close()});return bp(u,gs.EventType.OPEN,(()=>{f||(j(yp,`RPC '${t}' stream ${i} transport opened.`),p.i_())})),bp(u,gs.EventType.CLOSE,(()=>{f||(f=!0,j(yp,`RPC '${t}' stream ${i} transport closed`),p.o_(),this.E_(u))})),bp(u,gs.EventType.ERROR,(e=>{f||(f=!0,Os(yp,`RPC '${t}' stream ${i} transport errored. Name:`,e.name,`Message:`,e.message),p.o_(new I(F.UNAVAILABLE,`The operation could not be completed`)))})),bp(u,gs.EventType.MESSAGE,(e=>{if(!f){let n=e.data[0];N(!!n,16349);let r=n,a=r?.error||r[0]?.error;if(a){j(yp,`RPC '${t}' stream ${i} received error:`,a);let e=a.status,n=function(e){let t=J[e];if(t!==void 0)return pd(t)}(e),r=a.message;e===`NOT_FOUND`&&r.includes(`database`)&&r.includes(`does not exist`)&&r.includes(this.databaseId.database)&&Os(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),n===void 0&&(n=F.INTERNAL,r=`Unknown error status: `+e+` with message `+a.message),f=!0,p.o_(new I(n,r)),u.close()}else j(yp,`RPC '${t}' stream ${i} received:`,n),p.__(n)}})),e.u_(),setTimeout((()=>{p.s_()}),0),p}terminate(){this.a_.forEach((e=>e.close())),this.a_=[]}I_(e){this.a_.push(e)}E_(e){this.a_=this.a_.filter((t=>t===e))}Go(e,t,n){super.Go(e,t,n),this.databaseInfo.apiKey&&(e[`x-goog-api-key`]=this.databaseInfo.apiKey)}createWebChannelTransport(){return Ss()}};function Sp(e){return new xp(e)}function Cp(){return typeof document<`u`?document:null}function wp(e){return new Nd(e,!0)}xp.c_=!1;var Tp=class{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Ci=e,this.timerId=t,this.R_=n,this.A_=r,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();let t=Math.floor(this.d_+this.y_()),n=Math.max(0,Date.now()-this.f_),r=Math.max(0,t-n);r>0&&j(`ExponentialBackoff`,`Backing off for ${r} ms (base delay: ${this.d_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,r,(()=>(this.f_=Date.now(),e()))),this.d_*=this.A_,this.d_<this.R_&&(this.d_=this.R_),this.d_>this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}},Ep=`PersistentStream`,Dp=class{constructor(e,t,n,r,i,a,o,s){this.Ci=e,this.S_=n,this.b_=r,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=o,this.listener=s,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new Tp(e,t)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state===4?this.N_():this.auth()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,(()=>this.k_())))}K_(e){this.q_(),this.stream.send(e)}
12async k_(){if(this.O_())return this.close(0)}q_(){this.C_&&=(this.C_.cancel(),null)}U_(){this.v_&&=(this.v_.cancel(),null)}async close(e,t){this.q_(),this.U_(),this.M_.cancel(),this.D_++,e===4?t&&t.code===F.RESOURCE_EXHAUSTED?(Ds(t.toString()),Ds(`Using maximum backoff delay to prevent overloading the backend.`),this.M_.g_()):t&&t.code===F.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()):this.M_.reset(),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(t)}W_(){}auth(){this.state=1;let e=this.Q_(this.D_),t=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.D_===t&&this.G_(e,n)}),(t=>{e((()=>{let e=new I(F.UNKNOWN,`Fetching auth token failed: `+t.message);return this.z_(e)}))}))}G_(e,t){let n=this.Q_(this.D_);this.stream=this.j_(e,t),this.stream.Zo((()=>{n((()=>this.listener.Zo()))})),this.stream.Yo((()=>{n((()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.Yo())))})),this.stream.t_((e=>{n((()=>this.z_(e)))})),this.stream.onMessage((e=>{n((()=>++this.F_==1?this.J_(e):this.onNext(e)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return j(Ep,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return t=>{this.Ci.enqueueAndForget((()=>this.D_===e?t():(j(Ep,`stream callback skipped by getCloseGuardedDispatcher.`),Promise.resolve())))}}},Op=class extends Dp{constructor(e,t,n,r,i,a){super(e,`listen_stream_connection_backoff`,`listen_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}j_(e,t){return this.connection.T_(`Listen`,e,t)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();let t=Yd(this.serializer,e),n=function(e){if(!(`targetChange`in e))return H.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?H.min():t.readTime?Rd(t.readTime):H.min()}(e);return this.listener.H_(t,n)}Z_(e){let t={};t.database=Kd(this.serializer),t.addTarget=function(e,t){let n,r=t.target;if(n=Yl(r)?{documents:Qd(e,r)}:{query:$d(e,r).ft},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Id(e,t.resumeToken);let r=Pd(e,t.expectedCount);r!==null&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(H.min())>0){n.readTime=Fd(e,t.snapshotVersion.toTimestamp());let r=Pd(e,t.expectedCount);r!==null&&(n.expectedCount=r)}return n}(this.serializer,e);let n=tf(this.serializer,e);n&&(t.labels=n),this.K_(t)}X_(e){let t={};t.database=Kd(this.serializer),t.removeTarget=e,this.K_(t)}},kp=class extends Dp{constructor(e,t,n,r,i,a){super(e,`write_stream_connection_backoff`,`write_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,t){return this.connection.T_(`Write`,e,t)}J_(e){return N(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,N(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){N(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();let t=Zd(e.writeResults,e.commitTime),n=Rd(e.commitTime);return this.listener.na(n,t)}ra(){let e={};e.database=Kd(this.serializer),this.K_(e)}ea(e){let t={streamToken:this.lastStreamToken,writes:e.map((e=>Xd(this.serializer,e)))};this.K_(t)}},Ap=class{},jp=class extends Ap{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.ia=!1}sa(){if(this.ia)throw new I(F.FAILED_PRECONDITION,`The client has already been terminated.`)}Wo(e,t,n,r){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Wo(e,Bd(t,n),r,i,a))).catch((e=>{throw e.name===`FirebaseError`?(e.code===F.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new I(F.UNKNOWN,e.toString())}))}jo(e,t,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,o])=>this.connection.jo(e,Bd(t,n),r,a,o,i))).catch((e=>{throw e.name===`FirebaseError`?(e.code===F.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new I(F.UNKNOWN,e.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}};function Mp(e,t,n,r){return new jp(e,t,n,r)}var Np=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state=`Unknown`,this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca(`Unknown`),this._a=this.asyncQueue.enqueueAfterDelay(`online_state_timeout`,1e4,(()=>(this._a=null,this.la(`Backend didn't respond within 10 seconds.`),this.ca(`Offline`),Promise.resolve()))))}ha(e){this.state===`Online`?this.ca(`Unknown`):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca(`Offline`)))}set(e){this.Pa(),this.oa=0,e===`Online`&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){let t=`Could not reach Cloud Firestore backend. ${e}\nThis 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.`;
12this.aa?(Ds(t),this.aa=!1):j(`OnlineStateTracker`,t)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}},Pp=`RemoteStore`,Fp=class{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Map,this.Ra=new Map,this.Aa=new Sf(1e3),this.Va=new Sf(1001),this.da=new Set,this.ma=[],this.fa=i,this.fa.Mo((e=>{n.enqueueAndForget((async()=>{Gp(this)&&(j(Pp,`Restarting streams for network reachability change.`),await async function(e){let t=P(e);t.da.add(4),await Lp(t),t.ga.set(`Unknown`),t.da.delete(4),await Ip(t)}(this))}))})),this.ga=new Np(n,r)}};async function Ip(e){if(Gp(e))for(let t of e.ma)await t(!0)}async function Lp(e){for(let t of e.ma)await t(!1)}function Rp(e,t){return e.Ea.get(t)||void 0}function zp(e,t){let n=P(e),r=Rp(n,t.targetId);if(r!==void 0&&n.Ia.has(r))return;let i=function(e,t){let n=Rp(e,t);n!==void 0&&e.Ra.delete(n);let r=function(e,t){return t%2==0?e.Aa.next():e.Va.next()}(e,t);return e.Ea.set(t,r),e.Ra.set(r,t),r}(n,t.targetId);j(Pp,`remoteStoreListen mapping SDK target ID to remote`,t.targetId,i);let a=new pf(t.target,i,t.purpose,t.sequenceNumber,t.snapshotVersion,t.lastLimboFreeSnapshotVersion,t.resumeToken);n.Ia.set(i,a),Wp(n)?Up(n):um(n).O_()&&Vp(n,a)}function Bp(e,t){let n=P(e),r=um(n),i=Rp(n,t);j(Pp,`remoteStoreUnlisten removing mapping of SDK target ID to remote`,t,i),n.Ia.delete(i),n.Ea.delete(t),n.Ra.delete(i),r.O_()&&Hp(n,i),n.Ia.size===0&&(r.O_()?r.L_():Gp(n)&&n.ga.set(`Unknown`))}function Vp(e,t){if(e.pa.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(H.min())>0){let n=e.Ra.get(t.targetId);if(n===void 0)return void j(Pp,`SDK target ID not found for remote ID: `+t.targetId);let r=e.remoteSyncer.getRemoteKeysForTarget(n).size;t=t.withExpectedCount(r)}um(e).Z_(t)}function Hp(e,t){e.pa.$e(t),um(e).X_(t)}function Up(e){e.pa=new Dd({getRemoteKeysForTarget:t=>{let n=e.Ra.get(t);return n===void 0?q():e.remoteSyncer.getRemoteKeysForTarget(n)},At:t=>e.Ia.get(t)||null,ht:()=>e.datastore.serializer.databaseId}),um(e).start(),e.ga.ua()}function Wp(e){return Gp(e)&&!um(e).x_()&&e.Ia.size>0}function Gp(e){return P(e).da.size===0}function Kp(e){e.pa=void 0}async function qp(e){e.ga.set(`Online`)}async function Jp(e){e.Ia.forEach(((t,n)=>{Vp(e,t)}))}async function Yp(e,t){Kp(e),Wp(e)?(e.ga.ha(t),Up(e)):e.ga.set(`Unknown`)}async function Xp(e,t,n){if(e.ga.set(`Online`),t instanceof Td&&t.state===2&&t.cause)try{await async function(e,t){let n=t.cause;for(let r of t.targetIds){if(e.Ia.has(r)){let t=e.Ra.get(r);t!==void 0&&(await e.remoteSyncer.rejectListen(t,n),e.Ea.delete(t),e.Ra.delete(r)),e.Ia.delete(r)}e.pa.removeTarget(r)}}(e,t)}catch(n){j(Pp,`Failed to remove targets %s: %s `,t.targetIds.join(`,`),n),await Zp(e,n)}else if(t instanceof Cd?e.pa.Xe(t):t instanceof wd?e.pa.st(t):e.pa.tt(t),!n.isEqual(H.min()))try{let t=await ep(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.pa.Tt(t);
12n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){let i=e.Ia.get(r);i&&e.Ia.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{let r=e.Ia.get(t);r&&(e.Ia.set(t,r.withResumeToken(Lc.EMPTY_BYTE_STRING,r.snapshotVersion)),Hp(e,t),Vp(e,new pf(r.target,t,n,r.sequenceNumber)))}));let r=function(e,t){let n=new Map;t.targetChanges.forEach(((t,r)=>{let i=e.Ra.get(r);i!==void 0&&n.set(i,t)}));let r=new W(L);return t.targetMismatches.forEach(((t,n)=>{let i=e.Ra.get(t);i!==void 0&&(r=r.insert(i,n))})),new xd(t.snapshotVersion,n,r,t.documentUpdates,t.resolvedLimboDocuments)}(e,n);return e.remoteSyncer.applyRemoteEvent(r)}(e,n)}catch(t){j(Pp,`Failed to raise snapshot:`,t),await Zp(e,t)}}async function Zp(e,t,n){if(!vc(t))throw t;e.da.add(1),await Lp(e),e.ga.set(`Offline`),n||=()=>ep(e.localStore),e.asyncQueue.enqueueRetryable((async()=>{j(Pp,`Retrying IndexedDB access`),await n(),e.da.delete(1),await Ip(e)}))}function Qp(e,t){return t().catch((n=>Zp(e,n,t)))}async function $p(e){let t=P(e),n=dm(t),r=t.Ta.length>0?t.Ta[t.Ta.length-1].batchId:bc;for(;em(t);)try{let e=await rp(t.localStore,r);if(e===null){t.Ta.length===0&&n.L_();break}r=e.batchId,tm(t,e)}catch(e){await Zp(t,e)}nm(t)&&rm(t)}function em(e){return Gp(e)&&e.Ta.length<10}function tm(e,t){e.Ta.push(t);let n=dm(e);n.O_()&&n.Y_&&n.ea(t.mutations)}function nm(e){return Gp(e)&&!dm(e).x_()&&e.Ta.length>0}function rm(e){dm(e).start()}async function im(e){dm(e).ra()}async function am(e){let t=dm(e);for(let n of e.Ta)t.ea(n.mutations)}async function om(e,t,n){let r=e.Ta.shift(),i=ld.from(r,t,n);await Qp(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await $p(e)}async function sm(e,t){t&&dm(e).Y_&&await async function(e,t){if(function(e){return fd(e)&&e!==F.ABORTED}(t.code)){let n=e.Ta.shift();dm(e).B_(),await Qp(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await $p(e)}}(e,t),nm(e)&&rm(e)}async function cm(e,t){let n=P(e);n.asyncQueue.verifyOperationInProgress(),j(Pp,`RemoteStore received new credentials`);let r=Gp(n);n.da.add(3),await Lp(n),r&&n.ga.set(`Unknown`),await n.remoteSyncer.handleCredentialChange(t),n.da.delete(3),await Ip(n)}async function lm(e,t){let n=P(e);t?(n.da.delete(2),await Ip(n)):t||(n.da.add(2),await Lp(n),n.ga.set(`Unknown`))}function um(e){return e.ya||(e.ya=function(e,t,n){let r=P(e);
12return r.sa(),new Op(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Zo:qp.bind(null,e),Yo:Jp.bind(null,e),t_:Yp.bind(null,e),H_:Xp.bind(null,e)}),e.ma.push((async t=>{t?(e.ya.B_(),Wp(e)?Up(e):e.ga.set(`Unknown`)):(await e.ya.stop(),Kp(e))}))),e.ya}function dm(e){return e.wa||(e.wa=function(e,t,n){let r=P(e);return r.sa(),new kp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),Yo:im.bind(null,e),t_:sm.bind(null,e),ta:am.bind(null,e),na:om.bind(null,e)}),e.ma.push((async t=>{t?(e.wa.B_(),await $p(e)):(await e.wa.stop(),e.Ta.length>0&&(j(Pp,`Stopping write stream with ${e.Ta.length} pending writes`),e.Ta=[]))}))),e.wa}var fm=class e{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new js,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,n,r,i,a){let o=Date.now()+r,s=new e(t,n,o,i,a);return s.start(r),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new I(F.CANCELLED,`Operation cancelled`+(e?`: `+e:``))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle===null?Promise.resolve():(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e))))))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function pm(e,t){if(Ds(`AsyncQueue`,`${t}: ${e}`),vc(e))return new I(F.UNAVAILABLE,`${t}: ${e}`);throw e}var mm=class e{static emptySet(t){return new e(t.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||z.comparator(t.key,n.key):(e,t)=>z.comparator(e.key,t.key),this.keyedMap=bu(),this.sortedSet=new W(this.comparator)}has(e){return this.keyedMap.get(e)!=null}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(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(!e.isEqual(t))return!1}return!0}toString(){let e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?`DocumentSet ()`:`DocumentSet (
13  `+e.join(`  
14`)+`
15)`}copy(t,n){let r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}},hm=class{constructor(){this.Sa=new W(z.comparator)}track(e){let t=e.doc.key,n=this.Sa.get(t);n?e.type!==0&&n.type===3?this.Sa=this.Sa.insert(t,e):e.type===3&&n.type!==1?this.Sa=this.Sa.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.Sa=this.Sa.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.Sa=this.Sa.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.Sa=this.Sa.remove(t):e.type===1&&n.type===2?this.Sa=this.Sa.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.Sa=this.Sa.insert(t,{type:2,doc:e.doc}):M(63341,{Vt:e,ba:n}):this.Sa=this.Sa.insert(t,e)}Da(){let e=[];return this.Sa.inorderTraversal(((t,n)=>{e.push(n)})),e}},gm=class e{constructor(e,t,n,r,i,a,o,s,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=o,this.excludesMetadataChanges=s,this.hasCachedResults=c}static fromInitialDocuments(t,n,r,i,a){let o=[];return n.forEach((e=>{o.push({type:0,doc:e})})),new e(t,n,mm.emptySet(n),o,r,i,!0,!1,a)}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)&&lu(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}},_m=class{constructor(){this.Ca=void 0,this.va=[]}Fa(){return this.va.some((e=>e.Ma()))}},vm=class{constructor(){this.queries=ym(),this.onlineState=`Unknown`,this.xa=new Set}terminate(){(function(e,t){let n=P(e),r=n.queries;n.queries=ym(),r.forEach(((e,n)=>{for(let e of n.va)e.onError(t)}))})(this,new I(F.ABORTED,`Firestore shutting down`))}};function ym(){return new gu((e=>uu(e)),lu)}async function bm(e,t){let n=P(e),r=3,i=t.query,a=n.queries.get(i);a?!a.Fa()&&t.Ma()&&(r=2):(a=new _m,r=+!t.Ma());try{switch(r){case 0:a.Ca=await n.onListen(i,!0);break;case 1:a.Ca=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(e){let n=pm(e,`Initialization of query '${du(t.query)}' failed`);t.onError(n);return}n.queries.set(i,a),a.va.push(t),t.Oa(n.onlineState),a.Ca&&t.Na(a.Ca)&&wm(n)}async function xm(e,t){let n=P(e),r=t.query,i=3,a=n.queries.get(r);if(a){let e=a.va.indexOf(t);e>=0&&(a.va.splice(e,1),a.va.length===0?i=+!t.Ma():!a.Fa()&&t.Ma()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function Sm(e,t){let n=P(e),r=!1;for(let e of t){let t=e.query,i=n.queries.get(t);if(i){for(let t of i.va)t.Na(e)&&(r=!0);i.Ca=e}}r&&wm(n)}function Cm(e,t,n){let r=P(e),i=r.queries.get(t);if(i)for(let e of i.va)e.onError(n);r.queries.delete(t)}
vendor: 3,512 bytes, line 15
15function wm(e){e.xa.forEach((e=>{e.next()}))}var Tm,Em;(Em=Tm||={}).Ba=`default`,Em.Cache=`cache`;var Dm=class{constructor(e,t,n){this.query=e,this.La=t,this.ka=!1,this.Ka=null,this.onlineState=`Unknown`,this.options=n||{}}Na(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)n.type!==3&&t.push(n);e=new gm(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.ka?this.qa(e)&&(this.La.next(e),t=!0):this.Ua(e,this.onlineState)&&(this.$a(e),t=!0),this.Ka=e,t}onError(e){this.La.error(e)}Oa(e){this.onlineState=e;let t=!1;return this.Ka&&!this.ka&&this.Ua(this.Ka,e)&&(this.$a(this.Ka),t=!0),t}Ua(e,t){if(!e.fromCache||!this.Ma())return!0;let n=t!==`Offline`;return(!this.options.Wa||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t===`Offline`)}qa(e){if(e.docChanges.length>0)return!0;let t=this.Ka&&this.Ka.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}$a(e){e=gm.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.ka=!0,this.La.next(e)}Ma(){return this.options.source!==Tm.Cache}},Om=class{constructor(e){this.key=e}},km=class{constructor(e){this.key=e}},Am=class{constructor(e,t){this.query=e,this.tu=t,this.nu=null,this.hasCachedResults=!1,this.current=!1,this.ru=q(),this.mutatedKeys=q(),this.iu=mu(e),this.su=new mm(this.iu)}get ou(){return this.tu}_u(e,t){let n=t?t.au:new hm,r=t?t.su:this.su,i=t?t.mutatedKeys:this.mutatedKeys,a=r,o=!1,s=this.query.limitType===`F`&&r.size===this.query.limit?r.last():null,c=this.query.limitType===`L`&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal(((e,t)=>{let l=r.get(e),u=fu(this.query,t)?t:null,d=!!l&&this.mutatedKeys.has(l.key),f=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations),p=!1;l&&u?l.data.isEqual(u.data)?d!==f&&(n.track({type:3,doc:u}),p=!0):this.uu(l,u)||(n.track({type:2,doc:u}),p=!0,(s&&this.iu(u,s)>0||c&&this.iu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),p=!0):l&&!u&&(n.track({type:1,doc:l}),p=!0,(s||c)&&(o=!0)),p&&(u?(a=a.add(u),i=f?i.add(e):i.delete(e)):(a=a.delete(e),i=i.delete(e)))})),this.query.limit!==null)for(;a.size>this.query.limit;){let e=this.query.limitType===`F`?a.last():a.first();a=a.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{su:a,au:n,bs:o,mutatedKeys:i}}uu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){let i=this.su;this.su=e.su,this.mutatedKeys=e.mutatedKeys;let a=e.au.Da();a.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 M(20277,{Vt:e})}};return n(e)-n(t)}(e.type,t.type)||this.iu(e.doc,t.doc))),this.cu(n),r??=!1;let o=t&&!r?this.lu():[],s=this.ru.size===0&&this.current&&!r?1:0,c=s!==this.nu;return this.nu=s,a.length!==0||c?{snapshot:new gm(this.query,e.su,i,a,e.mutatedKeys,s===0,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),hu:o}:{hu:o}}Oa(e){return this.current&&e===`Offline`?(this.current=!1,this.applyChanges({su:this.su,au:new hm,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{hu:[]}}Pu(e){return!this.tu.has(e)&&!!this.su.has(e)&&!this.su.get(e).hasLocalMutations}cu(e){e&&(e.addedDocuments.forEach((e=>this.tu=this.tu.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.tu=this.tu.delete(e))),this.current=e.current)}lu(){if(!this.current)return[];let e=this.ru;this.ru=q(),this.su.forEach((e=>
15{this.Pu(e.key)&&(this.ru=this.ru.add(e.key))}));let t=[];return e.forEach((e=>{this.ru.has(e)||t.push(new km(e))})),this.ru.forEach((n=>{e.has(n)||t.push(new Om(n))})),t}Tu(e){this.tu=e.ks,this.ru=q();let t=this._u(e.documents);return this.applyChanges(t,!0)}Iu(){return gm.fromInitialDocuments(this.query,this.su,this.mutatedKeys,this.nu===0,this.hasCachedResults)}},jm=`SyncEngine`,Mm=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},Nm=class{constructor(e){this.key=e,this.Eu=!1}},Pm=class{constructor(e,t,n,r,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Ru={},this.Au=new gu((e=>uu(e)),lu),this.Vu=new Map,this.du=new Set,this.mu=new W(z.comparator),this.fu=new Map,this.gu=new If,this.pu={},this.yu=new Map,this.wu=Sf.ar(),this.onlineState=`Unknown`,this.Su=void 0}get isPrimaryClient(){return!0===this.Su}};async function Fm(e,t,n=!0){let r=rh(e),i,a=r.Au.get(t);return a?(r.sharedClientState.addLocalQueryTarget(a.targetId),i=a.view.Iu()):i=await Lm(r,t,n,!0),i}async function Im(e,t){await Lm(rh(e),t,!0,!1)}async function Lm(e,t,n,r){let i=await ip(e.localStore,ru(t)),a=i.targetId,o=e.sharedCl
15ientState.addLocalQueryTarget(a,n),s;return r&&(s=await Rm(e,t,a,o===`current`,i.resumeToken)),e.isPrimaryClient&&n&&zp(e.remoteStore,i),s}async function Rm(e,t,n,r,i){e.bu=(t,n,r)=>async function(e,t,n,r){let i=t.view._u(n);i.bs&&(i=await op(e.localStore,t.query,!1).then((({documents:e})=>t.view._u(e,i))));let a=r&&r.targetChanges.get(t.targetId),o=r&&r.targetMismatches.get(t.targetId)!=null,s=t.view.applyChanges(i,e.isPrimaryClient,a,o);return Zm(e,t.targetId,s.hu),s.snapshot}(e,t,n,r);let a=await op(e.localStore,t,!0),o=new Am(t,a.ks),s=o._u(a.documents),c=Sd.createSynthesizedTargetChangeForCurrentChange(n,r&&e.onlineState!==`Offline`,i),l=o.applyChanges(s,e.isPrimaryClient,c);Zm(e,n,l.hu);let u=new Mm(t,n,o);return e.Au.set(t,u),e.Vu.has(n)?e.Vu.get(n).push(t):e.Vu.set(n,[t]),l.snapshot}async function zm(e,t,n){let r=P(e),i=r.Au.get(t),a=r.Vu.get(i.targetId);if(a.length>1)return r.Vu.set(i.targetId,a.filter((e=>!lu(e,t)))),void r.Au.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedCl
15ientState.isActiveQueryTarget(i.targetId)||await ap(r.localStore,i.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(i.targetId),n&&Bp(r.remoteStore,i.targetId),Ym(r,i.targetId)})).catch(gc)):(Ym(r,i.targetId),await ap(r.localStore,i.targetId,!0))}async function Bm(e,t){let n=P(e),r=n.Au.get(t),i=n.Vu.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Bp(n.remoteStore,r.targetId))}async function Vm(e,t,n){let r=ih(e);try{let e=await function(e,t){let n=P(e),r=V.now(),i=t.reduce(((e,t)=>e.add(t.key)),q()),a,o;return n.persistence.runTransaction(`Locally write mutations`,`readwrite`,(e=>{let s=vu(),c=q();return n.xs.getEntries(e,i).next((e=>{s=e,s.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,s))).next((i=>{a=i;let o=[];for(let e of t){let t=$u(e,a.get(e.key).overlayedDocument);t!=null&&o.push(new nd(e.key,t,Sl(t.value.mapValue),qu.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)})).next((t=>{o=t;let r=t.applyToLocalDocumentSet(a,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:xu(a)})))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.pu[e.currentUser.toKey()];r||=new W(L),r=r.insert(t,n),e.pu[e.currentUser.toKey()]=r}(r,e.batchId,n),await eh(r,e.changes),await $p(r.remoteStore)}catch(e){let t=pm(e,`Failed to persist write`);n.reject(t)}}async function Hm(e,t){let n=P(e);try{let e=await tp(n.localStore,t);
15t.targetChanges.forEach(((e,t)=>{let r=n.fu.get(t);r&&(N(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.Eu=!0:e.modifiedDocuments.size>0?N(r.Eu,14607):e.removedDocuments.size>0&&(N(r.Eu,42227),r.Eu=!1))})),await eh(n,e,t)}catch(e){await gc(e)}}function Um(e,t,n){let r=P(e);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){let e=[];r.Au.forEach(((n,r)=>{let i=r.view.Oa(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){let n=P(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(let e of n.va)e.Oa(t)&&(r=!0)})),r&&wm(n)}(r.eventManager,t),e.length&&r.Ru.H_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function Wm(e,t,n){let r=P(e);r.sharedClientState.updateQueryState(t,`rejected`,n);let i=r.fu.get(t),a=i&&i.key;if(a){let e=new W(z.comparator);e=e.insert(a,Cl.newNoDocument(a,H.min()));let n=q().add(a);await Hm(r,new xd(H.min(),new Map,new W(L),e,n)),r.mu=r.mu.remove(a),r.fu.delete(t),$m(r)}else await ap(r.localStore,t,!1).then((()=>Ym(r,t,n))).catch(gc)}async function Gm(e,t){let n=P(e),r=t.batch.batchId;try{let e=await $f(n.localStore,t);Jm(n,r,null),qm(n,r),n.sharedClientState.updateMutationState(r,`acknowledged`),await eh(n,e)}catch(e){await gc(e)}}async function Km(e,t,n){let r=P(e);try{let e=await function(e,t){let n=P(e);return n.persistence.runTransaction(`Reject batch`,`readwrite-primary`,(e=>{let r;
15return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(N(t!==null,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);Jm(r,t,n),qm(r,t),r.sharedClientState.updateMutationState(t,`rejected`,n),await eh(r,e)}catch(e){await gc(e)}}function qm(e,t){(e.yu.get(t)||[]).forEach((e=>{e.resolve()})),e.yu.delete(t)}function Jm(e,t,n){let r=P(e),i=r.pu[r.currentUser.toKey()];if(i){let e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.pu[r.currentUser.toKey()]=i}}function Ym(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(let r of e.Vu.get(t))e.Au.delete(r),n&&e.Ru.Du(r,n);e.Vu.delete(t),e.isPrimaryClient&&e.gu.Gr(t).forEach((t=>{e.gu.containsKey(t)||Xm(e,t)}))}function Xm(e,t){e.du.delete(t.path.canonicalString());let n=e.mu.get(t);n!==null&&(Bp(e.remoteStore,n),e.mu=e.mu.remove(t),e.fu.delete(n),$m(e))}function Zm(e,t,n){for(let r of n)r instanceof Om?(e.gu.addReference(r.key,t),Qm(e,r)):r instanceof km?(j(jm,`Document no longer in limbo: `+r.key),e.gu.removeReference(r.key,t),e.gu.containsKey(r.key)||Xm(e,r.key)):M(19791,{Cu:r})}function Qm(e,t){let n=t.key,r=n.path.canonicalString();e.mu.get(n)||e.du.has(r)||(j(jm,`New document in limbo: `+n),e.du.add(r),$m(e))}function $m(e){for(;e.du.size>0&&e.mu.size<e.maxConcurrentLimboResolutions;){let t=e.du.values().next().value;e.du.delete(t);let n=new z(R.fromString(t)),r=e.wu.next();e.fu.set(r,new Nm(n)),e.mu=e.mu.insert(n,r),zp(e.remoteStore,new pf(ru(Ql(n.path)),r,`TargetPurposeLimboResolution`,yc.ce))}}async function eh(e,t,n){let r=P(e),i=[],a=[],o=[];r.Au.isEmpty()||(r.Au.forEach(((e,s)=>{o.push(r.bu(s,t,n).then((e=>{if((e||n)&&r.isPrimaryClient){let t=e?!e.fromCache:n?.targetChanges.get(s.targetId)?.current;
15r.sharedClientState.updateQueryState(s.targetId,t?`current`:`not-current`)}if(e){i.push(e);let t=Gf.Es(s.targetId,e);a.push(t)}})))})),await Promise.all(o),r.Ru.H_(i),await async function(e,t){let n=P(e);try{await n.persistence.runTransaction(`notifyLocalViewChanges`,`readwrite`,(e=>U.forEach(t,(t=>U.forEach(t.Ts,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>U.forEach(t.Is,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!vc(e))throw e;j(Jf,`Failed to update sequence numbers: `+e)}for(let e of t){let t=e.targetId;if(!e.fromCache){let e=n.vs.get(t),r=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(r);n.vs=n.vs.insert(t,i)}}}(r.localStore,a))}async function th(e,t){let n=P(e);if(!n.currentUser.isEqual(t)){j(jm,`User change. New user:`,t.toKey());let e=await Qf(n.localStore,t);n.currentUser=t,function(e,t){e.yu.forEach((e=>{e.forEach((e=>{e.reject(new I(F.CANCELLED,t))}))})),e.yu.clear()}(n,`'waitForPendingWrites' promise is rejected due to a user change.`),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await eh(n,e.Ns)}}function nh(e,t){let n=P(e),r=n.fu.get(t);if(r&&r.Eu)return q().add(r.key);{let e=q(),r=n.Vu.get(t);if(!r)return e;for(let t of r){let r=n.Au.get(t);e=e.unionWith(r.view.ou)}return e}}function rh(e){let t=P(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Hm.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=nh.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Wm.bind(null,t),t.Ru.H_=Sm.bind(null,t.eventManager),t.Ru.Du=Cm.bind(null,t.eventManager),t}function ih(e){let t=P(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Gm.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Km.bind(null,t),t}var ah=class{constructor(){this.kind=`memory`,this.synchronizeTabs=!1}async initialize(e){this.serializer=wp(e.databaseInfo.databaseId),this.sharedClientState=this.Mu(e),this.persistence=this.xu(e),await this.persistence.start(),this.localStore=this.Ou(e),this.gcScheduler=this.Nu(e,this.localStore),this.indexBackfillerScheduler=this.Bu(e,this.localStore)}Nu(e,t){return null}Bu(e,t){return null}Ou(e){return Zf(this.persistence,new qf,e.initialUser,this.serializer)}xu(e){return new Vf(Uf.Vi,this.serializer)}Mu(e){return new lp}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};ah.provider={build:()=>new ah};var oh=class extends ah{constructor(e){super(),this.cacheSizeBytes=e}Nu(e,t){N(this.persistence.referenceDelegate instanceof Wf,46915);let n=this.persistence.referenceDelegate.garbageCollector;return new Df(n,e.asyncQueue,t)}xu(e){let t=this.cacheSizeBytes===void 0?xf.DEFAULT:xf.withCacheSize(this.cacheSizeBytes);return new Vf((e=>Wf.Vi(e,t)),this.serializer)}},sh=class{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=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=>Um(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=th.bind(null,this.syncEngine),await lm(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new vm}()}createDatastore(e){let t=wp(e.databaseInfo.databaseId),n=Sp(e.databaseInfo);return Mp(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new Fp(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>Um(this.syncEngine,e,0)),function(){return fp.v()?new fp:new up}())}createSyncEngine(e,t){return function(e,t,n,r,i,a,o){let s=new Pm(e,t,n,r,i,a);return o&&(s.Su=!0),s}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){let t=P(e);j(Pp,`RemoteStore shutting down.`),t.da.add(5),await Lp(t),t.fa.shutdown(),t.ga.set(`Unknown`)}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};sh.provider={build:()=>new sh};var ch=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.ku(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.ku(this.observer.error,e):Ds(`Uncaught Error in snapshot listener:`,e.toString()))}Ku(){this.muted=!0}
15ku(e,t){setTimeout((()=>{this.muted||e(t)}),0)}},lh=`FirestoreClient`,uh=class{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=A.UNAUTHENTICATED,this.clientId=Vs.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async e=>{j(lh,`Received user=`,e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(j(lh,`Received new app check token=`,e),this.appCheckCredentialListener(e,this.user))))}get configuration(){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}terminate(){this.asyncQueue.enterRestrictedMode();let e=new js;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(t){let n=pm(t,`Failed to shutdown persistence`);e.reject(n)}})),e.promise}};async function dh(e,t){e.asyncQueue.verifyOperationInProgress(),j(lh,`Initializing OfflineComponentProvider`);let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await Qf(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function fh(e,t){e.asyncQueue.verifyOperationInProgress();let n=await ph(e);j(lh,`Initializing OnlineComponentProvider`),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>cm(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>cm(t.remoteStore,n))),e._onlineComponents=t}async function ph(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){j(lh,`Using user provided OfflineComponentProvider`);try{await dh(e,e._uninitializedComponentsProvider._offline)}catch(t){let n=t;if(!function(e){return e.name===`FirebaseError`?e.code===F.FAILED_PRECONDITION||e.code===F.UNIMPLEMENTED:!(typeof DOMException<`u`&&e instanceof DOMException)||e.code===22||e.code===20||e.code===11}(n))throw n;Os(`Error using user provided cache. Falling back to memory cache: `+n),await dh(e,new ah)}}else j(lh,`Using default OfflineComponentProvider`),await dh(e,new oh(void 0));return e._offlineComponents}async function mh(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(j(lh,`Using user provided OnlineComponentProvider`),await fh(e,e._uninitializedComponentsProvider._online)):(j(lh,`Using default OnlineComponentProvider`),await fh(e,new sh))),e._onlineComponents}function hh(e){return mh(e).then((e=>e.syncEngine))}async function gh(e){let t=await mh(e),n=t.eventManager;return n.onListen=Fm.bind(null,t.syncEngine),n.onUnlisten=zm.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=Im.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=Bm.bind(null,t.syncEngine),n}function _h(e,t,n,r){let i=new ch(r),a=new Dm(t,i,n);return e.asyncQueue.enqueueAndForget((async()=>bm(await gh(e),a))),()=>{i.Ku(),e.asyncQueue.enqueueAndForget((async()=>xm(await gh(e),a)))}}function vh(e,t,n={}){let r=new js;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,i){let a=new ch({next:s=>{a.Ku(),t.enqueueAndForget((()=>xm(e,o)));let c=s.docs.has(n);!c&&s.fromCache?i.reject(new I(F.UNAVAILABLE,`Failed to get document because the client is offline.`)):c&&s.fromCache&&r&&r.source===`server`?i.reject(new I(F.UNAVAILABLE,`Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)`)):i.resolve(s)},error:e=>i.reject(e)}),o=new Dm(Ql(n.path),a,{includeMetadataChanges:!0,Wa:!0});return bm(e,o)}(await gh(e),e.asyncQueue,t,n,r))),r.promise}function yh(e,t,n={}){let r=new js;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,i){let a=new ch({next:n=>{a.Ku(),t.enqueueAndForget((()=>xm(e,o))),n.fromCache&&r.source===`server`?i.reject(new I(F.UNAVAILABLE,`Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)`)):i.resolve(n)},error:e=>i.reject(e)}),o=new Dm(n,a,{includeMetadataChanges:!0,Wa:!0});return bm(e,o)}(await gh(e),e.asyncQueue,t,n,r))),r.promise}function bh(e,t){let n=new js;return e.asyncQueue.enqueueAndForget((async()=>Vm(await hh(e),t,n))),n.promise}function xh(e){let t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}var Sh=`ComponentProvider`,Ch=new Map;function wh(e,t,n,r,i){return new Jc(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,xh(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,r)}var Th=`firestore.googleapis.com`,Eh=!0,Dh=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new I(F.INVALID_ARGUMENT,`Can't provide ssl option if host option is not set`);this.host=Th,this.ssl=Eh}else this.host=e.host,this.ssl=e.ssl??Eh;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=bf;
15else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<wf)throw new I(F.INVALID_ARGUMENT,`cacheSizeBytes must be at least 1048576`);this.cacheSizeBytes=e.cacheSizeBytes}Qs(`experimentalForceLongPolling`,e.experimentalForceLongPolling,`experimentalAutoDetectLongPolling`,e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=xh(e.experimentalLongPollingOptions??{}),function(e){if(e.timeoutSeconds!==void 0){if(isNaN(e.timeoutSeconds))throw new I(F.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new I(F.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new I(F.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){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&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Oh=class{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type=`firestore-lite`,this._persistenceKey=`(lite)`,this._settings=new Dh({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask=`notTerminated`}get app(){if(!this._app)throw new I(F.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 this._terminateTask!==`notTerminated`}_setSettings(e){if(this._settingsFrozen)throw new I(F.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 Dh(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(e){if(!e)return new Ns;switch(e.type){case`firstParty`:return new Ls(e.sessionIndex||`0`,e.iamToken||null,e.authTokenFactory||null);case`provider`:return e.client;default:throw new I(F.INVALID_ARGUMENT,`makeAuthCredentialsProvider failed due to invalid credential type`)}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask===`notTerminated`&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask===`notTerminated`?await this._terminate():this._terminateTask=`notTerminated`}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=Ch.get(e);t&&(j(Sh,`Removing Datastore`),Ch.delete(e),t.terminate())}(this),Promise.resolve()}};function kh(e,t,n,r={}){e=rc(e,Oh);let i=Te(t),a=e._getSettings(),o={...a,emulatorOptions:e._getEmulatorOptions()},s=`${t}:${n}`;i&&Ee(`https://${s}`),a.host!==Th&&a.host!==s&&Os(`Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.`);let c={...a,host:s,ssl:i,emulatorOptions:r};if(!ge(c,o)&&(e._setSettings(c),r.mockUserToken)){let t,n;if(typeof r.mockUserToken==`string`)t=r.mockUserToken,n=A.MOCK_USER;else{t=te(r.mockUserToken,e._app?.options.projectId);let i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new I(F.INVALID_ARGUMENT,`mockUserToken must contain 'sub' or 'user_id' field!`);n=new A(i)}e._authCredentials=new Ps(new Ms(t,n))}}var Ah=class e{constructor(e,t,n){this.converter=t,this._query=n,this.type=`query`,this.firestore=e}withConverter(t){return new e(this.firestore,t,this._query)}},Z=class e{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()}
15get path(){return this._key.path.canonicalString()}get parent(){return new jh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new e(this.firestore,t,this._key)}toJSON(){return{type:e._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,n,r){if(ac(n,e._jsonSchema))return new e(t,r||null,new z(R.fromString(n.referencePath)))}};Z._jsonSchemaVersion=`firestore/documentReference/1.0`,Z._jsonSchema={type:B(`string`,Z._jsonSchemaVersion),referencePath:B(`string`)};var jh=class e extends Ah{constructor(e,t,n){super(e,t,Ql(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 Z(this.firestore,null,new z(e))}withConverter(t){return new e(this.firestore,t,this._path)}};function Mh(e,t,...n){if(e=y(e),Zs(`collection`,`path`,t),e instanceof Oh){let r=R.fromString(t,...n);return ec(r),new jh(e,null,r)}{if(!(e instanceof Z||e instanceof jh))throw new I(F.INVALID_ARGUMENT,`Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(R.fromString(t,...n));return ec(r),new jh(e.firestore,null,r)}}function Nh(e,t,...n){if(e=y(e),arguments.length===1&&(t=Vs.newId()),Zs(`doc`,`path`,t),e instanceof Oh){let r=R.fromString(t,...n);return $s(r),new Z(e,null,new z(r))}{if(!(e instanceof Z||e instanceof jh))throw new I(F.INVALID_ARGUMENT,`Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(R.fromString(t,...n));return $s(r),new Z(e.firestore,e instanceof jh?e.converter:null,new z(r))}}var Ph=`AsyncQueue`,Fh=class{constructor(e=Promise.resolve()){this.rc=[],this.sc=!1,this.oc=[],this._c=null,this.ac=!1,this.uc=!1,this.cc=[],this.M_=new Tp(this,`async_queue_retry`),this.lc=()=>{let e=Cp();e&&j(Ph,`Visibility state changed to `+e.visibilityState),this.M_.w_()},this.hc=e;let t=Cp();t&&typeof t.addEventListener==`function`&&t.addEventListener(`visibilitychange`,this.lc)}get isShuttingDown(){return this.sc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Pc(),this.Tc(e)}enterRestrictedMode(e){if(!this.sc){this.sc=!0,this.uc=e||!1;let t=Cp();t&&typeof t.removeEventListener==`function`&&t.removeEventListener(`visibilitychange`,this.lc)}}enqueue(e){if(this.Pc(),this.sc)return new Promise((()=>{}));let t=new js;return this.Tc((()=>this.sc&&this.uc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.rc.push(e),this.Ic())))}async Ic(){if(this.rc.length!==0){try{await this.rc[0](),this.rc.shift(),this.M_.reset()}catch(e){if(!vc(e))throw e;j(Ph,`Operation failed with retryable error: `+e)}this.rc.length>0&&this.M_.p_((()=>this.Ic()))}}Tc(e){let t=this.hc.then((()=>(this.ac=!0,e().catch((e=>{throw this._c=e,this.ac=!1,Ds(`INTERNAL UNHANDLED ERROR: `,Ih(e)),e})).then((e=>(this.ac=!1,e))))));return this.hc=t,t}enqueueAfterDelay(e,t,n){this.Pc(),this.cc.indexOf(e)>-1&&(t=0);let r=fm.createAndSchedule(this,e,t,n,(e=>this.Ec(e)));return this.oc.push(r),r}Pc(){this._c&&M(47125,{Rc:Ih(this._c)})}verifyOperationInProgress(){}async Ac(){let e;do e=this.hc,await e;while(e!==this.hc)}Vc(e){for(let t of this.oc)if(t.timerId===e)return!0;return!1}dc(e){return this.Ac().then((()=>{this.oc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(let t of this.oc)if(t.skipDelay(),e!==`all`&&t.timerId===e)break;return this.Ac()}))}mc(e){this.cc.push(e)}Ec(e){let t=this.oc.indexOf(e);this.oc.splice(t,1)}};function Ih(e){let t=e.message||``;return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+`
16`+e.stack),t}var Lh=class extends Oh{constructor(e,t,n,r){super(e,t,n,r),this.type=`firestore`,this._queue=new Fh,this._persistenceKey=r?.name||`[DEFAULT]`}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Fh(e),this._firestoreClient=void 0,await e}}};function Rh(e,t){let n=typeof e==`object`?e:Yt(),r=typeof e==`string`?e:t||Yc,i=Gt(n,`firestore`).getImmediate({identifier:r});if(!i._initialized){let e=m(`firestore`);e&&kh(i,...e)}return i}function zh(e){if(e._terminated)throw new I(F.FAILED_PRECONDITION,`The client has already been terminated.`);return e._firestoreClient||Bh(e),e._firestoreClient}function Bh(e){let t=e._freezeSettings(),n=wh(e._databaseId,e._app?.options.appId||``,e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new uh(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){let t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}var Vh=class e{constructor(e){this._byteString=e}static fromBase64String(t){try{return new e(Lc.fromBase64String(t))}catch(e){throw new I(F.INVALID_ARGUMENT,`Failed to construct data from Base64 string: `+e)}}static fromUint8Array(t){return new e(Lc.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return`Bytes(base64: `+this.toBase64()+`)`}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:e._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(ac(t,e._jsonSchema))return e.fromBase64String(t.bytes)}};
vendor: 6,217 bytes, line 16
16Vh._jsonSchemaVersion=`firestore/bytes/1.0`,Vh._jsonSchema={type:B(`string`,Vh._jsonSchemaVersion),bytes:B(`string`)};var Hh=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new I(F.INVALID_ARGUMENT,`Invalid field name at argument $(i + 1). Field names must not be empty.`);this._internalPath=new Xs(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}},Uh=class{constructor(e){this._methodName=e}},Wh=class e{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new I(F.INVALID_ARGUMENT,`Latitude must be a number between -90 and 90, but was: `+e);if(!isFinite(t)||t<-180||t>180)throw new I(F.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}_compareTo(e){return L(this._lat,e._lat)||L(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:e._jsonSchemaVersion}}static fromJSON(t){if(ac(t,e._jsonSchema))return new e(t.latitude,t.longitude)}};Wh._jsonSchemaVersion=`firestore/geoPoint/1.0`,Wh._jsonSchema={type:B(`string`,Wh._jsonSchemaVersion),latitude:B(`number`),longitude:B(`number`)};var Gh=class e{constructor(e){this._values=(e||[]).map((e=>e))}toArray(){return this._values.map((e=>e))}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:e._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(ac(t,e._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every((e=>typeof e==`number`)))return new e(t.vectorValues);throw new I(F.INVALID_ARGUMENT,`Expected 'vectorValues' field to be a number array`)}}};Gh._jsonSchemaVersion=`firestore/vectorValue/1.0`,Gh._jsonSchema={type:B(`string`,Gh._jsonSchemaVersion),vectorValues:B(`object`)};var Kh=/^__.*__$/,qh=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask===null?new td(e,this.data,t,this.fieldTransforms):new nd(e,this.data,this.fieldMask,t,this.fieldTransforms)}},Jh=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new nd(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function Yh(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw M(40011,{dataSource:e})}}var Xh=class e{constructor(e,t,n,r,i,a){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,i===void 0&&this.fc(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(t){return new e({...this.settings,...t},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}yc(e){let t=this.path?.child(e),n=this.i({path:t,arrayElement:!1});return n.wc(e),n}Sc(e){let t=this.path?.child(e),n=this.i({path:t,arrayElement:!1});return n.fc(),n}bc(e){return this.i({path:void 0,arrayElement:!0})}Dc(e){return pg(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}fc(){if(this.path)for(let e=0;e<this.path.length;e++)this.wc(this.path.get(e))}wc(e){if(e.length===0)throw this.Dc(`Document fields must not be empty`);if(Yh(this.dataSource)&&Kh.test(e))throw this.Dc(`Document fields cannot begin and end with "__"`)}},Zh=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||wp(e)}V(e,t,n,r=!1){return new Xh({dataSource:e,methodName:t,targetDoc:n,path:Xs.emptyPath(),arrayElement:!1,hasConverter:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function Qh(e){let t=e._freezeSettings(),n=wp(e._databaseId);return new Zh(e._databaseId,!!t.ignoreUndefinedProperties,n)}function $h(e,t,n,r,i,a={}){let o=e.V(a.merge||a.mergeFields?2:0,t,n,i);lg(`Data must be an object, but it was:`,o,r);let s=sg(r,o),c,l;if(a.merge)c=new Fc(o.fieldMask),l=o.fieldTransforms;else if(a.mergeFields){let e=[];for(let r of a.mergeFields){let i=ug(t,r,n);if(!o.contains(i))throw new I(F.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);mg(e,i)||e.push(i)}c=new Fc(e),l=o.fieldTransforms.filter((e=>c.covers(e.field)))}else c=null,l=o.fieldTransforms;return new qh(new xl(s),c,l)}var eg=class e extends Uh{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.Dc(`${this._methodName}() can only appear at the top level of your update data`):e.Dc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(t){return t instanceof e}},tg=class e extends Uh{_toFieldTransform(e){return new Wu(e.path,new Iu)}isEqual(t){return t instanceof e}},ng=class e extends Uh{constructor(e,t){super(e),this.Fc=t}_toFieldTransform(e){let t=new Vu(e.serializer,ju(e.serializer,this.Fc));return new Wu(e.path,t)}isEqual(t){return t instanceof e&&this.Fc===t.Fc}};function rg(e,t,n,r){let i=e.V(1,t,n);lg(`Data must be an object, but it was:`,i,r);let a=[],o=xl.empty();return kc(r,((e,r)=>{let s=fg(t,e,n);r=y(r);let c=i.Sc(s);if(r instanceof eg)a.push(s);else{let e=og(r,c);e!=null&&(a.push(s),o.set(s,e))}})),new Jh(o,new Fc(a),i.fieldTransforms)}function ig(e,t,n,r,i,a){let o=e.V(1,t,n),s=[ug(t,r,n)],c=[i];if(a.length%2!=0)throw new I(F.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<a.length;e+=2)s.push(ug(t,a[e])),c.push(a[e+1]);let l=[],u=xl.empty();for(let e=s.length-1;e>=0;--e)if(!mg(l,s[e])){let t=s[e],n=c[e];n=y(n);let r=o.Sc(t);if(n instanceof eg)l.push(t);else{let e=og(n,r);e!=null&&(l.push(t),u.set(t,e))}}return new Jh(u,new Fc(l),o.fieldTransforms)}function ag(e,t,n,r=!1){return og(n,e.V(r?4:3,t))}function og(e,t){if(cg(e=y(e)))return lg(`Unsupported field value:`,t,e),sg(e,t);if(e instanceof Uh)return function(e,t){if(!Yh(t.dataSource))throw t.Dc(`${e._methodName}
16() can only be used with update() and set()`);if(!t.path)throw t.Dc(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&t.dataSource!==4)throw t.Dc(`Nested arrays are not supported`);return function(e,t){let n=[],r=0;for(let i of e){let e=og(i,t.bc(r));e??={nullValue:`NULL_VALUE`},n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if((e=y(e))===null)return{nullValue:`NULL_VALUE`};if(typeof e==`number`)return ju(t.serializer,e);if(typeof e==`boolean`)return{booleanValue:e};if(typeof e==`string`)return{stringValue:e};if(e instanceof Date){let n=V.fromDate(e);return{timestampValue:Fd(t.serializer,n)}}if(e instanceof V){let n=new V(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Fd(t.serializer,n)}}if(e instanceof Wh)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Vh)return{bytesValue:Id(t.serializer,e._byteString)};if(e instanceof Z){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.Dc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:zd(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof Gh)return function(e,t){let n=e instanceof Gh?e.toArray():e;return{mapValue:{fields:{[Qc]:{stringValue:tl},[nl]:{arrayValue:{values:n.map((e=>{if(typeof e!=`number`)throw t.Dc(`VectorValues must only contain numeric values.`);return ku(t.serializer,e)}))}}}}}}(e,t);if(ff(e))return e._toProto(t.serializer);throw t.Dc(`Unsupported field value: ${nc(e)}`)}(e,t)}function sg(e,t){let n={};return Ac(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):kc(e,((e,r)=>{let i=og(r,t.yc(e));i!=null&&(n[e]=i)})),{mapValue:{fields:n}}}function cg(e){return!(typeof e!=`object`||!e||e instanceof Array||e instanceof Date||e instanceof V||e instanceof Wh||e instanceof Vh||e instanceof Z||e instanceof Uh||e instanceof Gh||ff(e))}function lg(e,t,n){if(!cg(n)||!tc(n)){let r=nc(n);throw r===`an object`?t.Dc(e+` a custom object`):t.Dc(e+` `+r)}}function ug(e,t,n){if((t=y(t))instanceof Hh)return t._internalPath;if(typeof t==`string`)return fg(e,t);throw pg(`Field path arguments must be of type string or `,e,!1,void 0,n)}var dg=RegExp(`[~\\*/\\[\\]]`);function fg(e,t,n){if(t.search(dg)>=0)throw pg(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new Hh(...t.split(`.`))._internalPath}catch{throw pg(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function pg(e,t,n,r,i){let a=r&&!r.isEmpty(),o=i!==void 0,s=`Function ${t}() called with invalid data`;n&&(s+=" (via `toFirestore()`)"),s+=`. `;let c=``;return(a||o)&&(c+=` (found`,a&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=`)`),new I(F.INVALID_ARGUMENT,s+e+c)}function mg(e,t){return e.some((e=>e.isEqual(t)))}var hg=class{convertValue(e,t=`none`){switch(rl(e)){case 0:return null;case 1:return e.booleanValue;case 2:return G(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(Bc(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 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw M(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t=`none`){let n={};return kc(e,((e,r)=>{n[e]=this.convertValue(r,t)})),n}convertVectorValue(e){let t=e.fields?.[nl].arrayValue?.values?.map((e=>G(e.doubleValue)));return new Gh(t)}convertGeoPoint(e){return new Wh(G(e.latitude),G(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case`previous`:let n=Kc(e);return n==null?null:this.convertValue(n,t);case`estimate`:return this.convertTimestamp(qc(e));default:return null}}convertTimestamp(e){let t=zc(e);return new V(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=R.fromString(e);N(df(n),9688,{name:e});let r=new Xc(n.get(1),n.get(3)),i=new z(n.popFirst(5));return r.isEqual(t)||Ds(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}},gg=class extends hg{constructor(e){super(),this.firestore=e}convertBytes(e){return new Vh(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
16return new Z(this.firestore,null,t)}};function _g(){return new tg(`serverTimestamp`)}function vg(e){return new ng(`increment`,e)}var yg=`@firebase/firestore`,bg=`4.14.1`;function xg(e){return function(e,t){if(typeof e!=`object`||!e)return!1;let n=e;for(let e of t)if(e in n&&typeof n[e]==`function`)return!0;return!1}(e,[`next`,`error`,`complete`])}var Sg=class{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Z(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new Cg(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){let t=this._document.data.field(ug(`DocumentSnapshot.get`,e));if(t!==null)return this._userDataWriter.convertValue(t)}}},Cg=class extends Sg{data(){return super.data()}};function wg(e){if(e.limitType===`L`&&e.explicitOrderBy.length===0)throw new I(F.UNIMPLEMENTED,`limitToLast() queries require specifying at least one orderBy() clause`)}var Tg=class{},Eg=class extends Tg{};function Dg(e,t,...n){let r=[];t instanceof Tg&&r.push(t),r=r.concat(n),function(e){let t=e.filter((e=>e instanceof Ag)).length,n=e.filter((e=>e instanceof Og)).length;if(t>1||t>0&&n>0)throw new I(F.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(let t of r)e=t._apply(e);return e}var Og=class e extends Eg{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type=`where`}static _create(t,n,r){return new e(t,n,r)}_apply(e){let t=this._parse(e);return Bg(e._query,t),new Ah(e.firestore,e.converter,au(e._query,t))}_parse(e){let t=Qh(e.firestore);return function(e,t,n,r,i,a,o){let s;if(i.isKeyField()){if(a===`array-contains`||a===`array-contains-any`)throw new I(F.INVALID_ARGUMENT,`Invalid Query. You can't perform '${a}' queries on documentId().`);if(a===`in`||a===`not-in`){zg(o,a);let t=[];for(let n of o)t.push(Rg(r,e,n));s={arrayValue:{values:t}}}else s=Rg(r,e,o)}else a!==`in`&&a!==`not-in`&&a!==`array-contains-any`||zg(o,a),s=ag(n,t,o,a===`in`||a===`not-in`);return K.create(i,a,s)}(e._query,`where`,t,e.firestore._databaseId,this._field,this._op,this._value)}};function kg(e,t,n){let r=t,i=ug(`where`,e);return Og._create(i,r,n)}var Ag=class e extends Tg{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(t,n){return new e(t,n)}_parse(e){let t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return t.length===1?t[0]:Al.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return t.getFilters().length===0?e:(function(e,t){let n=e,r=t.getFlattenedFilters();for(let e of r)Bg(n,e),n=au(n,e)}(e._query,t),new Ah(e.firestore,e.converter,au(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type===`and`?`and`:`or`}},jg=class e extends Eg{constructor(e,t){super(),this._field=e,this._direction=t,this.type=`orderBy`}static _create(t,n){return new e(t,n)}_apply(e){let t=function(e,t,n){if(e.startAt!==null)throw new I(F.INVALID_ARGUMENT,`Invalid query. You must not call startAt() or startAfter() before calling orderBy().`);if(e.endAt!==null)throw new I(F.INVALID_ARGUMENT,`Invalid query. You must not call endAt() or endBefore() before calling orderBy().`);return new Dl(t,n)}(e._query,this._field,this._direction);return new Ah(e.firestore,e.converter,ou(e._query,t))}};function Mg(e,t=`asc`){let n=t,r=ug(`orderBy`,e);return jg._create(r,n)}var Ng=class e extends Eg{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(t,n,r){return new e(t,n,r)}_apply(e){return new Ah(e.firestore,e.converter,su(e._query,this._limit,this._limitType))}};function Pg(e){return ic(`limit`,e),Ng._create(`limit`,e,`F`)}
vendor: 7,341 bytes, line 16
16var Fg=class e extends Eg{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(t,n,r){return new e(t,n,r)}_apply(e){let t=Lg(e,this.type,this._docOrFields,this._inclusive);return new Ah(e.firestore,e.converter,cu(e._query,t))}};function Ig(...e){return Fg._create(`startAfter`,e,!1)}function Lg(e,t,n,r){if(n[0]=y(n[0]),n[0]instanceof Sg)return function(e,t,n,r,i){if(!r)throw new I(F.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${n}().`);let a=[];for(let n of nu(e))if(n.field.isKeyField())a.push(fl(t,r.key));else{let e=r.data.field(n.field);if(Gc(e))throw new I(F.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field "`+n.field+`" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)`);if(e===null){let e=n.field.canonicalString();throw new I(F.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${e}' (used as the orderBy) does not exist.`)}a.push(e)}return new wl(a,i)}(e._query,e.firestore._databaseId,t,n[0]._document,r);{let i=Qh(e.firestore);return function(e,t,n,r,i,a){let o=e.explicitOrderBy;if(i.length>o.length)throw new I(F.INVALID_ARGUMENT,`Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);let s=[];for(let a=0;a<i.length;a++){let c=i[a];if(o[a].field.isKeyField()){if(typeof c!=`string`)throw new I(F.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);if(!tu(e)&&c.indexOf(`/`)!==-1)throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);let n=e.path.child(R.fromString(c));if(!z.isDocumentKey(n))throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);let i=new z(n);s.push(fl(t,i))}else{let e=ag(n,r,c);s.push(e)}}return new wl(s,a)}(e._query,e.firestore._databaseId,i,t,n,r)}}function Rg(e,t,n){if(typeof(n=y(n))==`string`){if(n===``)throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.`);if(!tu(t)&&n.indexOf(`/`)!==-1)throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let r=t.path.child(R.fromString(n));if(!z.isDocumentKey(r))throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return fl(e,new z(r))}if(n instanceof Z)return fl(e,n._key);throw new I(F.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nc(n)}.`)}function zg(e,t){if(!Array.isArray(e)||e.length===0)throw new I(F.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Bg(e,t){let n=function(e,t){for(let n of e)for(let e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case`!=`:return[`!=`,`not-in`];case`array-contains-any`:case`in`:return[`not-in`];case`not-in`:return[`array-contains-any`,`in`,`not-in`,`!=`];default:return[]}}(t.op));if(n!==null)throw n===t.op?new I(F.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new I(F.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}function Vg(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}var Hg=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ug=class e extends Sg{constructor(e,t,n,r,i,a){super(e,t,n,r,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new Wg(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(ug(`DocumentSnapshot.get`,e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new I(F.FAILED_PRECONDITION,`DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t=this._document,n={};return n.type=e._jsonSchemaVersion,n.bundle=``,n.bundleSource=`DocumentSnapshot`,n.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,`previous`),n.bundle=(this._firestore,this.ref.path,`NOT SUPPORTED`),n)}};Ug._jsonSchemaVersion=`firestore/documentSnapshot/1.0`,Ug._jsonSchema={type:B(`string`,Ug._jsonSchemaVersion),bundleSource:B(`string`,`DocumentSnapshot`),bundleName:B(`string`),bundle:B(`string`)};var Wg=class extends Ug{data(e={}){return super.data(e)}},Gg=class e{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new Hg(r.hasPendingWrites,r.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 this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new Wg(this._firestore,this._userDataWriter,n.key,n,new Hg(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 I(F.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 r=new Wg(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Hg(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:`added`,doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||e.type!==3)).map((t=>{let r=new Wg(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Hg(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return t.type!==0&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),t.type!==1&&(n=n.add(t.doc),a=n.indexOf(t.doc.key)),{type:Kg(t.type),doc:r,oldIndex:i,newIndex:a}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new I(F.FAILED_PRECONDITION,`QuerySnapsh
16ot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t={};t.type=e._jsonSchemaVersion,t.bundleSource=`QuerySnapshot`,t.bundleName=Vs.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],r=[],i=[];return this.docs.forEach((e=>{e._document!==null&&(n.push(e._document),r.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,`previous`)),i.push(e.ref.path))})),t.bundle=(this._firestore,this.query._query,t.bundleName,`NOT SUPPORTED`),t}};function Kg(e){switch(e){case 0:return`added`;case 2:case 3:return`modified`;case 1:return`removed`;default:return M(61501,{type:e})}}Gg._jsonSchemaVersion=`firestore/querySnapshot/1.0`,Gg._jsonSchema={type:B(`string`,Gg._jsonSchemaVersion),bundleSource:B(`string`,`QuerySnapshot`),bundleName:B(`string`),bundle:B(`string`)};var qg=class{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Qh(e)}set(e,t,n){this._verifyNotCommitted();let r=Jg(e,this._firestore),i=Vg(r.converter,t,n),a=$h(this._dataReader,`WriteBatch.set`,r._key,i,r.converter!==null,n);return this._mutations.push(a.toMutation(r._key,qu.none())),this}update(e,t,n,...r){this._verifyNotCommitted();let i=Jg(e,this._firestore),a;return a=typeof(t=y(t))==`string`||t instanceof Hh?ig(this._dataReader,`WriteBatch.update`,i._key,t,n,r):rg(this._dataReader,`WriteBatch.update`,i._key,t),this._mutations.push(a.toMutation(i._key,qu.exists(!0))),this}delete(e){this._verifyNotCommitted();let t=Jg(e,this._firestore);return this._mutations=this._mutations.concat(new od(t._key,qu.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new I(F.FAILED_PRECONDITION,`A write batch can no longer be used after commit() has been called.`)}};function Jg(e,t){if((e=y(e)).firestore!==t)throw new I(F.INVALID_ARGUMENT,`Provided document reference is from a different Firestore instance.`);return e}function Yg(e){e=rc(e,Z);let t=rc(e.firestore,Lh);return vh(zh(t),e._key).then((n=>r_(t,e,n)))}function Xg(e){e=rc(e,Ah);let t=rc(e.firestore,Lh),n=zh(t),r=new gg(t);return wg(e._query),yh(n,e._query).then((n=>new Gg(t,r,e,n)))}function Zg(e,t,n){e=rc(e,Z);let r=rc(e.firestore,Lh),i=Vg(e.converter,t,n);return n_(r,[$h(Qh(r),`setDoc`,e._key,i,e.converter!==null,n).toMutation(e._key,qu.none())])}function Qg(e,t,n,...r){e=rc(e,Z);let i=rc(e.firestore,Lh),a=Qh(i),o;return o=typeof(t=y(t))==`string`||t instanceof Hh?ig(a,`updateDoc`,e._key,t,n,r):rg(a,`updateDoc`,e._key,t),n_(i,[o.toMutation(e._key,qu.exists(!0))])}function $g(e){return n_(rc(e.firestore,Lh),[new od(e._key,qu.none())])}function e_(e,t){let n=rc(e.firestore,Lh),r=Nh(e),i=Vg(e.converter,t);return n_(n,[$h(Qh(e.firestore),`addDoc`,r._key,i,e.converter!==null,{}).toMutation(r._key,qu.exists(!1))]).then((()=>r))}function t_(e,...t){e=y(e);let n={includeMetadataChanges:!1,source:`default`},r=0;typeof t[r]!=`object`||xg(t[r])||(n=t[r++]);let i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(xg(t[r])){let e=t[r];t[r]=e.next?.bind(e),t[r+1]=e.error?.bind(e),t[r+2]=e.complete?.bind(e)}let a,o,s;if(e instanceof Z)o=rc(e.firestore,Lh),s=Ql(e._key.path),a={next:n=>{t[r]&&t[r](r_(o,e,n))},error:t[r+1],complete:t[r+2]};else{let n=rc(e,Ah);o=rc(n.firestore,Lh),s=n._query;let i=new gg(o);a={next:e=>{t[r]&&t[r](new Gg(o,i,n,e))},error:t[r+1],complete:t[r+2]},wg(e._query)}return _h(zh(o),s,i,a)}function n_(e,t){return bh(zh(e),t)}function r_(e,t,n){let r=n.docs.get(t._key);return new Ug(e,new gg(e),t._key,r,new Hg(n.hasPendingWrites,n.fromCache),t.converter)}function i_(e){return e=rc(e,Lh),zh(e),new qg(e,(t=>n_(e,t)))}(function(e,t=!0){ws(qt),Wt(new De(`firestore`,((e,{instanceIdentifier:n,options:r})=>{let i=e.getProvider(`app`).getImmediate(),a=new Lh(new Fs(e.getProvider(`auth-internal`)),new zs(i,e.getProvider(`app-check-internal`)),Zc(i,n),i);return r={useFetchStreams:t,...r},a._setSettings(r),a}),`PUBLIC`).setMultipleInstances(!0)),Xt(yg,bg,e),Xt(yg,bg,`esm2020`)})();
vendor: 25,770 bytes, lines 16-24
16var a_=`firebasestorage.googleapis.com`,o_=`storageBucket`,s_=120*1e3,c_=600*1e3,l_=1e3,Q=class e extends de{constructor(t,n,r=0){super(u_(t),`Firebase Storage: ${n} (${u_(t)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,e.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return u_(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}},$;(function(e){e.UNKNOWN=`unknown`,e.OBJECT_NOT_FOUND=`object-not-found`,e.BUCKET_NOT_FOUND=`bucket-not-found`,e.PROJECT_NOT_FOUND=`project-not-found`,e.QUOTA_EXCEEDED=`quota-exceeded`,e.UNAUTHENTICATED=`unauthenticated`,e.UNAUTHORIZED=`unauthorized`,e.UNAUTHORIZED_APP=`unauthorized-app`,e.RETRY_LIMIT_EXCEEDED=`retry-limit-exceeded`,e.INVALID_CHECKSUM=`invalid-checksum`,e.CANCELED=`canceled`,e.INVALID_EVENT_NAME=`invalid-event-name`,e.INVALID_URL=`invalid-url`,e.INVALID_DEFAULT_BUCKET=`invalid-default-bucket`,e.NO_DEFAULT_BUCKET=`no-default-bucket`,e.CANNOT_SLICE_BLOB=`cannot-slice-blob`,e.SERVER_FILE_WRONG_SIZE=`server-file-wrong-size`,e.NO_DOWNLOAD_URL=`no-download-url`,e.INVALID_ARGUMENT=`invalid-argument`,e.INVALID_ARGUMENT_COUNT=`invalid-argument-count`,e.APP_DELETED=`app-deleted`,e.INVALID_ROOT_OPERATION=`invalid-root-operation`,e.INVALID_FORMAT=`invalid-format`,e.INTERNAL_ERROR=`internal-error`,e.UNSUPPORTED_ENVIRONMENT=`unsupported-environment`})($||={});function u_(e){return`storage/`+e}function d_(){return new Q($.UNKNOWN,`An unknown error occurred, please check the error payload for server response.`)}function f_(e){return new Q($.OBJECT_NOT_FOUND,`Object '`+e+`' does not exist.`)}function p_(e){return new Q($.QUOTA_EXCEEDED,`Quota for bucket '`+e+`' exceeded, please view quota on https://firebase.google.com/pricing/.`)}function m_(){return new Q($.UNAUTHENTICATED,`User is not authenticated, please authenticate using Firebase Authentication and try again.`)}function h_(){return new Q($.UNAUTHORIZED_APP,`This app does not have permission to access Firebase Storage on this project.`)}function g_(e){return new Q($.UNAUTHORIZED,`User does not have permission to access '`+e+`'.`)}function __(){return new Q($.RETRY_LIMIT_EXCEEDED,`Max retry time for operation exceeded, please try again.`)}function v_(){return new Q($.CANCELED,`User canceled the upload/download.`)}function y_(e){return new Q($.INVALID_URL,`Invalid URL '`+e+`'.`)}function b_(e){return new Q($.INVALID_DEFAULT_BUCKET,`Invalid default bucket '`+e+`'.`)}function x_(){return new Q($.NO_DEFAULT_BUCKET,`No default bucket found. Did you set the 'storageBucket' property when initializing the app?`)}function S_(){return new Q($.CANNOT_SLICE_BLOB,`Cannot slice blob for upload. Please retry the upload.`)}function C_(){return new Q($.SERVER_FILE_WRONG_SIZE,`Server recorded incorrect upload file size, please retry the upload.`)}function w_(){return new Q($.NO_DOWNLOAD_URL,`The given file does not have any download URLs.`)}function T_(e){return new Q($.UNSUPPORTED_ENVIRONMENT,`${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function E_(e){return new Q($.INVALID_ARGUMENT,e)}function D_(){return new Q($.APP_DELETED,`The Firebase app was deleted.`)}function O_(e){return new Q($.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 k_(e,t){return new Q($.INVALID_FORMAT,`String does not match format '`+e+`': `+t)}function A_(e){throw new Q($.INTERNAL_ERROR,`Internal error: `+e)}var j_=class e{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){let e=encodeURIComponent;return`/b/`+e(this.bucket)+`/o/`+e(this.path)}bucketOnlyServerUrl(){return`/b/`+encodeURIComponent(this.bucket)+`/o`}static makeFromBucketSpec(t,n){let r;try{r=e.makeFromUrl(t,n)}catch{return new e(t,``)}if(r.path===``)return r;throw b_(t)}static makeFromUrl(t,n){let r=null,i=`([A-Za-z0-9.\\-_]+)`;function a(e){e.path.charAt(e.path.length-1)===`/`&&(e.path_=e.path_.slice(0,-1))}let o=RegExp(`^gs://([A-Za-z0-9.\\-_]+)(/(.*))?$`,`i`),s={bucket:1,path:3};function c(e){e.path_=decodeURIComponent(e.path)}let l=n.replace(/[.]/g,`\\.`),u=RegExp(`^https?://${l}/v[A-Za-z0-9_]+/b/${i}/o(/([^?#]*).*)?\$`,`i`),d={bucket:1,path:3},f=RegExp(`^https?://${n===a_?`(?:storage.googleapis.com|storage.cloud.google.com)`:n}/${i}/([^?#]*)`,`i`),p=[{regex:o,indices:s,postModify:a},{regex:u,indices:d,postModify:c},{regex:f,indices:{bucket:1,path:2},postModify:c}];for(let n=0;n<p.length;n++){let i=p[n],a=i.regex.exec(t);if(a){let t=a[i.indices.bucket],n=a[i.indices.path];n||=``,r=new e(t,n),i.postModify(r);break}}if(r==null)throw y_(t);return r}},M_=class{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}};function N_(e,t,n){let r=1,i=null,a=null,o=!1,s=0;function c(){return s===2}let l=!1;function u(...e){l||(l=!0,t.apply(null,e))}function d(t){i=setTimeout(()=>{i=null,e(p,c())},t)}function f(){a&&clearTimeout(a)}function p(e,...t){if(l){f();return}if(e){f(),u.call(null,e,...t);return}if(c()||o){f(),u.call(null,e,...t);return}r<64&&(r*=2);let n;s===1?(s=2,n=0):n=(r+Math.random())*1e3,d(n)}let m=!1;function h(e){m||(m=!0,f(),!l&&(i===null?e||(s=1):(e||(s=2),clearTimeout(i),d(0))))}return d(0),a=setTimeout(()=>{o=!0,h(!0)},n),h}function P_(e){e(!1)}function F_(e){return e!==void 0}function I_(e){return typeof e==`function`}function L_(e){return typeof e==`object`&&!Array.isArray(e)}function R_(e){return typeof e==`string`||e instanceof String}function z_(e){return B_()&&e instanceof Blob}function B_(){return typeof Blob<`u`}function V_(e,t,n,r){if(r<t)throw E_(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r>n)throw E_(`Invalid value for '${e}'. Expected ${n} or less.`)}function H_(e,t,n){let r=t;return n??(r=`https://${t}`),`${n}://${r}/v0${e}`}function U_(e){let t=encodeURIComponent,n=`?`;for(let r in e)if(e.hasOwnProperty(r)){let i=t(r)+`=`+t(e[r]);n=n+i+`&`}return n=n.slice(0,-1),n}var W_;(function(e){e[e.NO_ERROR=0]=`NO_ERROR`,e[e.NETWORK_ERROR=1]=`NETWORK_ERROR`,e[e.ABORT=2]=`ABORT`})(W_||={});function G_(e,t){let n=e>=500&&e<600,r=[408,429].indexOf(e)!==-1,i=t.indexOf(e)!==-1;return n||r||i}var K_=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d=!0,f=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=r,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=o,this.errorCallback_=s,this.timeout_=c,this.progressCallback_=l,this.connectionFactory_=u,this.retry=d,this.isUsingEmulator=f,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)=>{if(t){e(!1,new q_(!1,null,!0));return}let n=this.connectionFactory_();this.pendingConnection_=n;let r=e=>{let t=e.loaded,n=e.lengthComputable?e.total:-1;this.progressCallback_!==null&&this.progressCallback_(t,n)};this.progressCallback_!==null&&n.addUploadProgressListener(r),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&n.removeUploadProgressListener(r),this.pendingConnection_=null;let t=n.getErrorCode()===W_.NO_ERROR,i=n.getStatus();if(!t||G_(i,this.additionalRetryCodes_)&&this.retry){e(!1,new q_(!1,null,n.getErrorCode()===W_.ABORT));return}e(!0,new q_(this.successCodes_.indexOf(i)!==-1,n))})},t=(e,t)=>{let n=this.resolve_,r=this.reject_,i=t.connection;if(t.wasSuccessCode)try{let e=this.callback_(i,i.getResponse());F_(e)?n(e):n()}catch(e){r(e)}else if(i!==null){let e=d_();e.serverResponse=i.getErrorText(),this.errorCallback_?r(this.errorCallback_(i,e)):r(e)}else t.canceled?r(this.appDelete_?D_():v_()):r(__())};this.canceled_?t(!1,new q_(!1,null,!0)):this.backoffId_=N_(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&P_(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}},q_=class{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}};function J_(e,t){t!==null&&t.length>0&&(e.Authorization=`Firebase `+t)}function Y_(e,t){e[`X-Firebase-Storage-Version`]=`webjs/`+(t??`AppManager`)}function X_(e,t){t&&(e[`X-Firebase-GMPID`]=t)}function Z_(e,t){t!==null&&(e[`X-Firebase-AppCheck`]=t)}function Q_(e,t,n,r,i,a,o=!0,s=!1){let c=U_(e.urlParams),l=e.url+c,u=Object.assign({},e.headers);return X_(u,t),J_(u,n),Y_(u,a),Z_(u,r),new K_(l,e.method,u,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,i,o,s)}function $_(){if(typeof BlobBuilder<`u`)return BlobBuilder;if(typeof WebKitBlobBuilder<`u`)return WebKitBlobBuilder}function ev(...e){let t=$_();if(t!==void 0){let n=new t;for(let t=0;t<e.length;t++)n.append(e[t]);return n.getBlob()}else if(B_())return new Blob(e);else throw new Q($.UNSUPPORTED_ENVIRONMENT,`This browser doesn't seem to support creating Blobs`)}function tv(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}function nv(e){if(typeof atob>`u`)throw T_(`base-64`);return atob(e)}var rv={RAW:`raw`,BASE64:`base64`,BASE64URL:`base64url`,DATA_URL:`data_url`},iv=class{constructor(e,t){this.data=e,this.contentType=t||null}};function av(e,t){switch(e){case rv.RAW:return new iv(ov(t));case rv.BASE64:case rv.BASE64URL:return new iv(cv(e,t));case rv.DATA_URL:return new iv(uv(t),dv(t))}throw d_()}function ov(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<=127)t.push(r);else if(r<=2047)t.push(192|r>>6,128|r&63);else if((r&64512)==55296)if(!(n<e.length-1&&(e.charCodeAt(n+1)&64512)==56320))t.push(239,191,189);else{let i=r,a=e.charCodeAt(++n);r=65536|(i&1023)<<10|a&1023,t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)==56320?t.push(239,191,189):t.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(t)}function sv(e){let t;try{t=decodeURIComponent(e)}catch{throw k_(rv.DATA_URL,`Malformed data URL.`)}return ov(t)}function cv(e,t){switch(e){case rv.BASE64:{let n=t.indexOf(`-`)!==-1,r=t.indexOf(`_`)!==-1;if(n||r)throw k_(e,`Invalid character '`+(n?`-`:`_`)+`' found: is it base64url encoded?`);break}case rv.BASE64URL:{let n=t.indexOf(`+`)!==-1,r=t.indexOf(`/`)!==-1;if(n||r)throw k_(e,`Invalid character '`+(n?`+`:`/`)+`' found: is it base64 encoded?`);t=t.replace(/-/g,`+`).replace(/_/g,`/`);break}}let n;try{n=nv(t)}catch(t){throw t.message.includes(`polyfill`)?t:k_(e,`Invalid character found`)}let r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}var lv=class{constructor(e){this.base64=!1,this.contentType=null;let t=e.match(/^data:([^,]+)?,/);if(t===null)throw k_(rv.DATA_URL,`Must be formatted 'data:[<mediatype>][;base64],<data>`);let n=t[1]||null;n!=null&&(this.base64=fv(n,`;base64`),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(`,`)+1)}};function uv(e){let t=new lv(e);return t.base64?cv(rv.BASE64,t.rest):sv(t.rest)}function dv(e){return new lv(e).contentType}function fv(e,t){return e.length>=t.length?e.substring(e.length-t.length)===t:!1}var pv=class e{constructor(e,t){let n=0,r=``;z_(e)?(this.data_=e,n=e.size,r=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_=r}size(){return this.size_}type(){return this.type_}slice(t,n){if(z_(this.data_)){let r=this.data_,i=tv(r,t,n);return i===null?null:new e(i)}else{let r=new Uint8Array(this.data_.buffer,t,n-t);return new e(r,!0)}}static getBlob(...t){if(B_()){let n=t.map(t=>t instanceof e?t.data_:t);return new e(ev.apply(null,n))}else{let n=t.map(e=>R_(e)?av(rv.RAW,e).data:e.data_),r=0;n.forEach(e=>{r+=e.byteLength});let i=new Uint8Array(r),a=0;return n.forEach(e=>{for(let t=0;t<e.length;t++)i[a++]=e[t]}),new e(i,!0)}}uploadData(){return this.data_}};function mv(e){let t;try{t=JSON.parse(e)}catch{return null}return L_(t)?t:null}function hv(e){if(e.length===0)return null;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function gv(e,t){let n=t.split(`/`).filter(e=>e.length>0).join(`/`);return e.length===0?n:e+`/`+n}function _v(e){let t=e.lastIndexOf(`/`,e.length-2);return t===-1?e:e.slice(t+1)}function vv(e,t){return t}var yv=class{constructor(e,t,n,r){this.server=e,this.local=t||e,this.writable=!!n,this.xform=r||vv}},bv=null;function xv(e){return!R_(e)||e.length<2?e:_v(e)}function Sv(){if(bv)return bv;let e=[];e.push(new yv(`bucket`)),e.push(new yv(`generation`)),e.push(new yv(`metageneration`)),e.push(new yv(`name`,`fullPath`,!0));function t(e,t){return xv(t)}let n=new yv(`name`);n.xform=t,e.push(n);function r(e,t){return t===void 0?t:Number(t)}let i=new yv(`size`);return i.xform=r,e.push(i),e.push(new yv(`timeCreated`)),e.push(new yv(`updated`)),e.push(new yv(`md5Hash`,null,!0)),e.push(new yv(`cacheControl`,null,!0)),e.push(new yv(`contentDisposition`,null,!0)),e.push(new yv(`contentEncoding`,null,!0)),e.push(new yv(`contentLanguage`,null,!0)),e.push(new yv(`contentType`,null,!0)),e.push(new yv(`metadata`,`customMetadata`,!0)),bv=e,bv}function Cv(e,t){function n(){let n=e.bucket,r=e.fullPath,i=new j_(n,r);return t._makeStorageReference(i)}Object.defineProperty(e,"ref",{get:n})}function wv(e,t,n){let r={};r.type=`file`;let i=n.length;for(let e=0;e<i;e++){let i=n[e];r[i.local]=i.xform(r,t[i.server])}return Cv(r,e),r}function Tv(e,t,n){let r=mv(t);return r===null?null:wv(e,r,n)}function Ev(e,t,n,r){let i=mv(t);if(i===null||!R_(i.downloadTokens))return null;let a=i.downloadTokens;if(a.length===0)return null;let o=encodeURIComponent;return a.split(`,`).map(t=>{let i=e.bucket,a=e.fullPath;return H_(`/b/`+o(i)+`/o/`+o(a),n,r)+U_({alt:`media`,token:t})})[0]}function Dv(e,t){let n={},r=t.length;for(let i=0;i<r;i++){let r=t[i];r.writable&&(n[r.server]=e[r.local])}return JSON.stringify(n)}var Ov=class{constructor(e,t,n,r){this.url=e,this.method=t,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}};function kv(e){if(!e)throw d_()}function Av(e,t){function n(n,r){let i=Tv(e,r,t);return kv(i!==null),i}return n}function jv(e,t){function n(n,r){let i=Tv(e,r,t);return kv(i!==null),Ev(i,r,e.host,e._protocol)}return n}function Mv(e){function t(t,n){let r;return r=t.getStatus()===401?t.getErrorText().includes(`Firebase App Check token is invalid`)?h_():m_():t.getStatus()===402?p_(e.bucket):t.getStatus()===403?g_(e.path):n,r.status=t.getStatus(),r.serverResponse=n.serverResponse,r}return t}function Nv(e){let t=Mv(e);function n(n,r){let i=t(n,r);return n.getStatus()===404&&(i=f_(e.path)),i.serverResponse=r.serverResponse,i}return n}function Pv(e,t,n){let r=H_(t.fullServerUrl(),e.host,e._protocol),i=e.maxOperationRetryTime,a=new Ov(r,`GET`,Av(e,n),i);return a.errorHandler=Nv(t),a}function Fv(e,t,n){let r=H_(t.fullServerUrl(),e.host,e._protocol),i=e.maxOperationRetryTime,a=new Ov(r,`GET`,jv(e,n),i);return a.errorHandler=Nv(t),a}function Iv(e,t){return e&&e.contentType||t&&t.type()||`application/octet-stream`}function Lv(e,t,n){let r=Object.assign({},n);return r.fullPath=e.path,r.size=t.size(),r.contentType||=Iv(null,t),r}function Rv(e,t,n,r,i){let a=t.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":`multipart`};function s(){let e=``;for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}let c=s();o[`Content-Type`]=`multipart/related; boundary=`+c;let l=Lv(t,r,i),u=Dv(l,n),d=`--`+c+`\r
17Content-Type: application/json; charset=utf-8\r
18\r
19`+u+`\r
20--`+c+`\r
21Content-Type: `+l.contentType+`\r
22\r
23`,f=`\r
24--`+c+`--`,p=pv.getBlob(d,r,f);if(p===null)throw S_();let m={name:l.fullPath},h=H_(a,e.host,e._protocol),g=e.maxUploadRetryTime,ee=new Ov(h,`POST`,Av(e,n),g);return ee.urlParams=m,ee.headers=o,ee.body=p.uploadData(),ee.errorHandler=Mv(t),ee}var zv=class{constructor(e,t,n,r){this.current=e,this.total=t,this.finalized=!!n,this.metadata=r||null}};function Bv(e,t){let n=null;try{n=e.getResponseHeader(`X-Goog-Upload-Status`)}catch{kv(!1)}return kv(!!n&&(t||[`active`]).indexOf(n)!==-1),n}function Vv(e,t,n,r,i){let a=t.bucketOnlyServerUrl(),o=Lv(t,r,i),s={name:o.fullPath},c=H_(a,e.host,e._protocol),l={"X-Goog-Upload-Protocol":`resumable`,"X-Goog-Upload-Command":`start`,"X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":`application/json; charset=utf-8`},u=Dv(o,n),d=e.maxUploadRetryTime;function f(e){Bv(e);let t;try{t=e.getResponseHeader(`X-Goog-Upload-URL`)}catch{kv(!1)}return kv(R_(t)),t}let p=new Ov(c,`POST`,f,d);return p.urlParams=s,p.headers=l,p.body=u,p.errorHandler=Mv(t),p}function Hv(e,t,n,r){let i={"X-Goog-Upload-Command":`query`};function a(e){let t=Bv(e,[`active`,`final`]),n=null;try{n=e.getResponseHeader(`X-Goog-Upload-Size-Received`)}catch{kv(!1)}n||kv(!1);let i=Number(n);return kv(!isNaN(i)),new zv(i,r.size(),t===`final`)}let o=e.maxUploadRetryTime,s=new Ov(n,`POST`,a,o);return s.headers=i,s.errorHandler=Mv(t),s}var Uv=256*1024;function Wv(e,t,n,r,i,a,o,s){let c=new zv(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw C_();let l=c.total-c.current,u=l;i>0&&(u=Math.min(u,i));let d=c.current,f=d+u,p=``;p=u===0?`finalize`:l===u?`upload, finalize`:`upload`;let m={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":`${c.current}`},h=r.slice(d,f);if(h===null)throw S_();function g(e,n){let i=Bv(e,[`active`,`final`]),o=c.current+u,s=r.size(),l;return l=i===`final`?Av(t,a)(e,n):null,new zv(o,s,i===`final`,l)}let ee=t.maxUploadRetryTime,te=new Ov(n,`POST`,g,ee);return te.headers=m,te.body=h.uploadData(),te.progressCallback=s||null,te.errorHandler=Mv(e),te}var Gv={RUNNING:`running`,PAUSED:`paused`,SUCCESS:`success`,CANCELED:`canceled`,ERROR:`error`};function Kv(e){switch(e){case`running`:case`pausing`:case`canceling`:return Gv.RUNNING;case`paused`:return Gv.PAUSED;case`success`:return Gv.SUCCESS;case`canceled`:return Gv.CANCELED;case`error`:return Gv.ERROR;default:return Gv.ERROR}}var qv=class{constructor(e,t,n){if(I_(e)||t!=null||n!=null)this.next=e,this.error=t??void 0,this.complete=n??void 0;else{let t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}};function Jv(e){return(...t)=>{Promise.resolve().then(()=>e(...t))}}var Yv=class{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=W_.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener(`abort`,()=>{this.errorCode_=W_.ABORT,e()}),this.xhr_.addEventListener(`error`,()=>{this.errorCode_=W_.NETWORK_ERROR,e()}),this.xhr_.addEventListener(`load`,()=>{e()})})}send(e,t,n,r,i){if(this.sent_)throw A_(`cannot .send() more than once`);if(Te(e)&&n&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(t,e,!0),i!==void 0)for(let e in i)i.hasOwnProperty(e)&&this.xhr_.setRequestHeader(e,i[e].toString());return r===void 0?this.xhr_.send():this.xhr_.send(r),this.sendPromise_}getErrorCode(){if(!this.sent_)throw A_(`cannot .getErrorCode() before sending`);return this.errorCode_}getStatus(){if(!this.sent_)throw A_(`cannot .getStatus() before sending`);try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw A_(`cannot .getResponse() before sending`);return this.xhr_.response}getErrorText(){if(!this.sent_)throw A_(`cannot .getErrorText() before sending`);return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener(`progress`,e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener(`progress`,e)}},Xv=class extends Yv{initXhr(){this.xhr_.responseType=`text`}};function Zv(){return new Xv}var Qv=class{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}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=Sv(),this._resumable=this._shouldDoResumable(this._blob),this._state=`running`,this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals($.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{let t=this.isExponentialBackoffExpired();if(G_(e.status,[]))if(t)e=__();else{this.sleepTime=Math.max(this.sleepTime*2,l_),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=e,this._transition(`error`)}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals($.CANCELED)?this.completeTransitions_():(this._error=e,this._transition(`error`))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){let e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state===`running`&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?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`);break}})}_createResumable(){this._resolveToken((e,t)=>{let n=Vv(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,Zv,e,t);this._request=r,r.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 r=Hv(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(r,Zv,t,n);this._request=i,i.getPromise().then(e=>{e=e,this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){let e=Uv*this._chunkMultiplier,t=new zv(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken((r,i)=>{let a;try{a=Wv(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,Zv,r,i,!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(){Uv*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{let n=Pv(this._ref.storage,this._ref._location,this._mappings),r=this._ref.storage._makeRequest(n,Zv,e,t);this._request=r,r.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition(`success`)},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{let n=Rv(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),r=this._ref.storage._makeRequest(n,Zv,e,t);this._request=r,r.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,this._request===void 0?this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_()):this._request.cancel();break;case`running`:let t=this._state===`paused`;this._state=e,t&&(this._notifyObservers(),this._start());break;case`paused`:this._state=e,this._notifyObservers();break;case`canceled`:this._error=v_(),this._state=e,this._notifyObservers();break;case`error`:this._state=e,this._notifyObservers();break;case`success`:this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case`pausing`:this._transition(`paused`);break;case`canceling`:this._transition(`canceled`);break;case`running`:this._start();break}}get snapshot(){let e=Kv(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,r){let i=new qv(t||void 0,n||void 0,r||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}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);t!==-1&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEac
24h(e=>{this._notifyObserver(e)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(Kv(this._state)){case Gv.SUCCESS:Jv(this._resolve.bind(null,this.snapshot))();break;case Gv.CANCELED:case Gv.ERROR:let t=this._reject;Jv(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Kv(this._state)){case Gv.RUNNING:case Gv.PAUSED:e.next&&Jv(e.next.bind(e,this.snapshot))();break;case Gv.SUCCESS:e.complete&&Jv(e.complete.bind(e))();break;case Gv.CANCELED:case Gv.ERROR:e.error&&Jv(e.error.bind(e,this._error))();break;default:e.error&&Jv(e.error.bind(e,this._error))()}}resume(){let e=this._state===`paused`||this._state===`pausing`;return e&&this._transition(`running`),e}pause(){let e=this._state===`running`;return e&&this._transition(`pausing`),e}cancel(){let e=this._state===`running`||this._state===`pausing`;return e&&this._transition(`canceling`),e}},$v=class e{constructor(e,t){this._service=e,t instanceof j_?this._location=t:this._location=j_.makeFromUrl(t,e.host)}toString(){return`gs://`+this._location.bucket+`/`+this._location.path}_newRef(t,n){return new e(t,n)}get root(){let e=new j_(this._location.bucket,``);return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return _v(this._location.path)}get storage(){return this._service}get parent(){let t=hv(this._location.path);if(t===null)return null;let n=new j_(this._location.bucket,t);return new e(this._service,n)}_throwIfRoot(e){if(this._location.path===``)throw O_(e)}};function ey(e,t,n){return e._throwIfRoot(`uploadBytesResumable`),new Qv(e,new pv(t),n)}function ty(e){e._throwIfRoot(`getDownloadURL`);let t=Fv(e.storage,e._location,Sv());return e.storage.makeRequestWithTokens(t,Zv).then(e=>{if(e===null)throw w_();return e})}function ny(e,t){let n=gv(e._location.path,t),r=new j_(e._location.bucket,n);return new $v(e.storage,r)}function ry(e){return/^[A-Za-z]+:\/\//.test(e)}function iy(e,t){return new $v(e,t)}function ay(e,t){if(e instanceof ly){let n=e;if(n._bucket==null)throw x_();let r=new $v(n,n._bucket);return t==null?r:ay(r,t)}else if(t!==void 0)return ny(e,t);else return e}function oy(e,t){if(t&&ry(t)){if(e instanceof ly)return iy(e,t);throw E_(`To use ref(service, url), the first argument must be a Storage instance.`)}else return ay(e,t)}function sy(e,t){let n=t?.[o_];return n==null?null:j_.makeFromBucketSpec(n,e)}function cy(e,t,n,r={}){e.host=`${t}:${n}`;let i=Te(t);i&&Ee(`https://${e.host}/b`),e._isUsingEmulator=!0,e._protocol=i?`https`:`http`;let{mockUserToken:a}=r;a&&(e._overrideAuthToken=typeof a==`string`?a:te(a,e.app.options.projectId))}var ly=class{constructor(e,t,n,r,i,a=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=r,this._firebaseVersion=i,this._isUsingEmulator=a,this._bucket=null,this._host=a_,this._protocol=`https`,this._appId=null,this._deleted=!1,this._maxOperationRetryTime=s_,this._maxUploadRetryTime=c_,this._requests=new Set,r==null?this._bucket=sy(this._host,this.app.options):this._bucket=j_.makeFromBucketSpec(r,this._host)}get host(){return this._host}set host(e){this._host=e,this._url==null?this._bucket=sy(e,this.app.options):this._bucket=j_.makeFromBucketSpec(this._url,e)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){V_(`time`,0,1/0,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){V_(`time`,0,1/0,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(t!==null)return t.accessToken}return null}async _getAppCheckToken(){if(C(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=this._appCheckProvider.getImmediate({optional:!0});return 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 $v(this,e)}
24_makeRequest(e,t,n,r,i=!0){if(this._deleted)return new M_(D_());{let a=Q_(e,this._appId,n,r,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){let[n,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,r).getPromise()}},uy=`@firebase/storage`,dy=`0.14.3`,fy=`storage`;function py(e,t,n){return e=y(e),ey(e,t,n)}function my(e){return e=y(e),ty(e)}function hy(e,t){return e=y(e),oy(e,t)}function gy(e=Yt(),t){e=y(e);let n=Gt(e,fy).getImmediate({identifier:t}),r=m(`storage`);return r&&_y(n,...r),n}function _y(e,t,n,r={}){cy(e,t,n,r)}function vy(e,{instanceIdentifier:t}){return new ly(e.getProvider(`app`).getImmediate(),e.getProvider(`auth-internal`),e.getProvider(`app-check-internal`),t,qt)}function yy(){Wt(new De(fy,vy,`PUBLIC`).setMultipleInstances(!0)),Xt(uy,dy,``),Xt(uy,dy,`esm2020`)}yy();var by=`type.googleapis.com/google.protobuf.Int64Value`,xy=`type.googleapis.com/google.protobuf.UInt64Value`;function Sy(e,t){let n={};for(let r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}function Cy(e){if(e==null)return null;if(e instanceof Number&&(e=e.valueOf()),typeof e==`number`&&isFinite(e)||e===!0||e===!1||Object.prototype.toString.call(e)===`[object String]`)return e;if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(e=>Cy(e));if(typeof e==`function`||typeof e==`object`)return Sy(e,e=>Cy(e));throw Error(`Data cannot be encoded in JSON: `+e)}function wy(e){if(e==null)return e;if(e[`@type`])switch(e[`@type`]){case by:case xy:{let t=Number(e.value);if(isNaN(t))throw Error(`Data cannot be decoded from JSON: `+e);return t}default:throw Error(`Data cannot be decoded from JSON: `+e)}return Array.isArray(e)?e.map(e=>wy(e)):typeof e==`function`||typeof e==`object`?Sy(e,e=>wy(e)):e}var Ty=`functions`,Ey={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`,UNIMPLEMENTED:`unimplemented`,INTERNAL:`internal`,UNAVAILABLE:`unavailable`,DATA_LOSS:`data-loss`},Dy=class e extends de{constructor(t,n,r){super(`${Ty}/${t}`,n||``),this.details=r,Object.setPrototypeOf(this,e.prototype)}};function Oy(e){if(e>=200&&e<300)return`ok`;switch(e){case 0:return`internal`;case 400:return`invalid-argument`;case 401:return`unauthenticated`;case 403:return`permission-denied`;case 404:return`not-found`;case 409:return`aborted`;case 429:return`resource-exhausted`;case 499:return`cancelled`;case 500:return`internal`;case 501:return`unimplemented`;case 503:return`unavailable`;case 504:return`deadline-exceeded`}return`unknown`}function ky(e,t){let n=Oy(e),r=n,i;try{let e=t&&t.error;if(e){let t=e.status;if(typeof t==`string`){if(!Ey[t])return new Dy(`internal`,`internal`);n=Ey[t],r=t}let a=e.message;typeof a==`string`&&(r=a),i=e.details,i!==void 0&&(i=wy(i))}}catch{}return n===`ok`?null:new Dy(n,r,i)}var Ay=class{constructor(e,t,n,r){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,C(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=n.getImmediate({optional:!0}),this.auth||t.get().then(e=>this.auth=e,()=>{}),this.messaging||n.get().then(e=>this.messaging=e,()=>{}),this.appCheck||r?.get().then(e=>this.appCheck=e,()=>{})}async getAuthToken(){if(this.auth)try{return(await this.auth.getToken())?.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!(`Notification`in self)||Notification.permission!==`granted`))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){let t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){return{authToken:await this.getAuthToken(),messagingToken:await this.getMessagingToken(),appCheckToken:await this.getAppCheckToken(e)}}},jy=`us-central1`,My=/^data: (.*?)(?:\n|$)/;function Ny(e){let t=null;return{promise:new Promise((n,r)=>{t=setTimeout(()=>{r(new Dy(`deadline-exceeded`,`deadline-exceeded`))},e)}),cancel:()=>{t&&clearTimeout(t)}}}var Py=class{constructor(e,t,n,r,i=jy,a=(...e)=>fetch(...e)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new Ay(e,t,n,r),this.cancelAllRequests=new Promise(e=>{this.deleteService=()=>Promise.resolve(e())});try{let e=new URL(i);this.customDomain=e.origin+(e.pathname===`/`?``:e.pathname),this.region=jy}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){let t=this.app.options.projectId;return this.emulatorOrigin===null?this.customDomain===null?`https://${this.region}-${t}.cloudfunctions.net/${e}`:`${this.customDomain}/${e}`:`${this.emulatorOrigin}/${t}/${this.region}/${e}`}};function Fy(e,t,n){let r=Te(t);e.emulatorOrigin=`http${r?`s`:``}://${t}:${n}`,r&&Ee(e.emulatorOrigin+`/backends`)}function Iy(e,t,n){let r=r=>By(e,t,r,n||{});return r.stream=(n,r)=>Hy(e,t,n,r),r}function Ly(e){return e.emulatorOrigin&&Te(e.emulatorOrigin)?`include`:void 0}async function Ry(e,t,n,r,i){n[`Content-Type`]=`application/json`;let a;try{a=await r(e,{method:`POST`,body:JSON.stringify(t),headers:n,credentials:Ly(i)})}catch{return{status:0,json:null}}let o=null;try{o=await a.json()}catch{}return{status:a.status,json:o}}async function zy(e,t){let n={},r=await e.contextProvider.getContext(t.limitedUseAppCheckTokens);return r.authToken&&(n.Authorization=`Bearer `+r.authToken),r.messagingToken&&
24(n[`Firebase-Instance-ID-Token`]=r.messagingToken),r.appCheckToken!==null&&(n[`X-Firebase-AppCheck`]=r.appCheckToken),n}function By(e,t,n,r){return Vy(e,e._url(t),n,r)}async function Vy(e,t,n,r){n=Cy(n);let i={data:n},a=await zy(e,r),o=Ny(r.timeout||7e4),s=await Promise.race([Ry(t,i,a,e.fetchImpl,e),o.promise,e.cancelAllRequests]);if(o.cancel(),!s)throw new Dy(`cancelled`,`Firebase Functions instance was deleted.`);let c=ky(s.status,s.json);if(c)throw c;if(!s.json)throw new Dy(`internal`,`Response is not valid JSON object.`);let l=s.json.data;if(l===void 0&&(l=s.json.result),l===void 0)throw new Dy(`internal`,`Response is missing data field.`);return{data:wy(l)}}function Hy(e,t,n,r){return Uy(e,e._url(t),n,r||{})}async function Uy(e,t,n,r){n=Cy(n);let i={data:n},a=await zy(e,r);a[`Content-Type`]=`application/json`,a.Accept=`text/event-stream`;let o;try{o=await e.fetchImpl(t,{method:`POST`,body:JSON.stringify(i),headers:a,signal:r?.signal,credentials:Ly(e)})}catch(e){if(e instanceof Error&&e.name===`AbortError`){let e=new Dy(`cancelled`,`Request was cancelled.`);return{data:Promise.reject(e),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(e)}}}}}}let t=ky(0,null);return{data:Promise.reject(t),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(t)}}}}}}let s,c,l=new Promise((e,t)=>{s=e,c=t});r?.signal?.addEventListener(`abort`,()=>{let e=new Dy(`cancelled`,`Request was cancelled.`);c(e)});let u=Wy(o.body.getReader(),s,c,r?.signal);return{stream:{[Symbol.asyncIterator](){let e=u.getReader();return{async next(){let{value:t,done:n}=await e.read();return{value:t,done:n}},async return(){return await e.cancel(),{done:!0,value:void 0}}}}},data:l}}function Wy(e,t,n,r){let i=(e,r)=>{let i=e.match(My);if(!i)return;let a=i[1];try{let e=JSON.parse(a);if(`result`in e){t(wy(e.result));return}if(`message`in e){r.enqueue(wy(e.message));return}if(`error`in e){let t=ky(0,e);r.error(t),n(t);return}}catch(e){if(e instanceof Dy){r.error(e),n(e);return}}},a=new TextDecoder;return new ReadableStream({start(t){let o=``;return s();async function s(){if(r?.aborted){let e=new Dy(`cancelled`,`Request was cancelled`);return t.error(e),n(e),Promise.resolve()}try{let{value:c,done:l}=await e.read();if(l){o.trim()&&i(o.trim(),t),t.close();return}if(r?.aborted){let r=new Dy(`cancelled`,`Request was cancelled`);t.error(r),n(r),await e.cancel();return}o+=a.decode(c,{stream:!0});let u=o.split(`
25`);o=u.pop()||``;for(let e of u)e.trim()&&i(e.trim(),t);return s()}catch(e){let r=e instanceof Dy?e:ky(0,null);t.error(r),n(r)}}},cancel(){return e.cancel()}})}var Gy=`@firebase/functions`,Ky=`0.13.4`,qy=`auth-internal`,Jy=`app-check-internal`,Yy=`messaging-internal`;function Xy(e){Wt(new De(Ty,(e,{instanceIdentifier:t})=>new Py(e.getProvider(`app`).getImmediate(),e.getProvider(qy),e.getProvider(Yy),e.getProvider(Jy),t),`PUBLIC`).setMultipleInstances(!0)),Xt(Gy,Ky,e),Xt(Gy,Ky,`esm2020`)}function Zy(e=Yt(),t=jy){let n=Gt(y(e),Ty).getImmediate({identifier:t}),r=m(`functions`);return r&&Qy(n,...r),n}function Qy(e,t,n){Fy(y(e),t,n)}function $y(e,t,n){return Iy(y(e),t,n)}Xy();export{Zi as A,vg as C,Xi as D,ss as E,Jt as M,Ui as O,Rh as S,Wi as T,Qg as _,hy as a,Mh as b,$g as c,Pg as d,t_ as f,Ig as g,Zg as h,gy as i,qi as j,Gi as k,Yg as l,Dg as m,$y as n,py as o,Mg as p,my as r,e_ as s,Zy as t,Xg as u,kg as v,_g as w,Nh as x,i_ as y};

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.