1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,465965,324045,e=>{"use strict";let t,n,r;var i,s,a,o,l,h,u,c,d,f,p,g,m,y,v,w,_=e.i(247167);let E={apiKey:"AIzaSyCefxsOxDIW2PEWPY9q11FauGhABXUM268",authDomain:"v3chat-700d3.firebaseapp.com",projectId:"v3chat-700d3",storageBucket:"v3chat-700d3.appspot.com",messagingSenderId:"726569477419",appId:"1:726569477419:web:065a6efb7d696b254f116e",measurementId:_.default.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID},b=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:((64512&i)==55296&&r+1<e.length&&(64512&e.charCodeAt(r+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},T=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 s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{let s=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return t.join("")},I={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,h=i>>2,u=(3&i)<<4|a>>4,c=(15&a)<<2|l>>6,d=63&l;!o&&(d=64,s||(c=64)),r.push(n[h],n[u],n[c],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(b(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):T(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 i=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0,a=++t<e.length?n[e.charAt(t)]:64,o=++t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==s||null==a||null==o)throw new S;let l=i<<2|s>>4;if(r.push(l),64!==a){let e=s<<4&240|a>>2;if(r.push(e),64!==o){let e=a<<6&192|o;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)}}};class S extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let C=function(e){let t=b(e);return I.encodeByteArray(t,!0)},A=function(e){return C(e).replace(/\./g,"")},D=function(e){try{return I.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},N=()=>{try{return("u">typeof self?self:"u">typeof window?window:e.g).__FIREBASE_DEFAULTS__||(()=>{if(void 0===_.default||void 0===_.default.env)return;let e=_.default.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("u"<typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&D(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},k=()=>{var e;return null==(e=N())?void 0:e.config};class x{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>
1{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}class R extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,R.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,L.prototype.create)}}class L{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var n,r;let i=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],o=a?(n=a,r=i,n.replace(O,(e,t)=>{let n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new R(s,l,i)}}let O=/\{\$([^}]+)}/g;function M(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],s=t[i];if(P(n)&&P(s)){if(!M(n,s))return!1}else if(n!==s)return!1}for(let e of r)if(!n.includes(e))return!1;return!0}function P(e){return null!==e&&"object"==typeof e}function V(e){return e&&e._delegate?e._delegate:e}class F{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let U="[DEFAULT]";class B{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 x;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!=(t=null==e?void 0:e.optional)&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}if(r)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:U})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=U){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=U){return this.instances.has(e)}getOptions(e=U){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){var n;let r=this.normalizeInstanceIdentifier(t),i=null!=(n=this.onInitCallbacks.get(r))?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var n;let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===U?void 0:n,options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}return r||null}normalizeInstanceIdentifier(e=U){return this.component?this.component.multipleInstances?e:U:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class j{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 B(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}let q=[];(i=s||(s={}))[i.DEBUG=0]="DEBUG",i[i.VERBOSE=1]="VERBOSE",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.ERROR=4]="ERROR",i[i.SILENT=5]="SILENT";
1let $={debug:s.DEBUG,verbose:s.VERBOSE,info:s.INFO,warn:s.WARN,error:s.ERROR,silent:s.SILENT},z=s.INFO,K={[s.DEBUG]:"log",[s.VERBOSE]:"log",[s.INFO]:"info",[s.WARN]:"warn",[s.ERROR]:"error"},G=(e,t,...n)=>{if(t<e.logLevel)return;let r=new Date().toISOString(),i=K[t];if(i)console[i](`[${r}] ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class H{constructor(e){this.name=e,this._logLevel=z,this._logHandler=G,this._userLogHandler=null,q.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in s))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?$[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,s.DEBUG,...e),this._logHandler(this,s.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,s.VERBOSE,...e),this._logHandler(this,s.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,s.INFO,...e),this._logHandler(this,s.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,s.WARN,...e),this._logHandler(this,s.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,s.ERROR,...e),this._logHandler(this,s.ERROR,...e)}}let Q=new WeakMap,W=new WeakMap,X=new WeakMap,Y=new WeakMap,J=new WeakMap,Z={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return W.get(e);if("objectStoreNames"===t)return e.objectStoreNames||X.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ee(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function ee(e){if(e instanceof IDBRequest){let t;return(t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(ee(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)})).then(t=>{t instanceof IDBCursor&&Q.set(t,e)}).catch(()=>{}),J.set(t,e),t}if(Y.has(e))return Y.get(e);let r=function(e){if("function"==typeof e)return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(n||(n=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(et(this),t),ee(Q.get(this))}:function(...t){return ee(e.apply(et(this),t))}:function(t,...n){let r=e.call(et(this),t,...n);return X.set(r,t.sort?t.sort():[t]),ee(r)};return e instanceof IDBTransaction&&function(e){if(W.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});W.set(e,t)}(e),(t||(t=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,Z):e}(e);return r!==e&&(Y.set(e,r),J.set(r,e)),r}let et=e=>J.get(e),en=["get","getKey","getAll","getAllKeys","count"],er=["put","add","delete","clear"],ei=new Map;function es(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(ei.get(t))return ei.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=er.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||en.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),a=s.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),i&&s.done]))[0]};return ei.set(t,s),s}Z={...r=Z,get:(e,t,n)=>es(e,t)||r.get(e,t,n),has:(e,t)=>!!es(e,t)||r.has(e,t)};class ea{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if((null==(t=e.getComponent())?void 0:t.type)!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let eo="@firebase/app",el="0.10.13",eh=new H("@firebase/app"),eu="[DEFAULT]",ec={[eo]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/vertexai-preview":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},ed=new Map,ef=new Map,ep=new Map;function eg(e,t){try{e.container.addComponent(t)}catch(n){eh.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function em(e){let t=e.name;if(ep.has(t))return eh.debug(`There were multiple attempts to register component ${t}.`),!1;
1for(let n of(ep.set(t,e),ed.values()))eg(n,e);for(let t of ef.values())eg(t,e);return!0}let ey=new L("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."});class ev{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new F("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 ey.create("app-deleted",{appName:this._name})}}function ew(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});let r=Object.assign({name:eu,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw ey.create("bad-app-name",{appName:String(i)});if(n||(n=k()),!n)throw ey.create("no-options");let s=ed.get(i);if(s)if(M(n,s.options)&&M(r,s.config))return s;else throw ey.create("duplicate-app",{appName:i});let a=new j(i);for(let e of ep.values())a.addComponent(e);let o=new ev(n,r,a);return ed.set(i,o),o}function e_(e,t,n){var r;let i=null!=(r=ec[e])?r:e;n&&(i+=`-${n}`);let s=i.match(/\s|\//),a=t.match(/\s|\//);if(s||a){let e=[`Unable to register library "${i}" with version "${t}":`];s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),eh.warn(e.join(" "));return}em(new F(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}let eE="firebase-heartbeat-store",eb=null;function eT(){return eb||(eb=(function(e,{blocked:t,upgrade:n,blocking:r,terminated:i}={}){let s=indexedDB.open(e,1),a=ee(s);return n&&s.addEventListener("upgradeneeded",e=>{n(ee(s.result),e.oldVersion,e.newVersion,ee(s.transaction),e)}),t&&s.addEventListener("blocked",e=>t(e.oldVersion,e.newVersion,e)),a.then(e=>{i&&e.addEventListener("close",()=>i()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a})("firebase-heartbeat-database",{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(eE)}catch(e){console.warn(e)}}}).catch(e=>{throw ey.create("idb-open",{originalErrorMessage:e.message})})),eb}async function eI(e){try{let t=(await eT()).transaction(eE),n=await t.objectStore(eE).get(eC(e));return await t.done,n}catch(e){if(e instanceof R)eh.warn(e.message);else{let t=ey.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});eh.warn(t.message)}}}async function eS(e,t){try{let n=(await eT()).transaction(eE,"readwrite"),r=n.objectStore(eE);await r.put(t,eC(e)),await n.done}catch(e){if(e instanceof R)eh.warn(e.message);else{let t=ey.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});eh.warn(t.message)}}}function eC(e){return`${e.name}!${e.options.appId}`}class eA{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new eN(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=eD();if((null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,(null==(t=this._heartbeatsCache)?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(e=>e.date===r))return;return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{let t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}catch(e){eh.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null||0===this._heartbeatsCache.heartbeats.length)return"";let t=eD(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){let n=[],r=e.slice();for(let i of e){let e=n.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),ek(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),ek(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=A(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return eh.warn(e),""}}}function eD(){return new Date().toISOString().substring(0,10)}class eN{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>
1{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=()=>{var e;t((null==(e=i.error)?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await eI(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return eS(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return eS(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function ek(e){return A(JSON.stringify({version:2,heartbeats:e})).length}em(new F("platform-logger",e=>new ea(e),"PRIVATE")),em(new F("heartbeat",e=>new eA(e),"PRIVATE")),e_(eo,el,""),e_(eo,el,"esm2017"),e_("fire-js",""),e_("firebase","10.14.1","app");var ex=e.i(467034),eR="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,eL={};(function(){function e(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.B=Array(this.blockSize),this.o=this.h=0,this.s()}var t=function(){this.blockSize=-1};function n(){}function r(e,t,n){n||(n=0);var r=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++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];var s=e.g[3],a=t+(s^n&(i^s))+r[0]+0xd76aa478|0;a=s+(i^(t=n+(a<<7|a>>>25))&(n^i))+r[1]+0xe8c7b756|0,a=i+(n^(s=t+(a<<12|a>>>20))&(t^n))+r[2]+0x242070db|0,a=n+(t^(i=s+(a<<17|a>>>15))&(s^t))+r[3]+0xc1bdceee|0,a=t+(s^(n=i+(a<<22|a>>>10))&(i^s))+r[4]+0xf57c0faf|0,a=s+(i^(t=n+(a<<7|a>>>25))&(n^i))+r[5]+0x4787c62a|0,a=i+(n^(s=t+(a<<12|a>>>20))&(t^n))+r[6]+0xa8304613|0,a=n+(t^(i=s+(a<<17|a>>>15))&(s^t))+r[7]+0xfd469501|0,a=t+(s^(n=i+(a<<22|a>>>10))&(i^s))+r[8]+0x698098d8|0,a=s+(i^(t=n+(a<<7|a>>>25))&(n^i))+r[9]+0x8b44f7af|0,a=i+(n^(s=t+(a<<12|a>>>20))&(t^n))+r[10]+0xffff5bb1|0,a=n+(t^(i=s+(a<<17|a>>>15))&(s^t))+r[11]+0x895cd7be|0,a=t+(s^(n=i+(a<<22|a>>>10))&(i^s))+r[12]+0x6b901122|0,a=s+(i^(t=n+(a<<7|a>>>25))&(n^i))+r[13]+0xfd987193|0,a=i+(n^(s=t+(a<<12|a>>>20))&(t^n))+r[14]+0xa679438e|0,a=n+(t^(i=s+(a<<17|a>>>15))&(s^t))+r[15]+0x49b40821|0,n=i+(a<<22|a>>>10),a=t+(i^s&(n^i))+r[1]+0xf61e2562|0,t=n+(a<<5|a>>>27),a=s+(n^i&(t^n))+r[6]+0xc040b340|0,s=t+(a<<9|a>>>23),a=i+(t^n&(s^t))+r[11]+0x265e5a51|0,i=s+(a<<14|a>>>18),a=n+(s^t&(i^s))+r[0]+0xe9b6c7aa|0,n=i+(a<<20|a>>>12),a=t+(i^s&(n^i))+r[5]+0xd62f105d|0,t=n+(a<<5|a>>>27),a=s+(n^i&(t^n))+r[10]+0x2441453|0,s=t+(a<<9|a>>>23),a=i+(t^n&(s^t))+r[15]+0xd8a1e681|0,i=s+(a<<14|a>>>18),a=n+(s^t&(i^s))+r[4]+0xe7d3fbc8|0,n=i+(a<<20|a>>>12),a=t+(i^s&(n^i))+r[9]+0x21e1cde6|0,t=n+(a<<5|a>>>27),a=s+(n^i&(t^n))+r[14]+0xc33707d6|0,s=t+(a<<9|a>>>23),a=i+(t^n&(s^t))+r[3]+0xf4d50d87|0,i=s+(a<<14|a>>>18),a=n+(s^t&(i^s))+r[8]+0x455a14ed|0,n=i+(a<<20|a>>>12),a=t+(i^s&(n^i))+r[13]+0xa9e3e905|0,t=n+(a<<5|a>>>27),a=s+(n^i&(t^n))+r[2]+0xfcefa3f8|0,s=t+(a<<9|a>>>23),a=i+(t^n&(s^t))+r[7]+0x676f02d9|0,i=s+(a<<14|a>>>18),a=n+(s^t&(i^s))+r[12]+0x8d2a4c8a|0,a=t+((n=i+(a<<20|a>>>12))^i^s)+r[5]+0xfffa3942|0,a=s+((t=n+(a<<4|a>>>28))^n^i)+r[8]+0x8771f681|0,a=i+((s=t+(a<<11|a>>>21))^t^n)+r[11]+0x6d9d6122|0,a=n+((i=s+(a<<16|a>>>16))^s^t)+r[14]+0xfde5380c|0,a=t+((n=i+(a<<23|a>>>9))^i^s)+r[1]+0xa4beea44|0,a=s+((t=n+(a<<4|a>>>28))^n^i)+r[4]+0x4bdecfa9|0,a=i+((s=t+(a<<11|a>>>21))^t^n)+r[7]+0xf6bb4b60|0,a=n+((i=s+(a<<16|a>>>16))^s^t)+r[10]+0xbebfbc70|0,a=t+((n=i+(a<<23|a>>>9))^i^s)+r[13]+0x289b7ec6|0,a=s+((t=n+(a<<4|a>>>28))^n^i)+r[0]+0xeaa127fa|0,a=i+((s=t+(a<<11|a>>>21))^t^n)+r[3]+0xd4ef3085|0,a=n+((i=s+(a<<16|a>>>16))^s^t)+r[6]+0x4881d05|0,a=t+((n=i+(a<<23|a>>>9))^i^s)+r[9]+0xd9d4d039|0,a=s+((t=n+(a<<4|a>>>28))^n^i)+r[12]+0xe6db99e5|0,a=i+((s=t+(a<<11|a>>>21))^t^n)+r[15]+0x1fa27cf8|0,a=n+((i=s+(a<<16|a>>>16))^s^t)+r[2]+0xc4ac5665|0,n=i+(a<<23|a>>>9),a=t+(i^(n|~s))+r[0]+0xf4292244|0,t=n+(a<<6|a>>>26),a=s+(n^(t|~i))+r[7]+0x432aff97|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~n))+r[14]+0xab9423a7|0,i=s+(a<<15|a>>>17),a=n+(s^(i|~t))+r[5]+0xfc93a039|0,n=i+(a<<21|a>>>11),a=t+(i^(n|~s))+r[12]+0x655b59c3|0,t=n+(a<<6|a>>>26),a=s+(n^(t|~i))+r[3]+0x8f0ccc92|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~n))+r[10]+0xffeff47d|0,i=s+(a<<15|a>>>17),a=n+(s^(i|~t))+r[1]+0x85845dd1|0,n=i+(a<<21|a>>>11),a=t+(i^(n|~s))+r[8]+0x6fa87e4f|0,t=n+(a<<6|a>>>26),a=s+(n^(t|~i))+r[15]+0xfe2ce6e0|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~n))+r[6]+0xa3014314|0,i=s+(a<<15|a>>>17),a=n+(s^(i|~t))+r[13]+0x4e0811a1|0,n=i+(a<<21|a>>>11),a=t+(i^(n|~s))+r[4]+0xf7537e82|0,t=n+(a<<6|a>>>
126),a=s+(n^(t|~i))+r[11]+0xbd3af235|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~n))+r[2]+0x2ad7d2bb|0,i=s+(a<<15|a>>>17),a=n+(s^(i|~t))+r[9]+0xeb86d391|0,e.g[0]=e.g[0]+t|0,e.g[1]=e.g[1]+(i+(a<<21|a>>>11))|0,e.g[2]=e.g[2]+i|0,e.g[3]=e.g[3]+s|0}function i(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var s=0|e[i];r&&s==t||(n[i]=s,r=!1)}this.g=n}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)},e.prototype.s=function(){this.g[0]=0x67452301,this.g[1]=0xefcdab89,this.g[2]=0x98badcfe,this.g[3]=0x10325476,this.o=this.h=0},e.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,i=this.B,s=this.h,a=0;a<t;){if(0==s)for(;a<=n;)r(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(i[s++]=e.charCodeAt(a++),s==this.blockSize){r(this,i),s=0;break}}else for(;a<t;)if(i[s++]=e[a++],s==this.blockSize){r(this,i),s=0;break}}this.h=s,this.o+=t},e.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var s,l={};function h(e){var t;return -128<=e&&128>e?(t=function(e){return new i([0|e],0>e?-1:0)},Object.prototype.hasOwnProperty.call(l,e)?l[e]:l[e]=t(e)):new i([0|e],0>e?-1:0)}function u(e){if(isNaN(e)||!isFinite(e))return c;if(0>e)return m(u(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=0x100000000;return new i(t,0)}var c=h(0),d=h(1),f=h(0x1000000);function p(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function g(e){return -1==e.h}function m(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new i(n,~e.h).add(d)}function y(e,t){return e.add(m(t))}function v(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function w(e,t){this.g=e,this.h=t}function _(e,t){if(p(t))throw Error("division by zero");if(p(e))return new w(c,c);if(g(e))return t=_(m(e),t),new w(m(t.g),m(t.h));if(g(t))return t=_(e,m(t)),new w(m(t.g),t.h);if(30<e.g.length){if(g(e)||g(t))throw Error("slowDivide_ only works with positive integers.");for(var n=d,r=t;0>=r.l(e);)n=E(n),r=E(r);var i=b(n,1),s=b(r,1);for(r=b(r,2),n=b(n,2);!p(r);){var a=s.add(r);0>=a.l(e)&&(i=i.add(n),s=a),r=b(r,1),n=b(n,1)}return t=y(e,i.j(t)),new w(i,t)}for(i=c;0<=e.l(t);){for(r=48>=(r=Math.ceil(Math.log(n=Math.max(1,Math.floor(e.m()/t.m())))/Math.LN2))?1:Math.pow(2,r-48),a=(s=u(n)).j(t);g(a)||0<a.l(e);)n-=r,a=(s=u(n)).j(t);p(s)&&(s=d),i=i.add(s),e=y(e,a)}return new w(i,e)}function E(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new i(n,e.h)}function b(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,s=[],a=0;a<r;a++)s[a]=0<t?e.i(a+n)>>>t|e.i(a+n+1)<<32-t:e.i(a+n);return new i(s,e.h)}(s=i.prototype).m=function(){if(g(this))return-m(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:0x100000000+r)*t,t*=0x100000000}return e},s.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(p(this))return"0";if(g(this))return"-"+m(this).toString(e);for(var t=u(Math.pow(e,6)),n=this,r="";;){var i=_(n,t).g,s=((0<(n=y(n,i.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(p(n=i))return s+r;for(;6>s.length;)s="0"+s;r=s+r}},s.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},s.l=function(e){return g(e=y(this,e))?-1:+!p(e)},s.abs=function(){return g(this)?m(this):this},s.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,s=0;s<=t;s++){var a=r+(65535&this.i(s))+(65535&e.i(s)),o=(a>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=o>>>16,a&=65535,o&=65535,n[s]=o<<16|a}return new i(n,-0x80000000&n[n.length-1]?-1:0)},s.j=function(e){if(p(this)||p(e))return c;if(g(this))return g(e)?m(this).j(m(e)):m(m(this).j(e));if(g(e))return m(this.j(m(e)));if(0>this.l(f)&&0>e.l(f))return u(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<e.g.length;s++){var a=this.i(r)>>>16,o=65535&this.i(r),l=e.i(s)>>>16,h=65535&e.i(s);n[2*r+2*s]+=o*h,v(n,2*r+2*s),n[2*r+2*s+1]+=a*h,v(n,2*r+2*s+1),n[2*r+2*s+1]+=o*l,v(n,2*r+2*s+1),n[2*r+2*s+2]+=a*l,v(n,2*r+2*s+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new i(n,0)},s.A=function(e){return _(this,e).h},s.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new i(n,this.h&e.h)},s.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new i(n,this.h|e.h)},s.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new i(n,this.h^e.h)},e.prototype.digest=e.prototype.v,e.prototype.reset=e.prototype.s,e.prototype.update=e.prototype.u,o=eL.Md5=e,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.A,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=u,i.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);
1if("-"==t.charAt(0))return m(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=u(Math.pow(n,8)),i=c,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),o=parseInt(t.substring(s,s+a),n);8>a?(a=u(Math.pow(n,a)),i=i.j(a).add(u(o))):i=(i=i.j(r)).add(u(o))}return i},a=eL.Integer=i}).apply(void 0!==eR?eR:"u">typeof self?self:"u">typeof window?window:{});var eO="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,eM={};(function(){var e,t,n,r="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},i=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof eO&&eO];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")}(this);!function(e,t){if(t)e:{var n=i;e=e.split(".");for(var s=0;s<e.length-1;s++){var a=e[s];if(!(a in n))break e;n=n[a]}(t=t(s=n[e=e[e.length-1]]))!=s&&null!=t&&r(n,e,{configurable:!0,writable:!0,value:t})}}("Array.prototype.values",function(e){return e||function(){var e,t,n,r,i;return e=this,t=function(e,t){return t},e instanceof String&&(e+=""),n=0,r=!1,(i={next:function(){if(!r&&n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r=!0,{done:!0,value:void 0}}})[Symbol.iterator]=function(){return i},i}});var s=s||{},a=this||self;function o(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function m(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function y(e,t,n){return e.call.apply(e.bind,arguments)}function v(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function w(e,t,n){return(w=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?y:v).apply(null,arguments)}function _(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function E(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)}}function b(e){let t=e.length;if(0<t){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function T(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(o(n)){let t=e.length||0,r=n.length||0;e.length=t+r;for(let i=0;i<r;i++)e[t+i]=n[i]}else e.push(n)}}function I(e){return/^[\s\xa0]*$/.test(e)}function S(){var e=a.navigator;return e&&(e=e.userAgent)?e:""}function C(e){return C[" "](e),e}C[" "]=function(){};var A=-1!=S().indexOf("Gecko")&&(-1==S().toLowerCase().indexOf("webkit")||-1!=S().indexOf("Edge"))&&-1==S().indexOf("Trident")&&-1==S().indexOf("MSIE")&&-1==S().indexOf("Edge");function D(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function N(e){let t={};for(let n in e)t[n]=e[n];return t}let k="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function x(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t])e[n]=r[n];for(let t=0;t<k.length;t++)n=k[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}var R=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new L,e=>e.reset());class L{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 O,M=!1,P=new class{constructor(){this.h=this.g=null}add(e,t){let n=R.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},V=()=>{let e=a.Promise.resolve(void 0);O=()=>{e.then(F)}};var F=()=>{let e;for(var t;e=null,P.g&&(e=P.g,P.g=P.g.next,P.g||(P.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){a.setTimeout(()=>{throw e},0)}(e)}R.j(t),100>R.h&&(R.h++,t.next=R.g,R.g=t)}M=!1};function U(){this.s=this.s,this.C=this.C}function B(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}U.prototype.s=!1,U.prototype.ma=function(){this.s||(this.s=!0,this.N())},U.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},B.prototype.h=function(){this.defaultPrevented=!0};var j=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};a.addEventListener("test",e,t),a.removeEventListener("test",e,t)}catch(e){}return e}();function q(e,t){if(B.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(A){e:{try{C(t.nodeName);var i=!0;break e}catch(e){}i=!1}i||(t=null)}}
1else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:$[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&q.aa.h.call(this)}}E(q,B);var $={2:"touch",3:"pen",4:"mouse"};q.prototype.h=function(){q.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var z="closure_listenable_"+(1e6*Math.random()|0),K=0;function G(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=++K,this.da=this.fa=!1}function H(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function Q(e){this.src=e,this.g={},this.h=0}function W(e,t){var n=t.type;if(n in e.g){var r,i=e.g[n],s=Array.prototype.indexOf.call(i,t,void 0);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(H(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function X(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i];if(!s.da&&s.listener==t&&!!n==s.capture&&s.ha==r)return i}return -1}Q.prototype.add=function(e,t,n,r,i){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var a=X(e,t,r,i);return -1<a?(t=e[a],n||(t.fa=!1)):((t=new G(t,this.src,s,!!r,i)).fa=n,e.push(t)),t};var Y="closure_lm_"+(1e6*Math.random()|0),J={};function Z(e,t,n,r,i,s){if(!t)throw Error("Invalid event type");var a=m(i)?!!i.capture:!!i,o=er(e);if(o||(e[Y]=o=new Q(e)),(n=o.add(t,n,r,a,s)).proxy)return n;if(r=function e(t){return en.call(e.src,e.listener,t)},n.proxy=r,r.src=e,r.listener=n,e.addEventListener)j||(i=a),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(et(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function ee(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[z])W(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(et(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=er(t))?(W(n,e),0==n.h&&(n.src=null,t[Y]=null)):H(e)}}}function et(e){return e in J?J[e]:J[e]="on"+e}function en(e,t){if(e.da)e=!0;else{t=new q(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&ee(e),e=n.call(r,t)}return e}function er(e){return(e=e[Y])instanceof Q?e:null}var ei="__closure_events_fn_"+(1e9*Math.random()>>>0);function es(e){return"function"==typeof e?e:(e[ei]||(e[ei]=function(t){return e.handleEvent(t)}),e[ei])}function ea(){U.call(this),this.i=new Q(this),this.M=this,this.F=null}function eo(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new B(t,e);else if(t instanceof B)t.target=t.target||e;else{var i=t;x(t=new B(r,e),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var a=t.g=n[s];i=el(a,r,!0,t)&&i}if(i=el(a=t.g=e,r,!0,t)&&i,i=el(a,r,!1,t)&&i,n)for(s=0;s<n.length;s++)i=el(a=t.g=n[s],r,!1,t)&&i}function el(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,s=0;s<t.length;++s){var a=t[s];if(a&&!a.da&&a.capture==n){var o=a.listener,l=a.ha||a.src;a.fa&&W(e.i,a),i=!1!==o.call(l,r)&&i}}return i&&!r.defaultPrevented}function eh(e,t,n){if("function"==typeof e)n&&(e=w(e,n));else if(e&&"function"==typeof e.handleEvent)e=w(e.handleEvent,e);else throw Error("Invalid listener argument");return 0x7fffffff<Number(t)?-1:a.setTimeout(e,t||0)}E(ea,U),ea.prototype[z]=!0,ea.prototype.removeEventListener=function(e,t,n,r){!function e(t,n,r,i,s){if(Array.isArray(n))for(var a=0;a<n.length;a++)e(t,n[a],r,i,s);else(i=m(i)?!!i.capture:!!i,r=es(r),t&&t[z])?(t=t.i,(n=String(n).toString())in t.g&&-1<(r=X(a=t.g[n],r,i,s))&&(H(a[r]),Array.prototype.splice.call(a,r,1),0==a.length&&(delete t.g[n],t.h--))):t&&(t=er(t))&&(n=t.g[n.toString()],t=-1,n&&(t=X(n,r,i,s)),(r=-1<t?n[t]:null)&&ee(r))}(this,e,t,n,r)},ea.prototype.N=function(){if(ea.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)H(n[r]);delete t.g[e],t.h--}}this.F=null},ea.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},ea.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class eu extends U{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:function e(t){t.g=eh(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.l);let n=t.h;t.h=null,t.m.apply(null,n)}(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ec(e){U.call(this),this.h=e,this.g={}}E(ec,U);var ed=[];function ef(e){D(e.g,function(e,t){this.g.hasOwnProperty(t)&&ee(e)},e),e.g={}}ec.prototype.N=function(){ec.aa.N.call(this),ef(this)},ec.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ep=a.JSON.stringify,eg=a.JSON.parse,em=class{stringify(e){return a.JSON.stringify(e,void 0)}parse(e){return a.JSON.parse(e,void 0)}};function ey(){}function ev(e){return e.h||(e.h=e.i())}function ew(){}ey.prototype.h=null;var e_={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function eE(){B.call(this,"d")}function eb(){B.call(this,"c")}E(eE,B),E(eb,B);var eT={},eI=null;function eS(){return eI=eI||new ea}function eC(e){B.call(this,eT.La,e)}function eA(e){let t=eS();eo(t,new eC(t))}function eD(e,t){B.call(this,eT.STAT_EVENT,e),this.stat=t}function eN(e){let t=eS();eo(t,new eD(t,e))}function ek(e,t){B.call(this,eT.Ma,e),this.size=t}function ex(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){e()},t)}function eR(){this.g=!0}function eL(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var a=1;a<i.length;a++)i[a]=""}}}}return ep(n)}catch(e){return t}}(e,n)+(r?" "+r:"")})}eT.La="serverreachability",E(eC,B),eT.STAT_EVENT="statevent",E(eD,B),eT.Ma="timingevent",E(ek,B),eR.prototype.xa=function(){this.g=!1},eR.prototype.info=function(){};var eP={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},eV={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function eF(){}function eU(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new ec(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new eB}function eB(){this.i=null,this.g="",this.h=!1}E(eF,ey),eF.prototype.g=function(){return new XMLHttpRequest},eF.prototype.i=function(){return{}},t=new eF;var ej={},eq={};function e$(e,t,n){e.L=1,e.v=ti(e9(t)),e.m=n,e.P=!0,ez(e,null)}function ez(e,t){e.F=Date.now(),eG(e),e.A=e9(e.v);var n,r,i,s,a,o,l=e.A,h=e.R;Array.isArray(h)||(h=[String(h)]),ty(l.i,"t",h),e.C=0,l=e.j.J,e.h=new eB,e.g=t3(e.j,l?t:null,!e.m),
10<e.O&&(e.M=new eu(w(e.Y,e,e.g),e.O)),t=e.U,l=e.g,h=e.ca;var u="readystatechange";Array.isArray(u)||(u&&(ed[0]=u.toString()),u=ed);for(var c=0;c<u.length;c++){var d=function e(t,n,r,i,s){if(i&&i.once)return function e(t,n,r,i,s){if(Array.isArray(n)){for(var a=0;a<n.length;a++)e(t,n[a],r,i,s);return null}return r=es(r),t&&t[z]?t.L(n,r,m(i)?!!i.capture:!!i,s):Z(t,n,r,!0,i,s)}(t,n,r,i,s);if(Array.isArray(n)){for(var a=0;a<n.length;a++)e(t,n[a],r,i,s);return null}return r=es(r),t&&t[z]?t.K(n,r,m(i)?!!i.capture:!!i,s):Z(t,n,r,!1,i,s)}(l,u[c],h||t.handleEvent,!1,t.h||t);if(!d)break;t.g[d.key]=d}t=e.H?N(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),eA(),n=e.i,r=e.u,i=e.A,s=e.l,a=e.R,o=e.m,n.info(function(){if(n.g)if(o)for(var e="",t=o.split("&"),l=0;l<t.length;l++){var h=t[l].split("=");if(1<h.length){var u=h[0];h=h[1];var c=u.split("_");e=2<=c.length&&"type"==c[1]?e+(u+"=")+h+"&":e+(u+"=redacted&")}}else e=null;else e=o;return"XMLHTTP REQ ("+s+") [attempt "+a+"]: "+r+"\n"+i+"\n"+e})}function eK(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.j.Ca}function eG(e){e.S=Date.now()+e.I,eH(e,e.I)}function eH(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=ex(w(e.ba,e),t)}function eQ(e){e.B&&(a.clearTimeout(e.B),e.B=null)}function eW(e){0==e.j.G||e.J||tJ(e.j,e)}function eX(e){eQ(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ef(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function eY(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||e2(n.h,e))){if(!e.K&&e2(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g)if(n.g.F+3e3<e.F)tY(n),tj(n);else break e;tQ(n),eN(18)}}else n.za=i[1],0<n.za-n.T&&37500>i[2]&&n.F&&0==n.v&&!n.C&&(n.C=ex(w(n.Za,n),6e3));if(1>=e1(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else t0(n,11)}else if((e.K||n.g==e)&&tY(n),!I(t))for(i=n.Da.g.parse(t),t=0;t<i.length;t++){let o=i[t];if(n.T=o[0],o=o[1],2==n.G)if("c"==o[0]){n.K=o[1],n.ia=o[2];let t=o[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));let i=o[4];null!=i&&(n.Aa=i,n.j.info("SVER="+n.Aa));let l=o[5];null!=l&&"number"==typeof l&&0<l&&(n.L=r=1.5*l,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;let h=e.g;if(h){let e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=r.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(e3(s,s.h),s.h=null))}if(r.D){let e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.ya=e,tr(r.I,r.D,e))}}if(n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms")),(r=n).qa=t2(r,r.J?r.ia:null,r.W),e.K){e6(r.h,e);var a=r.L;a&&(e.I=a),e.B&&(eQ(e),eG(e)),r.g=e}else tH(r);0<n.i.length&&t$(n)}else"stop"!=o[0]&&"close"!=o[0]||t0(n,7);else 3==n.G&&("stop"==o[0]||"close"==o[0]?"stop"==o[0]?t0(n,7):tB(n):"noop"!=o[0]&&n.l&&n.l.ta(o),n.v=0)}}eA(4)}catch(e){}}eU.prototype.ca=function(e){e=e.target;let t=this.M;t&&3==tP(e)?t.j():this.Y(e)},eU.prototype.Y=function(e){try{if(e==this.g)e:{let v=tP(this.g);var t=this.g.Ba();let w=this.g.Z();if(!(3>v)&&(3!=v||this.g&&(this.h.h||this.g.oa()||tV(this.g)))){this.J||4!=v||7==t||(8==t||0>=w?eA(3):eA(2)),eQ(this);var n=this.g.Z();this.X=n;t:if(eK(this)){var r=tV(this.g);e="";var i=r.length,s=4==tP(this.g);if(!this.h.i){if("u"<typeof TextDecoder){eX(this),eW(this);var o="";break t}this.h.i=new a.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:!(s&&t==i-1)});r.length=0,this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.oa();if(this.o=200==n,l=this.i,h=this.u,u=this.A,c=this.l,d=this.R,f=n,l.info(function(){return"XMLHTTP RESP ("+c+") [ attempt "+d+"]: "+h+"\n"+u+"\n"+v+" "+f}),this.o){if(this.T&&!this.K){t:{if(this.g){var l,h,u,c,d,f,p,g=this.g;if((p=g.g?g.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!I(p)){var m=p;break t}}m=null}if(n=m)eL(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,eY(this,n);else{this.o=!1,this.s=3,eN(12),eX(this),eW(this);break e}}if(this.P){let e;for(n=!0;!this.J&&this.C<o.length;)if((e=function(e,t){var n=e.C,r=t.indexOf("\n",n);return -1==r?eq:isNaN(n=Number(t.substring(n,r)))?ej:(r+=1)+n>t.length?eq:(t=t.slice(r,r+n),e.C=r+n,t)}(this,o))==eq){4==v&&(this.s=4,eN(14),n=!1),eL(this.i,this.l,null,"[Incomplete Response]");break}else if(e==ej){this.s=4,eN(15),eL(this.i,this.l,o,"[Invalid Chunk]"),n=!1;break}else eL(this.i,this.l,e,null),eY(this,e);if(eK(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=v||0!=o.length||this.h.h||(this.s=1,eN(16),n=!1),this.o=this.o&&n,n){if(0<o.length&&!this.W){this.W=!0;var y=this.j;y.g==this&&y.ba&&!y.M&&(y.j.info("Great, no buffering proxy detected. Bytes received: "+o.length),tW(y),y.M=!0,eN(11))}}else eL(this.i,this.l,o,"[Invalid Chunked Response]"),eX(this),eW(this)}else eL(this.i,this.l,o,null),eY(this,o);4==v&&eX(this),this.o&&!this.J&&(4==v?tJ(this.j,this):(this.o=!1,eG(this)))}else(function(e){let t={};e=(e.g&&2<=tP(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(I(e[r]))continue;var n=function(e){var t=1;e=e.split(":");let n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}(e[r]);let i=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();let s=t[i]||[];t[i]=s,s.push(n)}
1var r=function(e){return e.join(", ")};for(let e in t)r.call(void 0,t[e],e,t)})(this.g),400==n&&0<o.indexOf("Unknown SID")?(this.s=3,eN(12)):(this.s=0,eN(13)),eX(this),eW(this)}}}catch(e){}finally{}},eU.prototype.cancel=function(){this.J=!0,eX(this)},eU.prototype.ba=function(){var e,t;this.B=null;let n=Date.now();0<=n-this.S?(e=this.i,t=this.A,e.info(function(){return"TIMEOUT: "+t}),2!=this.L&&(eA(),eN(17)),eX(this),this.s=2,eW(this)):eH(this,this.S-n)};var eJ=class{constructor(e,t){this.g=e,this.map=t}};function eZ(e){this.l=e||10,e=a.PerformanceNavigationTiming?0<(e=a.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function e0(e){return!!e.h||!!e.g&&e.g.size>=e.j}function e1(e){return e.h?1:e.g?e.g.size:0}function e2(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function e3(e,t){e.g?e.g.add(t):e.h=t}function e6(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function e4(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let n of e.g.values())t=t.concat(n.D);return t}return b(e.i)}function e5(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(o(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("u">typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("u">typeof Set&&e instanceof Set)){if(o(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(let r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("u">typeof Map&&e instanceof Map||"u">typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(o(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),i=r.length,s=0;s<i;s++)t.call(void 0,r[s],n&&n[s],e)}eZ.prototype.cancel=function(){if(this.i=e4(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var e8=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function e7(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof e7){this.h=e.h,te(this,e.j),this.o=e.o,this.g=e.g,tt(this,e.s),this.l=e.l;var t=e.i,n=new tf;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),tn(this,n),this.m=e.m}else e&&(t=String(e).match(e8))?(this.h=!1,te(this,t[1]||"",!0),this.o=ts(t[2]||""),this.g=ts(t[3]||"",!0),tt(this,t[4]),this.l=ts(t[5]||"",!0),tn(this,t[6]||"",!0),this.m=ts(t[7]||"")):(this.h=!1,this.i=new tf(null,this.h))}function e9(e){return new e7(e)}function te(e,t,n){e.j=n?ts(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function tt(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function tn(e,t,n){var r,i;t instanceof tf?(e.i=t,r=e.i,(i=e.h)&&!r.j&&(tp(r),r.i=null,r.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(tg(this,t),ty(this,n,e))},r)),r.j=i):(n||(t=ta(t,tc)),e.i=new tf(t,e.h))}function tr(e,t,n){e.i.set(t,n)}function ti(e){return tr(e,"zx",Math.floor(0x80000000*Math.random()).toString(36)+Math.abs(Math.floor(0x80000000*Math.random())^Date.now()).toString(36)),e}function ts(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function ta(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,to),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function to(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}e7.prototype.toString=function(){var e=[],t=this.j;t&&e.push(ta(t,tl,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(ta(t,tl,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(ta(n,"/"==n.charAt(0)?tu:th,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",ta(n,td)),e.join("")};var tl=/[#\/\?@]/g,th=/[#\?:]/g,tu=/[#\?]/g,tc=/[#\?@]/g,td=/#/g;function tf(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function tp(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var s=e[n].substring(0,r);i=e[n].substring(r+1)}else s=e[n];t(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function tg(e,t){tp(e),t=tv(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function tm(e,t){return tp(e),t=tv(e,t),e.g.has(t)}function ty(e,t,n){tg(e,t),0<n.length&&(e.i=null,e.g.set(tv(e,t),b(n)),e.h+=n.length)}function tv(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function tw(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch(e){}}function t_(){this.g=new em}function tE(e){this.l=e.Ub||null,this.j=e.eb||!1}function tb(e,t){ea.call(this),this.D=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.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function tT(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function tI(e){e.readyState=4,e.l=null,e.j=null,e.v=null,tS(e)}function tS(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function tC(e){let t="";return D(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function tA(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=tC(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):tr(e,t,n))}function tD(e){ea.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(n=tf.prototype).add=function(e,t){tp(this),this.i=null,e=tv(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this}
1,n.forEach=function(e,t){tp(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},n.na=function(){tp(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){let i=e[r];for(let e=0;e<i.length;e++)n.push(t[r])}return n},n.V=function(e){tp(this);let t=[];if("string"==typeof e)tm(this,e)&&(t=t.concat(this.g.get(tv(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},n.set=function(e,t){return tp(this),this.i=null,tm(this,e=tv(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},n.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];let s=encodeURIComponent(String(r)),a=this.V(r);for(r=0;r<a.length;r++){var i=s;""!==a[r]&&(i+="="+encodeURIComponent(String(a[r]))),e.push(i)}}return this.i=e.join("&")},E(tE,ey),tE.prototype.g=function(){return new tb(this.l,this.j)},tE.prototype.i=(e={},function(){return e}),E(tb,ea),(n=tb.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,tS(this)},n.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||a).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,tI(this)),this.readyState=0},n.Sa=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,tS(this)),this.g&&(this.readyState=3,tS(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==a.ReadableStream&&"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.v=new TextDecoder;tT(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},n.Pa=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(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tI(this):tS(this),3==this.readyState&&tT(this)}},n.Ra=function(e){this.g&&(this.response=this.responseText=e,tI(this))},n.Qa=function(e){this.g&&(this.response=e,tI(this))},n.ga=function(){this.g&&tI(this)},n.setRequestHeader=function(e,t){this.u.append(e,t)},n.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var n=t.next();!n.done;)e.push((n=n.value)[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(tb.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),E(tD,ea);var tN=/^https?$/i,tk=["POST","PUT"];function tx(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,tR(e),tO(e)}function tR(e){e.A||(e.A=!0,eo(e,"complete"),eo(e,"error"))}function tL(e){if(e.h&&void 0!==s&&(!e.v[1]||4!=tP(e)||2!=e.Z())){if(e.u&&4==tP(e))eh(e.Ea,0,e);else if(eo(e,"readystatechange"),4==tP(e)){e.h=!1;try{let s=e.Z();switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,n,r=!0;break;default:r=!1}if(!(t=r)){if(n=0===s){var i=String(e.D).match(e8)[1]||null;!i&&a.self&&a.self.location&&(i=a.self.location.protocol.slice(0,-1)),n=!tN.test(i?i.toLowerCase():"")}t=n}if(t)eo(e,"complete"),eo(e,"success");else{e.m=6;try{var o=2<tP(e)?e.g.statusText:""}catch(e){o=""}e.l=o+" ["+e.Z()+"]",tR(e)}}finally{tO(e)}}}}function tO(e,t){if(e.g){tM(e);let n=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||eo(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function tM(e){e.I&&(a.clearTimeout(e.I),e.I=null)}function tP(e){return e.g?e.g.readyState:0}function tV(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}
1function tF(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tU(e){this.Aa=0,this.i=[],this.j=new eR,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=tF("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=tF("baseRetryDelayMs",5e3,e),this.cb=tF("retryDelaySeedMs",1e4,e),this.Wa=tF("forwardChannelMaxRetries",2,e),this.wa=tF("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new eZ(e&&e.concurrentRequestLimit),this.Da=new t_,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function tB(e){if(tq(e),3==e.G){var t=e.U++,n=e9(e.I);if(tr(n,"SID",e.K),tr(n,"RID",t),tr(n,"TYPE","terminate"),tK(e,n),(t=new eU(e,e.j,t)).L=2,t.v=ti(e9(n)),n=!1,a.navigator&&a.navigator.sendBeacon)try{n=a.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&a.Image&&((new Image).src=t.v,n=!0),n||(t.g=t3(t.j,null),t.g.ea(t.v)),t.F=Date.now(),eG(t)}t1(e)}function tj(e){e.g&&(tW(e),e.g.cancel(),e.g=null)}function tq(e){tj(e),e.u&&(a.clearTimeout(e.u),e.u=null),tY(e),e.h.cancel(),e.s&&("number"==typeof e.s&&a.clearTimeout(e.s),e.s=null)}function t$(e){if(!e0(e.h)&&!e.s){e.s=!0;var t=e.Ga;O||V(),M||(O(),M=!0),P.add(t,e),e.B=0}}function tz(e,t){var n;n=t?t.l:e.U++;let r=e9(e.I);tr(r,"SID",e.K),tr(r,"RID",n),tr(r,"AID",e.T),tK(e,r),e.m&&e.o&&tA(r,e.m,e.o),n=new eU(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=tG(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),e3(e.h,n),e$(n,r,t)}function tK(e,t){e.H&&D(e.H,function(e,n){tr(t,n,e)}),e.l&&e5({},function(e,n){tr(t,n,e)})}function tG(e,t,n){n=Math.min(e.i.length,n);var r=e.l?w(e.l.Na,e.l,e):null;e:{var i=e.i;let t=-1;for(;;){let e=["count="+n];-1==t?0<n?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let a=0;a<n;a++){let n=i[a].g,o=i[a].map;if(0>(n-=t))t=Math.max(0,i[a].g-100),s=!1;else try{!function(e,t,n){let r=n||"";try{e5(e,function(e,n){let i=e;m(e)&&(i=ep(e)),t.push(r+n+"="+encodeURIComponent(i))})}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}(o,e,"req"+n+"_")}catch(e){r&&r(o)}}if(s){r=e.join("&");break e}}}return t.D=e=e.i.splice(0,n),r}function tH(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;O||V(),M||(O(),M=!0),P.add(t,e),e.v=0}}function tQ(e){return!e.g&&!e.u&&!(3<=e.v)&&(e.Y++,e.u=ex(w(e.Fa,e),tZ(e,e.v)),e.v++,!0)}function tW(e){null!=e.A&&(a.clearTimeout(e.A),e.A=null)}function tX(e){e.g=new eU(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=e9(e.qa);tr(t,"RID","rpc"),tr(t,"SID",e.K),tr(t,"AID",e.T),tr(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&tr(t,"TO",e.ja),tr(t,"TYPE","xmlhttp"),tK(e,t),e.m&&e.o&&tA(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=ti(e9(t)),n.m=null,n.P=!0,ez(n,e)}function tY(e){null!=e.C&&(a.clearTimeout(e.C),e.C=null)}function tJ(e,t){var n,r=null;if(e.g==t){tY(e),tW(e),e.g=null;var i=2}else{if(!e2(e.h,t))return;r=t.D,e6(e.h,t),i=1}if(0!=e.G){if(t.o)if(1==i){r=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;eo(i=eS(),new ek(i,r)),t$(e)}else tH(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==i&&(n=t,!(e1(e.h)>=e.h.j-!!e.s)&&(e.s?(e.i=n.D.concat(e.i),!0):1!=e.G&&2!=e.G&&!(e.B>=(e.Va?0:e.Wa))&&(e.s=ex(w(e.Ga,e,n),tZ(e,e.B)),e.B++,!0)))||2==i&&tQ(e)))switch(r&&0<r.length&&((t=e.h).i=t.i.concat(r)),s){case 1:t0(e,5);break;case 4:t0(e,10);break;case 3:t0(e,6);break;default:t0(e,2)}}}function tZ(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function t0(e,t){if(e.j.info("Error code "+t),2==t){let t,s,o;var n,r=w(e.fb,e),i=e.Xa;let l=!i;i=new e7(i||"//www.google.com/images/cleardot.gif"),a.location&&"http"==a.location.protocol||te(i,"https"),ti(i),l?function(e,t){let n=new eR;if(a.Image){let r=new Image;r.onload=_(tw,n,"TestLoadImage: loaded",!0,t,r),r.onerror=_(tw,n,"TestLoadImage: error",!1,t,r),r.onabort=_(tw,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=_(tw,n,"TestLoadImage: timeout",!1,t,r),a.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(i.toString(),r):(n=i.toString(),t=new eR,s=new AbortController,o=setTimeout(()=>{s.abort(),tw(t,"TestPingServer: timeout",!1,r)},1e4),fetch(n,{signal:s.signal}).then(e=>
1{clearTimeout(o),e.ok?tw(t,"TestPingServer: ok",!0,r):tw(t,"TestPingServer: server error",!1,r)}).catch(()=>{clearTimeout(o),tw(t,"TestPingServer: error",!1,r)}))}else eN(2);e.G=0,e.l&&e.l.sa(t),t1(e),tq(e)}function t1(e){if(e.G=0,e.ka=[],e.l){let t=e4(e.h);(0!=t.length||0!=e.i.length)&&(T(e.ka,t),T(e.ka,e.i),e.h.i.length=0,b(e.i),e.i.length=0),e.l.ra()}}function t2(e,t,n){var r=n instanceof e7?e9(n):new e7(n);if(""!=r.g)t&&(r.g=t+"."+r.g),tt(r,r.s);else{var i=a.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var s=new e7(null);r&&te(s,r),t&&(s.g=t),i&&tt(s,i),n&&(s.l=n),r=s}return n=e.D,t=e.ya,n&&t&&tr(r,n,t),tr(r,"VER",e.la),tK(e,r),r}function t3(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tD(e.Ca&&!e.pa?new tE({eb:n}):e.pa)).Ha(e.J),t}function t6(){}function t4(){}function t5(e,t){ea.call(this),this.g=new tU(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.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!I(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!I(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new t9(this)}function t8(e){eE.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(let n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function t7(){eb.call(this),this.status=1}function t9(e){this.g=e}(n=tD.prototype).Ha=function(e){this.J=e},n.ea=function(e,n,r,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);n=n?n.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():t.g(),this.v=this.o?ev(this.o):ev(t),this.g.onreadystatechange=w(this.Ea,this);try{this.B=!0,this.g.open(n,String(e),!0),this.B=!1}catch(e){tx(this,e);return}if(e=r||"",r=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)r.set(s,i[s]);else if("function"==typeof i.keys&&"function"==typeof i.get)for(let e of i.keys())r.set(e,i.get(e));else throw Error("Unknown input type for opt_headers: "+String(i));for(let[t,o]of(i=Array.from(r.keys()).find(e=>"content-type"==e.toLowerCase()),s=a.FormData&&e instanceof a.FormData,!(0<=Array.prototype.indexOf.call(tk,n,void 0))||i||s||r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),r))this.g.setRequestHeader(t,o);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{tM(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){tx(this,e)}},n.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,eo(this,"complete"),eo(this,"abort"),tO(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),tO(this,!0)),tD.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?tL(this):this.bb())},n.bb=function(){tL(this)},n.isActive=function(){return!!this.g},n.Z=function(){try{return 2<tP(this)?this.g.status:-1}catch(e){return -1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},n.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),eg(t)}},n.Ba=function(){return this.m},n.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(n=tU.prototype).la=8,n.G=1,n.connect=function(e,t,n,r){eN(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=t2(this,null,this.W),t$(this)},n.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;let i=new eU(this,this.j,e),s=this.o;if(this.S&&(s?x(s=N(s),this.S):s=this.S),null!==this.m||this.O||(i.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){t:{var r=this.i[n];if("__data__"in r.map&&"string"==typeof(r=r.map.__data__)){r=r.length;break t}r=void 0}if(void 0===r)break;
1if(4096<(t+=r)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=tG(this,i,t),tr(n=e9(this.I),"RID",e),tr(n,"CVER",22),this.D&&tr(n,"X-HTTP-Session-Id",this.D),tK(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(tC(s)))+"&"+t:this.m&&tA(n,this.m,s)),e3(this.h,i),this.Ua&&tr(n,"TYPE","init"),this.P?(tr(n,"$req",t),tr(n,"SID","null"),i.T=!0,e$(i,n,null)):e$(i,n,t),this.G=2}}else 3==this.G&&(e?tz(this,e):0==this.i.length||e0(this.h)||tz(this))},n.Fa=function(){if(this.u=null,tX(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=ex(w(this.ab,this),e)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,eN(10),tj(this),tX(this))},n.Za=function(){null!=this.C&&(this.C=null,tj(this),tQ(this),eN(19))},n.fb=function(e){e?(this.j.info("Successfully pinged google.com"),eN(2)):(this.j.info("Failed to ping google.com"),eN(1))},n.isActive=function(){return!!this.l&&this.l.isActive(this)},(n=t6.prototype).ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){},t4.prototype.g=function(e,t){return new t5(e,t)},E(t5,ea),t5.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},t5.prototype.close=function(){tB(this.g)},t5.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ep(e),e=n);t.i.push(new eJ(t.Ya++,e)),3==t.G&&t$(t)},t5.prototype.N=function(){this.g.l=null,delete this.j,tB(this.g),delete this.g,t5.aa.N.call(this)},E(t8,eE),E(t7,eb),E(t9,t6),t9.prototype.ua=function(){eo(this.g,"a")},t9.prototype.ta=function(e){eo(this.g,new t8(e))},t9.prototype.sa=function(e){eo(this.g,new t7)},t9.prototype.ra=function(){eo(this.g,"b")},t4.prototype.createWebChannel=t4.prototype.g,t5.prototype.send=t5.prototype.o,t5.prototype.open=t5.prototype.m,t5.prototype.close=t5.prototype.close,g=eM.createWebChannelTransport=function(){return new t4},p=eM.getStatEventTarget=function(){return eS()},f=eM.Event=eT,d=eM.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},eP.NO_ERROR=0,eP.TIMEOUT=8,eP.HTTP_ERROR=6,c=eM.ErrorCode=eP,eV.COMPLETE="complete",u=eM.EventType=eV,ew.EventType=e_,e_.OPEN="a",e_.CLOSE="b",e_.ERROR="c",e_.MESSAGE="d",ea.prototype.listen=ea.prototype.K,h=eM.WebChannel=ew,eM.FetchXmlHttpFactory=tE,tD.prototype.listenOnce=tD.prototype.L,tD.prototype.getLastError=tD.prototype.Ka,tD.prototype.getLastErrorCode=tD.prototype.Ba,tD.prototype.getStatus=tD.prototype.Z,tD.prototype.getResponseJson=tD.prototype.Oa,tD.prototype.getResponseText=tD.prototype.oa,tD.prototype.send=tD.prototype.ea,tD.prototype.setWithCredentials=tD.prototype.Ha,l=eM.XhrIo=tD}).apply(void 0!==eO?eO:"u">typeof self?self:"u">typeof window?window:{});let eP="@firebase/firestore";class eV{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}eV.UNAUTHENTICATED=new eV(null),eV.GOOGLE_CREDENTIALS=new eV("google-credentials-uid"),eV.FIRST_PARTY=new eV("first-party-uid"),eV.MOCK_USER=new eV("mock-user");let eF="10.14.0",eU=new H("@firebase/firestore");function eB(){return eU.logLevel}function ej(e,...t){if(eU.logLevel<=s.DEBUG){let n=t.map(ez);eU.debug(`Firestore (${eF}): ${e}`,...n)}}function eq(e,...t){if(eU.logLevel<=s.ERROR){let n=t.map(ez);eU.error(`Firestore (${eF}): ${e}`,...n)}}function e$(e,...t){if(eU.logLevel<=s.WARN){let n=t.map(ez);eU.warn(`Firestore (${eF}): ${e}`,...n)}}function ez(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function eK(e="Unexpected state"){let t=`FIRESTORE (${eF}) INTERNAL ASSERTION FAILED: `+e;throw eq(t),Error(t)}let eG={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
1ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class eH extends R{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class eQ{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class eW{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class eX{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(eV.UNAUTHENTICATED))}shutdown(){}}class eY{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class eJ{constructor(e){this.t=e,this.currentUser=eV.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){void 0===this.o||eK();let n=this.i,r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve(),i=new eQ;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new eQ,e.enqueueRetryable(()=>r(this.currentUser))};let s=()=>{let t=i;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},a=e=>{ej("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?a(e):(ej("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new eQ)}},0),s()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(ej("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?("string"==typeof t.accessToken||eK(),new eW(t.accessToken,this.currentUser)):null):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 null===e||"string"==typeof e||eK(),new eV(e)}}class eZ{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=eV.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);let e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class e0{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new eZ(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(eV.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class e1{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class e2{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){void 0===this.o||eK();let n=e=>{null!=e.error&&ej("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.R;return this.R=e.token,ej("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};let r=e=>{ej("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(e=>r(e)),setTimeout(()=>{if(!this.appCheck){let e=this.A.getImmediate({optional:!0});e?r(e):ej("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?("string"==typeof e.token||eK(),this.R=e.token,new e1(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class e3{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length,n="";for(;n.length<20;){let r=function(){let e="u">typeof self&&(self.crypto||self.msCrypto),t=new Uint8Array(40);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(t);else for(let e=0;e<40;
1e++)t[e]=Math.floor(256*Math.random());return t}();for(let i=0;i<r.length;++i)n.length<20&&r[i]<t&&(n+=e.charAt(r[i]%e.length))}return n}}function e6(e,t){return e<t?-1:+(e>t)}function e4(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}class e5{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new eH(eG.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-0xe7791f700||e>=0x3afff44180)throw new eH(eG.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return e5.fromMillis(Date.now())}static fromDate(e){return e5.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new e5(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?e6(this.nanoseconds,e.nanoseconds):e6(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){return String(this.seconds- -0xe7791f700).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class e8{constructor(e){this.timestamp=e}static fromTimestamp(e){return new e8(e)}static min(){return new e8(new e5(0,0))}static max(){return new e8(new e5(0x3afff4417f,0x3b9ac9ff))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class e7{constructor(e,t,n){void 0===t?t=0:t>e.length&&eK(),void 0===n?n=e.length-t:n>e.length-t&&eK(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===e7.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof e7?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e.get(r),i=t.get(r);if(n<i)return -1;if(n>i)return 1}return e.length<t.length?-1:+(e.length>t.length)}}class e9 extends e7{construct(e,t,n){return new e9(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new eH(eG.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new e9(t)}static emptyPath(){return new e9([])}}let te=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class tt extends e7{construct(e,t,n){return new tt(e,t,n)}static isValidIdentifier(e){return te.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),tt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new tt(["__name__"])}static fromServerFormat(e){let t=[],n="",r=0,i=()=>{if(0===n.length)throw new eH(eG.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},s=!1;for(;r<e.length;){let t=e[r];if("\\"===t){if(r+1===e.length)throw new eH(eG.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new eH(eG.INVALID_ARGUMENT,"Path has invali
1d escape sequence: "+e);n+=t,r+=2}else"`"===t?s=!s:"."!==t||s?n+=t:i(),r++}if(i(),s)throw new eH(eG.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new tt(t)}static emptyPath(){return new tt([])}}class tn{constructor(e){this.path=e}static fromPath(e){return new tn(e9.fromString(e))}static fromName(e){return new tn(e9.fromString(e).popFirst(5))}static empty(){return new tn(e9.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===e9.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return e9.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new tn(new e9(e.slice()))}}class tr{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new tr(e8.min(),tn.empty(),-1)}static max(){return new tr(e8.max(),tn.empty(),-1)}}class ti{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function ts(e){if(e.code!==eG.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;ej("LocalStore","Unexpectedly lost primary lease")}class ta{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&eK(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new ta((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof ta?t:ta.resolve(t)}catch(e){return ta.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):ta.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):ta.reject(t)}static resolve(e){return new ta((t,n)=>{t(e)})}static reject(e){return new ta((t,n)=>{n(e)})}static waitFor(e){return new ta((t,n)=>{let r=0,i=0,s=!1;e.forEach(e=>{++r,e.next(()=>{++i,s&&i===r&&t()},e=>n(e))}),s=!0,i===r&&t()})}static or(e){let t=ta.resolve(!1);for(let n of e)t=t.next(e=>e?ta.resolve(e):n());return t}static forEach(e,t){let n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new ta((n,r)=>{let i=e.length,s=Array(i),a=0;for(let o=0;o<i;o++){let l=o;t(e[l]).next(e=>{s[l]=e,++a===i&&n(s)},e=>r(e))}})}static doWhile(e,t){return new ta((n,r)=>{let i=()=>{!0===e()?t().next(()=>{i()},r):n()};i()})}}function to(e){return"IndexedDbTransactionError"===e.name}class tl{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ie(e),this.se=e=>t.writeSequenceNumber(e))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.se&&this.se(e),e}}function th(e){return 0===e&&1/e==-1/0}function tu(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function tc(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function td(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}tl.oe=-1;class tf{constructor(e,t){this.comparator=e,this.root=t||tg.EMPTY}insert(e,t){return new tf(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,tg.BLACK,null,null))}remove(e){return new tf(this.comparator,this.root.remove(e,this.comparator).copy(null,null,tg.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();
1){let n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let r=this.comparator(e,n.key);if(0===r)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 tp(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new tp(this.root,e,this.comparator,!1)}getReverseIterator(){return new tp(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new tp(this.root,e,this.comparator,!0)}}class tp{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(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class tg{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:tg.RED,this.left=null!=r?r:tg.EMPTY,this.right=null!=i?i:tg.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,i){return new tg(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i: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):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}removeMin(){if(this.left.isEmpty())return tg.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let n,r=this;if(0>t(e,r.key))r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return tg.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,tg.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,tg.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return Math.pow(2,this.check())<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw eK();let e=this.left.check();if(e!==this.right.check())throw eK();return e+ +!this.isRed()}}
1tg.EMPTY=null,tg.RED=!0,tg.BLACK=!1,tg.EMPTY=new class{constructor(){this.size=0}get key(){throw eK()}get value(){throw eK()}get color(){throw eK()}get left(){throw eK()}get right(){throw eK()}copy(e,t,n,r,i){return this}insert(e,t,n){return new tg(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class tm{constructor(e){this.comparator=e,this.data=new tf(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new ty(this.data.getIterator())}getIteratorFrom(e){return new ty(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof tm)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new tm(this.comparator);return t.data=e,t}}class ty{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class tv{constructor(e){this.fields=e,e.sort(tt.comparator)}static empty(){return new tv([])}unionWith(e){let t=new tm(tt.comparator);for(let e of this.fields)t=t.add(e);for(let n of e)t=t.add(n);return new tv(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return e4(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class tw extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class t_{constructor(e){this.binaryString=e}static fromBase64String(e){return new t_(function(e){try{return atob(e)}catch(e){throw"u">typeof DOMException&&e instanceof DOMException?new tw("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new t_(function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e))}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return btoa(this.binaryString)}toUint8Array(){var e=this.binaryString;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return e6(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}t_.EMPTY_BYTE_STRING=new t_("");let tE=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function tb(e){if(e||eK(),"string"==typeof e){let t=0,n=tE.exec(e);if(n||eK(),n[1]){let e=n[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:tT(e.seconds),nanos:tT(e.nanos)}}function tT(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function tI(e){return"string"==typeof e?t_.fromBase64String(e):t_.fromUint8Array(e)}function tS(e){var t,n;return"server_timestamp"===(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{}).__type__)?void 0:n.stringValue)}function tC(e){let t=e.mapValue.fields.__previous_value__;return tS(t)?tC(t):t}function tA(e){let t=tb(e.mapValue.fields.__local_write_time__.timestampValue);return new e5(t.seconds,t.nanos)}class tD{constructor(e,t,n,r,i,s,a,o,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=l}}class tN{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new tN("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof tN&&e.projectId===this.projectId&&e.database===this.database}}let tk={};function tx(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?tS(e)?4:tG(e)?0x1fffffffffffff:tz(e)?10:11:eK()}function tR(e,t){if(e===t)return!0;let n=tx(e);if(n!==tx(t))return!1;switch(n){case 0:case 0x1fffffffffffff:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return tA(e).isEqual(tA(t));case 3:if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let r=tb(e.timestampValue),i=tb(t.timestampValue);return r.seconds===i.seconds&&r.nanos===i.nanos;case 5:return e.stringValue===t.stringValue;case 6:return tI(e.bytesValue).isEqual(tI(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return tT(e.geoPointValue.latitude)===tT(t.geoPointValue.latitude)&&tT(e.geoPointValue.longitude)===tT(t.geoPointValue.longitude);case 2:if("integerValue"in e&&"integerValue"in t)return tT(e.integerValue)===tT(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let n=tT(e.doubleValue),r=tT(t.doubleValue);return n===r?th(n)===th(r):isNaN(n)&&isNaN(r)}return!1;case 9:return e4(e.arrayValue.values||[],t.arrayValue.values||[],tR);case 10:case 11:let s=e.mapValue.fields||{},a=t.mapValue.fields||{};if(tu(s)!==tu(a))return!1;for(let e in s)if(s.hasOwnProperty(e)&&(void 0===a[e]||!tR(s[e],a[e])))return!1;return!0;default:return eK()}}function tL(e,t){return void 0!==(e.values||[]).find(e=>tR(e,t))}function tO(e,t){var n,r,i,s,a,o,l,h,u,c;if(e===t)return 0;let d=tx(e),f=tx(t);if(d!==f)return e6(d,f);switch(d){case 0:case 0x1fffffffffffff:return 0;case 1:return e6(e.booleanValue,t.booleanValue);case 2:let p,g;return p=tT(e.integerValue||e.doubleValue),p<(g=tT(t.integerValue||t.doubleValue))?-1:p>g?1:p===g?0:isNaN(p)?isNaN(g)?0:-1:1;case 3:return tM(e.timestampValue,t.timestampValue);
1case 4:return tM(tA(e),tA(t));case 5:return e6(e.stringValue,t.stringValue);case 6:let m,y;return n=e.bytesValue,r=t.bytesValue,m=tI(n),y=tI(r),m.compareTo(y);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=e6(n[e],r[e]);if(0!==t)return t}return e6(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:let v;return i=e.geoPointValue,s=t.geoPointValue,0!==(v=e6(tT(i.latitude),tT(s.latitude)))?v:e6(tT(i.longitude),tT(s.longitude));case 9:return tP(e.arrayValue,t.arrayValue);case 10:let w,_,E,b,T;return a=e.mapValue,o=t.mapValue,w=a.fields||{},_=o.fields||{},E=null==(l=w.value)?void 0:l.arrayValue,b=null==(h=_.value)?void 0:h.arrayValue,0!==(T=e6((null==(u=null==E?void 0:E.values)?void 0:u.length)||0,(null==(c=null==b?void 0:b.values)?void 0:c.length)||0))?T:tP(E,b);case 11:return function(e,t){if(e===tk&&t===tk)return 0;if(e===tk)return 1;if(t===tk)return -1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let e=0;e<r.length&&e<s.length;++e){let t=e6(r[e],s[e]);if(0!==t)return t;let a=tO(n[r[e]],i[s[e]]);if(0!==a)return a}return e6(r.length,s.length)}(e.mapValue,t.mapValue);default:throw eK()}}function tM(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return e6(e,t);let n=tb(e),r=tb(t),i=e6(n.seconds,r.seconds);return 0!==i?i:e6(n.nanos,r.nanos)}function tP(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=tO(n[e],r[e]);if(t)return t}return e6(n.length,r.length)}function tV(e){var t,n;let r;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(r=tb(e.timestampValue),`time(${r.seconds},${r.nanos})`):"stringValue"in e?e.stringValue:"bytesValue"in e?tI(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,tn.fromName(t).toString()):"geoPointValue"in e?(n=e.geoPointValue,`geo(${n.latitude},${n.longitude})`):"arrayValue"in e?function(e){let t="[",n=!0;for(let r of e.values||[])n?n=!1:t+=",",t+=tV(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}:${tV(e.fields[i])}`;return n+"}"}(e.mapValue):eK()}function tF(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function tU(e){return!!e&&"integerValue"in e}function tB(e){return!!e&&"arrayValue"in e}function tj(e){return!!e&&"nullValue"in e}function tq(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function t$(e){return!!e&&"mapValue"in e}function tz(e){var t,n;return"__vector__"===(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{}).__type__)?void 0:n.stringValue)}function tK(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return tc(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=tK(n)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=tK(e.arrayValue.values[n]);return t}return Object.assign({},e)}function tG(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class tH{constructor(e){this.value=e}static empty(){return new tH({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=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=tK(t)}setAll(e){let t=tt.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()]=tK(e):r.push(i.lastSegment())});let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());t$(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return tR(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)];t$(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}
1applyChanges(e,t,n){for(let r of(tc(t,(t,n)=>e[t]=n),n))delete e[r]}clone(){return new tH(tK(this.value))}}class tQ{constructor(e,t,n,r,i,s,a){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=a}static newInvalidDocument(e){return new tQ(e,0,e8.min(),e8.min(),e8.min(),tH.empty(),0)}static newFoundDocument(e,t,n,r){return new tQ(e,1,t,e8.min(),n,r,0)}static newNoDocument(e,t){return new tQ(e,2,t,e8.min(),e8.min(),tH.empty(),0)}static newUnknownDocument(e,t){return new tQ(e,3,t,e8.min(),e8.min(),tH.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(e8.min())&&(2===this.documentType||0===this.documentType)&&(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=tH.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=tH.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=e8.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof tQ&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new tQ(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}})`}}class tW{constructor(e,t){this.position=e,this.inclusive=t}}function tX(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let s=t[i],a=e.position[i];if(r=s.field.isKeyField()?tn.comparator(tn.fromName(a.referenceValue),n.key):tO(a,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function tY(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!tR(e.position[n],t.position[n]))return!1;return!0}class tJ{constructor(e,t="asc"){this.field=e,this.dir=t}}class tZ{}class t0 extends tZ{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new t6(e,t,n):"array-contains"===t?new t7(e,n):"in"===t?new t9(e,n):"not-in"===t?new ne(e,n):"array-contains-any"===t?new nt(e,n):new t0(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new t4(e,n):new t5(e,n)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(tO(t,this.value)):null!==t&&tx(this.value)===tx(t)&&this.matchesComparison(tO(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return eK()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class t1 extends tZ{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new t1(e,t)}matches(e){return t2(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.ae||(this.ae=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function t2(e){return"and"===e.op}function t3(e){for(let t of e.filters)if(t instanceof t1)return!1;return!0}class t6 extends t0{constructor(e,t,n){super(e,t,n),this.key=tn.fromName(n.referenceValue)}matches(e){let t=tn.comparator(e.key,this.key);return this.matchesComparison(t)}}class t4 extends t0{constructor(e,t){super(e,"in",t),this.keys=t8("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class t5 extends t0{constructor(e,t){super(e,"not-in",t),this.keys=t8("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function t8(e,t){var n;return((null==(n=t.arrayValue)?void 0:n.values)||[]).map(e=>tn.fromName(e.referenceValue))}class t7 extends t0{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return tB(t)&&tL(t.arrayValue,this.value)}}class t9 extends t0{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&tL(this.value.arrayValue,t)}}class ne extends t0{constructor(e,t){super(e,"not-in",t)}matches(e){if(tL(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&!tL(this.value.arrayValue,t)}}class nt extends t0{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!tB(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>tL(this.value.arrayValue,e))}}class nn{constructor(e,t=null,n=[],r=[],i=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=a,this.ue=null}}function nr(e,t=null,n=[],r=[],i=null,s=null,a=null){return new nn(e,t,n,r,i,s,a)}function ni(e){if(null===e.ue){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(e=>(function e(t){if(t instanceof t0)return t.field.canonicalString()+t.op.toString()+tV(t.value);if(t3(t)&&t2(t))return t.filters.map(t=>e(t)).join(",");{let n=t.filters.map(t=>e(t)).join(",");return`${t.op}(${n})`}})(e)).join(","),t+="|ob:",t+=e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>tV(e)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>tV(e)).join(",")),e.ue=t}return e.ue}function ns(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let i=0;i<e.orderBy.length;i++){var n,r;if(n=e.orderBy[i],r=t.orderBy[i],!(n.dir===r.dir&&n.field.isEqual(r.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!function e(t,n){return t instanceof t0?n instanceof t0&&t.op===n.op&&t.field.isEqual(n.field)&&tR(t.value,n.value):t instanceof t1?n instanceof t1&&t.op===n.op&&t.filters.length===n.filters.length&&t.filters.reduce((t,r,i)=>t&&e(r,n.filters[i]),!0):void eK()}(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!tY(e.startAt,t.startAt)&&tY(e.endAt,t.endAt)}function na(e){return tn.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class no{constructor(e,t=null,n=[],r=[],i=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=a,this.endAt=o,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function nl(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function nh(e){return null!==e.collectionGroup}function nu(e){if(null===e.ce){let t;e.ce=[];let n=new Set;for(let t of e.explicitOrderBy)e.ce.push(t),n.add(t.field.canonicalString());let r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";
1(t=new tm(tt.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t).forEach(t=>{n.has(t.canonicalString())||t.isKeyField()||e.ce.push(new tJ(t,r))}),n.has(tt.keyField().canonicalString())||e.ce.push(new tJ(tt.keyField(),r))}return e.ce}function nc(e){return e.le||(e.le=function(e,t){if("F"===e.limitType)return nr(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{let t="desc"===e.dir?"asc":"desc";return new tJ(e.field,t)});let n=e.endAt?new tW(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new tW(e.startAt.position,e.startAt.inclusive):null;return nr(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(e,nu(e))),e.le}function nd(e,t){let n=e.filters.concat([t]);return new no(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function nf(e,t,n){return new no(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function np(e,t){return ns(nc(e),nc(t))&&e.limitType===t.limitType}function ng(e){return`${ni(nc(e))}|lt:${e.limitType}`}function nm(e){var t;let n;return`Query(target=${n=(t=nc(e)).path.canonicalString(),null!==t.collectionGroup&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof t0?`${t.field.canonicalString()} ${t.op} ${tV(t.value)}`:t instanceof t1?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(e=>tV(e)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(e=>tV(e)).join(",")),`Target(${n})`}; limitType=${e.limitType})`}function ny(e,t){var n,r,i,s;let a,o,l;return t.isFoundDocument()&&(a=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(a):tn.isDocumentKey(e.path)?e.path.isEqual(a):e.path.isImmediateParentOf(a))&&function(e,t){for(let n of nu(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&(n=e,r=t,(!n.startAt||(i=n.startAt,o=tX(i,nu(n),r),i.inclusive?!!(o<=0):!!(o<0)))&&(!n.endAt||(s=n.endAt,l=tX(s,nu(n),r),s.inclusive?!!(l>=0):!!(l>0))))}function nv(e){return(t,n)=>{let r=!1;for(let i of nu(e)){let e=function(e,t,n){var r;let i,s,a=e.field.isKeyField()?tn.comparator(t.key,n.key):(r=e.field,i=t.data.field(r),s=n.data.field(r),null!==i&&null!==s?tO(i,s):eK());switch(e.dir){case"asc":return a;case"desc":return -1*a;default:return eK()}}(i,t,n);if(0!==e)return e;r=r||i.field.isKeyField()}return 0}}class nw{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return void 0!==this.get(e)}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)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(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){tc(this.inner,(t,n)=>{for(let[t,r]of n)e(t,r)})}isEmpty(){return td(this.inner)}size(){return this.innerSize}}let n_=new tf(tn.comparator),nE=new tf(tn.comparator);function nb(...e){let t=nE;for(let n of e)t=t.insert(n.key,n);return t}function nT(e){let t=nE;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function nI(){return new nw(e=>e.toString(),(e,t)=>e.isEqual(t))}let nS=new tf(tn.comparator),nC=new tm(tn.comparator);function nA(...e){let t=nC;for(let n of e)t=t.add(n);return t}let nD=new tm(e6);function nN(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:th(t)?"-0":t}}function nk(e){return{integerValue:""+e}}class nx{constructor(){this._=void 0}}function nR(e,t){return e instanceof nF?tU(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}class nL extends nx{}class nO extends nx{constructor(e){super(),this.elements=e}}function nM(e,t){let n=nB(t);for(let t of e.elements)n.some(e=>tR(e,t))||n.push(t);return{arrayValue:{values:n}}}class nP extends nx{constructor(e){super(),this.elements=e}}function nV(e,t){let n=nB(t);for(let t of e.elements)n=n.filter(e=>!tR(e,t));return{arrayValue:{values:n}}}
1class nF extends nx{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function nU(e){return tT(e.integerValue||e.doubleValue)}function nB(e){return tB(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class nj{constructor(e,t){this.version=e,this.transformResults=t}}class nq{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new nq}static exists(e){return new nq(void 0,e)}static updateTime(e){return new nq(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function n$(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class nz{}function nK(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new nZ(e.key,nq.none()):new nQ(e.key,e.data,nq.none());{let n=e.data,r=tH.empty(),i=new tm(tt.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),i=i.add(e)}return new nW(e.key,r,new tv(i.toArray()),nq.none())}}function nG(e,t,n,r){return e instanceof nQ?function(e,t,n,r){if(!n$(e.precondition,t))return n;let i=e.value.clone(),s=nJ(e.fieldTransforms,r,t);return i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof nW?function(e,t,n,r){if(!n$(e.precondition,t))return n;let i=nJ(e.fieldTransforms,r,t),s=t.data;return(s.setAll(nX(e)),s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n)?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):n$(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}function nH(e,t){var n,r;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,r=t.fieldTransforms,!!(void 0===n&&void 0===r||!(!n||!r)&&e4(n,r,(e,t)=>{var n,r;return e.field.isEqual(t.field)&&(n=e.transform,r=t.transform,n instanceof nO&&r instanceof nO||n instanceof nP&&r instanceof nP?e4(n.elements,r.elements,tR):n instanceof nF&&r instanceof nF?tR(n.Pe,r.Pe):n instanceof nL&&r instanceof nL)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class nQ extends nz{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class nW extends nz{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 nX(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 nY(e,t,n){let r=new Map;e.length===n.length||eK();for(let s=0;s<n.length;s++){var i;let a=e[s],o=a.transform,l=t.data.field(a.field);r.set(a.field,(i=n[s],o instanceof nO?nM(o,l):o instanceof nP?nV(o,l):i))}return r}function nJ(e,t,n){let r=new Map;for(let i of e){let e=i.transform,s=n.data.field(i.field);r.set(i.field,function(e,t,n){var r;let i,s,a;return e instanceof nL?(r=t,i={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:n.seconds,nanos:n.nanoseconds}}}},r&&tS(r)&&(r=tC(r)),r&&(i.fields.__previous_value__=r),{mapValue:i}):e instanceof nO?nM(e,t):e instanceof nP?nV(e,t):(a=nU(s=nR(e,t))+nU(e.Pe),tU(s)&&tU(e.Pe)?nk(a):nN(e.serializer,a))}(e,s,t))}return r}class nZ extends nz{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class n0 extends nz{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class n1{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)&&function(e,t,n){let r,i;e instanceof nQ?(r=e.value.clone(),i=nY(e.fieldTransforms,t,n.transformResults),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()):e instanceof nW?function(e,t,n){if(!n$(e.precondition,t))return t.convertToUnknownDocument(n.version);let r=nY(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(nX(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}
1(e,t,n):t.convertToNoDocument(n.version).setHasCommittedMutations()}(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=nG(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=nG(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=nI();return this.mutations.forEach(r=>{let i=e.get(r.key),s=i.overlayedDocument,a=this.applyToLocalView(s,i.mutatedFields),o=nK(s,a=t.has(r.key)?null:a);null!==o&&n.set(r.key,o),s.isValidDocument()||s.convertToNoDocument(e8.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),nA())}isEqual(e){return this.batchId===e.batchId&&e4(this.mutations,e.mutations,(e,t)=>nH(e,t))&&e4(this.baseMutations,e.baseMutations,(e,t)=>nH(e,t))}}class n2{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){e.mutations.length===n.length||eK();let r=nS,i=e.mutations;for(let e=0;e<i.length;e++)r=r.insert(i[e].key,n[e].version);return new n2(e,t,n,r)}}class n3{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{ 2 largestBatchId: ${this.largestBatchId}, 3 mutation: ${this.mutation.toString()} 4 }`}}class n6{constructor(e,t){this.count=e,this.unchangedNames=t}}function n4(e){if(void 0===e)return eq("GRPC error has no .code"),eG.UNKNOWN;switch(e){case m.OK:return eG.OK;case m.CANCELLED:return eG.CANCELLED;case m.UNKNOWN:return eG.UNKNOWN;case m.DEADLINE_EXCEEDED:return eG.DEADLINE_EXCEEDED;case m.RESOURCE_EXHAUSTED:return eG.RESOURCE_EXHAUSTED;case m.INTERNAL:return eG.INTERNAL;case m.UNAVAILABLE:return eG.UNAVAILABLE;case m.UNAUTHENTICATED:return eG.UNAUTHENTICATED;case m.INVALID_ARGUMENT:return eG.INVALID_ARGUMENT;case m.NOT_FOUND:return eG.NOT_FOUND;case m.ALREADY_EXISTS:return eG.ALREADY_EXISTS;case m.PERMISSION_DENIED:return eG.PERMISSION_DENIED;case m.FAILED_PRECONDITION:return eG.FAILED_PRECONDITION;case m.ABORTED:return eG.ABORTED;case m.OUT_OF_RANGE:return eG.OUT_OF_RANGE;case m.UNIMPLEMENTED:return eG.UNIMPLEMENTED;case m.DATA_LOSS:return eG.DATA_LOSS;default:return eK()}}(y=m||(m={}))[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";let n5=new a([0xffffffff,0xffffffff],0);function n8(e){let t=(new TextEncoder).encode(e),n=new o;return n.update(t),new Uint8Array(n.digest())}function n7(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),s=t.getUint32(12,!0);return[new a([n,r],0),new a([i,s],0)]}class n9{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new re(`Invalid padding: ${t}`);if(n<0||e.length>0&&0===this.hashCount)throw new re(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new re(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=a.fromNumber(this.Ie)}Ee(e,t,n){let r=e.add(t.multiply(a.fromNumber(n)));return 1===r.compare(n5)&&(r=new a([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Te).toNumber()}de(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.Ie)return!1;let[t,n]=n7(n8(e));for(let e=0;e<this.hashCount;e++){let r=this.Ee(t,n,e);if(!this.de(r))return!1}return!0}static create(e,t,n){let r=new n9(new Uint8Array(Math.ceil(e/8)),e%8==0?0:8-e%8,t);return n.forEach(e=>r.insert(e)),r}insert(e){if(0===this.Ie)return;let[t,n]=n7(n8(e));for(let e=0;e<this.hashCount;e++){let r=this.Ee(t,n,e);this.Ae(r)}}Ae(e){let t=Math.floor(e/8);this.bitmap[t]|=1<<e%8}}
4class re extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class rt{constructor(e,t,n,r,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let r=new Map;return r.set(e,rn.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new rt(e8.min(),r,new tf(e6),n_,nA())}}class rn{constructor(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new rn(n,t,nA(),nA(),nA())}}class rr{constructor(e,t,n,r){this.Re=e,this.removedTargetIds=t,this.key=n,this.Ve=r}}class ri{constructor(e,t){this.targetId=e,this.me=t}}class rs{constructor(e,t,n=t_.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class ra{constructor(){this.fe=0,this.ge=rh(),this.pe=t_.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return 0!==this.fe}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=nA(),t=nA(),n=nA();return this.ge.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:eK()}}),new rn(this.pe,this.ye,e,t,n)}Ce(){this.we=!1,this.ge=rh()}Fe(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,this.fe>=0||eK()}Ne(){this.we=!0,this.ye=!0}}class ro{constructor(e){this.Le=e,this.Be=new Map,this.ke=n_,this.qe=rl(),this.Qe=new tf(e6)}Ke(e){for(let t of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(t,e.Ve):this.Ue(t,e.key,e.Ve);for(let t of e.removedTargetIds)this.Ue(t,e.key,e.Ve)}We(e){this.forEachTarget(e,t=>{let n=this.Ge(t);switch(e.state){case 0:this.ze(t)&&n.De(e.resumeToken);break;case 1:n.Oe(),n.Se||n.Ce(),n.De(e.resumeToken);break;case 2:n.Oe(),n.Se||this.removeTarget(t);break;case 3:this.ze(t)&&(n.Ne(),n.De(e.resumeToken));break;case 4:this.ze(t)&&(this.je(t),n.De(e.resumeToken));break;default:eK()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach((e,n)=>{this.ze(n)&&t(n)})}He(e){let t=e.targetId,n=e.me.count,r=this.Je(t);if(r){let i=r.target;if(na(i))if(0===n){let e=new tn(i.path);this.Ue(t,e,tQ.newNoDocument(e,e8.min()))}else 1===n||eK();else{let r=this.Ye(t);if(r!==n){let n=this.Ze(e),i=n?this.Xe(n,e,r):1;0!==i&&(this.je(t),this.Qe=this.Qe.insert(t,2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch"))}}}}Ze(e){let t,n,r=e.me.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:i="",padding:s=0},hashCount:a=0}=r;try{t=tI(i).toUint8Array()}catch(e){if(e instanceof tw)return e$("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{n=new n9(t,s,a)}catch(e){return e$(e instanceof re?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===n.Ie?null:n}Xe(e,t,n){return 2*(t.me.count!==n-this.nt(e,t.targetId))}nt(e,t){let n=this.Le.getRemoteKeysForTarget(t),r=0;return n.forEach(n=>{let i=this.Le.tt(),s=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Ue(t,n,null),r++)}),r}rt(e){let t=new Map;this.Be.forEach((n,r)=>{let i=this.Je(r);if(i){if(n.current&&na(i.target)){let t=new tn(i.target.path);null!==this.ke.get(t)||this.it(r,t)||this.Ue(r,t,tQ.newNoDocument(t,e))}n.be&&(t.set(r,n.ve()),n.Ce())}});let n=nA();this.qe.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{let t=this.Je(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.ke.forEach((t,n)=>n.setReadTime(e));let r=new rt(e,t,this.Qe,this.ke,n);return this.ke=n_,this.qe=rl(),this.Qe=new tf(e6),r}$e(e,t){if(!this.ze(e))return;let n=2*!!this.it(e,t.key);this.Ge(e).Fe(t.key,n),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}Ue(e,t,n){if(!this.ze(e))return;let r=this.Ge(e);this.it(e,t)?r.Fe(t,1):r.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),n&&(this.ke=this.ke.insert(t,n))}removeTarget(e){this.Be.delete(e)}Ye(e){let t=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let t=this.Be.get(e);return t||(t=new ra,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new tm(e6),this.qe=this.qe.insert(e,t)),t}ze(e){let t=null!==this.Je(e);return t||ej("WatchChangeAggregator","Detected inactive target",e),t}Je(e){let t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new ra),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function rl(){return new tf(tn.comparator)}function rh(){return new tf(tn.comparator)}let ru={asc:"ASCENDING",desc:"DESCENDING"},rc={"<":"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"},rd={and:"AND",or:"OR"};class rf{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function rp(e,t){return e.useProto3Json||null==t?t:{value:t}}function rg(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 rm(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function ry(e){let t;return e||eK(),e8.fromTimestamp(new e5((t=tb(e)).seconds,t.nanos))}function rv(e,t){return rw(e,t).canonicalString()}function rw(e,t){let n=new e9(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?n:n.child(t)}function r_(e){let t=e9.fromString(e);return rN(t)||eK(),t}function rE(e,t){return rv(e.databaseId,t.path)}function rb(e,t){let n=r_(t);if(n.get(1)!==e.databaseId.projectId)throw new eH(eG.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 eH(eG.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new tn(rS(n))}function rT(e,t){return rv(e.databaseId,t)}function rI(e){return new e9(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function rS(e){return e.length>4&&"documents"===e.get(4)||eK(),e.popFirst(5)}
4function rC(e,t,n){return{name:rE(e,t),fields:n.value.mapValue.fields}}function rA(e){return{fieldPath:e.canonicalString()}}function rD(e){return tt.fromServerFormat(e.fieldPath)}function rN(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class rk{constructor(e,t,n,r,i=e8.min(),s=e8.min(),a=t_.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new rk(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new rk(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new rk(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new rk(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class rx{constructor(e){this.ct=e}}class rR{It(e,t){this.Tt(e,t),t.Et()}Tt(e,t){if("nullValue"in e)this.dt(t,5);else if("booleanValue"in e)this.dt(t,10),t.At(+!!e.booleanValue);else if("integerValue"in e)this.dt(t,15),t.At(tT(e.integerValue));else if("doubleValue"in e){let n=tT(e.doubleValue);isNaN(n)?this.dt(t,13):(this.dt(t,15),th(n)?t.At(0):t.At(n))}else if("timestampValue"in e){let n=e.timestampValue;this.dt(t,20),"string"==typeof n&&(n=tb(n)),t.Rt(`${n.seconds||""}`),t.At(n.nanos||0)}else if("stringValue"in e)this.Vt(e.stringValue,t),this.ft(t);else if("bytesValue"in e)this.dt(t,30),t.gt(tI(e.bytesValue)),this.ft(t);else if("referenceValue"in e)this.yt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.dt(t,45),t.At(n.latitude||0),t.At(n.longitude||0)}else"mapValue"in e?tG(e)?this.dt(t,Number.MAX_SAFE_INTEGER):tz(e)?this.wt(e.mapValue,t):(this.St(e.mapValue,t),this.ft(t)):"arrayValue"in e?(this.bt(e.arrayValue,t),this.ft(t)):eK()}Vt(e,t){this.dt(t,25),this.Dt(e,t)}Dt(e,t){t.Rt(e)}St(e,t){let n=e.fields||{};for(let e of(this.dt(t,55),Object.keys(n)))this.Vt(e,t),this.Tt(n[e],t)}wt(e,t){var n,r;let i=e.fields||{};this.dt(t,53);let s="value",a=(null==(r=null==(n=i[s].arrayValue)?void 0:n.values)?void 0:r.length)||0;this.dt(t,15),t.At(tT(a)),this.Vt(s,t),this.Tt(i[s],t)}bt(e,t){let n=e.values||[];for(let e of(this.dt(t,50),n))this.Tt(e,t)}yt(e,t){this.dt(t,37),tn.fromName(e).path.forEach(e=>{this.dt(t,60),this.Dt(e,t)})}dt(e,t){e.At(t)}ft(e){e.At(2)}}rR.vt=new rR;class rL{constructor(){this.un=new rO}addToCollectionParentIndex(e,t){return this.un.add(t),ta.resolve()}getCollectionParents(e,t){return ta.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return ta.resolve()}deleteFieldIndex(e,t){return ta.resolve()}deleteAllFieldIndexes(e){return ta.resolve()}createTargetIndexes(e,t){return ta.resolve()}getDocumentsMatchingTarget(e,t){return ta.resolve(null)}getIndexType(e,t){return ta.resolve(0)}getFieldIndexes(e,t){return ta.resolve([])}getNextCollectionGroupToUpdate(e){return ta.resolve(null)}getMinOffset(e,t){return ta.resolve(tr.min())}getMinOffsetFromCollectionGroup(e,t){return ta.resolve(tr.min())}updateCollectionGroup(e,t,n){return ta.resolve()}updateIndexEntries(e,t){return ta.resolve()}}class rO{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new tm(e9.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 tm(e9.comparator)).toArray()}}new Uint8Array(0);class rM{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new rM(e,rM.DEFAULT_COLLECTION_PERCENTILE,rM.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}rM.DEFAULT_COLLECTION_PERCENTILE=10,rM.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,rM.DEFAULT=new rM(0x2800000,rM.DEFAULT_COLLECTION_PE
4RCENTILE,rM.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),rM.DISABLED=new rM(-1,0,0);class rP{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new rP(0)}static kn(){return new rP(-1)}}class rV{constructor(){this.changes=new nw(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,tQ.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return void 0!==n?ta.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class rF{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class rU{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=>(null!==n&&nG(n.mutation,e,tv.empty(),e5.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,nA()).next(()=>t))}getLocalViewOfDocuments(e,t,n=nA()){let r=nI();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=nb();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let n=nI();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,nA()))}populateOverlays(e,t,n){let r=[];return 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=n_,s=nI(),a=nI();return t.forEach((e,t)=>{let a=n.get(t.key);r.has(t.key)&&(void 0===a||a.mutation instanceof nW)?i=i.insert(t.key,t):void 0!==a?(s.set(t.key,a.mutation.getFieldMask()),nG(a.mutation,t,a.mutation.getFieldMask(),e5.now())):s.set(t.key,tv.empty())}),this.recalculateAndSaveOverlays(e,i).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var n;return a.set(e,new rF(t,null!=(n=s.get(e))?n:null))}),a))}recalculateAndSaveOverlays(e,t){let n=nI(),r=new tf((e,t)=>e-t),i=nA();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let i of e)i.keys().forEach(e=>{let s=t.get(e);if(null===s)return;let a=n.get(e)||tv.empty();a=i.applyToLocalView(s,a),n.set(e,a);let o=(r.get(i.batchId)||nA()).add(e);r=r.insert(i.batchId,o)})}).next(()=>{let s=[],a=r.getReverseIterator();for(;a.hasNext();){let r=a.getNext(),o=r.key,l=r.value,h=nI();l.forEach(e=>{if(!i.has(e)){let r=nK(t.get(e),n.get(e));null!==r&&h.set(e,r),i=i.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,o,h))}return ta.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return tn.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):nh(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 s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):ta.resolve(nI()),a=-1,o=i;return s.next(t=>ta.forEach(t,(t,n)=>(a<n.largestBatchId&&(a=n.largestBatchId),i.get(t)?ta.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,i)).next(()=>this.computeViews(e,o,t,nA())).next(e=>({batchId:a,changes:nT(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new tn(t)).next(e=>{let t=nb();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,s=nb();return this.indexManager.getCollectionParents(e,i).next(a=>ta.forEach(a,a=>{let o=new no(a.child(i),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,o,n,r).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(s=>(i=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r))).next(e=>
4{i.forEach((t,n)=>{let r=n.getKey();null===e.get(r)&&(e=e.insert(r,tQ.newInvalidDocument(r)))});let n=nb();return e.forEach((e,r)=>{let s=i.get(e);void 0!==s&&nG(s.mutation,r,tv.empty(),e5.now()),ny(t,r)&&(n=n.insert(e,r))}),n})}}class rB{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return ta.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,{id:t.id,version:t.version,createTime:ry(t.createTime)}),ta.resolve()}getNamedQuery(e,t){return ta.resolve(this.Pr.get(t))}saveNamedQuery(e,t){var n;let r;return this.Pr.set(t.name,{name:t.name,query:(r=function(e){var t,n,r,i;let s,a,o,l,h,u=4===(s=r_(e.parent)).length?e9.emptyPath():rS(s),c=e.structuredQuery,d=c.from?c.from.length:0,f=null;if(d>0){1===d||eK();let e=c.from[0];e.allDescendants?f=e.collectionId:u=u.child(e.collectionId)}let p=[];c.where&&(p=(a=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=rD(e.unaryFilter.field);return t0.create(t,"==",{doubleValue:NaN});case"IS_NULL":let n=rD(e.unaryFilter.field);return t0.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let r=rD(e.unaryFilter.field);return t0.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let i=rD(e.unaryFilter.field);return t0.create(i,"!=",{nullValue:"NULL_VALUE"});default:return eK()}}(t):void 0!==t.fieldFilter?t0.create(rD(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return eK()}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?t1.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return eK()}}(t.compositeFilter.op)):eK()}(c.where))instanceof t1&&t3(t=a)&&t2(t)?a.getFilters():[a]);let g=[];c.orderBy&&(g=c.orderBy.map(e=>new tJ(rD(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let m=null;c.limit&&(m=null==(o="object"==typeof(n=c.limit)?n.value:n)?null:o);let y=null;c.startAt&&(l=!!(r=c.startAt).before,y=new tW(r.values||[],l));let v=null;return c.endAt&&(h=!(i=c.endAt).before,v=new tW(i.values||[],h)),new no(u,f,g,p,m,"F",y,v)}({parent:(n=t.bundledQuery).parent,structuredQuery:n.structuredQuery}),"LAST"===n.limitType?nf(r,r.limit,"L"):r),readTime:ry(t.readTime)}),ta.resolve()}}class rj{constructor(){this.overlays=new tf(tn.comparator),this.Ir=new Map}getOverlay(e,t){return ta.resolve(this.overlays.get(t))}getOverlays(e,t){let n=nI();return ta.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.ht(e,t,r)}),ta.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.Ir.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.Ir.delete(n)),ta.resolve()}getOverlaysForCollection(e,t,n){let r=nI(),i=t.length+1,s=new tn(t.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let e=a.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return ta.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new tf((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=nI(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let a=nI(),o=i.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=r)););return ta.resolve(a)}ht(e,t,n){let r=this.overlays.get(n.key);if(null!==r){let e=this.Ir.get(r.largestBatchId).delete(n.key);this.Ir.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new n3(t,n));let i=this.Ir.get(t);void 0===i&&(i=nA(),this.Ir.set(t,i)),this.Ir.set(t,i.add(n.key))}}class rq{constructor(){this.sessionToken=t_.EMPTY_BYTE_STRING}getSessionToken(e){return ta.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,ta.resolve()}}class r${constructor(){this.Tr=new tm(rz.Er),this.dr=new tm(rz.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){let n=new rz(e,t);this.Tr=this.Tr.add(n),this.dr=this.dr.add(n)}
4Rr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Vr(new rz(e,t))}mr(e,t){e.forEach(e=>this.removeReference(e,t))}gr(e){let t=new tn(new e9([])),n=new rz(t,e),r=new rz(t,e+1),i=[];return this.dr.forEachInRange([n,r],e=>{this.Vr(e),i.push(e.key)}),i}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){let t=new tn(new e9([])),n=new rz(t,e),r=new rz(t,e+1),i=nA();return this.dr.forEachInRange([n,r],e=>{i=i.add(e.key)}),i}containsKey(e){let t=new rz(e,0),n=this.Tr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class rz{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return tn.comparator(e.key,t.key)||e6(e.wr,t.wr)}static Ar(e,t){return e6(e.wr,t.wr)||tn.comparator(e.key,t.key)}}class rK{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new tm(rz.Er)}checkEmpty(e){return ta.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){let i=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new n1(i,t,n,r);for(let t of(this.mutationQueue.push(s),r))this.br=this.br.add(new rz(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return ta.resolve(s)}lookupMutationBatch(e,t){return ta.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){let n=this.vr(t+1),r=n<0?0:n;return ta.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return ta.resolve(0===this.mutationQueue.length?-1:this.Sr-1)}getAllMutationBatches(e){return ta.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new rz(t,0),r=new rz(t,1/0),i=[];return this.br.forEachInRange([n,r],e=>{let t=this.Dr(e.wr);i.push(t)}),ta.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new tm(e6);return t.forEach(e=>{let t=new rz(e,0),r=new rz(e,1/0);this.br.forEachInRange([t,r],e=>{n=n.add(e.wr)})}),ta.resolve(this.Cr(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;tn.isDocumentKey(i)||(i=i.child(""));let s=new rz(new tn(i),0),a=new tm(e6);return this.br.forEachWhile(e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(e.wr)),!0)},s),ta.resolve(this.Cr(a))}Cr(e){let t=[];return e.forEach(e=>{let n=this.Dr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){0===this.Fr(t.batchId,"removed")||eK(),this.mutationQueue.shift();let n=this.br;return ta.forEach(t.mutations,r=>{let i=new rz(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.br=n})}On(e){}containsKey(e,t){let n=new rz(t,0),r=this.br.firstAfterOrEqual(n);return ta.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,ta.resolve()}Fr(e,t){return this.vr(e)}vr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Dr(e){let t=this.vr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class rG{constructor(e){this.Mr=e,this.docs=new tf(tn.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,s=this.Mr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-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 ta.resolve(n?n.document.mutableCopy():tQ.newInvalidDocument(t))}getEntries(e,t){let n=n_;return t.forEach(e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():tQ.newInvalidDocument(e))}),ta.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=n_,s=t.path,a=new tn(s.child("")),o=this.docs.getIteratorFrom(a);for(;o.hasNext();){let{key:e,value:{document:a}}=o.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n||0!==(n=tn.comparator(e.documentKey,t.documentKey))?n:e6(e.largestBatchId,t.largestBatchId)}(new tr(a.readTime,a.key,-1),n)||(r.has(a.key)||ny(t,a))&&(i=i.insert(a.key,a.mutableCopy()))}return ta.resolve(i)}getAllFromCollectionGroup(e,t,n,r){eK()}Or(e,t){return ta.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new rH(this)}getSize(e){return ta.resolve(this.size)}}class rH extends rV{constructor(e){super(),this.cr=e}applyChanges(e){let t=[];
vendor: 5,077 bytes, line 4
4return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.cr.addEntry(e,r)):this.cr.removeEntry(n)}),ta.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}class rQ{constructor(e){this.persistence=e,this.Nr=new nw(e=>ni(e),ns),this.lastRemoteSnapshotVersion=e8.min(),this.highestTargetId=0,this.Lr=0,this.Br=new r$,this.targetCount=0,this.kr=rP.Bn()}forEachTarget(e,t){return this.Nr.forEach((e,n)=>t(n)),ta.resolve()}getLastRemoteSnapshotVersion(e){return ta.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return ta.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),ta.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Lr&&(this.Lr=t),ta.resolve()}Kn(e){this.Nr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.kr=new rP(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,ta.resolve()}updateTargetData(e,t){return this.Kn(t),ta.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,ta.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.Nr.forEach((s,a)=>{a.sequenceNumber<=t&&null===n.get(a.targetId)&&(this.Nr.delete(s),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),r++)}),ta.waitFor(i).next(()=>r)}getTargetCount(e){return ta.resolve(this.targetCount)}getTargetData(e,t){let n=this.Nr.get(t)||null;return ta.resolve(n)}addMatchingKeys(e,t,n){return this.Br.Rr(t,n),ta.resolve()}removeMatchingKeys(e,t,n){this.Br.mr(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(t=>{i.push(r.markPotentiallyOrphaned(e,t))}),ta.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),ta.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Br.yr(t);return ta.resolve(n)}containsKey(e,t){return ta.resolve(this.Br.containsKey(t))}}class rW{constructor(e,t){this.qr={},this.overlays={},this.Qr=new tl(0),this.Kr=!1,this.Kr=!0,this.$r=new rq,this.referenceDelegate=e(this),this.Ur=new rQ(this),this.indexManager=new rL,this.remoteDocumentCache=function(e){return new rG(e)}(e=>this.referenceDelegate.Wr(e)),this.serializer=new rx(t),this.Gr=new rB(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new rj,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.qr[e.toKey()];return n||(n=new rK(t,this.referenceDelegate),this.qr[e.toKey()]=n),n}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,t,n){ej("MemoryPersistence","Starting transaction:",e);let r=new rX(this.Qr.next());return this.referenceDelegate.zr(),n(r).next(e=>this.referenceDelegate.jr(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Hr(e,t){return ta.or(Object.values(this.qr).map(n=>()=>n.containsKey(e,t)))}}class rX extends ti{constructor(e){super(),this.currentSequenceNumber=e}}class rY{constructor(e){this.persistence=e,this.Jr=new r$,this.Yr=null}static Zr(e){return new rY(e)}get Xr(){if(this.Yr)return this.Yr;throw eK()}addReference(e,t,n){return this.Jr.addReference(n,t),this.Xr.delete(n.toString()),ta.resolve()}removeReference(e,t,n){return this.Jr.removeReference(n,t),this.Xr.add(n.toString()),ta.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),ta.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(e=>this.Xr.add(e.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.Xr.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ta.forEach(this.Xr,n=>{let r=tn.fromPath(n);return this.ei(e,r).next(e=>{e||t.removeEntry(r,e8.min())})}).next(()=>(this.Yr=null,t.apply(e)))}updateLimboDocument(e,t){return this.ei(e,t).next(e=>{e?this.Xr.delete(t.toString()):this.Xr.add(t.toString())})}Wr(e){return 0}ei(e,t){return ta.or([()=>ta.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}class rJ{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.$i=n,this.Ui=r}static Wi(e,t){let n=nA(),r=nA();for(let e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new rJ(e,t.fromCache,n,r)}}class rZ{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class r0{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){let t;return!function(){var t;let n=null==(t=N())?void 0:t.forceEnvironment;if("node"===n)return!0;
4if("browser"===n)return!1;try{return"[object process]"===Object.prototype.toString.call(e.g.process)}catch(e){return!1}}()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")?8:Number((t=("u">typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"").match(/Android ([\d.]+)/i))?t[1].split(".").slice(0,2).join("."):"-1")>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.Yi(e,t).next(e=>{i.result=e}).next(()=>{if(!i.result)return this.Zi(e,t,r,n).next(e=>{i.result=e})}).next(()=>{if(i.result)return;let n=new rZ;return this.Xi(e,t,n).next(r=>{if(i.result=r,this.zi)return this.es(e,t,n,r.size)})}).next(()=>i.result)}es(e,t,n,r){return n.documentReadCount<this.ji?(eB()<=s.DEBUG&&ej("QueryEngine","SDK will not create cache indexes for query:",nm(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),ta.resolve()):(eB()<=s.DEBUG&&ej("QueryEngine","Query:",nm(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Hi*r?(eB()<=s.DEBUG&&ej("QueryEngine","The SDK decides to create cache indexes for query:",nm(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,nc(t))):ta.resolve())}Yi(e,t){if(nl(t))return ta.resolve(null);let n=nc(t);return this.indexManager.getIndexType(e,n).next(r=>0===r?null:(null!==t.limit&&1===r&&(n=nc(t=nf(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,n).next(r=>{let i=nA(...r);return this.Ji.getDocuments(e,i).next(r=>this.indexManager.getMinOffset(e,n).next(n=>{let s=this.ts(t,r);return this.ns(t,s,i,n.readTime)?this.Yi(e,nf(t,null,"F")):this.rs(e,s,t,n)}))})))}Zi(e,t,n,r){return nl(t)||r.isEqual(e8.min())?ta.resolve(null):this.Ji.getDocuments(e,n).next(i=>{let a,o,l=this.ts(t,i);return this.ns(t,l,n,r)?ta.resolve(null):(eB()<=s.DEBUG&&ej("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),nm(t)),this.rs(e,l,t,(a=r.toTimestamp().seconds,o=r.toTimestamp().nanoseconds+1,new tr(e8.fromTimestamp(1e9===o?new e5(a+1,0):new e5(a,o)),tn.empty(),-1))).next(e=>e))})}ts(e,t){let n=new tm(nv(e));return t.forEach((t,r)=>{ny(e,r)&&(n=n.add(r))}),n}ns(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;let i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Xi(e,t,n){return eB()<=s.DEBUG&&ej("QueryEngine","Using full collection scan to execute query:",nm(t)),this.Ji.getDocumentsMatchingQuery(e,t,tr.min(),n)}rs(e,t,n,r){return this.Ji.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class r1{constructor(e,t,n,r){this.persistence=e,this.ss=t,this.serializer=r,this.os=new tf(e6),this._s=new nw(e=>ni(e),ns),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(n)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new rU(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.os))}}async function r2(e,t){return await e.persistence.runTransaction("Handle user change","readonly",n=>{let r;return e.mutationQueue.getAllMutationBatches(n).next(i=>(r=i,e.ls(t),e.mutationQueue.getAllMutationBatches(n))).next(t=>{let i=[],s=[],a=nA();for(let e of r)for(let t of(i.push(e.batchId),e.mutations))a=a.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))a=a.add(t.key);return e.localDocuments.getDocuments(n,a).next(e=>({hs:e,removedBatchIds:i,addedBatchIds:s}))})})}function r3(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}
4async function r6(e,t,n){let r=e.os.get(t);try{n||await e.persistence.runTransaction("Release target",n?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,r))}catch(e){if(!to(e))throw e;ej("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}e.os=e.os.remove(t),e._s.delete(r.target)}function r4(e,t,n){let r=e8.min(),i=nA();return e.persistence.runTransaction("Execute query","readwrite",s=>{var a;let o;return(a=nc(t),void 0!==(o=e._s.get(a))?ta.resolve(e.os.get(o)):e.Ur.getTargetData(s,a)).next(t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,e.Ur.getMatchingKeysForTargetId(s,t.targetId).next(e=>{i=e})}).next(()=>e.ss.getDocumentsMatchingQuery(s,t,n?r:e8.min(),n?i:nA())).next(n=>{var r,s,a;let o;return r=e,s=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),a=n,o=r.us.get(s)||e8.min(),a.forEach((e,t)=>{t.readTime.compareTo(o)>0&&(o=t.readTime)}),r.us.set(s,o),{documents:n,Ts:i}})})}class r5{constructor(){this.activeTargetIds=nD}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class r8{constructor(){this.so=new r5,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,t,n){this.oo[e]=t}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new r5,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class r7{_o(e){}shutdown(){}}class r9{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){for(let e of(ej("ConnectivityMonitor","Network connectivity changed: AVAILABLE"),this.ho))e(0)}lo(){for(let e of(ej("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE"),this.ho))e(1)}static D(){return"u">typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let ie=null;function it(){return null===ie?ie=0x10000000+Math.round(0x80000000*Math.random()):ie++,"0x"+ie.toString(16)}let ir={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class ii{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}let is="WebChannelConnection";class ia extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Do=t+"://"+e.host,this.vo=`projects/${n}/databases/${r}`,this.Co="(default)"===this.databaseId.database?`project_id=${n}`:`project_id=${n}&database_id=${r}`}get Fo(){return!1}Mo(e,t,n,r,i){let s=it(),a=this.xo(e,t.toUriEncodedString());ej("RestConnection",`Sending RPC '${e}' ${s}:`,a,n);let o={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(o,r,i),this.No(e,a,o,n).then(t=>(ej("RestConnection",`Received RPC '${e}' ${s}: `,t),t),t=>{throw e$("RestConnection",`RPC '${e}' ${s} failed with error: `,t,"url: ",a,"request:",n),t})}Lo(e,t,n,r,i,s){return this.Mo(e,t,n,r,i)}Oo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+eF,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)}xo(e,t){let n=ir[e];return`${this.Do}/v1/${t}:${n}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,t,n,r){let i=it();return new Promise((s,a)=>{let o=new l;o.setWithCredentials(!0),o.listenOnce(u.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case c.NO_ERROR:let t=o.getResponseJson();ej(is,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),s(t);break;case c.TIMEOUT:ej(is,`RPC '${e}' ${i} timed out`),a(new eH(eG.DEADLINE_EXCEEDED,"Request time out"));break;case c.HTTP_ERROR:let n=o.getStatus();if(ej(is,`RPC '${e}' ${i} failed with status:`,n,"response text:",o.getResponseText()),n>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e,n=(e=t.status.toLowerCase().replace(/_/g,"-"),Object.values(eG).indexOf(e)>=0?e:eG.UNKNOWN);a(new eH(n,t.message))}else a(new eH(eG.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new eH(eG.UNAVAILABLE,"Connection failed."));break;default:eK()}}finally{ej(is,`RPC '${e}' ${i} completed.`)}});let h=JSON.stringify(r);ej(is,`RPC '${e}' ${i} sending request:`,r),o.send(t,"POST",h,n,15)})}Bo(e,t,n){let r=it(),i=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=g(),a=p(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`}
4,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(o.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(o.useFetchStreams=!0),this.Oo(o.initMessageHeaders,t,n),o.encodeInitMessageHeaders=!0;let u=i.join("");ej(is,`Creating RPC '${e}' stream ${r}: ${u}`,o);let c=s.createWebChannel(u,o),y=!1,v=!1,w=new ii({Io:t=>{v?ej(is,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(y||(ej(is,`Opening RPC '${e}' stream ${r} transport.`),c.open(),y=!0),ej(is,`RPC '${e}' stream ${r} sending:`,t),c.send(t))},To:()=>c.close()}),_=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return _(c,h.EventType.OPEN,()=>{v||(ej(is,`RPC '${e}' stream ${r} transport opened.`),w.yo())}),_(c,h.EventType.CLOSE,()=>{v||(v=!0,ej(is,`RPC '${e}' stream ${r} transport closed`),w.So())}),_(c,h.EventType.ERROR,t=>{v||(v=!0,e$(is,`RPC '${e}' stream ${r} transport errored:`,t),w.So(new eH(eG.UNAVAILABLE,"The operation could not be completed")))}),_(c,h.EventType.MESSAGE,t=>{var n;if(!v){let i=t.data[0];i||eK();let s=i.error||(null==(n=i[0])?void 0:n.error);if(s){ej(is,`RPC '${e}' stream ${r} received error:`,s);let t=s.status,n=function(e){let t=m[e];if(void 0!==t)return n4(t)}(t),i=s.message;void 0===n&&(n=eG.INTERNAL,i="Unknown error status: "+t+" with message "+s.message),v=!0,w.So(new eH(n,i)),c.close()}else ej(is,`RPC '${e}' stream ${r} received:`,i),w.bo(i)}}),_(a,f.STAT_EVENT,t=>{t.stat===d.PROXY?ej(is,`RPC '${e}' stream ${r} detected buffering proxy`):t.stat===d.NOPROXY&&ej(is,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{w.wo()},0),w}}function io(){return"u">typeof document?document:null}function il(e){return new rf(e,!0)}class ih{constructor(e,t,n=1e3,r=1.5,i=6e4){this.ui=e,this.timerId=t,this.ko=n,this.qo=r,this.Qo=i,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();let t=Math.floor(this.Ko+this.zo()),n=Math.max(0,Date.now()-this.Uo),r=Math.max(0,t-n);r>0&&ej("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,r,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){null!==this.$o&&(this.$o.skipDelay(),this.$o=null)}
4cancel(){null!==this.$o&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}class iu{constructor(e,t,n,r,i,s,a,o){this.ui=e,this.Ho=n,this.Jo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new ih(e,t)}n_(){return 1===this.state||5===this.state||this.r_()}r_(){return 2===this.state||3===this.state}start(){this.e_=0,4!==this.state?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&null===this.Zo&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,t){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,4!==e?this.t_.reset():t&&t.code===eG.RESOURCE_EXHAUSTED?(eq(t.toString()),eq("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===eG.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(t)}l_(){}auth(){this.state=1;let e=this.h_(this.Yo),t=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.Yo===t&&this.P_(e,n)},t=>{e(()=>{let e=new eH(eG.UNKNOWN,"Fetching auth token failed: "+t.message);return this.I_(e)})})}P_(e,t){let n=this.h_(this.Yo);this.stream=this.T_(e,t),this.stream.Eo(()=>{n(()=>this.listener.Eo())}),this.stream.Ro(()=>{n(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(e=>{n(()=>this.I_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.e_?this.E_(e):this.onNext(e))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return ej("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(ej("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ic extends iu{constructor(e,t,n,r,i,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,s),this.serializer=i}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();let t=function(e,t){let n;if("targetChange"in t){var r,i;t.targetChange;let s="NO_CHANGE"===(r=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===r?1:"REMOVE"===r?2:"CURRENT"===r?3:"RESET"===r?4:eK(),a=t.targetChange.targetIds||[],o=(i=t.targetChange.resumeToken,e.useProto3Json?(void 0===i||"string"==typeof i||eK(),t_.fromBase64String(i||"")):(void 0===i||i instanceof ex.Buffer||i instanceof Uint8Array||eK(),t_.fromUint8Array(i||new Uint8Array))),l=t.targetChange.cause;n=new rs(s,a,o,l&&new eH(void 0===l.code?eG.UNKNOWN:n4(l.code),l.message||"")||null)}else if("documentChange"in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=rb(e,r.document.name),s=ry(r.document.updateTime),a=r.document.createTime?ry(r.document.createTime):e8.min(),o=new tH({mapValue:{fields:r.document.fields}}),l=tQ.newFoundDocument(i,s,a,o);n=new rr(r.targetIds||[],r.removedTargetIds||[],l.key,l)}else if("documentDelete"in t){t.documentDelete;let r=t.documentDelete;r.document;let i=rb(e,r.document),s=r.readTime?ry(r.readTime):e8.min(),a=tQ.newNoDocument(i,s);n=new rr([],r.removedTargetIds||[],a.key,a)}else if("documentRemove"in t){t.documentRemove;let r=t.documentRemove;r.document;let i=rb(e,r.document);n=new rr([],r.removedTargetIds||[],i,null)}else{if(!("filter"in t))return eK();{t.filter;let e=t.filter;e.targetId;let{count:r=0,unchangedNames:i}=e,s=new n6(r,i);n=new ri(e.targetId,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return e8.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?e8.min():t.readTime?ry(t.readTime):e8.min()}(e);return this.listener.d_(t,n)}A_(e){let t,n={};n.database=rI(this.serializer),n.addTarget=function(e,t){var n,r;let i,s,a,o,l,h,u,c=t.target;if((i=na(c)?{documents:{documents:[rT(e,c.path)]}}:{query:(a={structuredQuery:{}},o=c.path,null!==c.collectionGroup?(s=o,a.structuredQuery.from=[{collectionId:c.collectionGroup,allDescendants:!0}]):(s=o.popLast(),a.structuredQuery.from=[{collectionId:o.lastSegment()}]),a.parent=rT(e,s),(l=function(e){if(0!==e.length)return function e(t){var n;let r;return t instanceof t0?function(e){if("=="===e.op){if(tq(e.value))return{unaryFilter:{field:rA(e.field),op:"IS_NAN"}};if(tj(e.value))return{unaryFilter:{field:rA(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(tq(e.value))return{unaryFilter:{field:rA(e.field),op:"IS_NOT_NA
4N"}};if(tj(e.value))return{unaryFilter:{field:rA(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:rA(e.field),op:rc[e.op],value:e.value}}}(t):t instanceof t1?1===(r=(n=t).getFilters().map(t=>e(t))).length?r[0]:{compositeFilter:{op:rd[n.op],filters:r}}:eK()}(t1.create(e,"and"))}(c.filters))&&(a.structuredQuery.where=l),(h=function(e){if(0!==e.length)return e.map(e=>({field:rA(e.field),direction:ru[e.dir]}))}(c.orderBy))&&(a.structuredQuery.orderBy=h),null!==(u=rp(e,c.limit))&&(a.structuredQuery.limit=u),c.startAt&&(a.structuredQuery.startAt={before:(n=c.startAt).inclusive,values:n.position}),c.endAt&&(a.structuredQuery.endAt={before:!(r=c.endAt).inclusive,values:r.position}),{_t:a,parent:s})._t}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){i.resumeToken=rm(e,t.resumeToken);let n=rp(e,t.expectedCount);null!==n&&(i.expectedCount=n)}else if(t.snapshotVersion.compareTo(e8.min())>0){i.readTime=rg(e,t.snapshotVersion.toTimestamp());let n=rp(e,t.expectedCount);null!==n&&(i.expectedCount=n)}return i}(this.serializer,e);let r=(this.serializer,null==(t=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 eK()}}(e.purpose))?null:{"goog-listen-tags":t});r&&(n.labels=r),this.a_(n)}R_(e){let t={};t.database=rI(this.serializer),t.removeTarget=e,this.a_(t)}}class id extends iu{constructor(e,t,n,r,i,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,s),this.serializer=i}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,t){return this.connection.Bo("Write",e,t)}E_(e){return e.streamToken||eK(),this.lastStreamToken=e.streamToken,e.writeResults&&0!==e.writeResults.length&&eK(),this.listener.f_()}onNext(e){var t,n;e.streamToken||eK(),this.lastStreamToken=e.streamToken,this.t_.reset();let r=(t=e.writeResults,n=e.commitTime,t&&t.length>0?(void 0!==n||eK(),t.map(e=>{let t;return(t=e.updateTime?ry(e.updateTime):ry(n)).isEqual(e8.min())&&(t=ry(n)),new nj(t,e.transformResults||[])})):[]),i=ry(e.commitTime);return this.listener.g_(i,r)}p_(){let e={};e.database=rI(this.serializer),this.a_(e)}m_(e){let t={streamToken:this.lastStreamToken,writes:e.map(e=>(function(e,t){var n,r;let i;if(t instanceof nQ)i={update:rC(e,t.key,t.value)};else if(t instanceof nZ)i={delete:rE(e,t.key)};else if(t instanceof nW){let n;i={update:rC(e,t.key,t.data),updateMask:(r=t.fieldMask,n=[],r.fields.forEach(e=>n.push(e.canonicalString())),{fieldPaths:n})}}else{if(!(t instanceof n0))return eK();i={verify:rE(e,t.key)}}return t.fieldTransforms.length>0&&(i.updateTransforms=t.fieldTransforms.map(e=>(function(e){let t=e.transform;if(t instanceof nL)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(t instanceof nO)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:t.elements}};if(t instanceof nP)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:t.elements}};if(t instanceof nF)return{fieldPath:e.field.canonicalString(),increment:t.Pe};throw eK()})(e))),t.precondition.isNone||(i.currentDocument=void 0!==(n=t.precondition).updateTime?{updateTime:rg(e,n.updateTime.toTimestamp())}:void 0!==n.exists?{exists:n.exists}:eK()),i})(this.serializer,e))};this.a_(t)}}class ip extends class{}{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.y_=!1}w_(){if(this.y_)throw new eH(eG.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,n,r){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.Mo(e,rw(t,n),r,i,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===eG.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new eH(eG.UNKNOWN,e.toString())})}Lo(e,t,n,r,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.Lo(e,rw(t,n),r,s,a,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===eG.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new eH(eG.UNKNOWN,e.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class ig{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){0===this.S_&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){"Online"===this.state?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,"Online"===e&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){let t=`Could not reach Cloud Firestore backend. ${e} 5This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(eq(t),this.D_=!1):ej("OnlineStateTracker",t)}x_(){null!==this.b_&&(this.b_.cancel(),this.b_=null)}}class im{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=i,this.k_._o(e=>{n.enqueueAndForget(async()=>{iS(this)&&(ej("RemoteStore","Restarting streams for network reach
5ability change."),await async function(e){e.L_.add(4),await iv(e),e.q_.set("Unknown"),e.L_.delete(4),await iy(e)}(this))})}),this.q_=new ig(n,r)}}async function iy(e){if(iS(e))for(let t of e.B_)await t(!0)}async function iv(e){for(let t of e.B_)await t(!1)}function iw(e,t){e.N_.has(t.targetId)||(e.N_.set(t.targetId,t),iI(e)?iT(e):ij(e).r_()&&iE(e,t))}function i_(e,t){let n=ij(e);e.N_.delete(t),n.r_()&&ib(e,t),0===e.N_.size&&(n.r_()?n.o_():iS(e)&&e.q_.set("Unknown"))}function iE(e,t){if(e.Q_.xe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(e8.min())>0){let n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}ij(e).A_(t)}function ib(e,t){e.Q_.xe(t),ij(e).R_(t)}function iT(e){e.Q_=new ro({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),ot:t=>e.N_.get(t)||null,tt:()=>e.datastore.serializer.databaseId}),ij(e).start(),e.q_.v_()}function iI(e){return iS(e)&&!ij(e).n_()&&e.N_.size>0}function iS(e){return 0===e.L_.size}async function iC(e){e.q_.set("Online")}async function iA(e){e.N_.forEach((t,n)=>{iE(e,t)})}async function iD(e,t){e.Q_=void 0,iI(e)?(e.q_.M_(t),iT(e)):e.q_.set("Unknown")}async function iN(e,t,n){if(e.q_.set("Online"),t instanceof rs&&2===t.state&&t.cause)try{await async function(e,t){let n=t.cause;for(let r of t.targetIds)e.N_.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.N_.delete(r),e.Q_.removeTarget(r))}(e,t)}catch(n){ej("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await ik(e,n)}else if(t instanceof rr?e.Q_.Ke(t):t instanceof ri?e.Q_.He(t):e.Q_.We(t),!n.isEqual(e8.min()))try{let t,r=await r3(e.localStore);n.compareTo(r)>
5=0&&await ((t=e.Q_.rt(n)).targetChanges.forEach((t,r)=>{if(t.resumeToken.approximateByteSize()>0){let i=e.N_.get(r);i&&e.N_.set(r,i.withResumeToken(t.resumeToken,n))}}),t.targetMismatches.forEach((t,n)=>{let r=e.N_.get(t);if(!r)return;e.N_.set(t,r.withResumeToken(t_.EMPTY_BYTE_STRING,r.snapshotVersion)),ib(e,t);let i=new rk(r.target,t,n,r.sequenceNumber);iE(e,i)}),e.remoteSyncer.applyRemoteEvent(t))}catch(t){ej("RemoteStore","Failed to raise snapshot:",t),await ik(e,t)}}async function ik(e,t,n){if(!to(t))throw t;e.L_.add(1),await iv(e),e.q_.set("Offline"),n||(n=()=>r3(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{ej("RemoteStore","Retrying IndexedDB access"),await n(),e.L_.delete(1),await iy(e)})}function ix(e,t){return t().catch(n=>ik(e,n,t))}async function iR(e){var t;let n=iq(e),r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;iS(t=e)&&t.O_.length<10;)try{let t=await function(e,t){return e.persistence.runTransaction("Get next mutation batch","readonly",n=>(void 0===t&&(t=-1),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)))}(e.localStore,r);if(null===t){0===e.O_.length&&n.o_();break}r=t.batchId,function(e,t){e.O_.push(t);let n=iq(e);n.r_()&&n.V_&&n.m_(t.mutations)}(e,t)}catch(t){await ik(e,t)}iL(e)&&iO(e)}function iL(e){return iS(e)&&!iq(e).n_()&&e.O_.length>0}function iO(e){iq(e).start()}async function iM(e){iq(e).p_()}async function iP(e){let t=iq(e);for(let n of e.O_)t.m_(n.mutations)}async function iV(e,t,n){let r=e.O_.shift(),i=n2.from(r,t,n);await ix(e,()=>e.remoteSyncer.applySuccessfulWrite(i)),await iR(e)}async function iF(e,t){t&&iq(e).V_&&await async function(e,t){var n;if(function(e){switch(e){default:return eK();case eG.CANCELLED:case eG.UNKNOWN:case eG.DEADLINE_EXCEEDED:case eG.RESOURCE_EXHAUSTED:case eG.INTERNAL:case eG.UNAVAILABLE:case eG.UNAUTHENTICATED:return!1;case eG.INVALID_ARGUMENT:case eG.NOT_FOUND:case eG.ALREADY_EXISTS:case eG.PERMISSION_DENIED:case eG.FAILED_PRECONDITION:case eG.ABORTED:case eG.OUT_OF_RANGE:case eG.UNIMPLEMENTED:case eG.DATA_LOSS:return!0}}(n=t.code)&&n!==eG.ABORTED){let n=e.O_.shift();iq(e).s_(),await ix(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await iR(e)}}(e,t),iL(e)&&iO(e)}async function iU(e,t){e.asyncQueue.verifyOperationInProgress(),ej("RemoteStore","RemoteStore received new credentials");let n=iS(e);e.L_.add(3),await iv(e),n&&e.q_.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.L_.delete(3),await iy(e)}async function iB(e,t){t?(e.L_.delete(2),await iy(e)):t||(e.L_.add(2),await iv(e),e.q_.set("Unknown"))}function ij(e){var t,n,r;return e.K_||(t=e.datastore,n=e.asyncQueue,r={Eo:iC.bind(null,e),Ro:iA.bind(null,e),mo:iD.bind(null,e),d_:iN.bind(null,e)},t.w_(),e.K_=new ic(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,r),e.B_.push(async t=>{t?(e.K_.s_(),iI(e)?iT(e):e.q_.set("Unknown")):(await e.K_.stop(),e.Q_=void 0)})),e.K_}function iq(e){var t,n,r;return e.U_||(t=e.datastore,n=e.asyncQueue,r={Eo:()=>Promise.resolve(),Ro:iM.bind(null,e),mo:iF.bind(null,e),f_:iP.bind(null,e),g_:iV.bind(null,e)},t.w_(),e.U_=new id(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,r),e.B_.push(async t=>{t?(e.U_.s_(),await iR(e)):(await e.U_.stop(),e.O_.length>0&&(ej("RemoteStore",`Stopping write stream with ${e.O_.length} pending writes`),e.O_=[]))})),e.U_}class i${constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new eQ,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,i){let s=new i$(e,t,Date.now()+n,r,i);return s.start(n),s}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new eH(eG.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function iz(e,t){if(eq("AsyncQueue",`${t}: ${e}`),to(e))return new eH(eG.UNAVAILABLE,`${t}: ${e}`);throw e}class iK{constructor(e){this.comparator=e?(t,n)=>e(t,n)||tn.comparator(t.key,n.key):(e,t)=>
5tn.comparator(e.key,t.key),this.keyedMap=nb(),this.sortedSet=new tf(this.comparator)}static emptySet(e){return new iK(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof iK)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){let n=new iK;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class iG{constructor(){this.W_=new tf(tn.comparator)}track(e){let t=e.doc.key,n=this.W_.get(t);n?0!==e.type&&3===n.type?this.W_=this.W_.insert(t,e):3===e.type&&1!==n.type?this.W_=this.W_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.W_=this.W_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.W_=this.W_.remove(t):1===e.type&&2===n.type?this.W_=this.W_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):eK():this.W_=this.W_.insert(t,e)}G_(){let e=[];return this.W_.inorderTraversal((t,n)=>{e.push(n)}),e}}class iH{constructor(e,t,n,r,i,s,a,o,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=o,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,r,i){let s=[];return t.forEach(e=>{s.push({type:0,doc:e})}),new iH(e,t,iK.emptySet(t),s,n,r,!0,!1,i)}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)&&np(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class iQ{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class iW{constructor(){this.queries=iX(),this.onlineState="Unknown",this.Y_=new Set}terminate(){var e;let t;e=new eH(eG.ABORTED,"Firestore shutting down"),t=this.queries,this.queries=iX(),t.forEach((t,n)=>{for(let t of n.j_)t.onError(e)})}}function iX(){return new nw(e=>ng(e),np)}async function iY(e,t){let n=3,r=t.query,i=e.queries.get(r);i?!i.H_()&&t.J_()&&(n=2):(i=new iQ,n=+!t.J_());try{switch(n){case 0:i.z_=await e.onListen(r,!0);break;case 1:i.z_=await e.onListen(r,!1);break;case 2:await e.onFirstRemoteStoreListen(r)}}catch(n){let e=iz(n,`Initialization of query '${nm(t.query)}' failed`);return void t.onError(e)}e.queries.set(r,i),i.j_.push(t),t.Z_(e.onlineState),i.z_&&t.X_(i.z_)&&i1(e)}async function iJ(e,t){let n=t.query,r=3,i=e.queries.get(n);if(i){let e=i.j_.indexOf(t);e>=0&&(i.j_.splice(e,1),0===i.j_.length?r=+!t.J_():!i.H_()&&t.J_()&&(r=2))}switch(r){case 0:return e.queries.delete(n),e.onUnlisten(n,!0);case 1:return e.queries.delete(n),e.onUnlisten(n,!1);case 2:return e.onLastRemoteStoreUnlisten(n);default:return}}function iZ(e,t){let n=!1;for(let r of t){let t=r.query,i=e.queries.get(t);if(i){for(let e of i.j_)e.X_(r)&&(n=!0);i.z_=r}}n&&i1(e)}function i0(e,t,n){let r=e.queries.get(t);if(r)for(let e of r.j_)e.onError(n);e.queries.delete(t)}function i1(e){e.Y_.forEach(e=>{e.next()})}(w=v||(v={})).ea="default",w.Cache="cache";class i2{constructor(e,t,n){this.query=e,this.ta=t,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=n||{}}X_(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)3!==n.type&&t.push(n);e=new iH(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.na?this.ia(e)&&(this.ta.next(e),t=!0):this.sa(e,this.onlineState)&&(this.oa(e),t=!0),this.ra=e,t}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let t=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),t=!0),t}sa(e,t){return!(e.fromCache&&this.J_())||(!this.options._a||"Offline"===t)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}ia(e){if(e.docChanges.length>0)return!0;let t=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}oa(e){e=iH.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==v.Cache}}class i3{constructor(e){this.key=e}}class i6{constructor(e){this.key=e}}class i4{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=nA(),this.mutatedKeys=nA(),this.Aa=nv(e),this.Ra=new iK(this.Aa)}get Va(){return this.Ta}ma(e,t){let n=t?t.fa:new iG,r=t?t.Ra:this.Ra,i=t?t.mutatedKeys:this.mutatedKeys,s=r,a=!1,o="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,l="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((e,t)=>
5{let h=r.get(e),u=ny(this.query,t)?t:null,c=!!h&&this.mutatedKeys.has(h.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations),f=!1;h&&u?h.data.isEqual(u.data)?c!==d&&(n.track({type:3,doc:u}),f=!0):this.ga(h,u)||(n.track({type:2,doc:u}),f=!0,(o&&this.Aa(u,o)>0||l&&0>this.Aa(u,l))&&(a=!0)):!h&&u?(n.track({type:0,doc:u}),f=!0):h&&!u&&(n.track({type:1,doc:h}),f=!0,(o||l)&&(a=!0)),f&&(u?(s=s.add(u),i=d?i.add(e):i.delete(e)):(s=s.delete(e),i=i.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){let e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{Ra:s,fa:n,ns:a,mutatedKeys:i}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){let i=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;let s=e.fa.G_();s.sort((e,t)=>{var n,r;let i;return n=e.type,r=t.type,(i=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return eK()}})(n)-i(r)||this.Aa(e.doc,t.doc)}),this.pa(n),r=null!=r&&r;let a=t&&!r?this.ya():[],o=0===this.da.size&&this.current&&!r?1:0,l=o!==this.Ea;return(this.Ea=o,0!==s.length||l)?{snapshot:new iH(this.query,e.Ra,i,s,e.mutatedKeys,0===o,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),wa:a}:{wa:a}}Z_(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new iG,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(e=>this.Ta=this.Ta.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ta=this.Ta.delete(e)),this.current=e.current)}ya(){if(!this.current)return[];let e=this.da;this.da=nA(),this.Ra.forEach(e=>{this.Sa(e.key)&&(this.da=this.da.add(e.key))});let t=[];return e.forEach(e=>{this.da.has(e)||t.push(new i6(e))}),this.da.forEach(n=>{e.has(n)||t.push(new i3(n))}),t}ba(e){this.Ta=e.Ts,this.da=nA();let t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return iH.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,0===this.Ea,this.hasCachedResults)}}class i5{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class i8{constructor(e){this.key=e,this.va=!1}}class i7{constructor(e,t,n,r,i,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.Ca={},this.Fa=new nw(e=>ng(e),np),this.Ma=new Map,this.xa=new Set,this.Oa=new tf(tn.comparator),this.Na=new Map,this.La=new r$,this.Ba={},this.ka=new Map,this.qa=rP.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return!0===this.Qa}}async function i9(e,t,n=!0){let r,i=s_(e),s=i.Fa.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.Da()):r=await st(i,t,n,!0),r}async function se(e,t){let n=s_(e);await st(n,t,!0,!1)}async function st(e,t,n,r){var i,s;let a,o=await (i=e.localStore,s=nc(t),i.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return i.Ur.getTargetData(e,s).next(n=>n?(t=n,ta.resolve(t)):i.Ur.allocateTargetId(e).next(n=>(t=new rk(s,n,"TargetPurposeListen",e.currentSequenceNumber),i.Ur.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=i.os.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(i.os=i.os.insert(e.targetId,e),i._s.set(s,e.targetId)),e}
5)),l=o.targetId,h=e.sharedClientState.addLocalQueryTarget(l,n);return r&&(a=await sn(e,t,l,"current"===h,o.resumeToken)),e.isPrimaryClient&&n&&iw(e.remoteStore,o),a}async function sn(e,t,n,r,i){e.Ka=(t,n,r)=>(async function(e,t,n,r){let i=t.view.ma(n);i.ns&&(i=await r4(e.localStore,t.query,!1).then(({documents:e})=>t.view.ma(e,i)));let s=r&&r.targetChanges.get(t.targetId),a=r&&null!=r.targetMismatches.get(t.targetId),o=t.view.applyChanges(i,e.isPrimaryClient,s,a);return sg(e,t.targetId,o.wa),o.snapshot})(e,t,n,r);let s=await r4(e.localStore,t,!0),a=new i4(t,s.Ts),o=a.ma(s.documents),l=rn.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,i),h=a.applyChanges(o,e.isPrimaryClient,l);sg(e,n,h.wa);let u=new i5(t,n,a);return e.Fa.set(t,u),e.Ma.has(n)?e.Ma.get(n).push(t):e.Ma.set(n,[t]),h.snapshot}async function sr(e,t,n){let r=e.Fa.get(t),i=e.Ma.get(r.targetId);i.length>1?(e.Ma.set(r.targetId,i.filter(e=>!np(e,t))),e.Fa.delete(t)):e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(r.targetId),e.sharedClientState.isActiveQueryTarget(r.targetId)||await r6(e.localStore,r.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(r.targetId),n&&i_(e.remoteStore,r.targetId),sf(e,r.targetId)}).catch(ts)):(sf(e,r.targetId),await r6(e.localStore,r.targetId,!0))}async function si(e,t){let n=e.Fa.get(t),r=e.Ma.get(n.targetId);e.isPrimaryClient&&1===r.length&&(e.sharedClientState.removeLocalQueryTarget(n.targetId),i_(e.remoteStore,n.targetId))}async function ss(e,t,n){var r,i,s;let a=((r=e).remoteStore.remoteSyncer.applySuccessfulWrite=sh.bind(null,r),r.remoteStore.remoteSyncer.rejectFailedWrite=su.bind(null,r),r);try{let e,r,o,l,h,u=await (i=a.localStore,o=e5.now(),l=t.reduce((e,t)=>e.add(t.key),nA()),i.persistence.runTransaction("Locally write mutations","readwrite",n=>{let s=n_,a=nA();return i.cs.getEntries(n,l).next(e=>{(s=e).forEach((e,t)=>{t.isValidDocument()||(a=a.add(e))})}).next(()=>i.localDocuments.getOverlayedDocuments(n,s)).next(r=>{e=r;let s=[];for(let n of t){let t=function(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=nR(r.transform,e||null);null!=i&&(null===n&&(n=tH.empty()),n.set(r.field,i))}return n||null}(n,e.get(n.key).overlayedDocument);null!=t&&s.push(new nW(n.key,t,function e(t){let n=[];return tc(t.fields,(t,r)=>{let i=new tt([t]);if(t$(r)){let t=e(r.mapValue).fields;if(0===t.length)n.push(i);else for(let e of t)n.push(i.child(e))}else n.push(i)}),new tv(n)}(t.value.mapValue),nq.exists(!0)))}
5return i.mutationQueue.addMutationBatch(n,o,s,t)}).next(t=>{r=t;let s=t.applyToLocalDocumentSet(e,a);return i.documentOverlayCache.saveOverlays(n,t.batchId,s)})}).then(()=>({batchId:r.batchId,changes:nT(e)})));a.sharedClientState.addPendingMutation(u.batchId),s=u.batchId,(h=a.Ba[a.currentUser.toKey()])||(h=new tf(e6)),h=h.insert(s,n),a.Ba[a.currentUser.toKey()]=h,await sy(a,u.changes),await iR(a.remoteStore)}catch(t){let e=iz(t,"Failed to persist write");n.reject(e)}}async function sa(e,t){try{var n,r;let i,s,a=await (n=e.localStore,i=(r=t).snapshotVersion,s=n.os,n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{var t,a,o;let l,h,u=n.cs.newChangeBuffer({trackRemovals:!0});s=n.os;let c=[];r.targetChanges.forEach((t,a)=>{var o;let l=s.get(a);if(!l)return;c.push(n.Ur.removeMatchingKeys(e,t.removedDocuments,a).next(()=>n.Ur.addMatchingKeys(e,t.addedDocuments,a)));let h=l.withSequenceNumber(e.currentSequenceNumber);null!==r.targetMismatches.get(a)?h=h.withResumeToken(t_.EMPTY_BYTE_STRING,e8.min()).withLastLimboFreeSnapshotVersion(e8.min()):t.resumeToken.approximateByteSize()>0&&(h=h.withResumeToken(t.resumeToken,i)),s=s.insert(a,h),o=h,(0===l.resumeToken.approximateByteSize()||o.snapshotVersion.toMicroseconds()-l.snapshotVersion.toMicroseconds()>=3e8||t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size>0)&&c.push(n.Ur.updateTargetData(e,h))});let d=n_,f=nA();if(r.documentUpdates.forEach(t=>{r.resolvedLimboDocuments.has(t)&&c.push(n.persistence.referenceDelegate.updateLimboDocument(e,t))}),c.push((t=e,a=u,o=r.documentUpdates,l=nA(),h=nA(),o.forEach(e=>l=l.add(e)),a.getEntries(t,l).next(e=>{let t=n_;return o.forEach((n,r)=>{let i=e.get(n);r.isFoundDocument()!==i.isFoundDocument()&&(h=h.add(n)),r.isNoDocument()&&r.version.isEqual(e8.min())?(a.removeEntry(n,r.readTime),t=t.insert(n,r)):!i.isValidDocument()||r.version.compareTo(i.version)>0||0===r.version.compareTo(i.version)&&i.hasPendingWrites?(a.addEntry(r),t=t.insert(n,r)):ej("LocalStore","Ignoring outdated watch update for ",n,". Current version:",i.version," Watch version:",r.version)}),{Ps:t,Is:h}})).next(e=>{d=e.Ps,f=e.Is})),!i.isEqual(e8.min())){let t=n.Ur.getLastRemoteSnapshotVersion(e).next(t=>n.Ur.setTargetsMetadata(e,e.currentSequenceNumber,i));c.push(t)}return ta.waitFor(c).next(()=>u.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,d,f)).next(()=>d)}).then(e=>(n.os=s,e)));
5t.targetChanges.forEach((t,n)=>{let r=e.Na.get(n);r&&(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1||eK(),t.addedDocuments.size>0?r.va=!0:t.modifiedDocuments.size>0?r.va||eK():t.removedDocuments.size>0&&(r.va||eK(),r.va=!1))}),await sy(e,a,t)}catch(e){await ts(e)}}function so(e,t,n){if(e.isPrimaryClient&&0===n||!e.isPrimaryClient&&1===n){var r;let n,i=[];e.Fa.forEach((e,n)=>{let r=n.view.Z_(t);r.snapshot&&i.push(r.snapshot)}),(r=e.eventManager).onlineState=t,n=!1,r.queries.forEach((e,r)=>{for(let e of r.j_)e.Z_(t)&&(n=!0)}),n&&i1(r),i.length&&e.Ca.d_(i),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function sl(e,t,n){e.sharedClientState.updateQueryState(t,"rejected",n);let r=e.Na.get(t),i=r&&r.key;if(i){let n=new tf(tn.comparator);n=n.insert(i,tQ.newNoDocument(i,e8.min()));let r=nA().add(i),s=new rt(e8.min(),new Map,new tf(e6),n,r);await sa(e,s),e.Oa=e.Oa.remove(i),e.Na.delete(t),sm(e)}else await r6(e.localStore,t,!1).then(()=>sf(e,t,n)).catch(ts)}async function sh(e,t){let n=t.batch.batchId;try{var r,i;let s=await (r=e.localStore,i=t,r.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{let t,n,s,a=i.batch.keys(),o=r.cs.newChangeBuffer({trackRemovals:!0});return(n=(t=i.batch).keys(),s=ta.resolve(),n.forEach(n=>{s=s.next(()=>o.getEntry(e,n)).next(e=>{let r=i.docVersions.get(n);null!==r||eK(),0>e.version.compareTo(r)&&(t.applyToRemoteDocument(e,i),e.isValidDocument()&&(e.setReadTime(i.commitVersion),o.addEntry(e)))})}),s.next(()=>r.mutationQueue.removeMutationBatch(e,t))).next(()=>o.apply(e)).next(()=>r.mutationQueue.performConsistencyCheck(e)).next(()=>r.documentOverlayCache.removeOverlaysForBatchId(e,a,i.batch.batchId)).next(()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=nA();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}(i))).next(()=>r.localDocuments.getDocuments(e,a))}));sd(e,n,null),sc(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),await sy(e,s)}catch(e){await ts(e)}}async function su(e,t,n){try{var r;let i=await (r=e.localStore,r.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let n;return r.mutationQueue.lookupMutationBatch(e,t).next(t=>(null!==t||eK(),n=t.keys(),r.mutationQueue.removeMutationBatch(e,t))).next(()=>r.mutationQueue.performConsistencyCheck(e)).next(()=>r.documentOverlayCache.removeOverlaysForBatchId(e,n,t)).next(()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,n)).next(()=>r.localDocuments.getDocuments(e,n))}));sd(e,t,n),sc(e,t),e.sharedClientState.updateMutationState(t,"rejected",n),await sy(e,i)}catch(e){await ts(e)}}function sc(e,t){(e.ka.get(t)||[]).forEach(e=>{e.resolve()}),e.ka.delete(t)}function sd(e,t,n){let r=e.Ba[e.currentUser.toKey()];if(r){let i=r.get(t);i&&(n?i.reject(n):i.resolve(),r=r.remove(t)),e.Ba[e.currentUser.toKey()]=r}}function sf(e,t,n=null){for(let r of(e.sharedClientState.removeLocalQueryTarget(t),e.Ma.get(t)))e.Fa.delete(r),n&&e.Ca.$a(r,n);e.Ma.delete(t),e.isPrimaryClient&&e.La.gr(t).forEach(t=>{e.La.containsKey(t)||sp(e,t)})}function sp(e,t){e.xa.delete(t.path.canonicalString());let n=e.Oa.get(t);null!==n&&(i_(e.remoteStore,n),e.Oa=e.Oa.remove(t),e.Na.delete(n),sm(e))}function sg(e,t,n){for(let r of n)r instanceof i3?(e.La.addReference(r.key,t),function(e,t){let n=t.key,r=n.path.canonicalString();e.Oa.get(n)||e.xa.has(r)||(ej("SyncEngine","New document in limbo: "+n),e.xa.add(r),sm(e))}(e,r)):r instanceof i6?(ej("SyncEngine","Document no longer in limbo: "+r.key),e.La.removeReference(r.key,t),e.La.containsKey(r.key)||sp(e,r.key)):eK()}function sm(e){for(;e.xa.size>0&&e.Oa.size<e.maxConcurrentLimboResolutions;){let t=e.xa.values().next().value;e.xa.delete(t);let n=new tn(e9.fromString(t)),r=e.qa.next();e.Na.set(r,new i8(n)),e.Oa=e.Oa.insert(n,r),iw(e.remoteStore,new rk(nc(new no(n.path)),r,"TargetPurposeLimboResolution",tl.oe))}}async function sy(e,t,n){let r=[],i=[],s=[];e.Fa.isEmpty()||(e.Fa.forEach((a,o)=>{s.push(e.Ka(o,t,n).then(t=>{var s;if((t||n)&&e.isPrimaryClient){let r=t?!t.fromCache:null==(s=null==n?void 0:n.targetChanges.get(o.targetId))?void 0:s.current;
5e.sharedClientState.updateQueryState(o.targetId,r?"current":"not-current")}if(t){r.push(t);let e=rJ.Wi(o.targetId,t);i.push(e)}}))}),await Promise.all(s),e.Ca.d_(r),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",n=>ta.forEach(t,t=>ta.forEach(t.$i,r=>e.persistence.referenceDelegate.addReference(n,t.targetId,r)).next(()=>ta.forEach(t.Ui,r=>e.persistence.referenceDelegate.removeReference(n,t.targetId,r)))))}catch(e){if(!to(e))throw e;ej("LocalStore","Failed to update sequence numbers: "+e)}for(let n of t){let t=n.targetId;if(!n.fromCache){let n=e.os.get(t),r=n.snapshotVersion,i=n.withLastLimboFreeSnapshotVersion(r);e.os=e.os.insert(t,i)}}}(e.localStore,i))}async function sv(e,t){if(!e.currentUser.isEqual(t)){ej("SyncEngine","User change. New user:",t.toKey());let n=await r2(e.localStore,t);e.currentUser=t,e.ka.forEach(e=>{e.forEach(e=>{e.reject(new eH(eG.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.ka.clear(),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await sy(e,n.hs)}}function sw(e,t){let n=e.Na.get(t);if(n&&n.va)return nA().add(n.key);{let n=nA(),r=e.Ma.get(t);if(!r)return n;for(let t of r){let r=e.Fa.get(t);n=n.unionWith(r.view.Va)}return n}}function s_(e){return e.remoteStore.remoteSyncer.applyRemoteEvent=sa.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=sw.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=sl.bind(null,e),e.Ca.d_=iZ.bind(null,e.eventManager),e.Ca.$a=i0.bind(null,e.eventManager),e}class sE{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=il(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,t){return null}Ha(e,t){return null}za(e){var t,n;return t=this.persistence,n=new r0,new r1(t,n,e.initialUser,this.serializer)}Ga(e){return new rW(rY.Zr,this.serializer)}Wa(e){return new r8}async terminate(){var e,t;null==(e=this.gcScheduler)||e.stop(),null==(t=this.indexBackfillerScheduler)||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}sE.provider={build:()=>new sE};class sb{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=>so(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=sv.bind(null,this.syncEngine),await iB(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new iW}createDatastore(e){var t;let n=il(e.databaseInfo.databaseId),r=new ia(e.databaseInfo);return t=e.authCredentials,new ip(t,e.appCheckCredentials,r,n)}createRemoteStore(e){var t,n;return t=this.localStore,n=this.datastore,new im(t,n,e.asyncQueue,e=>so(this.syncEngine,e,0),r9.D()?new r9:new r7)}createSyncEngine(e,t){var n,r,i,s,a,o;let l;return n=this.localStore,r=this.remoteStore,i=this.eventManager,s=this.sharedClientState,a=e.initialUser,o=e.maxConcurrentLimboResolutions,l=new i7(n,r,i,s,a,o),t&&(l.Qa=!0),l}async terminate(){var e,t;await async function(e){ej("RemoteStore","RemoteStore shutting down."),e.L_.add(5),await iv(e),e.k_.shutdown(),e.q_.set("Unknown")}(this.remoteStore),null==(e=this.datastore)||e.terminate(),null==(t=this.eventManager)||t.terminate()}}sb.provider={build:()=>new sb};class sT{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):eq("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,t){setTimeout(()=>{this.muted||e(t)},0)}}class sI{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=eV.UNAUTHENTICATED,this.clientId=e3.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,async e=>{ej("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(ej("FirestoreClient","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 eQ;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){let t=iz(n,"Failed to shutdown persistence");e.reject(t)}}),e.promise}}async function sS(e,t){e.asyncQueue.verifyOperationInProgress(),ej("FirestoreClient","Initializing OfflineComponentProvider");let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await r2(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function sC(e,t){e.asyncQueue.verifyOperationInProgress();let n=await sA(e);ej("FirestoreClient","Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>iU(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>iU(t.remoteStore,n)),e._onlineComponents=t}async function sA(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){ej("FirestoreClient","Using user provided OfflineComponentProvider");try{await sS(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===eG.FAILED_PRECONDITION||t.code===eG.UNIMPLEMENT
5ED:!("u">typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;e$("Error using user provided cache. Falling back to memory cache: "+t),await sS(e,new sE)}}else ej("FirestoreClient","Using default OfflineComponentProvider"),await sS(e,new sE);return e._offlineComponents}async function sD(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(ej("FirestoreClient","Using user provided OnlineComponentProvider"),await sC(e,e._uninitializedComponentsProvider._online)):(ej("FirestoreClient","Using default OnlineComponentProvider"),await sC(e,new sb))),e._onlineComponents}async function sN(e){let t=await sD(e),n=t.eventManager;return n.onListen=i9.bind(null,t.syncEngine),n.onUnlisten=sr.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=se.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=si.bind(null,t.syncEngine),n}function sk(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}let sx=new Map;function sR(e,t,n){if(!n)throw new eH(eG.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function sL(e){if(!tn.isDocumentKey(e))throw new eH(eG.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function sO(e){if(tn.isDocumentKey(e))throw new eH(eG.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function sM(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let n=(t=e).constructor?t.constructor.name:null;return n?`a custom ${n} object`:"an object"}}return"function"==typeof e?"a function":eK()}function sP(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new eH(eG.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=sM(e);throw new eH(eG.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}class sV{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new eH(eG.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null==(t=e.ssl)||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=0x2800000;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new eH(eG.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new eH(eG.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=sk(null!=(n=e.experimentalLongPollingOptions)?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new eH(eG.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new eH(eG.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new eH(eG.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,n;return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class sF{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 sV({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new eH(eG.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new eH(eG.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 sV(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new eX;switch(e.type){case"firstParty":return new e0(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new eH(eG.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
5d credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){let e;return(e=sx.get(this))&&(ej("ComponentProvider","Removing Datastore"),sx.delete(this),e.terminate()),Promise.resolve()}}class sU{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new sU(this.firestore,e,this._query)}}class sB{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new sj(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new sB(this.firestore,e,this._key)}}class sj extends sU{constructor(e,t,n){super(e,t,function(e){return new no(e)}(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 sB(this.firestore,null,new tn(e))}withConverter(e){return new sj(this.firestore,e,this._path)}}function sq(e,t,...n){if(e=V(e),sR("collection","path",t),e instanceof sF){let r=e9.fromString(t,...n);return sO(r),new sj(e,null,r)}{if(!(e instanceof sB||e instanceof sj))throw new eH(eG.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=e._path.child(e9.fromString(t,...n));return sO(r),new sj(e.firestore,null,r)}}function s$(e,t,...n){if(e=V(e),1==arguments.length&&(t=e3.newId()),sR("doc","path",t),e instanceof sF){let r=e9.fromString(t,...n);return sL(r),new sB(e,null,new tn(r))}{if(!(e instanceof sB||e instanceof sj))throw new eH(eG.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=e._path.child(e9.fromString(t,...n));return sL(r),new sB(e.firestore,e instanceof sj?e.converter:null,new tn(r))}}class sz{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new ih(this,"async_queue_retry"),this.Vu=()=>{let e=io();e&&ej("AsyncQueue","Visibility state changed to "+e.visibilityState),this.t_.jo()},this.mu=e;const t=io();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;let t=io();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});let t=new eQ;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(0!==this.Pu.length){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!to(e))throw e;ej("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){let t=this.mu.then(()=>(this.du=!0,e().catch(e=>{let t;throw this.Eu=e,this.du=!1,eq("INTERNAL UNHANDLED ERROR: ",(t=e.message||"",e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t)),e}).then(e=>(this.du=!1,e))));return this.mu=t,t}enqueueAfterDelay(e,t,n){this.fu(),this.Ru.indexOf(e)>-1&&(t=0);let r=i$.createAndSchedule(this,e,t,n,e=>this.yu(e));return this.Tu.push(r),r}fu(){this.Eu&&eK()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(let t of this.Tu)if(t.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{for(let t of(this.Tu.sort((e,t)=>
5e.targetTimeMs-t.targetTimeMs),this.Tu))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){let t=this.Tu.indexOf(e);this.Tu.splice(t,1)}}function sK(e){if("object"!=typeof e||null===e)return!1;for(let t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}class sG extends sF{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new sz,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new sz(e),this._firestoreClient=void 0,await e}}}function sH(e){if(e._terminated)throw new eH(eG.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,r,i,s,a;let o,l=e._freezeSettings(),h=(i=e._databaseId,s=(null==(t=e._app)?void 0:t.options.appId)||"",new tD(i,s,e._persistenceKey,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,sk(l.experimentalLongPollingOptions),l.useFetchStreams));e._componentsProvider||(null==(n=l.localCache)?void 0:n._offlineComponentProvider)&&(null==(r=l.localCache)?void 0:r._onlineComponentProvider)&&(e._componentsProvider={_offline:l.localCache._offlineComponentProvider,_online:l.localCache._onlineComponentProvider}),e._firestoreClient=new sI(e._authCredentials,e._appCheckCredentials,e._queue,h,e._componentsProvider&&(o=null==(a=e._componentsProvider)?void 0:a._online.build(),{_offline:null==a?void 0:a._offline.build(o),_online:o}))}(e),e._firestoreClient}class sQ{constructor(e){this._byteString=e}static fromBase64String(e){try{return new sQ(t_.fromBase64String(e))}catch(e){throw new eH(eG.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new sQ(t_.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class sW{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new eH(eG.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new tt(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class sX{constructor(e){this._methodName=e}}class sY{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new eH(eG.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new eH(eG.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return e6(this._lat,e._lat)||e6(this._long,e._long)}}class sJ{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)}}let sZ=/^__.*__$/;class s0{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new nW(e,this.data,this.fieldMask,t,this.fieldTransforms):new nQ(e,this.data,t,this.fieldTransforms)}}function s1(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw eK()}}class s2{constructor(e,t,n,r,i,s){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.vu(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new s2(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Mu(e){var t;let n=null==(t=this.path)?void 0:t.child(e),r=this.Fu({path:n,xu:!1});return r.Ou(e),r}Nu(e){var t;let n=null==(t=this.path)?void 0:t.child(e),r=this.Fu({path:n,xu:!1});return r.vu(),r}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return at(e,this.settings.methodName,this.settings.ku||!1,this.path,this.settings.qu)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}vu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Ou(this.path.get(e))}Ou(e){if(0===e.length)throw this.Bu("Document fields must not be empty");if(s1(this.Cu)&&sZ.test(e))throw this.Bu('Document fields cannot begin and end with "__"')}}class s3{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer
5=n||il(e)}Qu(e,t,n,r=!1){return new s2({Cu:e,methodName:t,qu:n,path:tt.emptyPath(),xu:!1,ku:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function s6(e){let t=e._freezeSettings(),n=il(e._databaseId);return new s3(e._databaseId,!!t.ignoreUndefinedProperties,n)}function s4(e,t){if(s8(e=V(e)))return s7("Unsupported field value:",t,e),s5(e,t);if(e instanceof sX)return function(e,t){if(!s1(t.Cu))throw t.Bu(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.Bu(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.xu&&4!==t.Cu)throw t.Bu("Nested arrays are not supported");let n=[],r=0;for(let i of e){let e=s4(i,t.Lu(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}return function(e,t){var n,r,i;if(null===(e=V(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return n=t.serializer,"number"==typeof(i=r=e)&&Number.isInteger(i)&&!th(i)&&i<=Number.MAX_SAFE_INTEGER&&i>=Number.MIN_SAFE_INTEGER?nk(r):nN(n,r);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let n=e5.fromDate(e);return{timestampValue:rg(t.serializer,n)}}if(e instanceof e5){let n=new e5(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:rg(t.serializer,n)}}if(e instanceof sY)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof sQ)return{bytesValue:rm(t.serializer,e._byteString)};if(e instanceof sB){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.Bu(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:rv(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof sJ)return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.Bu("VectorValues must only contain numeric values.");return nN(t.serializer,e)})}}}}};throw t.Bu(`Unsupported field value: ${sM(e)}`)}(e,t)}function s5(e,t){let n={};return td(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):tc(e,(e,r)=>{let i=s4(r,t.Mu(e));null!=i&&(n[e]=i)}),{mapValue:{fields:n}}}function s8(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof e5||e instanceof sY||e instanceof sQ||e instanceof sB||e instanceof sX||e instanceof sJ)}
5function s7(e,t,n){if(!s8(n)||"object"!=typeof n||null===n||Object.getPrototypeOf(n)!==Object.prototype&&null!==Object.getPrototypeOf(n)){let r=sM(n);throw"an object"===r?t.Bu(e+" a custom object"):t.Bu(e+" "+r)}}let s9=RegExp("[~\\*/\\[\\]]");function ae(e,t,n){if(t.search(s9)>=0)throw at(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new sW(...t.split("."))._internalPath}catch(r){throw at(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function at(e,t,n,r,i){let s=r&&!r.isEmpty(),a=void 0!==i,o=`Function ${t}() called with invalid data`;n&&(o+=" (via `toFirestore()`)"),o+=". ";let l="";return(s||a)&&(l+=" (found",s&&(l+=` in field ${r}`),a&&(l+=` in document ${i}`),l+=")"),new eH(eG.INVALID_ARGUMENT,o+e+l)}class an{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 sB(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new ar(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(ai("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class ar extends an{data(){return super.data()}}function ai(e,t){return"string"==typeof t?ae(e,t):t instanceof sW?t._internalPath:t._delegate._internalPath}function as(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new eH(eG.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class aa{}class ao extends aa{}function al(e,t,...n){let r=[];for(let i of(t instanceof aa&&r.push(t),function(e){let t=e.filter(e=>e instanceof ac).length,n=e.filter(e=>e instanceof ah).length;if(t>1||t>0&&n>0)throw new eH(eG.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=r.concat(n)),r))e=i._apply(e);return e}class ah extends ao{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new ah(e,t,n)}_apply(e){let t=this._parse(e);return ap(e._query,t),new sU(e.firestore,e.converter,nd(e._query,t))}_parse(e){let t=s6(e.firestore);return function(e,t,n,r,i,s,a){let o;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new eH(eG.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){af(a,s);let t=[];for(let n of a)t.push(ad(r,e,n));o={arrayValue:{values:t}}}else o=ad(r,e,a)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||af(a,s),o=function(e,t,n,r=!1){return s4(n,e.Qu(r?4:3,t))}(n,t,a,"in"===s||"not-in"===s);return t0.create(i,s,o)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function au(e,t,n){let r=ai("where",e);return ah._create(r,t,n)}class ac extends aa{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ac(e,t)}_parse(e){let t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:t1.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;for(let e of t.getFlattenedFilters())ap(n,e),n=nd(n,e)}(e._query,t),new sU(e.firestore,e.converter,nd(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function ad(e,t,n){if("string"==typeof(n=V(n))){if(""===n)throw new eH(eG.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!nh(t)&&-1!==n.indexOf("/"))throw new eH(eG.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(e9.fromString(n));if(!tn.isDocumentKey(r))throw new eH(eG.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 tF(e,new tn(r))}if(n instanceof sB)return tF(e,n._key);throw new eH(eG.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${sM(n)}.`)}function af(e,t){if(!Array.isArray(e)||0===e.length)throw new eH(eG.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function ap(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(null!==n)throw n===t.op?new eH(eG.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new eH(eG.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class ag{convertValue(e,t="none"){switch(tx(e)){case 0:return null;case 1:return e.booleanValue;case 2:return tT(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(tI(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 eK()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return tc(e,(e,r)=>{n[e]=this.convertValue(r,t)}),n}convertVectorValue(e){var t,n,r;return new sJ(null==(r=null==(n=null==(t=e.fields)?void 0:t.value.arrayValue)?void 0:n.values)?void 0:r.map(e=>tT(e.doubleValue)))}convertGeoPoint(e){return new sY(tT(e.latitude),tT(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=tC(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(tA(e));default:return null}}convertTimestamp(e){let t=tb(e);return new e5(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=e9.fromString(e);rN(n)||eK();let r=new tN(n.get(1),n.get(3)),i=new tn(n.popFirst(5));return r.isEqual(t)||eq(`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}}class am{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}
5class ay extends an{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new av(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(ai("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class av extends ay{data(e={}){return super.data(e)}}class aw{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new am(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 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new av(this._firestore,this._userDataWriter,n.key,n,new am(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 eH(eG.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 av(e._firestore,e._userDataWriter,n.doc.key,n.doc,new am(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||3!==e.type).map(t=>{let r=new av(e._firestore,e._userDataWriter,t.doc.key,t.doc,new am(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,s=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(s=(n=n.add(t.doc)).indexOf(t.doc.key)),{type:function(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return eK()}}(t.type),doc:r,oldIndex:i,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}class a_ extends ag{constructor(e){super(),this.firestore=e}convertBytes(e){return new sQ(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new sB(this.firestore,null,t)}}function aE(e){e=sP(e,sU);let t=sP(e.firestore,sG),n=sH(t),r=new a_(t);return as(e._query),(function(e,t,n={}){let r=new eQ;return e.asyncQueue.enqueueAndForget(async()=>{var i,s;let a,o;return i=await sN(e),s=e.asyncQueue,o=new i2(t,a=new sT({next:e=>{a.Za(),s.enqueueAndForget(()=>iJ(i,o)),e.fromCache&&"server"===n.source?r.reject(new eH(eG.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.)')):r.resolve(e)},error:e=>r.reject(e)}),{includeMetadataChanges:!0,_a:!0}),iY(i,o)}),r.promise})(n,e._query).then(n=>new aw(t,r,e,n))}function ab(e){return aI(sP(e.firestore,sG),[new nZ(e._key,nq.none())])}function aT(e,...t){var n,r,i,s;let a,o,l,h,u;e=V(e);let c={includeMetadataChanges:!1,source:"default"},d=0;"object"!=typeof t[0]||sK(t[d])||(c=t[d],d++);let f={includeMetadataChanges:c.includeMetadataChanges,source:c.source};if(sK(t[d])){let e=t[d];t[d]=null==(n=e.next)?void 0:n.bind(e),t[d+1]=null==(r=e.error)?void 0:r.bind(e),t[d+2]=null==(i=e.complete)?void 0:i.bind(e)}if(e instanceof sB)o=sP(e.firestore,sG),l=new no(e._key.path),a={next:n=>{var r,i,s;let a,l;t[d]&&t[d]((r=o,i=e,a=(s=n).docs.get(i._key),l=new a_(r),new ay(r,l,i._key,a,new am(s.hasPendingWrites,s.fromCache),i.converter)))},error:t[d+1],complete:t[d+2]};else{let n=sP(e,sU);o=sP(n.firestore,sG),l=n._query;let r=new a_(o);a={next:e=>{t[d]&&t[d](new aw(o,r,n,e))},error:t[d+1],complete:t[d+2]},as(e._query)}return s=sH(o),u=new i2(l,h=new sT(a),f),s.asyncQueue.enqueueAndForget(async()=>iY(await sN(s),u)),()=>{h.Za(),s.asyncQueue.enqueueAndForget(async()=>iJ(await sN(s),u))}}function aI(e,t){var n;let r;return n=sH(e),r=new eQ,n.asyncQueue.enqueueAndForget(async()=>ss(await sD(n).then(e=>e.syncEngine),t,r)),r.promise}new WeakMap,function(e=!0){eF="10.14.1",em(new F("firestore",(t,{instanceIdentifier:n,options:r})=>{let i=t.getProvider("app").getImmediate(),s=new sG(new eJ(t.getProvider("auth-internal")),new e2(t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new eH(eG.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new tN(e.options.projectId,t)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s},"PUBLIC").setMultipleInstances(!0)),e_(eP,"4.7.3",void 0),e_(eP,"4.7.3","esm2017")}();let aS=function(e){var t;let n,r=((n=(t="object"==typeof e?e:function(e=eu){let t=ed.get(e);if(!t&&e===eu&&k())return ew();if(!t)throw ey.create("no-app",{appName:e});return t}()).container.getProvider("heartbeat").getImmediate({optional:!0}))&&n.triggerHeartbeat(),t.container.getProvider("firestore")).getImmediate({identifier:"string"==typeof e?e:"(default)"});if(!r._initialized){let e=(e=>{var t,n;let r=null==(n=null==(t=N())?void 0:t.emulatorHosts)?void 0:n[e];if(!r)return;let i=r.lastIndexOf(":");if(i<=0||i+1===r.length)throw Error(`Invalid host ${r}
5 with no separate hostname and port!`);let s=parseInt(r.substring(i+1),10);return"["===r[0]?[r.substring(1,i-1),s]:[r.substring(0,i),s]})("firestore");e&&function(e,t,n,r={}){var i;let s=(e=sP(e,sF))._getSettings(),a=`${t}:${n}`;if("firestore.googleapis.com"!==s.host&&s.host!==a&&e$("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},s),{host:a,ssl:!1})),r.mockUserToken){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=eV.MOCK_USER;else{t=function(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[A(JSON.stringify({alg:"none",type:"JWT"})),A(JSON.stringify(s)),""].join(".")}(r.mockUserToken,null==(i=e._app)?void 0:i.options.projectId);let s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new eH(eG.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new eV(s)}e._authCredentials=new eY(new eW(t,n))}}(r,...e)}return r}(ew(E));async function aC(e,t,...n){let r=sq(aS,t,...n);return new Promise((t,n)=>{var i;let s,a,o;(s=sP(r.firestore,sG),a=s$(r),i=r.converter,o=i?i.toFirestore(e):e,aI(s,[(function(e,t,n,r,i,s={}){let a,o,l=e.Qu(s.merge||s.mergeFields?2:0,t,n,i);s7("Data must be an object, but it was:",l,r);let h=s5(r,l);if(s.merge)a=new tv(l.fieldMask),o=l.fieldTransforms;else if(s.mergeFields){let e=[];for(let r of s.mergeFields){let i=function(e,t,n){if((t=V(t))instanceof sW)return t._internalPath;if("string"==typeof t)return ae(e,t);throw at("Field path arguments must be of type string or ",e,!1,void 0,n)}(t,r,n);if(!l.contains(i))throw new eH(eG.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);(function(e,t){return e.some(e=>e.isEqual(t))})(e,i)||e.push(i)}a=new tv(e),o=l.fieldTransforms.filter(e=>a.covers(e.field))}else a=null,o=l.fieldTransforms;return new s0(new tH(h),a,o)})(s6(r.firestore),"addDoc",a._key,o,null!==r.converter,{}).toMutation(a._key,nq.exists(!1))]).then(()=>a)).then(e=>{t(e)}).catch(e=>{console.log(e),n(e)})})}async function aA(e=[],t,...n){let r=sq(aS,t,...n),i=al(r,...e.map(([e,t,n])=>au(e,t,n))),s=!1;try{let e=await aE(i),t=[];e.forEach(e=>{t.push(ab(s$(r,e.id)))}),t.length>0&&(await Promise.all(t),s=!0)}catch(e){console.error("Error deleting documents:",e)}return s}async function aD(e,t,...n){return ab(s$(sq(aS,t,...n),e))}let aN="chats",ak="messages",ax="blocked",aR="participants",aL=(e,t,n)=>aT(al(sq(aS,`acc-${e}`,aN,ak),au("session","==",t)),n),aO=(e,t)=>aT(sq(aS,`acc-${e}`,ax,aR),t),aM=async(e,t)=>aC({firstName:t.firstName,id:t.id,date:new Date},`acc-${e}`,ax,aR),aP=async(e,t)=>aA([["id","==",t]],`acc-${e}`,ax,aR),aV=async e=>{let t=al(sq(aS,`acc-${e}`,aN,ak)),n=(await aE(t)).docs,r={};return n.forEach(e=>{let t=e.data(),n=t.session;r[n]||(r[n]={messages:[],participantNames:[],lastUpdated:null}),r[n].messages.push(e.data()),r[n].participantNames.includes(t.firstName)||r[n].participantNames.push(t.firstName),(!r[n].lastUpdated||t.date.seconds>r[n].lastUpdated.seconds)&&(r[n].lastUpdated=t.date)}),r};e.s(["blockChatParticipant",0,aM,"clearAllComments",0,(e,t)=>aA([["session","==",t]],`acc-${e}`,aN,ak),"clearParticipantsComments",0,(e,t,n)=>aA([["id","==",t],["session","==",n]],`acc-${e}`,aN,ak),"deleteChatComment",0,(e,t)=>aD(t,`acc-${e}`,aN,ak),"getChatsList",0,aV,"postChatComment",0,(e,t,n,r)=>{if(e)return aC({firstName:n.name,id:n.id,profileImage:n?.meta?.profileImage??null,date:new Date,message:r,session:t},`acc-${e}`,aN,ak)},"subscribeToBlocked",0,aO,"subscribeToChat",0,aL,"unblockChatParticipant",0,aP],324045);var aF=e.i(271645);e.s(["useLoadBlockedChatParticipants",0,({account:e})=>{let[t,n]=(0,aF.useState)(!1),[r,i]=(0,aF.useState)(!1),[s,a]=(0,aF.useState)([]);return(0,aF.useEffect)(()=>
5{if(e?.id)return i(!0),aO(e.id,e=>{a(e.docs.map(e=>({...e.data(),documentId:e.id}))),i(!1),n(!0)})},[e]),{loaded:t,loading:r,blockedUsers:s}},"useLoadChatMessages",0,({account:e,chatId:t})=>{let[n,r]=(0,aF.useState)(!1),[i,s]=(0,aF.useState)([]);return(0,aF.useEffect)(()=>{if(e?.id)return r(!0),aL(e.id,t,e=>{s(e.docs.map(e=>({...e.data(),documentId:e.id})).filter(e=>e.session===t)),r(!1)})},[e]),{loading:n,messages:i}}],465965)}]);
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.