1/** 2 * @license 3 * Copyright 2017 Google LLC 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 *//** 17 * @license 18 * Copyright 2017 Google LLC 19 * 20 * Licensed under the Apache License, Version 2.0 (the "License"); 21 * you may not use this file except in compliance with the License. 22 * You may obtain a copy of the License at 23 * 24 * http://www.apache.org/licenses/LICENSE-2.0 25 * 26 * Unless required by applicable law or agreed to in writing, software 27 * distributed under the License is distributed on an "AS IS" BASIS, 28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 * See the License for the specific language governing permissions and 30 * limitations under the License. 31 */const cs=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t},Ia=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[n++];t[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=e[n++],o=e[n++],a=e[n++],l=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const s=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return t.join("")},fs={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<e.length;i+=3){const s=e[i],o=i+1<e.length,a=o?e[i+1]:0,l=i+2<e.length,u=l?e[i+2]:0,h=s>>2,c=(s&3)<<4|a>>4;let g=(a&15)<<2|u>>6,m=u&63;l||(m=64,o||(g=64)),r.push(n[h],n[c],n[g],n[m])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(cs(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):Ia(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<e.length;){const s=n[e.charAt(i++)],a=i<e.length?n[e.charAt(i)]:0;++i;const u=i<e.length?n[e.charAt(i)]:64;++i;const c=i<e.length?n[e.charAt(i)]:64;if(++i,s==null||a==null||u==null||c==null)throw new Aa;const g=s<<2|a>>4;if(r.push(g),u!==64){const m=a<<4&240|u>>2;if(r.push(m),c!==64){const w=u<<6&192|c;r.push(w)}}}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)}}};
31class Aa extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const wa=function(e){const t=cs(e);return fs.encodeByteArray(t,!0)},Ze=function(e){return wa(e).replace(/\./g,"")},Ra=function(e){try{return fs.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/** 32 * @license 33 * Copyright 2022 Google LLC 34 * 35 * Licensed under the Apache License, Version 2.0 (the "License"); 36 * you may not use this file except in compliance with the License. 37 * You may obtain a copy of the License at 38 * 39 * http://www.apache.org/licenses/LICENSE-2.0 40 * 41 * Unless required by applicable law or agreed to in writing, software 42 * distributed under the License is distributed on an "AS IS" BASIS, 43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 44 * See the License for the specific language governing permissions and 45 * limitations under the License. 46 */function Pa(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** 47 * @license 48 * Copyright 2022 Google LLC 49 * 50 * Licensed under the Apache License, Version 2.0 (the "License"); 51 * you may not use this file except in compliance with the License. 52 * You may obtain a copy of the License at 53 * 54 * http://www.apache.org/licenses/LICENSE-2.0 55 * 56 * Unless required by applicable law or agreed to in writing, software 57 * distributed under the License is distributed on an "AS IS" BASIS, 58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59 * See the License for the specific language governing permissions and 60 * limitations under the License. 61 */const Sa=()=>Pa().__FIREBASE_DEFAULTS__,Ca=()=>{if(typeof process>"u"||typeof process.env>"u")return;const e={}.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},Va=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Ra(e[1]);return t&&JSON.parse(t)},ds=()=>{try{return Sa()||Ca()||Va()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},Da=e=>{var t,n;return(n=(t=ds())===null||t===void 0?void 0:t.emulatorHosts)===null||n===void 0?void 0:n[e]},Na=e=>{const t=Da(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return t[0]==="["?[t.substring(1,n-1),r]:[t.substring(0,n),r]},ps=()=>{var e;return(e=ds())===null||e===void 0?void 0:e.config};/** 62 * @license 63 * Copyright 2017 Google LLC 64 * 65 * Licensed under the Apache License, Version 2.0 (the "License"); 66 * you may not use this file except in compliance with the License. 67 * You may obtain a copy of the License at 68 * 69 * http://www.apache.org/licenses/LICENSE-2.0 70 * 71 * Unless required by applicable law or agreed to in writing, software 72 * distributed under the License is distributed on an "AS IS" BASIS, 73 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74 * See the License for the specific language governing permissions and 75 * limitations under the License. 76 */class ba{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/** 77 * @license 78 * Copyright 2021 Google LLC 79 * 80 * Licensed under the Apache License, Version 2.0 (the "License"); 81 * you may not use this file except in compliance with the License. 82 * You may obtain a copy of the License at 83 * 84 * http://www.apache.org/licenses/LICENSE-2.0 85 * 86 * Unless required by applicable law or agreed to in writing, software 87 * distributed under the License is distributed on an "AS IS" BASIS, 88 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 89 * See the License for the specific language governing permissions and 90 * limitations under the License. 91 */function ka(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=t||"demo-project",i=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e),a="";return[Ze(JSON.stringify(n)),Ze(JSON.stringify(o)),a].join(".")}function Oa(){try{return typeof indexedDB=="object"}catch{return!1}}function Ma(){return new Promise((e,t)=>
91{try{let n=!0;const 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 s;t(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){t(n)}})}/** 92 * @license 93 * Copyright 2017 Google LLC 94 * 95 * Licensed under the Apache License, Version 2.0 (the "License"); 96 * you may not use this file except in compliance with the License. 97 * You may obtain a copy of the License at 98 * 99 * http://www.apache.org/licenses/LICENSE-2.0 100 * 101 * Unless required by applicable law or agreed to in writing, software 102 * distributed under the License is distributed on an "AS IS" BASIS, 103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 104 * See the License for the specific language governing permissions and 105 * limitations under the License. 106 */const xa="FirebaseError";class Jt extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=xa,Object.setPrototypeOf(this,Jt.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,gs.prototype.create)}}class gs{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},i=`${this.service}/${t}`,s=this.errors[t],o=s?Fa(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new Jt(i,a,r)}}function Fa(e,t){return e.replace(La,(n,r)=>{const i=t[r];return i!=null?String(i):`<${r}?>`})}const La=/\{\$([^}]+)}/g;function or(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const s=e[i],o=t[i];if(yi(s)&&yi(o)){if(!or(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function yi(e){return e!==null&&typeof e=="object"}/** 107 * @license 108 * Copyright 2021 Google LLC 109 * 110 * Licensed under the Apache License, Version 2.0 (the "License"); 111 * you may not use this file except in compliance with the License. 112 * You may obtain a copy of the License at 113 * 114 * http://www.apache.org/licenses/LICENSE-2.0 115 * 116 * Unless required by applicable law or agreed to in writing, software 117 * distributed under the License is distributed on an "AS IS" BASIS, 118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 119 * See the License for the specific language governing permissions and 120 * limitations under the License. 121 */function de(e){return e&&e._delegate?e._delegate:e}class pe{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/** 122 * @license 123 * Copyright 2019 Google LLC 124 * 125 * Licensed under the Apache License, Version 2.0 (the "License"); 126 * you may not use this file except in compliance with the License. 127 * You may obtain a copy of the License at 128 * 129 * http://www.apache.org/licenses/LICENSE-2.0 130 * 131 * Unless required by applicable law or agreed to in writing, software 132 * distributed under the License is distributed on an "AS IS" BASIS, 133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 134 * See the License for the specific language governing permissions and 135 * limitations under the License. 136 */const St="[DEFAULT]";/** 137 * @license 138 * Copyright 2019 Google LLC 139 * 140 * Licensed under the Apache License, Version 2.0 (the "License"); 141 * you may not use this file except in compliance with the License. 142 * You may obtain a copy of the License at 143 * 144 * http://www.apache.org/licenses/LICENSE-2.0 145 * 146 * Unless required by applicable law or agreed to in writing, software 147 * distributed under the License is distributed on an "AS IS" BASIS, 148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 149 * See the License for the specific language governing permissions and 150 * limitations under the License. 151 */class Ua{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const r=new ba;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){var n;const r=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),i=(n=t==null?void 0:t.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(ja(t))try{this.getOrInitializeService({instanceIdentifier:St})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(t=St){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=St){return this.instances.has(t)}getOptions(t=St){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(t,n){var r;const i=this.normalizeInstanceIdentifier(n),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(t),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&t(o,i),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Ba(t),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch{}return r||null}normalizeInstanceIdentifier(t=St){return this.component?this.component.multipleInstances?t:St:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Ba(e){return e===St?void 0:e}function ja(e){return e.instantiationMode==="EAGER"}/** 152 * @license 153 * Copyright 2019 Google LLC 154 * 155 * Licensed under the Apache License, Version 2.0 (the "License");
156 * you may not use this file except in compliance with the License. 157 * You may obtain a copy of the License at 158 * 159 * http://www.apache.org/licenses/LICENSE-2.0 160 * 161 * Unless required by applicable law or agreed to in writing, software 162 * distributed under the License is distributed on an "AS IS" BASIS, 163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 164 * See the License for the specific language governing permissions and 165 * limitations under the License. 166 */class $a{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new Ua(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/** 167 * @license 168 * Copyright 2017 Google LLC 169 * 170 * Licensed under the Apache License, Version 2.0 (the "License"); 171 * you may not use this file except in compliance with the License. 172 * You may obtain a copy of the License at 173 * 174 * http://www.apache.org/licenses/LICENSE-2.0 175 * 176 * Unless required by applicable law or agreed to in writing, software 177 * distributed under the License is distributed on an "AS IS" BASIS, 178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 179 * See the License for the specific language governing permissions and 180 * limitations under the License. 181 */var A;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(A||(A={}));const qa={debug:A.DEBUG,verbose:A.VERBOSE,info:A.INFO,warn:A.WARN,error:A.ERROR,silent:A.SILENT},Ha=A.INFO,za={[A.DEBUG]:"log",[A.VERBOSE]:"log",[A.INFO]:"info",[A.WARN]:"warn",[A.ERROR]:"error"},Ga=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),i=za[t];if(i)console[i](`[${r}] ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class ms{constructor(t){this.name=t,this._logLevel=Ha,this._logHandler=Ga,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in A))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?qa[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,A.DEBUG,...t),this._logHandler(this,A.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,A.VERBOSE,...t),this._logHandler(this,A.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,A.INFO,...t),this._logHandler(this,A.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,A.WARN,...t),this._logHandler(this,A.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,A.ERROR,...t),this._logHandler(this,A.ERROR,...t)}}const Ka=(e,t)=>t.some(n=>e instanceof n);let Ei,vi;function Qa(){return Ei||(Ei=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Wa(){return vi||(vi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const _s=new WeakMap,ar=new WeakMap,ys=new WeakMap,zn=new WeakMap,Nr=new WeakMap;function Xa(e){const t=new Promise((n,r)=>{const i=()=>{e.removeEventListener("success",s),e.removeEventListener("error",o)},s=()=>{n(yt(e.result)),i()},o=()=>{r(e.error),i()};e.addEventListener("success",s),e.addEventListener("error",o)});return t.then(n=>{n instanceof IDBCursor&&_s.set(n,e)}).catch(()=>{}),Nr.set(t,e),t}function Ya(e){if(ar.has(e))return;const t=new Promise((n,r)=>{const i=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",o),e.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",s),e.addEventListener("error",o),e.addEventListener("abort",o)});ar.set(e,t)}let lr={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return ar.get(e);if(t==="objectStoreNames")return e.objectStoreNames||ys.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return yt(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Ja(e){lr=e(lr)}function Za(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Gn(this),t,...n);return ys.set(r,t.sort?t.sort():[t]),yt(r)}:Wa().includes(e)?function(...t){return e.apply(Gn(this),t),yt(_s.get(this))}:function(...t){return yt(e.apply(Gn(this),t))}}function tl(e){return typeof e=="function"?Za(e):(e instanceof IDBTransaction&&Ya(e),Ka(e,Qa())?new Proxy(e,lr):e)}function yt(e){if(e instanceof IDBRequest)return Xa(e);if(zn.has(e))return zn.get(e);const t=tl(e);return t!==e&&(zn.set(e,t),Nr.set(t,e)),t}const Gn=e=>Nr.get(e);function el(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=yt(o);return r&&o.addEventListener("upgradeneeded",l=>{r(yt(o.result),l.oldVersion,l.newVersion,yt(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const nl=["get","getKey","getAll","getAllKeys","count"],rl=["put","add","delete","clear"],Kn=new Map;function Ti(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Kn.get(t))return Kn.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=rl.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||nl.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let u=l.store;
181return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),i&&l.done]))[0]};return Kn.set(t,s),s}Ja(e=>({...e,get:(t,n,r)=>Ti(t,n)||e.get(t,n,r),has:(t,n)=>!!Ti(t,n)||e.has(t,n)}));/** 182 * @license 183 * Copyright 2019 Google LLC 184 * 185 * Licensed under the Apache License, Version 2.0 (the "License"); 186 * you may not use this file except in compliance with the License. 187 * You may obtain a copy of the License at 188 * 189 * http://www.apache.org/licenses/LICENSE-2.0 190 * 191 * Unless required by applicable law or agreed to in writing, software 192 * distributed under the License is distributed on an "AS IS" BASIS, 193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 194 * See the License for the specific language governing permissions and 195 * limitations under the License. 196 */class il{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(sl(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function sl(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const ur="@firebase/app",Ii="0.9.17";/** 197 * @license 198 * Copyright 2019 Google LLC 199 * 200 * Licensed under the Apache License, Version 2.0 (the "License"); 201 * you may not use this file except in compliance with the License. 202 * You may obtain a copy of the License at 203 * 204 * http://www.apache.org/licenses/LICENSE-2.0 205 * 206 * Unless required by applicable law or agreed to in writing, software 207 * distributed under the License is distributed on an "AS IS" BASIS, 208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 209 * See the License for the specific language governing permissions and 210 * limitations under the License. 211 */const kt=new ms("@firebase/app"),ol="@firebase/app-compat",al="@firebase/analytics-compat",ll="@firebase/analytics",ul="@firebase/app-check-compat",hl="@firebase/app-check",cl="@firebase/auth",fl="@firebase/auth-compat",dl="@firebase/database",pl="@firebase/database-compat",gl="@firebase/functions",ml="@firebase/functions-compat",_l="@firebase/installations",yl="@firebase/installations-compat",El="@firebase/messaging",vl="@firebase/messaging-compat",Tl="@firebase/performance",Il="@firebase/performance-compat",Al="@firebase/remote-config",wl="@firebase/remote-config-compat",Rl="@firebase/storage",Pl="@firebase/storage-compat",Sl="@firebase/firestore",Cl="@firebase/firestore-compat",Vl="firebase",Dl="10.3.0";/** 212 * @license 213 * Copyright 2019 Google LLC 214 * 215 * Licensed under the Apache License, Version 2.0 (the "License"); 216 * you may not use this file except in compliance with the License. 217 * You may obtain a copy of the License at 218 * 219 * http://www.apache.org/licenses/LICENSE-2.0 220 * 221 * Unless required by applicable law or agreed to in writing, software 222 * distributed under the License is distributed on an "AS IS" BASIS, 223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 224 * See the License for the specific language governing permissions and 225 * limitations under the License. 226 */const hr="[DEFAULT]",Nl={[ur]:"fire-core",[ol]:"fire-core-compat",[ll]:"fire-analytics",[al]:"fire-analytics-compat",[hl]:"fire-app-check",[ul]:"fire-app-check-compat",[cl]:"fire-auth",[fl]:"fire-auth-compat",[dl]:"fire-rtdb",[pl]:"fire-rtdb-compat",[gl]:"fire-fn",[ml]:"fire-fn-compat",[_l]:"fire-iid",[yl]:"fire-iid-compat",[El]:"fire-fcm",[vl]:"fire-fcm-compat",[Tl]:"fire-perf",[Il]:"fire-perf-compat",[Al]:"fire-rc",[wl]:"fire-rc-compat",[Rl]:"fire-gcs",[Pl]:"fire-gcs-compat",[Sl]:"fire-fst",[Cl]:"fire-fst-compat","fire-js":"fire-js",[Vl]:"fire-js-all"};/** 227 * @license 228 * Copyright 2019 Google LLC 229 * 230 * Licensed under the Apache License, Version 2.0 (the "License"); 231 * you may not use this file except in compliance with the License. 232 * You may obtain a copy of the License at 233 * 234 * http://www.apache.org/licenses/LICENSE-2.0 235 * 236 * Unless required by applicable law or agreed to in writing, software 237 * distributed under the License is distributed on an "AS IS" BASIS, 238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 239 * See the License for the specific language governing permissions and 240 * limitations under the License. 241 */const tn=new Map,cr=new Map;function bl(e,t){try{e.container.addComponent(t)}catch(n){kt.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function en(e){const t=e.name;if(cr.has(t))return kt.debug(`There were multiple attempts to register component ${t}.`),!1;cr.set(t,e);for(const n of tn.values())bl(n,e);return!0}function kl(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}/** 242 * @license 243 * Copyright 2019 Google LLC 244 * 245 * Licensed under the Apache License, Version 2.0 (the "License");
246 * you may not use this file except in compliance with the License. 247 * You may obtain a copy of the License at 248 * 249 * http://www.apache.org/licenses/LICENSE-2.0 250 * 251 * Unless required by applicable law or agreed to in writing, software 252 * distributed under the License is distributed on an "AS IS" BASIS, 253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 254 * See the License for the specific language governing permissions and 255 * limitations under the License. 256 */const Ol={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},Et=new gs("app","Firebase",Ol);/** 257 * @license 258 * Copyright 2019 Google LLC 259 * 260 * Licensed under the Apache License, Version 2.0 (the "License"); 261 * you may not use this file except in compliance with the License. 262 * You may obtain a copy of the License at 263 * 264 * http://www.apache.org/licenses/LICENSE-2.0 265 * 266 * Unless required by applicable law or agreed to in writing, software 267 * distributed under the License is distributed on an "AS IS" BASIS, 268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 269 * See the License for the specific language governing permissions and 270 * limitations under the License. 271 */class Ml{constructor(t,n,r){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new pe("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}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(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Et.create("app-deleted",{appName:this._name})}}/** 272 * @license 273 * Copyright 2019 Google LLC 274 * 275 * Licensed under the Apache License, Version 2.0 (the "License"); 276 * you may not use this file except in compliance with the License. 277 * You may obtain a copy of the License at 278 * 279 * http://www.apache.org/licenses/LICENSE-2.0 280 * 281 * Unless required by applicable law or agreed to in writing, software 282 * distributed under the License is distributed on an "AS IS" BASIS, 283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 284 * See the License for the specific language governing permissions and 285 * limitations under the License. 286 */const xl=Dl;function Es(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r=Object.assign({name:hr,automaticDataCollectionEnabled:!1},t),i=r.name;if(typeof i!="string"||!i)throw Et.create("bad-app-name",{appName:String(i)});if(n||(n=ps()),!n)throw Et.create("no-options");const s=tn.get(i);if(s){if(or(n,s.options)&&or(r,s.config))return s;throw Et.create("duplicate-app",{appName:i})}const o=new $a(i);for(const l of cr.values())o.addComponent(l);const a=new Ml(n,r,o);return tn.set(i,a),a}function Fl(e=hr){const t=tn.get(e);if(!t&&e===hr&&ps())return Es();if(!t)throw Et.create("no-app",{appName:e});return t}function $t(e,t,n){var r;let i=(r=Nl[e])!==null&&r!==void 0?r:e;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const a=[`Unable to register library "${i}" with version "${t}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${t}" contains illegal characters (whitespace or "/")`),kt.warn(a.join(" "));return}en(new pe(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}/** 287 * @license 288 * Copyright 2021 Google LLC 289 * 290 * Licensed under the Apache License, Version 2.0 (the "License");
291 * you may not use this file except in compliance with the License. 292 * You may obtain a copy of the License at 293 * 294 * http://www.apache.org/licenses/LICENSE-2.0 295 * 296 * Unless required by applicable law or agreed to in writing, software 297 * distributed under the License is distributed on an "AS IS" BASIS, 298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 299 * See the License for the specific language governing permissions and 300 * limitations under the License. 301 */const Ll="firebase-heartbeat-database",Ul=1,ge="firebase-heartbeat-store";let Qn=null;function vs(){return Qn||(Qn=el(Ll,Ul,{upgrade:(e,t)=>{switch(t){case 0:e.createObjectStore(ge)}}}).catch(e=>{throw Et.create("idb-open",{originalErrorMessage:e.message})})),Qn}async function Bl(e){try{return await(await vs()).transaction(ge).objectStore(ge).get(Ts(e))}catch(t){if(t instanceof Jt)kt.warn(t.message);else{const n=Et.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});kt.warn(n.message)}}}async function Ai(e,t){try{const r=(await vs()).transaction(ge,"readwrite");await r.objectStore(ge).put(t,Ts(e)),await r.done}catch(n){if(n instanceof Jt)kt.warn(n.message);else{const r=Et.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});kt.warn(r.message)}}}function Ts(e){return`${e.name}!${e.options.appId}`}/** 302 * @license 303 * Copyright 2021 Google LLC 304 * 305 * Licensed under the Apache License, Version 2.0 (the "License"); 306 * you may not use this file except in compliance with the License. 307 * You may obtain a copy of the License at 308 * 309 * http://www.apache.org/licenses/LICENSE-2.0 310 * 311 * Unless required by applicable law or agreed to in writing, software 312 * distributed under the License is distributed on an "AS IS" BASIS, 313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 314 * See the License for the specific language governing permissions and 315 * limitations under the License. 316 */const jl=1024,$l=30*24*60*60*1e3;class ql{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new zl(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=wi();if(this._heartbeatsCache===null&&(this._heartbeatsCache=await this._heartbeatsCachePromise),!(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const s=new Date(i.date).valueOf();return Date.now()-s<=$l}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache===null||this._heartbeatsCache.heartbeats.length===0)return"";const t=wi(),{heartbeatsToSend:n,unsentEntries:r}=Hl(this._heartbeatsCache.heartbeats),i=Ze(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}}function wi(){return new Date().toISOString().substring(0,10)}function Hl(e,t=jl){const n=[];let r=e.slice();for(const i of e){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Ri(n)>t){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Ri(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class zl{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Oa()?Ma().then(()=>!0).catch(()=>!1):!1}async read(){return await this._canUseIndexedDBPromise?await Bl(this.app)||{heartbeats:[]}:{heartbeats:[]}}async overwrite(t){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return Ai(this.app,{lastSentHeartbeatDate:(n=t.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return Ai(this.app,{lastSentHeartbeatDate:(n=t.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...t.heartbeats]})}else return}}function Ri(e){return Ze(JSON.stringify({version:2,heartbeats:e})).length}/** 317 * @license 318 * Copyright 2019 Google LLC 319 * 320 * Licensed under the Apache License, Version 2.0 (the "License");
321 * you may not use this file except in compliance with the License. 322 * You may obtain a copy of the License at 323 * 324 * http://www.apache.org/licenses/LICENSE-2.0 325 * 326 * Unless required by applicable law or agreed to in writing, software 327 * distributed under the License is distributed on an "AS IS" BASIS, 328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 329 * See the License for the specific language governing permissions and 330 * limitations under the License. 331 */function Gl(e){en(new pe("platform-logger",t=>new il(t),"PRIVATE")),en(new pe("heartbeat",t=>new ql(t),"PRIVATE")),$t(ur,Ii,e),$t(ur,Ii,"esm2017"),$t("fire-js","")}Gl("");var Kl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},p,br=br||{},E=Kl||self;function En(e){var t=typeof e;return t=t!="object"?t:e?Array.isArray(e)?"array":t:"null",t=="array"||t=="object"&&typeof e.length=="number"}function De(e){var t=typeof e;return t=="object"&&e!=null||t=="function"}function Ql(e){return Object.prototype.hasOwnProperty.call(e,Wn)&&e[Wn]||(e[Wn]=++Wl)}var Wn="closure_uid_"+(1e9*Math.random()>>>0),Wl=0;function Xl(e,t,n){return e.call.apply(e.bind,arguments)}function Yl(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var i=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(i,r),e.apply(t,i)}}return function(){return e.apply(t,arguments)}}function W(e,t,n){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?W=Xl:W=Yl,W.apply(null,arguments)}function $e(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),e.apply(this,r)}}function B(e,t){function n(){}n.prototype=t.prototype,e.$=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.ac=function(r,i,s){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return t.prototype[i].apply(r,o)}}function wt(){this.s=this.s,this.o=this.o}var Jl=0;wt.prototype.s=!1;wt.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),Jl!=0)&&Ql(this)};wt.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const Is=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if(typeof e=="string")return typeof t!="string"||t.length!=1?-1:e.indexOf(t,0);for(let n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1};function kr(e){const t=e.length;if(0<t){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function Pi(e,t){for(let n=1;n<arguments.length;n++){const r=arguments[n];if(En(r)){const i=e.length||0,s=r.length||0;e.length=i+s;for(let o=0;o<s;o++)e[i+o]=r[o]}else e.push(r)}}function X(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}X.prototype.h=function(){this.defaultPrevented=!0};var Zl=function(){if(!E.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{E.addEventListener("test",()=>{},t),E.removeEventListener("test",()=>{},t)}catch{}return e}();function me(e){return/^[\s\xa0]*$/.test(e)}function vn(){var e=E.navigator;return e&&(e=e.userAgent)?e:""}function at(e){return vn().indexOf(e)!=-1}function Or(e){return Or[" "](e),e}Or[" "]=function(){};function tu(e,t){var n=Gu;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}var eu=at("Opera"),zt=at("Trident")||at("MSIE"),As=at("Edge"),fr=As||zt,ws=at("Gecko")&&!(vn().toLowerCase().indexOf("webkit")!=-1&&!at("Edge"))&&!(at("Trident")||at("MSIE"))&&!at("Edge"),nu=vn().toLowerCase().indexOf("webkit")!=-1&&!at("Edge");function Rs(){var e=E.document;return e?e.documentMode:void 0}var dr;t:{var Xn="",Yn=function(){var e=vn();if(ws)return/rv:([^\);]+)(\)|;)/.exec(e);if(As)return/Edge\/([\d\.]+)/.exec(e);if(zt)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e);if(nu)return/WebKit\/(\S+)/.exec(e);if(eu)return/(?:Version)[ \/]?(\S+)/.exec(e)}();if(Yn&&(Xn=Yn?Yn[1]:""),zt){var Jn=Rs();if(Jn!=null&&Jn>parseFloat(Xn)){dr=String(Jn);break t}}dr=Xn}var pr;if(E.document&&zt){var Si=Rs();pr=Si||parseInt(dr,10)||void 0}else pr=void 0;var ru=pr;function _e(e,t){if(X.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(ws){t:{try{Or(t.nodeName);var i=!0;break t}catch{}i=!1}i||(t=null)}}else n=="mouseover"?t=e.fromElement:n=="mouseout"&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX!==void 0?e.clientX:e.pageX,this.clientY=e.clientY!==void 0?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=typeof e.pointerType=="string"?e.pointerType:iu[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&_e.$.h.call(this)}}B(_e,X);var iu={2:"touch",3:"pen",4:"mouse"};_e.prototype.h=function(){_e.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var Ne="closure_listenable_"+(1e6*Math.random()|0),su=0;function ou(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.la=i,this.key=++su,this.fa=this.ia=!1}function Tn(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function Mr(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function au(e,t){for(const n in e)t.call(void 0,e[n],n,e)}function Ps(e){const t={};for(const n in e)t[n]=e[n];return t}const Ci="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
331ing toString valueOf".split(" ");function Ss(e,t){let n,r;for(let i=1;i<arguments.length;i++){r=arguments[i];for(n in r)e[n]=r[n];for(let s=0;s<Ci.length;s++)n=Ci[s],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function In(e){this.src=e,this.g={},this.h=0}In.prototype.add=function(e,t,n,r,i){var s=e.toString();e=this.g[s],e||(e=this.g[s]=[],this.h++);var o=mr(e,t,r,i);return-1<o?(t=e[o],n||(t.ia=!1)):(t=new ou(t,this.src,s,!!r,i),t.ia=n,e.push(t)),t};function gr(e,t){var n=t.type;if(n in e.g){var r=e.g[n],i=Is(r,t),s;(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(Tn(t),e.g[n].length==0&&(delete e.g[n],e.h--))}}function mr(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i];if(!s.fa&&s.listener==t&&s.capture==!!n&&s.la==r)return i}return-1}var xr="closure_lm_"+(1e6*Math.random()|0),Zn={};function Cs(e,t,n,r,i){if(r&&r.once)return Ds(e,t,n,r,i);if(Array.isArray(t)){for(var s=0;s<t.length;s++)Cs(e,t[s],n,r,i);return null}return n=Ur(n),e&&e[Ne]?e.O(t,n,De(r)?!!r.capture:!!r,i):Vs(e,t,n,!1,r,i)}function Vs(e,t,n,r,i,s){if(!t)throw Error("Invalid event type");var o=De(i)?!!i.capture:!!i,a=Lr(e);
331if(a||(e[xr]=a=new In(e)),n=a.add(t,n,r,o,s),n.proxy)return n;if(r=lu(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)Zl||(i=o),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(bs(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function lu(){function e(n){return t.call(e.src,e.listener,n)}const t=uu;return e}function Ds(e,t,n,r,i){if(Array.isArray(t)){for(var s=0;s<t.length;s++)Ds(e,t[s],n,r,i);return null}return n=Ur(n),e&&e[Ne]?e.P(t,n,De(r)?!!r.capture:!!r,i):Vs(e,t,n,!0,r,i)}function Ns(e,t,n,r,i){if(Array.isArray(t))for(var s=0;s<t.length;s++)Ns(e,t[s],n,r,i);else r=De(r)?!!r.capture:!!r,n=Ur(n),e&&e[Ne]?(e=e.i,t=String(t).toString(),t in e.g&&(s=e.g[t],n=mr(s,n,r,i),-1<n&&(Tn(s[n]),Array.prototype.splice.call(s,n,1),s.length==0&&(delete e.g[t],e.h--)))):e&&(e=Lr(e))&&(t=e.g[t.toString()],e=-1,t&&(e=mr(t,n,r,i)),(n=-1<e?t[e]:null)&&Fr(n))}function Fr(e){if(typeof e!="number"&&e&&!e.fa){var t=e.src;if(t&&t[Ne])gr(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(bs(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Lr(t))?(gr(n,e),n.h==0&&(n.src=null,t[xr]=null)):Tn(e)}}}function bs(e){return e in Zn?Zn[e]:Zn[e]="on"+e}function uu(e,t){if(e.fa)e=!0;else{t=new _e(t,this);var n=e.listener,r=e.la||e.src;e.ia&&Fr(e),e=n.call(r,t)}return e}function Lr(e){return e=e[xr],e instanceof In?e:null}var tr="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ur(e){return typeof e=="function"?e:(e[tr]||(e[tr]=function(t){return e.handleEvent(t)}),e[tr])}function L(){wt.call(this),this.i=new In(this),this.S=this,this.J=null}B(L,wt);L.prototype[Ne]=!0;L.prototype.removeEventListener=function(e,t,n,r){Ns(this,e,t,n,r)};function H(e,t){var n,r=e.J;if(r)for(n=[];r;r=r.J)n.push(r);if(e=e.S,r=t.type||t,typeof t=="string")t=new X(t,e);else if(t instanceof X)t.target=t.target||e;else{var i=t;t=new X(r,e),Ss(t,i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];i=qe(o,r,!0,t)&&i}if(o=t.g=e,i=qe(o,r,!0,t)&&i,i=qe(o,r,!1,t)&&i,n)for(s=0;s<n.length;s++)o=t.g=n[s],i=qe(o,r,!1,t)&&i}L.prototype.N=function(){if(L.$.N.call(this),this.i){var e=this.i,t;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)Tn(n[r]);delete e.g[t],e.h--}}this.J=null};L.prototype.O=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)};L.prototype.P=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};function qe(e,t,n,r){if(t=e.i.g[String(t)],!t)return!0;t=t.concat();for(var i=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.fa&&o.capture==n){var a=o.listener,l=o.la||o.src;o.ia&&gr(e.i,o),i=a.call(l,r)!==!1&&i}}return i&&!r.defaultPrevented}var Br=E.JSON.stringify;class hu{constructor(t,n){this.i=t,this.j=n,this.h=0,this.g=null}get(){let t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t}}function cu(){var e=jr;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}class fu{constructor(){this.h=this.g=null}add(t,n){const r=ks.get();r.set(t,n),this.h?this.h.next=r:this.g=r,this.h=r}}var ks=new hu(()=>new du,e=>e.reset());class du{constructor(){this.next=this.g=this.h=null}set(t,n){this.h=t,this.g=n,this.next=null}reset(){this.next=this.g=this.h=null}}function pu(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function gu(e){E.setTimeout(()=>{throw e},0)}let ye,Ee=!1,jr=new fu,Os=()=>{const e=E.Promise.resolve(void 0);ye=()=>{e.then(mu)}};var mu=()=>{for(var e;e=cu();){try{e.h.call(e.g)}catch(n){gu(n)}var t=ks;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}Ee=!1};function An(e,t){L.call(this),this.h=e||1,this.g=t||E,this.j=W(this.qb,this),this.l=Date.now()}B(An,L);p=An.prototype;p.ga=!1;p.T=null;p.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),H(this,"tick"),this.ga&&($r(this),this.start()))}};p.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function $r(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}p.N=function(){An.$.N.call(this),$r(this),delete this.g};function qr(e,t,n){if(typeof e=="function")n&&(e=W(e,n));else if(e&&typeof e.handleEvent=="function")e=W(e.handleEvent,e);else throw Error("Invalid listener argument");return 2147483647<Number(t)?-1:E.setTimeout(e,t||0)}function Ms(e){e.g=qr(()=>{e.g=null,e.i&&(e.i=!1,Ms(e))},e.j);const t=e.h;e.h=null,e.m.apply(null,t)}class _u extends wt{constructor(t,n){super(),this.m=t,this.j=n,this.h=null,this.i=!1,this.g=null}l(t){this.h=arguments,this.g?this.i=!0:Ms(this)}N(){super.N(),this.g&&(E.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ve(e){wt.call(this),this.h=e,this.g={}}B(ve,wt);var Vi=[];function xs(e,t,n,r){Array.isArray(n)||(n&&(Vi[0]=n.toString()),n=Vi);for(var i=0;i<n.length;i++){var s=Cs(t,n[i],r||e.handleEvent,!1,e.h||e);if(!s)break;e.g[s.key]=s}}function Fs(e){Mr(e.g,function(t,n){this.g.hasOwnProperty(n)&&Fr(t)},e),e.g={}}ve.prototype.N=function(){ve.$.N.call(this),Fs(this)};ve.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function wn(){this.g=!0}wn.prototype.Ea=function(){this.g=!1};function yu(e,t,n,r,i,s){e.info(function(){if(e.g)if(s)for(var o="",a=s.split("&"),l=0;l<a.length;l++){var u=a[l].split("=");if(1<u.length){var h=u[0];u=u[1];var c=h.split("_");o=2<=c.length&&c[1]=="type"?o+(h+"="+u+"&"):o+(h+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+` 332`+n+` 333`+o})}function Eu(e,t,n,r,i,s,o){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+` 334`+n+` 335`+s+" "+o})}function jt(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+Tu(e,n)+(r?" "+r:"")})}function vu(e,t){e.info(function(){return"TIMEOUT: "+t})}wn.prototype.info=function(){};function Tu(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(s!="noop"&&s!="stop"&&s!="close")for(var o=1;o<i.length;o++)i[o]=""}}}}return Br(n)}catch{return t}}var Ft={},Di=null;function Rn(){return Di=Di||new L}Ft.Ta="serverreachability";function Ls(e){X.call(this,Ft.Ta,e)}B(Ls,X);function Te(e){const t=Rn();H(t,new Ls(t))}Ft.STAT_EVENT="statevent";function Us(e,t){X.call(this,Ft.STAT_EVENT,e),this.stat=t}B(Us,X);function J(e){const t=Rn();H(t,new Us(t,e))}Ft.Ua="timingevent";function Bs(e,t){X.call(this,Ft.Ua,e),this.size=t}B(Bs,X);function be(e,t){if(typeof e!="function")throw Error("Fn must not be null and must be a function");return E.setTimeout(function(){e()},t)}var Pn={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9}
335,js={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function Hr(){}Hr.prototype.h=null;function Ni(e){return e.h||(e.h=e.i())}function $s(){}var ke={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function zr(){X.call(this,"d")}B(zr,X);function Gr(){X.call(this,"c")}B(Gr,X);var _r;function Sn(){}B(Sn,Hr);Sn.prototype.g=function(){return new XMLHttpRequest};Sn.prototype.i=function(){return{}};_r=new Sn;function Oe(e,t,n,r){this.l=e,this.j=t,this.m=n,this.W=r||1,this.U=new ve(this),this.P=Iu,e=fr?125:void 0,this.V=new An(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new qs}function qs(){this.i=null,this.g="",this.h=!1}var Iu=45e3,yr={},nn={};p=Oe.prototype;p.setTimeout=function(e){this.P=e};function Er(e,t,n){e.L=1,e.v=Vn(gt(t)),e.s=n,e.S=!0,Hs(e,null)}function Hs(e,t){e.G=Date.now(),Me(e),e.A=gt(e.v);var n=e.A,r=e.W;Array.isArray(r)||(r=[String(r)]),Js(n.i,"t",r),e.C=0,n=e.l.J,e.h=new qs,e.g=vo(e.l,n?t:null,!e.s),0<e.O&&(e.M=new _u(W(e.Pa,e,e.g),e.O)),xs(e.U,e.g,"readystatechange",e.nb),t=e.I?Ps(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),Te(),yu(e.j,e.u,e.A,e.m,e.W,e.s)}p.nb=function(e){e=e.target;const t=this.M;t&<(e)==3?t.l():this.Pa(e)};p.Pa=function(e){try{if(e==this.g)t:{const h=lt(this.g);var t=this.g.Ia();const c=this.g.da();if(!(3>h)&&(h!=3||fr||this.g&&(this.h.h||this.g.ja()||Mi(this.g)))){this.J||h!=4||t==7||(t==8||0>=c?Te(3):Te(2)),Cn(this);var n=this.g.da();this.ca=n;e:if(zs(this)){var r=Mi(this.g);e="";var i=r.length,s=lt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Ct(this),ae(this);var o="";break e}this.h.i=new E.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:s&&t==i-1});r.splice(0,i),this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.ja();if(this.i=n==200,Eu(this.j,this.u,this.A,this.m,this.W,h,n),this.i){if(this.aa&&
335!this.K){e:{if(this.g){var a,l=this.g;if((a=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!me(a)){var u=a;break e}}u=null}if(n=u)jt(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,vr(this,n);else{this.i=!1,this.o=3,J(12),Ct(this),ae(this);break t}}this.S?(Gs(this,h,o),fr&&this.i&&h==3&&(xs(this.U,this.V,"tick",this.mb),this.V.start())):(jt(this.j,this.m,o,null),vr(this,o)),h==4&&Ct(this),this.i&&!this.J&&(h==4?mo(this.l,this):(this.i=!1,Me(this)))}else qu(this.g),n==400&&0<o.indexOf("Unknown SID")?(this.o=3,J(12)):(this.o=0,J(13)),Ct(this),ae(this)}}}catch{}finally{}};function zs(e){return e.g?e.u=="GET"&&e.L!=2&&e.l.Ha:!1}function Gs(e,t,n){let r=!0,i;for(;!e.J&&e.C<n.length;)if(i=Au(e,n),i==nn){t==4&&(e.o=4,J(14),r=!1),jt(e.j,e.m,null,"[Incomplete Response]");break}else if(i==yr){e.o=4,J(15),jt(e.j,e.m,n,"[Invalid Chunk]"),r=!1;break}else jt(e.j,e.m,i,null),vr(e,i);zs(e)&&i!=nn&&i!=yr&&(e.h.g="",e.C=0),t!=4||n.length!=0||e.h.h||(e.o=1,J(16),r=!1),e.i=e.i&&r,r?0<n.length&&!e.ba&&(e.ba=!0,t=e.l,t.g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),Jr(t),t.M=!0,J(11))):(jt(e.j,e.m,n,"[Invalid Chunked Response]"),Ct(e),ae(e))}p.mb=function(){if(this.g){var e=lt(this.g),t=this.g.ja();this.C<t.length&&(Cn(this),Gs(this,e,t),this.i&&e!=4&&Me(this))}};function Au(e,t){var n=e.C,r=t.indexOf(` 336`,n);return r==-1?nn:(n=Number(t.substring(n,r)),isNaN(n)?yr:(r+=1,r+n>t.length?nn:(t=t.slice(r,r+n),e.C=r+n,t)))}p.cancel=function(){this.J=!0,Ct(this)};function Me(e){e.Y=Date.now()+e.P,Ks(e,e.P)}function Ks(e,t){if(e.B!=null)throw Error("WatchDog timer not null");e.B=be(W(e.lb,e),t)}function Cn(e){e.B&&(E.clearTimeout(e.B),e.B=null)}p.lb=function(){this.B=null;const e=Date.now();0<=e-this.Y?(vu(this.j,this.A),this.L!=2&&(Te(),J(17)),Ct(this),this.o=2,ae(this)):Ks(this,this.Y-e)};function ae(e){e.l.H==0||e.J||mo(e.l,e)}function Ct(e){Cn(e);var t=e.M;t&&typeof t.sa=="function"&&t.sa(),e.M=null,$r(e.V),Fs(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function vr(e,t){try{var n=e.l;if(n.H!=0&&(n.g==e||Tr(n.i,e))){if(!e.K&&Tr(n.i,e)&&n.H==3){try{var r=n.Ja.g.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){t:if(!n.u){if(n.g)if(n.g.G+3e3<e.G)on(n),kn(n);else break t;Yr(n),J(18)}}else n.Fa=i[1],0<n.Fa-n.V&&37500>i[2]&&n.G&&n.A==0&&!n.v&&(n.v=be(W(n.ib,n),6e3));if(1>=eo(n.i)&&n.oa){try{n.oa()}catch{}n.oa=void 0}}else Vt(n,11)}else if((e.K||n.g==e)&&on(n),!me(t))for(i=n.Ja.g.parse(t),t=0;t<i.length;t++){let u=i[t];if(n.V=u[0],u=u[1],n.H==2)if(u[0]=="c"){n.K=u[1],n.pa=u[2];const h=u[3];h!=null&&(n.ra=h,n.l.info("VER="+n.ra));const c=u[4];c!=null&&(n.Ga=c,n.l.info("SVER="+n.Ga));const g=u[5];g!=null&&typeof g=="number"&&0<g&&(r=1.5*g,n.L=r,n.l.info("backChannelRequestTimeoutMs_="+r)),r=n;const m=e.g;if(m){const w=m.g?m.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(w){var s=r.i;s.g||w.indexOf("spdy")==-1&&w.indexOf("quic")==-1&&w.indexOf("h2")==-1||(s.j=s.l,s.g=new Set,s.h&&(Kr(s,s.h),s.h=null))}if(r.F){const D=m.g?m.g.getResponseHeader("X-HTTP-Session-Id"):null;D&&(r.Da=D,C(r.I,r.F,D))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms")),r=n;var o=e;if(r.wa=Eo(r,r.J?r.pa:null,r.Y),o.K){no(r.i,o);var a=o,l=r.L;l&&a.setTimeout(l),a.B&&(Cn(a),Me(a)),r.g=o}else po(r);0<n.j.length&&On(n)}else u[0]!="stop"&&u[0]!="close"||Vt(n,7);else n.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Vt(n,7):Xr(n):u[0]!="noop"&&n.h&&n.h.Aa(u),n.A=0)}}Te(4)}catch{}}function wu(e){if(e.Z&&typeof e.Z=="function")return e.Z();if(typeof Map<"u"&&e instanceof Map||typeof Set<"u"&&e instanceof Set)return Array.from(e.values());if(typeof e=="string")return e.split("");if(En(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}t=[],n=0;for(r in e)t[n++]=e[r];return t}function Ru(e){if(e.ta&&typeof e.ta=="function")return e.ta();if(!e.Z||typeof e.Z!="function"){if(typeof Map<"u"&&e instanceof Map)return Array.from(e.keys());if(!(typeof Set<"u"&&e instanceof Set)){if(En(e)||typeof e=="string"){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const r in e)t[n++]=r;return t}}}function Qs(e,t){if(e.forEach&&typeof e.forEach=="function")e.forEach(t,void 0);else if(En(e)||typeof e=="string")Array.prototype.forEach.call(e,t,void 0);else for(var n=Ru(e),r=wu(e),i=r.length,s=0;s<i;s++)t.call(void 0,r[s],n&&n[s],e)}var Ws=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Pu(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," ")):"")}}}function Nt(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof Nt){this.h=e.h,rn(this,e.j),this.s=e.s,this.g=e.g,sn(this,e.m),this.l=e.l;var t=e.i,n=new Ie;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),bi(this,n),this.o=e.o}
336else e&&(t=String(e).match(Ws))?(this.h=!1,rn(this,t[1]||"",!0),this.s=se(t[2]||""),this.g=se(t[3]||"",!0),sn(this,t[4]),this.l=se(t[5]||"",!0),bi(this,t[6]||"",!0),this.o=se(t[7]||"")):(this.h=!1,this.i=new Ie(null,this.h))}Nt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(oe(t,ki,!0),":");var n=this.g;return(n||t=="file")&&(e.push("//"),(t=this.s)&&e.push(oe(t,ki,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.m,n!=null&&e.push(":",String(n))),(n=this.l)&&(this.g&&n.charAt(0)!="/"&&e.push("/"),e.push(oe(n,n.charAt(0)=="/"?Vu:Cu,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",oe(n,Nu)),e.join("")};function gt(e){return new Nt(e)}function rn(e,t,n){e.j=n?se(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function sn(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function bi(e,t,n){t instanceof Ie?(e.i=t,bu(e.i,e.h)):(n||(t=oe(t,Du)),e.i=new Ie(t,e.h))}function C(e,t,n){e.i.set(t,n)}function Vn(e){return C(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function se(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function oe(e,t,n){return typeof e=="string"?(e=encodeURI(e).replace(t,Su),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Su(e){return e=e.charCodeAt(0),"%"+(e>>4&15).toString(16)+(e&15).toString(16)}var ki=/[#\/\?@]/g,Cu=/[#\?:]/g,Vu=/[#\?]/g,Du=/[#\?@]/g,Nu=/#/g;function Ie(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Rt(e){e.g||(e.g=new Map,e.h=0,e.i&&Pu(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}p=Ie.prototype;p.add=function(e,t){Rt(this),this.i=null,e=Zt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this};function Xs(e,t){Rt(e),t=Zt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Ys(e,t){return Rt(e),t=Zt(e,t),e.g.has(t)}p.forEach=function(e,t){Rt(this),this.g.forEach(function(n,r){n.forEach(function(i){e.call(t,i,r,this)},this)},this)};p.ta=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){const i=e[r];for(let s=0;s<i.length;s++)n.push(t[r])}return n};p.Z=function(e){Rt(this);let t=[];if(typeof e=="string")Ys(this,e)&&(t=t.concat(this.g.get(Zt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t};p.set=function(e,t){return Rt(this),this.i=null,e=Zt(this,e),Ys(this,e)&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this};p.get=function(e,t){return e?(e=this.Z(e),0<e.length?String(e[0]):t):t};function Js(e,t,n){Xs(e,t),0<n.length&&(e.i=null,e.g.set(Zt(e,t),kr(n)),e.h+=n.length)}p.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];const s=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var i=s;o[r]!==""&&(i+="="+encodeURIComponent(String(o[r]))),e.push(i)}}return this.i=e.join("&")};function Zt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function bu(e,t){t&&!e.j&&(Rt(e),e.i=null,e.g.forEach(function(n,r){var i=r.toLowerCase();r!=i&&(Xs(this,r),Js(this,i,n))},e)),e.j=t}var ku=class{constructor(e,t){this.g=e,this.map=t}};function Zs(e){this.l=e||Ou,E.PerformanceNavigationTiming?(e=E.performance.getEntriesByType("navigation"),e=0<e.length&&(e[0].nextHopProtocol=="hq"||e[0].nextHopProtocol=="h2")):e=!!(E.g&&E.g.Ka&&E.g.Ka()&&E.g.Ka().ec),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Ou=10;function to(e){return e.h?!0:e.g?e.g.size>=e.j:!1}function eo(e){return e.h?1:e.g?e.g.size:0}function Tr(e,t){return e.h?e.h==t:e.g?e.g.has(t):!1}function Kr(e,t){e.g?e.g.add(t):e.h=t}function no(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}Zs.prototype.cancel=function(){if(this.i=ro(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const e of this.g.values())e.cancel();this.g.clear()}};function ro(e){if(e.h!=null)return e.i.concat(e.h.F);if(e.g!=null&&e.g.size!==0){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return kr(e.i)}var Mu=class{stringify(e){return E.JSON.stringify(e,void 0)}parse(e){return E.JSON.parse(e,void 0)}};function xu(){this.g=new Mu}function Fu(e,t,n){const r=n||"";try{Qs(e,function(i,s){let o=i;De(i)&&(o=Br(i)),t.push(r+s+"="+encodeURIComponent(o))})}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function Lu(e,t){const n=new wn;if(E.Image){const r=new Image;r.onload=$e(He,n,r,"TestLoadImage: loaded",!0,t),r.onerror=$e(He,n,r,"TestLoadImage: error",!1,t),r.onabort=$e(He,n,r,"TestLoadImage: abort",!1,t),r.ontimeout=$e(He,n,r,"TestLoadImage: timeout",!1,t),E.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function He(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch{}}function Dn(e){this.l=e.fc||null,this.j=e.ob||!1}B(Dn,Hr);Dn.prototype.g=function(){return new Nn(this.l,this.j)};Dn.prototype.i=function(e){return function(){return e}}({});function Nn(e,t){L.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=Qr,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}B(Nn,L);var Qr=0;p=Nn.prototype;p.open=function(e,t){if(this.readyState!=Qr)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,Ae(this)};p.send=function(e){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};
336e&&(t.body=e),(this.F||E).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))};p.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,xe(this)),this.readyState=Qr};p.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Ae(this)),this.g&&(this.readyState=3,Ae(this),this.g)))if(this.responseType==="arraybuffer")e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof E.ReadableStream<"u"&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;io(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))};function io(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}p.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?xe(this):Ae(this),this.readyState==3&&io(this)}};p.Za=function(e){this.g&&(this.response=this.responseText=e,xe(this))};p.Ya=function(e){this.g&&(this.response=e,xe(this))};p.ka=function(){this.g&&xe(this)};function xe(e){e.readyState=4,e.l=null,e.j=null,e.A=null,Ae(e)}p.setRequestHeader=function(e,t){this.v.append(e,t)};p.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""};p.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join(`\r 337`)};function Ae(e){e.onreadystatechange&&e.onreadystatechange.call(e)}Object.defineProperty(Nn.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(e){this.m=e?"include":"same-origin"}});var Uu=E.JSON.parse;function k(e){L.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=so,this.L=this.M=!1}B(k,L);var so="",Bu=/^https?$/i,ju=["POST","PUT"];p=k.prototype;p.Oa=function(e){this.M=e};p.ha=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():_r.g(),this.C=this.u?Ni(this.u):Ni(_r),this.g.onreadystatechange=W(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(s){Oi(this,s);return}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys=="function"&&typeof r.get=="function")for(const s of r.keys())n.set(s,r.get(s));else throw Error("Unknown input type for opt_headers: "+String(r));r=Array.from(n.keys()).find(s=>s.toLowerCase()=="content-type"),i=E.FormData&&e instanceof E.FormData,!(0<=Is(ju,t))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[s,o]of n)this.g.setRequestHeader(s,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{lo(this),0<this.B&&((this.L=$u(this.g))?(this.g.timeout=this.B,this.g.ontimeout=W(this.ua,this)):this.A=qr(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(s){Oi(this,s)}};function $u(e){return zt&&typeof e.timeout=="number"&&e.ontimeout!==void 0}p.ua=function(){typeof br<"u"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,H(this,"timeout"),this.abort(8))};function Oi(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,oo(e),bn(e)}function oo(e){e.F||(e.F=!0,H(e,"complete"),H(e,"error"))}p.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,H(this,"complete"),H(this,"abort"),bn(this))};p.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),bn(this,!0)),k.$.N.call(this)};p.La=function(){this.s||(this.G||this.v||this.l?ao(this):this.kb())};p.kb=function(){ao(this)};function ao(e){if(e.h&&typeof br<"u"&&(!e.C[1]||lt(e)!=4||e.da()!=2)){if(e.v&<(e)==4)qr(e.La,0,e);else if(H(e,"readystatechange"),lt(e)==4){e.h=!1;try{const o=e.da();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break t;default:t=!1}var n;if(!(n=t)){var r;
vendor: 20,975 bytes, lines 337-339
337if(r=o===0){var i=String(e.I).match(Ws)[1]||null;!i&&E.self&&E.self.location&&(i=E.self.location.protocol.slice(0,-1)),r=!Bu.test(i?i.toLowerCase():"")}n=r}if(n)H(e,"complete"),H(e,"success");else{e.m=6;try{var s=2<lt(e)?e.g.statusText:""}catch{s=""}e.j=s+" ["+e.da()+"]",oo(e)}}finally{bn(e)}}}}function bn(e,t){if(e.g){lo(e);const n=e.g,r=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||H(e,"ready");try{n.onreadystatechange=r}catch{}}}function lo(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(E.clearTimeout(e.A),e.A=null)}p.isActive=function(){return!!this.g};function lt(e){return e.g?e.g.readyState:0}p.da=function(){try{return 2<lt(this)?this.g.status:-1}catch{return-1}};p.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}};p.Wa=function(e){if(this.g){var t=this.g.responseText;return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Uu(t)}};function Mi(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case so:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch{return null}}function qu(e){const t={};e=(e.g&&2<=lt(e)&&e.g.getAllResponseHeaders()||"").split(`\r 338`);for(let r=0;r<e.length;r++){if(me(e[r]))continue;var n=pu(e[r]);const i=n[0];if(n=n[1],typeof n!="string")continue;n=n.trim();const s=t[i]||[];t[i]=s,s.push(n)}au(t,function(r){return r.join(", ")})}p.Ia=function(){return this.m};p.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function uo(e){let t="";return Mr(e,function(n,r){t+=r,t+=":",t+=n,t+=`\r 339`}),t}function Wr(e,t,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=uo(n),typeof e=="string"?n!=null&&encodeURIComponent(String(n)):C(e,t,n))}function re(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function ho(e){this.Ga=0,this.j=[],this.l=new wn,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=re("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=re("baseRetryDelayMs",5e3,e),this.hb=re("retryDelaySeedMs",1e4,e),this.eb=re("forwardChannelMaxRetries",2,e),this.xa=re("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.dc||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new Zs(e&&e.concurrentRequestLimit),this.Ja=new xu,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}p=ho.prototype;p.ra=8;p.H=1;function Xr(e){if(co(e),e.H==3){var t=e.W++,n=gt(e.I);if(C(n,"SID",e.K),C(n,"RID",t),C(n,"TYPE","terminate"),Fe(e,n),t=new Oe(e,e.l,t),t.L=2,t.v=Vn(gt(n)),n=!1,E.navigator&&E.navigator.sendBeacon)try{n=E.navigator.sendBeacon(t.v.toString(),"")}catch{}!n&&E.Image&&(new Image().src=t.v,n=!0),n||(t.g=vo(t.l,null),t.g.ha(t.v)),t.G=Date.now(),Me(t)}yo(e)}function kn(e){e.g&&(Jr(e),e.g.cancel(),e.g=null)}function co(e){kn(e),e.u&&(E.clearTimeout(e.u),e.u=null),on(e),e.i.cancel(),e.m&&(typeof e.m=="number"&&E.clearTimeout(e.m),e.m=null)}function On(e){if(!to(e.i)&&!e.m){e.m=!0;var t=e.Na;ye||Os(),Ee||(ye(),Ee=!0),jr.add(t,e),e.C=0}}function Hu(e,t){return eo(e.i)>=e.i.j-(e.m?1:0)?!1:e.m?(e.j=t.F.concat(e.j),!0):e.H==1||e.H==2||e.C>=(e.cb?0:e.eb)?!1:(e.m=be(W(e.Na,e,t),_o(e,e.C)),e.C++,!0)}p.Na=function(e){if(this.m)if(this.m=null,this.H==1){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;const i=new Oe(this,this.l,e);let s=this.s;if(this.U&&(s?(s=Ps(s),Ss(s,this.U)):s=this.U),this.o!==null||this.O||(i.I=s,s=null),this.P)t:{for(var t=0,n=0;n<this.j.length;n++){e:{var r=this.j[n];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break e}r=void 0}if(r===void 0)break;if(t+=r,4096<t){t=n;break t}if(t===4096||n===this.j.length-1){t=n+1;break t}}t=1e3}else t=1e3;t=fo(this,i,t),n=gt(this.I),C(n,"RID",e),C(n,"CVER",22),this.F&&C(n,"X-HTTP-Session-Id",this.F),Fe(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(uo(s)))+"&"+t:this.o&&Wr(n,this.o,s)),Kr(this.i,i),this.bb&&C(n,"TYPE","init"),this.P?(C(n,"$req",t),C(n,"SID","null"),i.aa=!0,Er(i,n,null)):Er(i,n,t),this.H=2}}else this.H==3&&(e?xi(this,e):this.j.length==0||to(this.i)||xi(this))};function xi(e,t){var n;t?n=t.m:n=e.W++;const r=gt(e.I);C(r,"SID",e.K),C(r,"RID",n),C(r,"AID",e.V),Fe(e,r),e.o&&e.s&&Wr(r,e.o,e.s),n=new Oe(e,e.l,n,e.C+1),e.o===null&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=fo(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),Kr(e.i,n),Er(n,r,t)}function Fe(e,t){e.na&&Mr(e.na,function(n,r){C(t,r,n)}),e.h&&Qs({},function(n,r){C(t,r,n)})}function fo(e,t,n){n=Math.min(e.j.length,n);var r=e.h?W(e.h.Va,e.h,e):null;t:{var i=e.j;let s=-1;for(;;){const o=["count="+n];s==-1?0<n?(s=i[0].g,o.push("ofs="+s)):s=0:o.push("ofs="+s);let a=!0;for(let l=0;l<n;l++){let u=i[l].g;const h=i[l].map;if(u-=s,0>u)s=Math.max(0,i[l].g-100),a=!1;else try{Fu(h,o,"req"+u+"_")}catch{r&&r(h)}}if(a){r=o.join("&");break t}}}return e=e.j.splice(0,n),t.F=e,r}function po(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;ye||Os(),Ee||(ye(),Ee=!0),jr.add(t,e),e.A=0}}function Yr(e){return e.g||e.u||3<=e.A?!1:(e.ba++,e.u=be(W(e.Ma,e),_o(e,e.A)),e.A++,!0)}p.Ma=function(){if(this.u=null,go(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=be(W(this.jb,this),e)}};p.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,J(10),kn(this),go(this))};function Jr(e){e.B!=null&&(E.clearTimeout(e.B),e.B=null)}function go(e){e.g=new Oe(e,e.l,"rpc",e.ba),e.o===null&&(e.g.I=e.s),e.g.O=0;var t=gt(e.wa);C(t,"RID","rpc"),C(t,"SID",e.K),C(t,"AID",e.V),C(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&C(t,"TO",e.qa),C(t,"TYPE","xmlhttp"),Fe(e,t),e.o&&e.s&&Wr(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=Vn(gt(t)),n.s=null,n.S=!0,Hs(n,e)}p.ib=function(){this.v!=null&&(this.v=null,kn(this),Yr(this),J(19))};function on(e){e.v!=null&&(E.clearTimeout(e.v),e.v=null)}function mo(e,t){var n=null;if(e.g==t){on(e),Jr(e),e.g=null;var r=2}else if(Tr(e.i,t))n=t.F,no(e.i,t),r=1;else return;if(e.H!=0){if(t.i)if(r==1){n=t.s?t.s.length:0,t=Date.now()-t.G;var i=e.C;r=Rn(),H(r,new Bs(r,n)),On(e)}else po(e);else if(i=t.o,i==3||i==0&&0<t.ca||!(r==1&&Hu(e,t)||r==2&&Yr(e)))switch(n&&0<n.length&&(t=e.i,t.i=t.i.concat(n)),i){case 1:Vt(e,5);break;case 4:Vt(e,10);break;case 3:Vt(e,6);break;default:Vt(e,2)}}}function _o(e,t){let n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function Vt(e,t){if(e.l.info("Error code "+t),t==2){var n=null;e.h&&(n=null);var r=W(e.pb,e);n||(n=new Nt("//www.google.com/images/cleardot.gif"),E.location&&E.location.protocol=="http"||rn(n,"https"),Vn(n)),Lu(n.toString(),r)}else J(2);e.H=0,e.h&&e.h.za(t),yo(e),co(e)}p.pb=function(e){e?(this.l.info("Successfully pinged google.com"),J(2)):(this.l.info("Failed to ping google.com"),J(1))};function yo(e){if(e.H=0,e.ma=[],e.h){const t=ro(e.i);(t.length!=0||e.j.length!=0)&&(Pi(e.ma,t),Pi(e.ma,e.j),e.i.i.length=0,kr(e.j),e.j.length=0),e.h.ya()}}function Eo(e,t,n){var r=n instanceof Nt?gt(n):new Nt(n);if(r.g!="")t&&(r.g=t+"."+r.g),sn(r,r.m);else{var i=E.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var s=new Nt(null);r&&rn(s,r),t&&(s.g=t),i&&sn(s,i),n&&(s.l=n),r=s}return n=e.F,t=e.Da,n&&t&&C(r,n,t),C(r,"VER",e.ra),Fe(e,r),r}function vo(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return t=n&&e.Ha&&!e.va?new k(new Dn({ob:!0})):new k(e.va),t.Oa(e.J),t}p.isActive=function(){return!!this.h&&this.h.isActive(this)};function To(){}p=To.prototype;p.Ba=function(){};p.Aa=function(){};p.za=function(){};p.ya=function(){};p.isActive=function(){return!0};p.Va=function(){};function an(){if(zt&&!(10<=Number(ru)))throw Error("Environmental error: no available transport.")}an.prototype.g=function(e,t){return new et(e,t)};function et(e,t){L.call(this),this.g=new ho(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!me(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!me(t)&&(this.g.F=t,e=this.h,e!==null&&t in e&&(e=this.h,t in e&&delete e[t])),this.j=new te(this)}B(et,L);et.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;J(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=Eo(e,null,e.Y),On(e)};et.prototype.close=function(){Xr(this.g)};et.prototype.u=function(e){var t=this.g;if(typeof e=="string"){var n={};n.__data__=e,e=n}else this.v&&(n={},n.__data__=Br(e),e=n);t.j.push(new ku(t.fb++,e)),t.H==3&&On(t)};et.prototype.N=function(){this.g.h=null,delete this.j,Xr(this.g),delete this.g,et.$.N.call(this)};function Io(e){zr.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){t:{for(const n in t){e=n;break t}e=void 0}(this.i=e)&&(e=this.i,t=t!==null&&e in t?t[e]:void 0),this.data=t}else this.data=e}B(Io,zr);function Ao(){Gr.call(this),this.status=1}B(Ao,Gr);function te(e){this.g=e}B(te,To);te.prototype.Ba=function(){H(this.g,"a")};te.prototype.Aa=function(e){H(this.g,new Io(e))};te.prototype.za=function(e){H(this.g,new Ao)};te.prototype.ya=function(){H(this.g,"b")};function zu(){this.blockSize=-1}function ct(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}B(ct,zu);ct.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function er(e,t,n){n||(n=0);var r=Array(16);if(typeof t=="string")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],o=t+(s^n&(i^s))+r[0]+3614090360&4294967295;t=n+(o<<7&4294967295|o>>>25),o=s+(i^t&(n^i))+r[1]+3905402710&4294967295,s=t+(o<<12&4294967295|o>>>20),o=i+(n^s&(t^n))+r[2]+606105819&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(t^i&(s^t))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(s^n&(i^s))+r[4]+4118548399&4294967295,t=n+(o<<7&4294967295|o>>>25),o=s+(i^t&(n^i))+r[5]+1200080426&4294967295,s=t+(o<<12&4294967295|o>>>20),o=i+(n^s&(t^n))+r[6]+2821735955&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(t^i&(s^t))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(s^n&(i^s))+r[8]+1770035416&4294967295,t=n+(o<<7&4294967295|o>>>25),o=s+(i^t&(n^i))+r[9]+2336552879&4294967295,s=t+(o<<12&4294967295|o>>>20),o=i+(n^s&(t^n))+r[10]+4294925233&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(t^i&(s^t))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(s^n&(i^s))+r[12]+1804603682&4294967295,t=n+(o<<7&4294967295|o>>>25),o=s+(i^t&(n^i))+r[13]+4254626195&4294967295,s=t+(o<<12&4294967295|o>>>20),o=i+(n^s&(t^n))+r[14]+2792965006&4294967295,i=s+(o<<17&4294967295|o>>>15),o=n+(t^i&(s^t))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(i^s&(n^i))+r[1]+4129170786&4294967295,t=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(t^n))+r[6]+3225465664&4294967295,s=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(s^t))+r[11]+643717713&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^t&(i^s))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^s&(n^i))+r[5]+3593408605&4294967295,t=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(t^n))+r[10]+38016083&4294967295,s=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(s^t))+r[15]+3634488961&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^t&(i^s))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^s&(n^i))+r[9]+568446438&4294967295,t=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(t^n))+r[14]+3275163606&4294967295,s=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(s^t))+r[3]+4107603335&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^t&(i^s))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^s&(n^i))+r[13]+2850285829&4294967295,t=n+(o<<5&4294967295|o>>>27),o=s+(n^i&(t^n))+r[2]+4243563512&4294967295,s=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(s^t))+r[7]+1735328473&4294967295,i=s+(o<<14&4294967295|o>>>18),o=n+(s^t&(i^s))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(n^i^s)+r[5]+4294588738&4294967295,t=n+(o<<4&4294967295|o>>>28),o=s+(t^n^i)+r[8]+2272392833&4294967295,s=t+(o<<11&4294967295|o>>>21),o=i+(s^t^n)+r[11]+1839030562&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^t)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^s)+r[1]+2763975236&4294967295,t=n+(o<<4&4294967295|o>>>28),o=s+(t^n^i)+r[4]+1272893353&4294967295,s=t+(o<<11&4294967295|o>>>21),o=i+(s^t^n)+r[7]+4139469664&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^t)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^s)+r[13]+681279174&4294967295,t=n+(o<<4&4294967295|o>>>28),o=s+(t^n^i)+r[0]+3936430074&4294967295,s=t+(o<<11&4294967295|o>>>21),o=i+(s^t^n)+r[3]+3572445317&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^t)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^s)+r[9]+3654602809&4294967295,t=n+(o<<4&4294967295|o>>>28),o=s+(t^n^i)+r[12]+3873151461&4294967295,s=t+(o<<11&4294967295|o>>>21),o=i+(s^t^n)+r[15]+530742520&4294967295,i=s+(o<<16&4294967295|o>>>16),o=n+(i^s^t)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(i^(n|~s))+r[0]+4096336452&4294967295,t=n+(o<<6&4294967295|o>>>26),o=s+(n^(t|~i))+r[7]+1126891415&4294967295,s=t+(o<<10&4294967295|o>>>22),o=i+(t^(s|~n))+r[14]+2878612391&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~t))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~s))+r[12]+1700485571&4294967295,t=n+(o<<6&4294967295|o>>>26),o=s+(n^(t|~i))+r[3]+2399980690&4294967295,s=t+(o<<10&4294967295|o>>>22),o=i+(t^(s|~n))+r[10]+4293915773&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~t))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~s))+r[8]+1873313359&4294967295,t=n+(o<<6&4294967295|o>>>26),o=s+(n^(t|~i))+r[15]+4264355552&4294967295,s=t+(o<<10&4294967295|o>>>22),o=i+(t^(s|~n))+r[6]+2734768916&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~t))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~s))+r[4]+4149444226&4294967295,t=n+(o<<6&4294967295|o>>>26),o=s+(n^(t|~i))+r[11]+3174756917&4294967295,s=t+(o<<10&4294967295|o>>>22),o=i+(t^(s|~n))+r[2]+718787259&4294967295,i=s+(o<<15&4294967295|o>>>17),o=n+(s^(i|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+s&4294967295}ct.prototype.j=function(e,t){t===void 0&&(t=e.length);for(var n=t-this.blockSize,r=this.m,i=this.h,s=0;s<t;){if(i==0)for(;s<=n;)er(this,e,s),s+=this.blockSize;if(typeof e=="string"){for(;s<t;)if(r[i++]=e.charCodeAt(s++),i==this.blockSize){er(this,r),i=0;break}}else for(;s<t;)if(r[i++]=e[s++],i==this.blockSize){er(this,r),i=0;break}}this.h=i,this.i+=t};ct.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=n&255,n/=256;for(this.j(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};function R(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var s=e[i]|0;r&&s==t||(n[i]=s,r=!1)}this.g=n}var Gu={};function Zr(e){return-128<=e&&128>e?tu(e,function(t){return new R([t|0],0>t?-1:0)}):new R([e|0],0>e?-1:0)}function ut(e){if(isNaN(e)||!isFinite(e))return qt;if(0>e)return q(ut(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=Ir;return new R(t,0)}function wo(e,t){if(e.length==0)throw Error("number format error: empty string");if(t=t||10,2>t||36<t)throw Error("radix out of range: "+t);if(e.charAt(0)=="-")return q(wo(e.substring(1),t));if(0<=e.indexOf("-"))throw Error('number format error: interior "-" character');for(var n=ut(Math.pow(t,8)),r=qt,i=0;i<e.length;i+=8){var s=Math.min(8,e.length-i),o=parseInt(e.substring(i,i+s),t);8>s?(s=ut(Math.pow(t,s)),r=r.R(s).add(ut(o))):(r=r.R(n),r=r.add(ut(o)))}return r}var Ir=4294967296,qt=Zr(0),Ar=Zr(1),Fi=Zr(16777216);p=R.prototype;p.ea=function(){if(rt(this))return-q(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.D(n);e+=(0<=r?r:Ir+r)*t,t*=Ir}return e};p.toString=function(e){if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(dt(this))return"0";if(rt(this))return"-"+q(this).toString(e);for(var t=ut(Math.pow(e,6)),n=this,r="";;){var i=un(n,t).g;n=ln(n,i.R(t));var s=((0<n.g.length?n.g[0]:n.h)>>>0).toString(e);if(n=i,dt(n))return s+r;for(;6>s.length;)s="0"+s;r=s+r}};p.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h};function dt(e){if(e.h!=0)return!1;for(var t=0;t<e.g.length;t++)if(e.g[t]!=0)return!1;return!0}function rt(e){return e.h==-1}p.X=function(e){return e=ln(this,e),rt(e)?-1:dt(e)?0:1};function q(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new R(n,~e.h).add(Ar)}p.abs=function(){return rt(this)?q(this):this};p.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,i=0;i<=t;i++){var s=r+(this.D(i)&65535)+(e.D(i)&65535),o=(s>>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);r=o>>>16,s&=65535,o&=65535,n[i]=o<<16|s}return new R(n,n[n.length-1]&-2147483648?-1:0)};function ln(e,t){return e.add(q(t))}p.R=function(e){if(dt(this)||dt(e))return qt;if(rt(this))return rt(e)?q(this).R(q(e)):q(q(this).R(e));if(rt(e))return q(this.R(q(e)));if(0>this.X(Fi)&&0>e.X(Fi))return ut(this.ea()*e.ea());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 i=0;i<e.g.length;i++){var s=this.D(r)>>>16,o=this.D(r)&65535,a=e.D(i)>>>16,l=e.D(i)&65535;n[2*r+2*i]+=o*l,ze(n,2*r+2*i),n[2*r+2*i+1]+=s*l,ze(n,2*r+2*i+1),n[2*r+2*i+1]+=o*a,ze(n,2*r+2*i+1),n[2*r+2*i+2]+=s*a,ze(n,2*r+2*i+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 R(n,0)};function ze(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function ie(e,t){this.g=e,this.h=t}function un(e,t){if(dt(t))throw Error("division by zero");if(dt(e))return new ie(qt,qt);if(rt(e))return t=un(q(e),t),new ie(q(t.g),q(t.h));if(rt(t))return t=un(e,q(t)),new ie(q(t.g),t.h);if(30<e.g.length){if(rt(e)||rt(t))throw Error("slowDivide_ only works with positive integers.");for(var n=Ar,r=t;0>=r.X(e);)n=Li(n),r=Li(r);var i=Ut(n,1),s=Ut(r,1);for(r=Ut(r,2),n=Ut(n,2);!dt(r);){var o=s.add(r);0>=o.X(e)&&(i=i.add(n),s=o),r=Ut(r,1),n=Ut(n,1)}return t=ln(e,i.R(t)),new ie(i,t)}for(i=qt;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),r=Math.ceil(Math.log(n)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),s=ut(n),o=s.R(t);rt(o)||0<o.X(e);)n-=r,s=ut(n),o=s.R(t);dt(s)&&(s=Ar),i=i.add(s),e=ln(e,o)}return new ie(i,e)}p.gb=function(e){return un(this,e).h};p.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)&e.D(r);return new R(n,this.h&e.h)};p.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)|e.D(r);return new R(n,this.h|e.h)};p.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)^e.D(r);return new R(n,this.h^e.h)};function Li(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.D(r)<<1|e.D(r-1)>>>31;return new R(n,e.h)}function Ut(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,i=[],s=0;s<r;s++)i[s]=0<t?e.D(s+n)>>>t|e.D(s+n+1)<<32-t:e.D(s+n);return new R(i,e.h)}an.prototype.createWebChannel=an.prototype.g;et.prototype.send=et.prototype.u;et.prototype.open=et.prototype.m;et.prototype.close=et.prototype.close;Pn.NO_ERROR=0;Pn.TIMEOUT=8;Pn.HTTP_ERROR=6;js.COMPLETE="complete";$s.EventType=ke;ke.OPEN="a";ke.CLOSE="b";ke.ERROR="c";ke.MESSAGE="d";L.prototype.listen=L.prototype.O;k.prototype.listenOnce=k.prototype.P;k.prototype.getLastError=k.prototype.Sa;k.prototype.getLastErrorCode=k.prototype.Ia;k.prototype.getStatus=k.prototype.da;k.prototype.getResponseJson=k.prototype.Wa;k.prototype.getResponseText=k.prototype.ja;k.prototype.send=k.prototype.ha;k.prototype.setWithCredentials=k.prototype.Oa;ct.prototype.digest=ct.prototype.l;ct.prototype.reset=ct.prototype.reset;ct.prototype.update=ct.prototype.j;R.prototype.add=R.prototype.add;R.prototype.multiply=R.prototype.R;R.prototype.modulo=R.prototype.gb;R.prototype.compare=R.prototype.X;
339R.prototype.toNumber=R.prototype.ea;R.prototype.toString=R.prototype.toString;R.prototype.getBits=R.prototype.D;R.fromNumber=ut;R.fromString=wo;var Ku=function(){return new an},Qu=function(){return Rn()},nr=Pn,Wu=js,Xu=Ft,Ui={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Ge=$s,Yu=k,Ju=R;const Bi="@firebase/firestore";/** 340 * @license 341 * Copyright 2017 Google LLC 342 * 343 * Licensed under the Apache License, Version 2.0 (the "License"); 344 * you may not use this file except in compliance with the License. 345 * You may obtain a copy of the License at 346 * 347 * http://www.apache.org/licenses/LICENSE-2.0 348 * 349 * Unless required by applicable law or agreed to in writing, software 350 * distributed under the License is distributed on an "AS IS" BASIS, 351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 352 * See the License for the specific language governing permissions and 353 * limitations under the License. 354 */class G{constructor(t){this.uid=t}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}G.UNAUTHENTICATED=new G(null),G.GOOGLE_CREDENTIALS=new G("google-credentials-uid"),G.FIRST_PARTY=new G("first-party-uid"),G.MOCK_USER=new G("mock-user");/** 355 * @license 356 * Copyright 2017 Google LLC 357 * 358 * Licensed under the Apache License, Version 2.0 (the "License"); 359 * you may not use this file except in compliance with the License. 360 * You may obtain a copy of the License at 361 * 362 * http://www.apache.org/licenses/LICENSE-2.0 363 * 364 * Unless required by applicable law or agreed to in writing, software 365 * distributed under the License is distributed on an "AS IS" BASIS, 366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 367 * See the License for the specific language governing permissions and 368 * limitations under the License. 369 */let ee="10.3.0";/** 370 * @license 371 * Copyright 2017 Google LLC 372 * 373 * Licensed under the Apache License, Version 2.0 (the "License"); 374 * you may not use this file except in compliance with the License. 375 * You may obtain a copy of the License at 376 * 377 * http://www.apache.org/licenses/LICENSE-2.0 378 * 379 * Unless required by applicable law or agreed to in writing, software 380 * distributed under the License is distributed on an "AS IS" BASIS, 381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 382 * See the License for the specific language governing permissions and 383 * limitations under the License. 384 */const Ot=new ms("@firebase/firestore");function ji(){return Ot.logLevel}function _(e,...t){if(Ot.logLevel<=A.DEBUG){const n=t.map(ti);Ot.debug(`Firestore (${ee}): ${e}`,...n)}}function Mt(e,...t){if(Ot.logLevel<=A.ERROR){const n=t.map(ti);Ot.error(`Firestore (${ee}): ${e}`,...n)}}function hn(e,...t){if(Ot.logLevel<=A.WARN){const n=t.map(ti);Ot.warn(`Firestore (${ee}): ${e}`,...n)}}function ti(e){if(typeof e=="string")return e;try{/** 385* @license 386* Copyright 2020 Google LLC 387* 388* Licensed under the Apache License, Version 2.0 (the "License"); 389* you may not use this file except in compliance with the License. 390* You may obtain a copy of the License at 391* 392* http://www.apache.org/licenses/LICENSE-2.0 393* 394* Unless required by applicable law or agreed to in writing, software 395* distributed under the License is distributed on an "AS IS" BASIS, 396* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 397* See the License for the specific language governing permissions and 398* limitations under the License. 399*/return function(n){return JSON.stringify(n)}(e)}catch{return e}}/** 400 * @license 401 * Copyright 2017 Google LLC 402 * 403 * Licensed under the Apache License, Version 2.0 (the "License"); 404 * you may not use this file except in compliance with the License. 405 * You may obtain a copy of the License at 406 * 407 * http://www.apache.org/licenses/LICENSE-2.0 408 * 409 * Unless required by applicable law or agreed to in writing, software 410 * distributed under the License is distributed on an "AS IS" BASIS, 411 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 412 * See the License for the specific language governing permissions and 413 * limitations under the License. 414 */function T(e="Unexpected state"){const t=`FIRESTORE (${ee}) INTERNAL ASSERTION FAILED: `+e;throw Mt(t),new Error(t)}
414function U(e,t){e||T()}function V(e,t){return e}/** 415 * @license 416 * Copyright 2017 Google LLC 417 * 418 * Licensed under the Apache License, Version 2.0 (the "License"); 419 * you may not use this file except in compliance with the License. 420 * You may obtain a copy of the License at 421 * 422 * http://www.apache.org/licenses/LICENSE-2.0 423 * 424 * Unless required by applicable law or agreed to in writing, software 425 * distributed under the License is distributed on an "AS IS" BASIS, 426 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 427 * See the License for the specific language governing permissions and 428 * limitations under the License. 429 */const f={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class y extends Jt{constructor(t,n){super(t,n),this.code=t,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** 430 * @license 431 * Copyright 2017 Google LLC 432 * 433 * Licensed under the Apache License, Version 2.0 (the "License"); 434 * you may not use this file except in compliance with the License. 435 * You may obtain a copy of the License at 436 * 437 * http://www.apache.org/licenses/LICENSE-2.0 438 * 439 * Unless required by applicable law or agreed to in writing, software 440 * distributed under the License is distributed on an "AS IS" BASIS, 441 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 442 * See the License for the specific language governing permissions and 443 * limitations under the License. 444 */class bt{constructor(){this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}}/** 445 * @license 446 * Copyright 2017 Google LLC 447 * 448 * Licensed under the Apache License, Version 2.0 (the "License"); 449 * you may not use this file except in compliance with the License. 450 * You may obtain a copy of the License at 451 * 452 * http://www.apache.org/licenses/LICENSE-2.0 453 * 454 * Unless required by applicable law or agreed to in writing, software 455 * distributed under the License is distributed on an "AS IS" BASIS, 456 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 457 * See the License for the specific language governing permissions and 458 * limitations under the License. 459 */class Ro{constructor(t,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Zu{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,n){t.enqueueRetryable(()=>n(G.UNAUTHENTICATED))}shutdown(){}}class th{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,n){this.changeListener=n,t.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class eh{constructor(t){this.t=t,this.currentUser=G.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,n){let r=this.i;const i=l=>this.i!==r?(r=this.i,n(l)):Promise.resolve();let s=new bt;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new bt,t.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const l=s;t.enqueueRetryable(async()=>{await l.promise,await i(this.currentUser)})},a=l=>{_("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(_("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new bt)}},0),o()}getToken(){const t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==t?(_("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(U(typeof r.accessToken=="string"),new Ro(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return U(t===null||typeof t=="string"),new G(t)}}class nh{constructor(t,n,r){this.l=t,this.h=n,this.P=r,this.type="FirstParty",this.user=G.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const t=this.T();return t&&this.I.set("Authorization",t),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class rh{constructor(t,n,r){this.l=t,this.h=n,this.P=r}getToken(){return Promise.resolve(new nh(this.l,this.h,this.P))}start(t,n){t.enqueueRetryable(()=>n(G.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class ih{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class sh{constructor(t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(t,n){const r=s=>{s.error!=null&&_("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,_("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{t.enqueueRetryable(()=>r(s))};const i=s=>{_("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):_("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(n=>n?(U(typeof n.token=="string"),this.R=n.token,new ih(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/** 460 * @license 461 * Copyright 2020 Google LLC 462 * 463 * Licensed under the Apache License, Version 2.0 (the "License");
464 * you may not use this file except in compliance with the License. 465 * You may obtain a copy of the License at 466 * 467 * http://www.apache.org/licenses/LICENSE-2.0 468 * 469 * Unless required by applicable law or agreed to in writing, software 470 * distributed under the License is distributed on an "AS IS" BASIS, 471 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 472 * See the License for the specific language governing permissions and 473 * limitations under the License. 474 */function oh(e){const t=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let r=0;r<e;r++)n[r]=Math.floor(256*Math.random());return n}/** 475 * @license 476 * Copyright 2017 Google LLC 477 * 478 * Licensed under the Apache License, Version 2.0 (the "License"); 479 * you may not use this file except in compliance with the License. 480 * You may obtain a copy of the License at 481 * 482 * http://www.apache.org/licenses/LICENSE-2.0 483 * 484 * Unless required by applicable law or agreed to in writing, software 485 * distributed under the License is distributed on an "AS IS" BASIS, 486 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 487 * See the License for the specific language governing permissions and 488 * limitations under the License. 489 */class Po{static V(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/t.length)*t.length;let r="";for(;r.length<20;){const i=oh(40);for(let s=0;s<i.length;++s)r.length<20&&i[s]<n&&(r+=t.charAt(i[s]%t.length))}return r}}function S(e,t){return e<t?-1:e>t?1:0}function Gt(e,t,n){return e.length===t.length&&e.every((r,i)=>n(r,t[i]))}/** 490 * @license 491 * Copyright 2017 Google LLC 492 * 493 * Licensed under the Apache License, Version 2.0 (the "License"); 494 * you may not use this file except in compliance with the License. 495 * You may obtain a copy of the License at 496 * 497 * http://www.apache.org/licenses/LICENSE-2.0 498 * 499 * Unless required by applicable law or agreed to in writing, software 500 * distributed under the License is distributed on an "AS IS" BASIS, 501 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 502 * See the License for the specific language governing permissions and 503 * limitations under the License. 504 */class F{constructor(t,n){if(this.seconds=t,this.nanoseconds=n,n<0)throw new y(f.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new y(f.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new y(f.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new y(f.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return F.fromMillis(Date.now())}static fromDate(t){return F.fromMillis(t.getTime())}static fromMillis(t){const n=Math.floor(t/1e3),r=Math.floor(1e6*(t-1e3*n));return new F(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?S(this.nanoseconds,t.nanoseconds):S(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/** 505 * @license 506 * Copyright 2017 Google LLC 507 * 508 * Licensed under the Apache License, Version 2.0 (the "License"); 509 * you may not use this file except in compliance with the License. 510 * You may obtain a copy of the License at 511 * 512 * http://www.apache.org/licenses/LICENSE-2.0 513 * 514 * Unless required by applicable law or agreed to in writing, software 515 * distributed under the License is distributed on an "AS IS" BASIS, 516 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 517 * See the License for the specific language governing permissions and 518 * limitations under the License. 519 */class N{constructor(t){this.timestamp=t}static fromTimestamp(t){return new N(t)}static min(){return new N(new F(0,0))}static max(){return new N(new F(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** 520 * @license 521 * Copyright 2017 Google LLC 522 * 523 * Licensed under the Apache License, Version 2.0 (the "License");
524 * you may not use this file except in compliance with the License. 525 * You may obtain a copy of the License at 526 * 527 * http://www.apache.org/licenses/LICENSE-2.0 528 * 529 * Unless required by applicable law or agreed to in writing, software 530 * distributed under the License is distributed on an "AS IS" BASIS, 531 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 532 * See the License for the specific language governing permissions and 533 * limitations under the License. 534 */class we{constructor(t,n,r){n===void 0?n=0:n>t.length&&T(),r===void 0?r=t.length-n:r>t.length-n&&T(),this.segments=t,this.offset=n,this.len=r}get length(){return this.len}isEqual(t){return we.comparator(this,t)===0}child(t){const n=this.segments.slice(this.offset,this.limit());return t instanceof we?t.forEach(r=>{n.push(r)}):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(t){return t=t===void 0?1:t,this.construct(this.segments,this.offset+t,this.length-t)}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(t){return this.segments[this.offset+t]}isEmpty(){return this.length===0}isPrefixOf(t){if(t.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0}forEach(t){for(let n=this.offset,r=this.limit();n<r;n++)t(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,n){const r=Math.min(t.length,n.length);for(let i=0;i<r;i++){const s=t.get(i),o=n.get(i);if(s<o)return-1;if(s>o)return 1}return t.length<n.length?-1:t.length>n.length?1:0}}class b extends we{construct(t,n,r){return new b(t,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const n=[];for(const r of t){if(r.indexOf("//")>=0)throw new y(f.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new b(n)}static emptyPath(){return new b([])}}const ah=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Q extends we{construct(t,n,r){return new Q(t,n,r)}static isValidIdentifier(t){return ah.test(t)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Q.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new Q(["__name__"])}static fromServerFormat(t){const n=[];let r="",i=0;const s=()=>
534{if(r.length===0)throw new y(f.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i<t.length;){const a=t[i];if(a==="\\"){if(i+1===t.length)throw new y(f.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const l=t[i+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new y(f.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=l,i+=2}else a==="`"?(o=!o,i++):a!=="."||o?(r+=a,i++):(s(),i++)}if(s(),o)throw new y(f.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Q(n)}static emptyPath(){return new Q([])}}/** 535 * @license 536 * Copyright 2017 Google LLC 537 * 538 * Licensed under the Apache License, Version 2.0 (the "License"); 539 * you may not use this file except in compliance with the License. 540 * You may obtain a copy of the License at 541 * 542 * http://www.apache.org/licenses/LICENSE-2.0 543 * 544 * Unless required by applicable law or agreed to in writing, software 545 * distributed under the License is distributed on an "AS IS" BASIS, 546 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 547 * See the License for the specific language governing permissions and 548 * limitations under the License. 549 */class v{constructor(t){this.path=t}static fromPath(t){return new v(b.fromString(t))}static fromName(t){return new v(b.fromString(t).popFirst(5))}static empty(){return new v(b.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return t!==null&&b.comparator(this.path,t.path)===0}toString(){return this.path.toString()}static comparator(t,n){return b.comparator(t.path,n.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new v(new b(t.slice()))}}function lh(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=N.fromTimestamp(r===1e9?new F(n+1,0):new F(n,r));return new Tt(i,v.empty(),t)}function uh(e){return new Tt(e.readTime,e.key,-1)}class Tt{constructor(t,n,r){this.readTime=t,this.documentKey=n,this.largestBatchId=r}static min(){return new Tt(N.min(),v.empty(),-1)}static max(){return new Tt(N.max(),v.empty(),-1)}}function hh(e,t){let n=e.readTime.compareTo(t.readTime);return n!==0?n:(n=v.comparator(e.documentKey,t.documentKey),n!==0?n:S(e.largestBatchId,t.largestBatchId))}/** 550 * @license 551 * Copyright 2020 Google LLC 552 * 553 * Licensed under the Apache License, Version 2.0 (the "License"); 554 * you may not use this file except in compliance with the License. 555 * You may obtain a copy of the License at 556 * 557 * http://www.apache.org/licenses/LICENSE-2.0 558 * 559 * Unless required by applicable law or agreed to in writing, software 560 * distributed under the License is distributed on an "AS IS" BASIS, 561 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 562 * See the License for the specific language governing permissions and 563 * limitations under the License. 564 */const ch="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class fh{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}}/** 565 * @license 566 * Copyright 2017 Google LLC 567 * 568 * Licensed under the Apache License, Version 2.0 (the "License"); 569 * you may not use this file except in compliance with the License. 570 * You may obtain a copy of the License at 571 * 572 * http://www.apache.org/licenses/LICENSE-2.0 573 * 574 * Unless required by applicable law or agreed to in writing, software 575 * distributed under the License is distributed on an "AS IS" BASIS, 576 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 577 * See the License for the specific language governing permissions and 578 * limitations under the License. 579 */async function So(e){if(e.code!==f.FAILED_PRECONDITION||e.message!==ch)throw e;_("LocalStore","Unexpectedly lost primary lease")}/** 580 * @license 581 * Copyright 2017 Google LLC 582 * 583 * Licensed under the Apache License, Version 2.0 (the "License");
584 * you may not use this file except in compliance with the License. 585 * You may obtain a copy of the License at 586 * 587 * http://www.apache.org/licenses/LICENSE-2.0 588 * 589 * Unless required by applicable law or agreed to in writing, software 590 * distributed under the License is distributed on an "AS IS" BASIS, 591 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 592 * See the License for the specific language governing permissions and 593 * limitations under the License. 594 */class d{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(t){return this.next(void 0,t)}next(t,n){return this.callbackAttached&&T(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new d((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(t,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((t,n)=>{this.next(t,n)})}wrapUserFunction(t){try{const n=t();return n instanceof d?n:d.resolve(n)}catch(n){return d.reject(n)}}wrapSuccess(t,n){return t?this.wrapUserFunction(()=>t(n)):d.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction(()=>t(n)):d.reject(n)}static resolve(t){return new d((n,r)=>{n(t)})}static reject(t){return new d((n,r)=>{r(t)})}static waitFor(t){return new d((n,r)=>{let i=0,s=0,o=!1;t.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},l=>r(l))}),o=!0,s===i&&n()})}static or(t){let n=d.resolve(!1);for(const r of t)n=n.next(i=>i?d.resolve(i):r());return n}static forEach(t,n){const r=[];return t.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(t,n){return new d((r,i)=>{const s=t.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const u=l;n(t[u]).next(h=>{o[u]=h,++a,a===s&&r(o)},h=>i(h))}})}static doWhile(t,n){return new d((r,i)=>{const s=()=>{t()===!0?n().next(()=>{s()},i):r()};s()})}}function Mn(e){return e.name==="IndexedDbTransactionError"}/** 595 * @license 596 * Copyright 2018 Google LLC 597 * 598 * Licensed under the Apache License, Version 2.0 (the "License"); 599 * you may not use this file except in compliance with the License. 600 * You may obtain a copy of the License at 601 * 602 * http://www.apache.org/licenses/LICENSE-2.0 603 * 604 * Unless required by applicable law or agreed to in writing, software 605 * distributed under the License is distributed on an "AS IS" BASIS, 606 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 607 * See the License for the specific language governing permissions and 608 * limitations under the License. 609 */class Co{constructor(t,n){this.previousValue=t,n&&(n.sequenceNumberHandler=r=>this.oe(r),this._e=r=>n.writeSequenceNumber(r))}oe(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this._e&&this._e(t),t}}Co.ae=-1;function ei(e){return e==null}function cn(e){return e===0&&1/e==-1/0}function dh(e){return typeof e=="number"&&Number.isInteger(e)&&!cn(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}/** 610 * @license 611 * Copyright 2017 Google LLC 612 * 613 * Licensed under the Apache License, Version 2.0 (the "License"); 614 * you may not use this file except in compliance with the License. 615 * You may obtain a copy of the License at 616 * 617 * http://www.apache.org/licenses/LICENSE-2.0 618 * 619 * Unless required by applicable law or agreed to in writing, software 620 * distributed under the License is distributed on an "AS IS" BASIS, 621 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 622 * See the License for the specific language governing permissions and 623 * limitations under the License. 624 */function $i(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Le(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Vo(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}/** 625 * @license 626 * Copyright 2017 Google LLC 627 * 628 * Licensed under the Apache License, Version 2.0 (the "License");
629 * you may not use this file except in compliance with the License. 630 * You may obtain a copy of the License at 631 * 632 * http://www.apache.org/licenses/LICENSE-2.0 633 * 634 * Unless required by applicable law or agreed to in writing, software 635 * distributed under the License is distributed on an "AS IS" BASIS, 636 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 637 * See the License for the specific language governing permissions and 638 * limitations under the License. 639 */class tt{constructor(t,n){this.comparator=t,this.root=n||j.EMPTY}insert(t,n){return new tt(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,j.BLACK,null,null))}remove(t){return new tt(this.comparator,this.root.remove(t,this.comparator).copy(null,null,j.BLACK,null,null))}get(t){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(t){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(t,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.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(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((n,r)=>(t(n,r),!1))}toString(){const t=[];return this.inorderTraversal((n,r)=>(t.push(`${n}:${r}`),!1)),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new Ke(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new Ke(this.root,t,this.comparator,!1)}getReverseIterator(){return new Ke(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new Ke(this.root,t,this.comparator,!0)}}class Ke{constructor(t,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=n?r(t.key,n):1,n&&i&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(s===0){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const n={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class j{constructor(t,n,r,i,s){this.key=t,this.value=n,this.color=r??j.RED,this.left=i??j.EMPTY,this.right=s??j.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,r,i,s){return new j(t??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}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(t,n,r){let i=this;const s=r(t,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(t,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(t,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return j.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(t,i.key)===0){if(i.right.isEmpty())return j.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,j.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,j.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,n)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw T();const t=this.left.check();if(t!==this.right.check())throw T();return t+(this.isRed()?0:1)}}j.EMPTY=null,j.RED=!0,j.BLACK=!1;
639j.EMPTY=new class{constructor(){this.size=0}get key(){throw T()}get value(){throw T()}get color(){throw T()}get left(){throw T()}get right(){throw T()}copy(t,n,r,i,s){return this}insert(t,n,r){return new j(t,n)}remove(t,n){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** 640 * @license 641 * Copyright 2017 Google LLC 642 * 643 * Licensed under the Apache License, Version 2.0 (the "License"); 644 * you may not use this file except in compliance with the License. 645 * You may obtain a copy of the License at 646 * 647 * http://www.apache.org/licenses/LICENSE-2.0 648 * 649 * Unless required by applicable law or agreed to in writing, software 650 * distributed under the License is distributed on an "AS IS" BASIS, 651 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 652 * See the License for the specific language governing permissions and 653 * limitations under the License. 654 */class Z{constructor(t){this.comparator=t,this.data=new tt(this.comparator)}has(t){return this.data.get(t)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((n,r)=>(t(n),!1))}forEachInRange(t,n){const r=this.data.getIteratorFrom(t[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,t[1])>=0)return;n(i.key)}}forEachWhile(t,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!t(r.getNext().key))return}firstAfterOrEqual(t){const n=this.data.getIteratorFrom(t);return n.hasNext()?n.getNext().key:null}getIterator(){return new qi(this.data.getIterator())}getIteratorFrom(t){return new qi(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let n=this;return n.size<t.size&&(n=t,t=this),t.forEach(r=>{n=n.add(r)}),n}isEqual(t){if(!(t instanceof Z)||this.size!==t.size)return!1;const n=this.data.getIterator(),r=t.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const t=[];return this.forEach(n=>{t.push(n)}),t}toString(){const t=[];return this.forEach(n=>t.push(n)),"SortedSet("+t.toString()+")"}copy(t){const n=new Z(this.comparator);return n.data=t,n}}class qi{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** 655 * @license 656 * Copyright 2020 Google LLC 657 * 658 * Licensed under the Apache License, Version 2.0 (the "License"); 659 * you may not use this file except in compliance with the License. 660 * You may obtain a copy of the License at 661 * 662 * http://www.apache.org/licenses/LICENSE-2.0 663 * 664 * Unless required by applicable law or agreed to in writing, software 665 * distributed under the License is distributed on an "AS IS" BASIS, 666 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 667 * See the License for the specific language governing permissions and 668 * limitations under the License. 669 */class ot{constructor(t){this.fields=t,t.sort(Q.comparator)}static empty(){return new ot([])}unionWith(t){let n=new Z(Q.comparator);for(const r of this.fields)n=n.add(r);for(const r of t)n=n.add(r);return new ot(n.toArray())}covers(t){for(const n of this.fields)if(n.isPrefixOf(t))return!0;return!1}isEqual(t){return Gt(this.fields,t.fields,(n,r)=>n.isEqual(r))}}/** 670 * @license 671 * Copyright 2023 Google LLC 672 * 673 * Licensed under the Apache License, Version 2.0 (the "License"); 674 * you may not use this file except in compliance with the License. 675 * You may obtain a copy of the License at 676 * 677 * http://www.apache.org/licenses/LICENSE-2.0 678 * 679 * Unless required by applicable law or agreed to in writing, software 680 * distributed under the License is distributed on an "AS IS" BASIS, 681 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 682 * See the License for the specific language governing permissions and 683 * limitations under the License.
684 */class ph extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** 685 * @license 686 * Copyright 2020 Google LLC 687 * 688 * Licensed under the Apache License, Version 2.0 (the "License"); 689 * you may not use this file except in compliance with the License. 690 * You may obtain a copy of the License at 691 * 692 * http://www.apache.org/licenses/LICENSE-2.0 693 * 694 * Unless required by applicable law or agreed to in writing, software 695 * distributed under the License is distributed on an "AS IS" BASIS, 696 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 697 * See the License for the specific language governing permissions and 698 * limitations under the License. 699 */class mt{constructor(t){this.binaryString=t}static fromBase64String(t){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new ph("Invalid base64 string: "+s):s}}(t);return new mt(n)}static fromUint8Array(t){const n=function(i){let s="";for(let o=0;o<i.length;++o)s+=String.fromCharCode(i[o]);return s}(t);return new mt(n)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return S(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}mt.EMPTY_BYTE_STRING=new mt("");const gh=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function xt(e){if(U(!!e),typeof e=="string"){let t=0;const n=gh.exec(e);if(U(!!n),n[1]){let i=n[1];i=(i+"000000000").substr(0,9),t=Number(i)}const r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:$(e.seconds),nanos:$(e.nanos)}}function $(e){return typeof e=="number"?e:typeof e=="string"?Number(e):0}function Re(e){return typeof e=="string"?mt.fromBase64String(e):mt.fromUint8Array(e)}/** 700 * @license 701 * Copyright 2020 Google LLC 702 * 703 * Licensed under the Apache License, Version 2.0 (the "License"); 704 * you may not use this file except in compliance with the License. 705 * You may obtain a copy of the License at 706 * 707 * http://www.apache.org/licenses/LICENSE-2.0 708 * 709 * Unless required by applicable law or agreed to in writing, software 710 * distributed under the License is distributed on an "AS IS" BASIS, 711 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 712 * See the License for the specific language governing permissions and 713 * limitations under the License. 714 */function ni(e){var t,n;return((n=(((t=e==null?void 0:e.mapValue)===null||t===void 0?void 0:t.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function Do(e){const t=e.mapValue.fields.__previous_value__;return ni(t)?Do(t):t}function fn(e){const t=xt(e.mapValue.fields.__local_write_time__.timestampValue);return new F(t.seconds,t.nanos)}/** 715 * @license 716 * Copyright 2017 Google LLC 717 * 718 * Licensed under the Apache License, Version 2.0 (the "License"); 719 * you may not use this file except in compliance with the License. 720 * You may obtain a copy of the License at 721 * 722 * http://www.apache.org/licenses/LICENSE-2.0 723 * 724 * Unless required by applicable law or agreed to in writing, software 725 * distributed under the License is distributed on an "AS IS" BASIS, 726 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 727 * See the License for the specific language governing permissions and 728 * limitations under the License. 729 */class mh{constructor(t,n,r,i,s,o,a,l,u){this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=u}}class dn{constructor(t,n){this.projectId=t,this.database=n||"(default)"}static empty(){return new dn("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(t){return t instanceof dn&&t.projectId===this.projectId&&t.database===this.database}}/** 730 * @license 731 * Copyright 2020 Google LLC 732 * 733 * Licensed under the Apache License, Version 2.0 (the "License");
734 * you may not use this file except in compliance with the License. 735 * You may obtain a copy of the License at 736 * 737 * http://www.apache.org/licenses/LICENSE-2.0 738 * 739 * Unless required by applicable law or agreed to in writing, software 740 * distributed under the License is distributed on an "AS IS" BASIS, 741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 742 * See the License for the specific language governing permissions and 743 * limitations under the License. 744 */const Qe={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Kt(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?ni(e)?4:_h(e)?9007199254740991:10:T()}function ft(e,t){if(e===t)return!0;const n=Kt(e);if(n!==Kt(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return fn(e).isEqual(fn(t));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const o=xt(i.timestampValue),a=xt(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(i,s){return Re(i.bytesValue).isEqual(Re(s.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(i,s){return $(i.geoPointValue.latitude)===$(s.geoPointValue.latitude)&&$(i.geoPointValue.longitude)===$(s.geoPointValue.longitude)}(e,t);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return $(i.integerValue)===$(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const o=$(i.doubleValue),a=$(s.doubleValue);return o===a?cn(o)===cn(a):isNaN(o)&&isNaN(a)}return!1}(e,t);case 9:return Gt(e.arrayValue.values||[],t.arrayValue.values||[],ft);case 10:return function(i,s){const o=i.mapValue.fields||{},a=s.mapValue.fields||{};if($i(o)!==$i(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!ft(o[l],a[l])))return!1;return!0}(e,t);default:return T()}}function Pe(e,t){return(e.values||[]).find(n=>ft(n,t))!==void 0}function Qt(e,t){if(e===t)return 0;const n=Kt(e),r=Kt(t);if(n!==r)return S(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return S(e.booleanValue,t.booleanValue);case 2:return function(s,o){const a=$(s.integerValue||s.doubleValue),l=$(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(e,t);case 3:return Hi(e.timestampValue,t.timestampValue);case 4:return Hi(fn(e),fn(t));case 5:return S(e.stringValue,t.stringValue);case 6:return function(s,o){const a=Re(s),l=Re(o);return a.compareTo(l)}(e.bytesValue,t.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let u=0;u<a.length&&u<l.length;u++){const h=S(a[u],l[u]);if(h!==0)return h}return S(a.length,l.length)}(e.referenceValue,t.referenceValue);case 8:return function(s,o){const a=S($(s.latitude),$(o.latitude));return a!==0?a:S($(s.longitude),$(o.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(s,o){const a=s.values||[],l=o.values||[];for(let u=0;u<a.length&&u<l.length;++u){const h=Qt(a[u],l[u]);if(h)return h}return S(a.length,l.length)}(e.arrayValue,t.arrayValue);case 10:return function(s,o){if(s===Qe.mapValue&&o===Qe.mapValue)return 0;if(s===Qe.mapValue)return 1;if(o===Qe.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),u=o.fields||{},h=Object.keys(u);l.sort(),h.sort();for(let c=0;c<l.length&&c<h.length;++c){const g=S(l[c],h[c]);if(g!==0)return g;const m=Qt(a[l[c]],u[h[c]]);if(m!==0)return m}return S(l.length,h.length)}(e.mapValue,t.mapValue);default:throw T()}}function Hi(e,t){if(typeof e=="string"&&typeof t=="string"&&e.length===t.length)return S(e,t);const n=xt(e),r=xt(t),i=S(n.seconds,r.seconds);return i!==0?i:S(n.nanos,r.nanos)}function Wt(e){return wr(e)}function wr(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(n){const r=xt(n);return`time(${r.seconds},${r.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(n){return Re(n).toBase64()}(e.bytesValue):"referenceValue"in e?function(n){return v.fromName(n).toString()}(e.referenceValue):"geoPointValue"in e?function(n){return`geo(${n.latitude},${n.longitude})`}(e.geoPointValue):"arrayValue"in e?function(n){let r="[",i=!0;for(const s of n.values||[])i?i=!1:r+=",",r+=wr(s);return r+"]"}(e.arrayValue):"mapValue"in e?function(n){const r=Object.keys(n.fields||{}).sort();let i="{",s=!0;for(const o of r)s?s=!1:i+=",",i+=`${o}:${wr(n.fields[o])}`;return i+"}"}(e.mapValue):T()}function Rr(e){return!!e&&"integerValue"in e}function ri(e){return!!e&&"arrayValue"in e}function Ye(e){return!!e&&"mapValue"in e}function le(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&typeof e.timestampValue=="object")return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return Le(e.mapValue.fields,(n,r)=>t.mapValue.fields[n]=le(r)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=le(e.arrayValue.values[n]);return t}return Object.assign({},e)}function _h(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/** 745 * @license 746 * Copyright 2017 Google LLC 747 * 748 * Licensed under the Apache License, Version 2.0 (the "License");
749 * you may not use this file except in compliance with the License. 750 * You may obtain a copy of the License at 751 * 752 * http://www.apache.org/licenses/LICENSE-2.0 753 * 754 * Unless required by applicable law or agreed to in writing, software 755 * distributed under the License is distributed on an "AS IS" BASIS, 756 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 757 * See the License for the specific language governing permissions and 758 * limitations under the License. 759 */class st{constructor(t){this.value=t}static empty(){return new st({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let n=this.value;for(let r=0;r<t.length-1;++r)if(n=(n.mapValue.fields||{})[t.get(r)],!Ye(n))return null;return n=(n.mapValue.fields||{})[t.lastSegment()],n||null}}set(t,n){this.getFieldsMap(t.popLast())[t.lastSegment()]=le(n)}setAll(t){let n=Q.emptyPath(),r={},i=[];t.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=le(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(t){const n=this.field(t.popLast());Ye(n)&&n.mapValue.fields&&delete n.mapValue.fields[t.lastSegment()]}isEqual(t){return ft(this.value,t.value)}getFieldsMap(t){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<t.length;++r){let i=n.mapValue.fields[t.get(r)];Ye(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},n.mapValue.fields[t.get(r)]=i),n=i}return n.mapValue.fields}applyChanges(t,n,r){Le(n,(i,s)=>t[i]=s);for(const i of r)delete t[i]}clone(){return new st(le(this.value))}}function No(e){const t=[];return Le(e.fields,(n,r)=>{const i=new Q([n]);if(Ye(r)){const s=No(r.mapValue).fields;if(s.length===0)t.push(i);else for(const o of s)t.push(i.child(o))}else t.push(i)}),new ot(t)}/** 760 * @license 761 * Copyright 2017 Google LLC 762 * 763 * Licensed under the Apache License, Version 2.0 (the "License"); 764 * you may not use this file except in compliance with the License. 765 * You may obtain a copy of the License at 766 * 767 * http://www.apache.org/licenses/LICENSE-2.0 768 * 769 * Unless required by applicable law or agreed to in writing, software 770 * distributed under the License is distributed on an "AS IS" BASIS, 771 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 772 * See the License for the specific language governing permissions and 773 * limitations under the License. 774 */class it{constructor(t,n,r,i,s,o,a){this.key=t,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(t){return new it(t,0,N.min(),N.min(),N.min(),st.empty(),0)}static newFoundDocument(t,n,r,i){return new it(t,1,n,N.min(),r,i,0)}static newNoDocument(t,n){return new it(t,2,n,N.min(),N.min(),st.empty(),0)}static newUnknownDocument(t,n){return new it(t,3,n,N.min(),N.min(),st.empty(),2)}convertToFoundDocument(t,n){return!this.createTime.isEqual(N.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=t),this.version=t,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=st.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=st.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=N.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof it&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new it(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}})`}}
774/** 775 * @license 776 * Copyright 2022 Google LLC 777 * 778 * Licensed under the Apache License, Version 2.0 (the "License"); 779 * you may not use this file except in compliance with the License. 780 * You may obtain a copy of the License at 781 * 782 * http://www.apache.org/licenses/LICENSE-2.0 783 * 784 * Unless required by applicable law or agreed to in writing, software 785 * distributed under the License is distributed on an "AS IS" BASIS, 786 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 787 * See the License for the specific language governing permissions and 788 * limitations under the License. 789 */class pn{constructor(t,n){this.position=t,this.inclusive=n}}function zi(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){const s=t[i],o=e.position[i];if(s.field.isKeyField()?r=v.comparator(v.fromName(o.referenceValue),n.key):r=Qt(o,n.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function Gi(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!ft(e.position[n],t.position[n]))return!1;return!0}/** 790 * @license 791 * Copyright 2022 Google LLC 792 * 793 * Licensed under the Apache License, Version 2.0 (the "License"); 794 * you may not use this file except in compliance with the License. 795 * You may obtain a copy of the License at 796 * 797 * http://www.apache.org/licenses/LICENSE-2.0 798 * 799 * Unless required by applicable law or agreed to in writing, software 800 * distributed under the License is distributed on an "AS IS" BASIS, 801 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 802 * See the License for the specific language governing permissions and 803 * limitations under the License. 804 */class ue{constructor(t,n="asc"){this.field=t,this.dir=n}}function yh(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}/** 805 * @license 806 * Copyright 2022 Google LLC 807 * 808 * Licensed under the Apache License, Version 2.0 (the "License"); 809 * you may not use this file except in compliance with the License. 810 * You may obtain a copy of the License at 811 * 812 * http://www.apache.org/licenses/LICENSE-2.0 813 * 814 * Unless required by applicable law or agreed to in writing, software 815 * distributed under the License is distributed on an "AS IS" BASIS, 816 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 817 * See the License for the specific language governing permissions and 818 * limitations under the License. 819 */class bo{}class x extends bo{constructor(t,n,r){super(),this.field=t,this.op=n,this.value=r}static create(t,n,r){return t.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(t,n,r):new vh(t,n,r):n==="array-contains"?new Ah(t,r):n==="in"?new wh(t,r):n==="not-in"?new Rh(t,r):n==="array-contains-any"?new Ph(t,r):new x(t,n,r)}static createKeyFieldInFilter(t,n,r){return n==="in"?new Th(t,r):new Ih(t,r)}matches(t){const n=t.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(Qt(n,this.value)):n!==null&&Kt(this.value)===Kt(n)&&this.matchesComparison(Qt(n,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return t===0;case"!=":return t!==0;case">":return t>0;case">=":return t>=0;default:return T()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class It extends bo{constructor(t,n){super(),this.filters=t,this.op=n,this.ce=null}static create(t,n){return new It(t,n)}matches(t){return ko(this)?this.filters.find(n=>!n.matches(t))===void 0:this.filters.find(n=>n.matches(t))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((t,n)=>t.concat(n.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.le(n=>n.isInequality());return t!==null?t.field:null}le(t){for(const n of this.getFlattenedFilters())if(t(n))return n;return null}}function ko(e){return e.op==="and"}function Oo(e){return Eh(e)&&ko(e)}function Eh(e){for(const t of e.filters)if(t instanceof It)return!1;return!0}function Pr(e){if(e instanceof x)return e.field.canonicalString()+e.op.toString()+Wt(e.value);if(Oo(e))return e.filters.map(t=>Pr(t)).join(",");{const t=e.filters.map(n=>Pr(n)).join(",");
819return`${e.op}(${t})`}}function Mo(e,t){return e instanceof x?function(r,i){return i instanceof x&&r.op===i.op&&r.field.isEqual(i.field)&&ft(r.value,i.value)}(e,t):e instanceof It?function(r,i){return i instanceof It&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&Mo(o,i.filters[a]),!0):!1}(e,t):void T()}function xo(e){return e instanceof x?function(n){return`${n.field.canonicalString()} ${n.op} ${Wt(n.value)}`}(e):e instanceof It?function(n){return n.op.toString()+" {"+n.getFilters().map(xo).join(" ,")+"}"}(e):"Filter"}class vh extends x{constructor(t,n,r){super(t,n,r),this.key=v.fromName(r.referenceValue)}matches(t){const n=v.comparator(t.key,this.key);return this.matchesComparison(n)}}class Th extends x{constructor(t,n){super(t,"in",n),this.keys=Fo("in",n)}matches(t){return this.keys.some(n=>n.isEqual(t.key))}}class Ih extends x{constructor(t,n){super(t,"not-in",n),this.keys=Fo("not-in",n)}matches(t){return!this.keys.some(n=>n.isEqual(t.key))}}function Fo(e,t){var n;return(((n=t.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>v.fromName(r.referenceValue))}class Ah extends x{constructor(t,n){super(t,"array-contains",n)}matches(t){const n=t.data.field(this.field);return ri(n)&&Pe(n.arrayValue,this.value)}}class wh extends x{constructor(t,n){super(t,"in",n)}matches(t){const n=t.data.field(this.field);return n!==null&&Pe(this.value.arrayValue,n)}}class Rh extends x{constructor(t,n){super(t,"not-in",n)}matches(t){if(Pe(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=t.data.field(this.field);return n!==null&&!Pe(this.value.arrayValue,n)}}class Ph extends x{constructor(t,n){super(t,"array-contains-any",n)}matches(t){const n=t.data.field(this.field);return!(!ri(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Pe(this.value.arrayValue,r))}}/** 820 * @license 821 * Copyright 2019 Google LLC 822 * 823 * Licensed under the Apache License, Version 2.0 (the "License"); 824 * you may not use this file except in compliance with the License. 825 * You may obtain a copy of the License at 826 * 827 * http://www.apache.org/licenses/LICENSE-2.0 828 * 829 * Unless required by applicable law or agreed to in writing, software 830 * distributed under the License is distributed on an "AS IS" BASIS, 831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 832 * See the License for the specific language governing permissions and 833 * limitations under the License. 834 */class Sh{constructor(t,n=null,r=[],i=[],s=null,o=null,a=null){this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.he=null}}function Ki(e,t=null,n=[],r=[],i=null,s=null,o=null){return new Sh(e,t,n,r,i,s,o)}function ii(e){const t=V(e);if(t.he===null){let n=t.path.canonicalString();t.collectionGroup!==null&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map(r=>Pr(r)).join(","),n+="|ob:",n+=t.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),ei(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(r=>Wt(r)).join(",")),t.endAt&&(n+="|ub:",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(r=>Wt(r)).join(",")),t.he=n}return t.he}function si(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!yh(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Mo(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Gi(e.startAt,t.startAt)&&Gi(e.endAt,t.endAt)}/** 835 * @license 836 * Copyright 2017 Google LLC 837 * 838 * Licensed under the Apache License, Version 2.0 (the "License"); 839 * you may not use this file except in compliance with the License. 840 * You may obtain a copy of the License at 841 * 842 * http://www.apache.org/licenses/LICENSE-2.0 843 * 844 * Unless required by applicable law or agreed to in writing, software 845 * distributed under the License is distributed on an "AS IS" BASIS, 846 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 847 * See the License for the specific language governing permissions and 848 * limitations under the License. 849 */class xn{constructor(t,n=null,r=[],i=[],s=null,o="F",a=null,l=null){this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.Pe=null,this.Ie=null,this.Te=null,this.startAt,this.endAt}}function Ch(e,t,n,r,i,s,o,a){return new xn(e,t,n,r,i,s,o,a)}function Vh(e){return new xn(e)}function Qi(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function Dh(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function Nh(e){for(const t of e.filters){const n=t.getFirstInequalityField();if(n!==null)return n}return null}function bh(e){return e.collectionGroup!==null}function he(e){const t=V(e);if(t.Pe===null){t.Pe=[];const n=Nh(t),r=Dh(t);if(n!==null&&r===null)n.isKeyField()||t.Pe.push(new ue(n)),t.Pe.push(new ue(Q.keyField(),"asc"));else{let i=!1;for(const s of t.explicitOrderBy)t.Pe.push(s),s.field.isKeyField()&&(i=!0);if(!i){const s=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.Pe.push(new ue(Q.keyField(),s))}}}return t.Pe}function Xt(e){const t=V(e);return t.Ie||(t.Ie=kh(t,he(e))),t.Ie}function kh(e,t){if(e.limitType==="F")return Ki(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new ue(i.field,s)});const n=e.endAt?new pn(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new pn(e.startAt.position,e.startAt.inclusive):null;return Ki(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function Sr(e,t,n){return new xn(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Lo(e,t){return si(Xt(e),Xt(t))&&e.limitType===t.limitType}function Uo(e){return`${ii(Xt(e))}|lt:${e.limitType}`}function Wi(e){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>xo(i)).join(", ")}]`),ei(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Wt(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Wt(i)).join(",")),`Target(${r})`}(Xt(e))}; limitType=${e.limitType})`}function oi(e,t){return t.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):v.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(e,t)&&function(r,i){for(const s of he(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(e,t)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(e,t)&&function(r,i){return!(r.startAt&&!function(o,a,l){const u=zi(o,a,l);return o.inclusive?u<=0:u<0}(r.startAt,he(r),i)||r.endAt&&!function(o,a,l){const u=zi(o,a,l);return o.inclusive?u>=0:u>0}(r.endAt,he(r),i))}(e,t)}function Oh(e){return(t,n)=>{let r=!1;for(const i of he(e)){const s=Mh(i,t,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function Mh(e,t,n){const r=e.field.isKeyField()?v.comparator(t.key,n.key):function(s,o,a){const l=o.data.field(s),u=a.data.field(s);return l!==null&&u!==null?Qt(l,u):T()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return T()}}/** 850 * @license 851 * Copyright 2017 Google LLC 852 * 853 * Licensed under the Apache License, Version 2.0 (the "License");
854 * you may not use this file except in compliance with the License. 855 * You may obtain a copy of the License at 856 * 857 * http://www.apache.org/licenses/LICENSE-2.0 858 * 859 * Unless required by applicable law or agreed to in writing, software 860 * distributed under the License is distributed on an "AS IS" BASIS, 861 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 862 * See the License for the specific language governing permissions and 863 * limitations under the License. 864 */class ne{constructor(t,n){this.mapKeyFn=t,this.equalsFn=n,this.inner={},this.innerSize=0}get(t){const n=this.mapKeyFn(t),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,t))return s}}has(t){return this.get(t)!==void 0}set(t,n){const r=this.mapKeyFn(t),i=this.inner[r];if(i===void 0)return this.inner[r]=[[t,n]],void this.innerSize++;for(let s=0;s<i.length;s++)if(this.equalsFn(i[s][0],t))return void(i[s]=[t,n]);i.push([t,n]),this.innerSize++}delete(t){const n=this.mapKeyFn(t),r=this.inner[n];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],t))return r.length===1?delete this.inner[n]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(t){Le(this.inner,(n,r)=>{for(const[i,s]of r)t(i,s)})}isEmpty(){return Vo(this.inner)}size(){return this.innerSize}}/** 865 * @license 866 * Copyright 2017 Google LLC 867 * 868 * Licensed under the Apache License, Version 2.0 (the "License"); 869 * you may not use this file except in compliance with the License. 870 * You may obtain a copy of the License at 871 * 872 * http://www.apache.org/licenses/LICENSE-2.0 873 * 874 * Unless required by applicable law or agreed to in writing, software 875 * distributed under the License is distributed on an "AS IS" BASIS, 876 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 877 * See the License for the specific language governing permissions and 878 * limitations under the License. 879 */const xh=new tt(v.comparator);function gn(){return xh}const Bo=new tt(v.comparator);function We(...e){let t=Bo;for(const n of e)t=t.insert(n.key,n);return t}function jo(e){let t=Bo;return e.forEach((n,r)=>t=t.insert(n,r.overlayedDocument)),t}function Dt(){return ce()}function $o(){return ce()}function ce(){return new ne(e=>e.toString(),(e,t)=>e.isEqual(t))}const Fh=new tt(v.comparator),Lh=new Z(v.comparator);function K(...e){let t=Lh;for(const n of e)t=t.add(n);return t}const Uh=new Z(S);function Bh(){return Uh}/** 880 * @license 881 * Copyright 2020 Google LLC 882 * 883 * Licensed under the Apache License, Version 2.0 (the "License"); 884 * you may not use this file except in compliance with the License. 885 * You may obtain a copy of the License at 886 * 887 * http://www.apache.org/licenses/LICENSE-2.0 888 * 889 * Unless required by applicable law or agreed to in writing, software 890 * distributed under the License is distributed on an "AS IS" BASIS, 891 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 892 * See the License for the specific language governing permissions and 893 * limitations under the License. 894 */function qo(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:cn(t)?"-0":t}}function Ho(e){return{integerValue:""+e}}function jh(e,t){return dh(t)?Ho(t):qo(e,t)}/** 895 * @license 896 * Copyright 2018 Google LLC 897 * 898 * Licensed under the Apache License, Version 2.0 (the "License"); 899 * you may not use this file except in compliance with the License. 900 * You may obtain a copy of the License at 901 * 902 * http://www.apache.org/licenses/LICENSE-2.0 903 * 904 * Unless required by applicable law or agreed to in writing, software 905 * distributed under the License is distributed on an "AS IS" BASIS, 906 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 907 * See the License for the specific language governing permissions and 908 * limitations under the License. 909 */class Fn{constructor(){this._=void 0}}function $h(e,t,n){return e instanceof mn?function(i,s){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&ni(s)&&(s=Do(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(n,t):e instanceof Se?Go(e,t):e instanceof Ce?Ko(e,t):function(i,s){const o=zo(i,s),a=Xi(o)+Xi(i.Ee);return Rr(o)&&Rr(i.Ee)?Ho(a):qo(i.serializer,a)}(e,t)}function qh(e,t,n){return e instanceof Se?Go(e,t):e instanceof Ce?Ko(e,t):n}function zo(e,t){return e instanceof _n?function(r){return Rr(r)||function(s){return!!s&&"doubleValue"in s}(r)}(t)?t:{integerValue:0}:null}class mn extends Fn{}class Se extends Fn{constructor(t){super(),this.elements=t}}function Go(e,t){const n=Qo(t);for(const r of e.elements)n.some(i=>ft(i,r))||n.push(r);return{arrayValue:{values:n}}}class Ce extends Fn{constructor(t){super(),this.elements=t}}function Ko(e,t){let n=Qo(t);for(const r of e.elements)n=n.filter(i=>!ft(i,r));return{arrayValue:{values:n}}}
909class _n extends Fn{constructor(t,n){super(),this.serializer=t,this.Ee=n}}function Xi(e){return $(e.integerValue||e.doubleValue)}function Qo(e){return ri(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}function Hh(e,t){return e.field.isEqual(t.field)&&function(r,i){return r instanceof Se&&i instanceof Se||r instanceof Ce&&i instanceof Ce?Gt(r.elements,i.elements,ft):r instanceof _n&&i instanceof _n?ft(r.Ee,i.Ee):r instanceof mn&&i instanceof mn}(e.transform,t.transform)}class zh{constructor(t,n){this.version=t,this.transformResults=n}}class pt{constructor(t,n){this.updateTime=t,this.exists=n}static none(){return new pt}static exists(t){return new pt(void 0,t)}static updateTime(t){return new pt(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Je(e,t){return e.updateTime!==void 0?t.isFoundDocument()&&t.version.isEqual(e.updateTime):e.exists===void 0||e.exists===t.isFoundDocument()}class Ln{}function Wo(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new Yo(e.key,pt.none()):new Ue(e.key,e.data,pt.none());{const n=e.data,r=st.empty();let i=new Z(Q.comparator);for(let s of t.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Lt(e.key,r,new ot(i.toArray()),pt.none())}}function Gh(e,t,n){e instanceof Ue?function(i,s,o){const a=i.value.clone(),l=Ji(i.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(e,t,n):e instanceof Lt?function(i,s,o){if(!Je(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=Ji(i.fieldTransforms,s,o.transformResults),l=s.data;l.setAll(Xo(i)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(e,t,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,t,n)}function fe(e,t,n,r){return e instanceof Ue?function(s,o,a,l){if(!Je(s.precondition,o))return a;const u=s.value.clone(),h=Zi(s.fieldTransforms,l,o);return u.setAll(h),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(e,t,n,r):e instanceof Lt?function(s,o,a,l){if(!Je(s.precondition,o))return a;const u=Zi(s.fieldTransforms,l,o),h=o.data;return h.setAll(Xo(s)),h.setAll(u),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(c=>c.field))}(e,t,n,r):function(s,o,a){return Je(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(e,t,n)}function Kh(e,t){let n=null;for(const r of e.fieldTransforms){const i=t.data.field(r.field),s=zo(r.transform,i||null);s!=null&&(n===null&&(n=st.empty()),n.set(r.field,s))}return n||null}function Yi(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Gt(r,i,(s,o)=>Hh(s,o))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class Ue extends Ln{constructor(t,n,r,i=[]){super(),this.key=t,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Lt extends Ln{constructor(t,n,r,i,s=[]){super(),this.key=t,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Xo(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}}),t}function Ji(e,t,n){const r=new Map;U(e.length===n.length);for(let i=0;i<n.length;i++){const s=e[i],o=s.transform,a=t.data.field(s.field);r.set(s.field,qh(o,a,n[i]))}return r}function Zi(e,t,n){const r=new Map;for(const i of e){const s=i.transform,o=n.data.field(i.field);r.set(i.field,$h(s,o,t))}return r}class Yo extends Ln{constructor(t,n){super(),this.key=t,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Qh extends Ln{constructor(t,n){super(),this.key=t,this.prec
909ondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/** 910 * @license 911 * Copyright 2017 Google LLC 912 * 913 * Licensed under the Apache License, Version 2.0 (the "License"); 914 * you may not use this file except in compliance with the License. 915 * You may obtain a copy of the License at 916 * 917 * http://www.apache.org/licenses/LICENSE-2.0 918 * 919 * Unless required by applicable law or agreed to in writing, software 920 * distributed under the License is distributed on an "AS IS" BASIS, 921 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 922 * See the License for the specific language governing permissions and 923 * limitations under the License. 924 */class Wh{constructor(t,n,r,i){this.batchId=t,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(t,n){const r=n.mutationResults;for(let i=0;i<this.mutations.length;i++){const s=this.mutations[i];s.key.isEqual(t.key)&&Gh(s,t,r[i])}}applyToLocalView(t,n){for(const r of this.baseMutations)r.key.isEqual(t.key)&&(n=fe(r,t,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(t.key)&&(n=fe(r,t,n,this.localWriteTime));return n}applyToLocalDocumentSet(t,n){const r=$o();return this.mutations.forEach(i=>{const s=t.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const l=Wo(o,a);l!==null&&r.set(i.key,l),o.isValidDocument()||o.convertToNoDocument(N.min())}),r}keys(){return this.mutations.reduce((t,n)=>t.add(n.key),K())}isEqual(t){return this.batchId===t.batchId&&Gt(this.mutations,t.mutations,(n,r)=>Yi(n,r))&&Gt(this.baseMutations,t.baseMutations,(n,r)=>Yi(n,r))}}class ai{constructor(t,n,r,i){this.batch=t,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(t,n,r){U(t.mutations.length===r.length);let i=function(){return Fh}();const s=t.mutations;for(let o=0;o<s.length;o++)i=i.insert(s[o].key,r[o].version);return new ai(t,n,r,i)}}/** 925 * @license 926 * Copyright 2022 Google LLC 927 * 928 * Licensed under the Apache License, Version 2.0 (the "License"); 929 * you may not use this file except in compliance with the License. 930 * You may obtain a copy of the License at 931 * 932 * http://www.apache.org/licenses/LICENSE-2.0 933 * 934 * Unless required by applicable law or agreed to in writing, software 935 * distributed under the License is distributed on an "AS IS" BASIS, 936 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 937 * See the License for the specific language governing permissions and 938 * limitations under the License. 939 */class Xh{constructor(t,n){this.largestBatchId=t,this.mutation=n}getKey(){return this.mutation.key}isEqual(t){return t!==null&&this.mutation===t.mutation}toString(){return`Overlay{ 940 largestBatchId: ${this.largestBatchId}, 941 mutation: ${this.mutation.toString()} 942 }`}}/** 943 * @license 944 * Copyright 2017 Google LLC 945 * 946 * Licensed under the Apache License, Version 2.0 (the "License"); 947 * you may not use this file except in compliance with the License. 948 * You may obtain a copy of the License at 949 * 950 * http://www.apache.org/licenses/LICENSE-2.0 951 * 952 * Unless required by applicable law or agreed to in writing, software 953 * distributed under the License is distributed on an "AS IS" BASIS, 954 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 955 * See the License for the specific language governing permissions and 956 * limitations under the License. 957 */var O,I;function Yh(e){switch(e){default:return T();case f.CANCELLED:case f.UNKNOWN:case f.DEADLINE_EXCEEDED:case f.RESOURCE_EXHAUSTED:case f.INTERNAL:case f.UNAVAILABLE:case f.UNAUTHENTICATED:return!1;case f.INVALID_ARGUMENT:case f.NOT_FOUND:case f.ALREADY_EXISTS:case f.PERMISSION_DENIED:case f.FAILED_PRECONDITION:case f.ABORTED:case f.OUT_OF_RANGE:case f.UNIMPLEMENTED:case f.DATA_LOSS:return!0}}function Jh(e){if(e===void 0)return Mt("GRPC error has no .code"),f.UNKNOWN;switch(e){case O.OK:return f.OK;case O.CANCELLED:return f.CANCELLED;case O.UNKNOWN:return f.UNKNOWN;case O.DEADLINE_EXCEEDED:return f.DEADLINE_EXCEEDED;case O.RESOURCE_EXHAUSTED:return f.RESOURCE_EXHAUSTED;case O.INTERNAL:return f.INTERNAL;case O.UNAVAILABLE:return f.UNAVAILABLE;case O.UNAUTHENTICATED:return f.UNAUTHENTICATED;case O.INVALID_ARGUMENT:return f.INVALID_ARGUMENT;case O.NOT_FOUND:return f.NOT_FOUND;case O.ALREADY_EXISTS:return f.ALREADY_EXISTS;case O.PERMISSION_DENIED:return f.PERMISSION_DENIED;case O.FAILED_PRECONDITION:return f.FAILED_PRECONDITION;case O.ABORTED:return f.ABORTED;case O.OUT_OF_RANGE:return f.OUT_OF_RANGE;
957case O.UNIMPLEMENTED:return f.UNIMPLEMENTED;case O.DATA_LOSS:return f.DATA_LOSS;default:return T()}}(I=O||(O={}))[I.OK=0]="OK",I[I.CANCELLED=1]="CANCELLED",I[I.UNKNOWN=2]="UNKNOWN",I[I.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",I[I.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",I[I.NOT_FOUND=5]="NOT_FOUND",I[I.ALREADY_EXISTS=6]="ALREADY_EXISTS",I[I.PERMISSION_DENIED=7]="PERMISSION_DENIED",I[I.UNAUTHENTICATED=16]="UNAUTHENTICATED",I[I.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",I[I.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",I[I.ABORTED=10]="ABORTED",I[I.OUT_OF_RANGE=11]="OUT_OF_RANGE",I[I.UNIMPLEMENTED=12]="UNIMPLEMENTED",I[I.INTERNAL=13]="INTERNAL",I[I.UNAVAILABLE=14]="UNAVAILABLE",I[I.DATA_LOSS=15]="DATA_LOSS";/** 958 * @license 959 * Copyright 2022 Google LLC 960 * 961 * Licensed under the Apache License, Version 2.0 (the "License"); 962 * you may not use this file except in compliance with the License. 963 * You may obtain a copy of the License at 964 * 965 * http://www.apache.org/licenses/LICENSE-2.0 966 * 967 * Unless required by applicable law or agreed to in writing, software 968 * distributed under the License is distributed on an "AS IS" BASIS, 969 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 970 * See the License for the specific language governing permissions and 971 * limitations under the License. 972 */new Ju([4294967295,4294967295],0);class Zh{constructor(t,n){this.databaseId=t,this.useProto3Json=n}}function Cr(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 tc(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function ec(e,t){return Cr(e,t.toTimestamp())}function Ht(e){return U(!!e),N.fromTimestamp(function(n){const r=xt(n);return new F(r.seconds,r.nanos)}(e))}function Jo(e,t){return function(r){return new b(["projects",r.projectId,"databases",r.database])}(e).child("documents").child(t).canonicalString()}function nc(e){const t=b.fromString(e);return U(hc(t)),t}function Vr(e,t){return Jo(e.databaseId,t.path)}function rc(e){const t=nc(e);return t.length===4?b.emptyPath():sc(t)}function ic(e){return new b(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function sc(e){return U(e.length>4&&e.get(4)==="documents"),e.popFirst(5)}function ts(e,t,n){return{name:Vr(e,t),fields:n.value.mapValue.fields}}function oc(e,t){let n;if(t instanceof Ue)n={update:ts(e,t.key,t.value)};else if(t instanceof Yo)n={delete:Vr(e,t.key)};else if(t instanceof Lt)n={update:ts(e,t.key,t.data),updateMask:uc(t.fieldMask)};else{if(!(t instanceof Qh))return T();n={verify:Vr(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof mn)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Se)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Ce)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof _n)return{fieldPath:o.field.canonicalString(),increment:a.Ee};throw T()}(0,r))),t.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:ec(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:T()}(e,t.precondition)),n}function ac(e,t){return e&&e.length>0?(U(t!==void 0),e.map(n=>function(i,s){let o=i.updateTime?Ht(i.updateTime):Ht(s);return o.isEqual(N.min())&&(o=Ht(s)),new zh(o,i.transformResults||[])}(n,t))):[]}function lc(e){let t=rc(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){U(r===1);const h=n.from[0];h.allDescendants?i=h.collectionId:t=t.child(h.collectionId)}let s=[];n.where&&(s=function(c){const g=Zo(c);return g instanceof It&&Oo(g)?g.getFilters():[g]}(n.where));let o=[];n.orderBy&&(o=function(c){return c.map(g=>function(w){return new ue(Bt(w.field),function(P){switch(P){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(w.direction))}(g))}(n.orderBy));let a=null;n.limit&&(a=function(c){let g;return g=typeof c=="object"?c.value:c,ei(g)?null:g}(n.limit));let l=null;n.startAt&&(l=function(c){const g=!!c.before,m=c.values||[];return new pn(m,g)}(n.startAt));let u=null;return n.endAt&&(u=function(c){const g=!c.before,m=c.values||[];return new pn(m,g)}(n.endAt)),Ch(t,i,o,s,a,"F",l,u)}function Zo(e){return e.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=Bt(n.unaryFilter.field);return x.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=Bt(n.unaryFilter.field);return x.create(i,"==",{nullValue:"NULL_VALUE"});
972case"IS_NOT_NAN":const s=Bt(n.unaryFilter.field);return x.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=Bt(n.unaryFilter.field);return x.create(o,"!=",{nullValue:"NULL_VALUE"});default:return T()}}(e):e.fieldFilter!==void 0?function(n){return x.create(Bt(n.fieldFilter.field),function(i){switch(i){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 T()}}(n.fieldFilter.op),n.fieldFilter.value)}(e):e.compositeFilter!==void 0?function(n){return It.create(n.compositeFilter.filters.map(r=>Zo(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return T()}}(n.compositeFilter.op))}(e):T()}function Bt(e){return Q.fromServerFormat(e.fieldPath)}function uc(e){const t=[];return e.fields.forEach(n=>t.push(n.canonicalString())),{fieldPaths:t}}function hc(e){return e.length>=4&&e.get(0)==="projects"&&e.get(2)==="databases"}/** 973 * @license 974 * Copyright 2017 Google LLC 975 * 976 * Licensed under the Apache License, Version 2.0 (the "License"); 977 * you may not use this file except in compliance with the License. 978 * You may obtain a copy of the License at 979 * 980 * http://www.apache.org/licenses/LICENSE-2.0 981 * 982 * Unless required by applicable law or agreed to in writing, software 983 * distributed under the License is distributed on an "AS IS" BASIS, 984 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 985 * See the License for the specific language governing permissions and 986 * limitations under the License. 987 */class cc{constructor(t){this.ht=t}}function fc(e){const t=lc({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType==="LAST"?Sr(t,t.limit,"L"):t}/** 988 * @license 989 * Copyright 2019 Google LLC 990 * 991 * Licensed under the Apache License, Version 2.0 (the "License"); 992 * you may not use this file except in compliance with the License. 993 * You may obtain a copy of the License at 994 * 995 * http://www.apache.org/licenses/LICENSE-2.0 996 * 997 * Unless required by applicable law or agreed to in writing, software 998 * distributed under the License is distributed on an "AS IS" BASIS, 999 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1000 * See the License for the specific language governing permissions and 1001 * limitations under the License. 1002 */class dc{constructor(){this._n=new pc}addToCollectionParentIndex(t,n){return this._n.add(n),d.resolve()}getCollectionParents(t,n){return d.resolve(this._n.getEntries(n))}addFieldIndex(t,n){return d.resolve()}deleteFieldIndex(t,n){return d.resolve()}getDocumentsMatchingTarget(t,n){return d.resolve(null)}getIndexType(t,n){return d.resolve(0)}getFieldIndexes(t,n){return d.resolve([])}getNextCollectionGroupToUpdate(t){return d.resolve(null)}getMinOffset(t,n){return d.resolve(Tt.min())}getMinOffsetFromCollectionGroup(t,n){return d.resolve(Tt.min())}updateCollectionGroup(t,n,r){return d.resolve()}updateIndexEntries(t,n){return d.resolve()}}class pc{constructor(){this.index={}}add(t){const n=t.lastSegment(),r=t.popLast(),i=this.index[n]||new Z(b.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(t){const n=t.lastSegment(),r=t.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(t){return(this.index[t]||new Z(b.comparator)).toArray()}}/** 1003 * @license 1004 * Copyright 2017 Google LLC 1005 * 1006 * Licensed under the Apache License, Version 2.0 (the "License"); 1007 * you may not use this file except in compliance with the License. 1008 * You may obtain a copy of the License at 1009 * 1010 * http://www.apache.org/licenses/LICENSE-2.0 1011 * 1012 * Unless required by applicable law or agreed to in writing, software 1013 * distributed under the License is distributed on an "AS IS" BASIS, 1014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1015 * See the License for the specific language governing permissions and 1016 * limitations under the License. 1017 */class Yt{constructor(t){this.On=t}next(){return this.On+=2,this.On}static Nn(){return new Yt(0)}static Bn(){return new Yt(-1)}}/** 1018 * @license 1019 * Copyright 2017 Google LLC 1020 * 1021 * Licensed under the Apache License, Version 2.0 (the "License");
1022 * you may not use this file except in compliance with the License. 1023 * You may obtain a copy of the License at 1024 * 1025 * http://www.apache.org/licenses/LICENSE-2.0 1026 * 1027 * Unless required by applicable law or agreed to in writing, software 1028 * distributed under the License is distributed on an "AS IS" BASIS, 1029 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1030 * See the License for the specific language governing permissions and 1031 * limitations under the License. 1032 */class gc{constructor(){this.changes=new ne(t=>t.toString(),(t,n)=>t.isEqual(n)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,n){this.assertNotApplied(),this.changes.set(t,it.newInvalidDocument(t).setReadTime(n))}getEntry(t,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?d.resolve(r):this.getFromCache(t,n)}getEntries(t,n){return this.getAllFromCache(t,n)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}/** 1033 * @license 1034 * Copyright 2017 Google LLC 1035 * 1036 * Licensed under the Apache License, Version 2.0 (the "License"); 1037 * you may not use this file except in compliance with the License. 1038 * You may obtain a copy of the License at 1039 * 1040 * http://www.apache.org/licenses/LICENSE-2.0 1041 * 1042 * Unless required by applicable law or agreed to in writing, software 1043 * distributed under the License is distributed on an "AS IS" BASIS, 1044 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1045 * See the License for the specific language governing permissions and 1046 * limitations under the License. 1047 *//** 1048 * @license 1049 * Copyright 2022 Google LLC 1050 * 1051 * Licensed under the Apache License, Version 2.0 (the "License"); 1052 * you may not use this file except in compliance with the License. 1053 * You may obtain a copy of the License at 1054 * 1055 * http://www.apache.org/licenses/LICENSE-2.0 1056 * 1057 * Unless required by applicable law or agreed to in writing, software 1058 * distributed under the License is distributed on an "AS IS" BASIS, 1059 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1060 * See the License for the specific language governing permissions and 1061 * limitations under the License. 1062 */class mc{constructor(t,n){this.overlayedDocument=t,this.mutatedFields=n}}/** 1063 * @license 1064 * Copyright 2017 Google LLC 1065 * 1066 * Licensed under the Apache License, Version 2.0 (the "License"); 1067 * you may not use this file except in compliance with the License. 1068 * You may obtain a copy of the License at 1069 * 1070 * http://www.apache.org/licenses/LICENSE-2.0 1071 * 1072 * Unless required by applicable law or agreed to in writing, software 1073 * distributed under the License is distributed on an "AS IS" BASIS, 1074 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1075 * See the License for the specific language governing permissions and 1076 * limitations under the License. 1077 */class _c{constructor(t,n,r,i){this.remoteDocumentCache=t,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(t,n){let r=null;return this.documentOverlayCache.getOverlay(t,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(t,n))).next(i=>(r!==null&&fe(r.mutation,i,ot.empty(),F.now()),i))}getDocuments(t,n){return this.remoteDocumentCache.getEntries(t,n).next(r=>this.getLocalViewOfDocuments(t,r,K()).next(()=>r))}getLocalViewOfDocuments(t,n,r=K()){const i=Dt();return this.populateOverlays(t,i,n).next(()=>this.computeViews(t,n,i,r).next(s=>{let o=We();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(t,n){const r=Dt();return this.populateOverlays(t,r,n).next(()=>this.computeViews(t,n,r,K()))}populateOverlays(t,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(t,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(t,n,r,i){let s=gn();const o=ce(),a=function(){return ce()}();return n.forEach((l,u)=>{const h=r.get(u.key);i.has(u.key)&&(h===void 0||h.mutation instanceof Lt)?s=s.insert(u.key,u):h!==void 0?(o.set(u.key,h.mutation.getFieldMask()),fe(h.mutation,u,h.mutation.getFieldMask(),F.now())):o.set(u.key,ot.empty())}),this.recalculateAndSaveOverlays(t,s).next(l=>(l.forEach((u,h)=>
1077o.set(u,h)),n.forEach((u,h)=>{var c;return a.set(u,new mc(h,(c=o.get(u))!==null&&c!==void 0?c:null))}),a))}recalculateAndSaveOverlays(t,n){const r=ce();let i=new tt((o,a)=>o-a),s=K();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const u=n.get(l);if(u===null)return;let h=r.get(l)||ot.empty();h=a.applyToLocalView(u,h),r.set(l,h);const c=(i.get(a.batchId)||K()).add(l);i=i.insert(a.batchId,c)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),u=l.key,h=l.value,c=$o();h.forEach(g=>{if(!s.has(g)){const m=Wo(n.get(g),r.get(g));m!==null&&c.set(g,m),s=s.add(g)}}),o.push(this.documentOverlayCache.saveOverlays(t,u,c))}return d.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(t,n){return this.remoteDocumentCache.getEntries(t,n).next(r=>this.recalculateAndSaveOverlays(t,r))}getDocumentsMatchingQuery(t,n,r){return function(s){return v.isDocumentKey(s.path)&&s.collectionGroup===null&&s.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(t,n.path):bh(n)?this.getDocumentsMatchingCollectionGroupQuery(t,n,r):this.getDocumentsMatchingCollectionQuery(t,n,r)}getNextDocuments(t,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(t,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,n,r.largestBatchId,i-s.size):d.resolve(Dt());let a=-1,l=s;return o.next(u=>d.forEach(u,(h,c)=>(a<c.largestBatchId&&(a=c.largestBatchId),s.get(h)?d.resolve():this.remoteDocumentCache.getEntry(t,h).next(g=>{l=l.insert(h,g)}))).next(()=>this.populateOverlays(t,u,s)).next(()=>this.computeViews(t,l,u,K())).next(h=>({batchId:a,changes:jo(h)})))})}getDocumentsMatchingDocumentQuery(t,n){return this.getDocument(t,new v(n)).next(r=>{let i=We();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(t,n,r){const i=n.collectionGroup;let s=We();return this.indexManager.getCollectionParents(t,i).next(o=>d.forEach(o,a=>{const l=function(h,c){return new xn(c,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,a.child(i));return this.getDocumentsMatchingCollectionQuery(t,l,r).next(u=>{u.forEach((h,c)=>{s=s.insert(h,c)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(t,n.path,r.largestBatchId).next(s=>(i=s,this.remoteDocumentCache.getDocumentsMatchingQuery(t,n,r,i))).next(s=>{i.forEach((a,l)=>{const u=l.getKey();s.get(u)===null&&(s=s.insert(u,it.newInvalidDocument(u)))});let o=We();return s.forEach((a,l)=>{const u=i.get(a);u!==void 0&&fe(u.mutation,l,ot.empty(),F.now()),oi(n,l)&&(o=o.insert(a,l))}),o})}}/** 1078 * @license 1079 * Copyright 2020 Google LLC 1080 * 1081 * Licensed under the Apache License, Version 2.0 (the "License"); 1082 * you may not use this file except in compliance with the License. 1083 * You may obtain a copy of the License at 1084 * 1085 * http://www.apache.org/licenses/LICENSE-2.0 1086 * 1087 * Unless required by applicable law or agreed to in writing, software 1088 * distributed under the License is distributed on an "AS IS" BASIS, 1089 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1090 * See the License for the specific language governing permissions and 1091 * limitations under the License. 1092 */class yc{constructor(t){this.serializer=t,this.cr=new Map,this.lr=new Map}getBundleMetadata(t,n){return d.resolve(this.cr.get(n))}saveBundleMetadata(t,n){return this.cr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:Ht(i.createTime)}}(n)),d.resolve()}getNamedQuery(t,n){return d.resolve(this.lr.get(n))}saveNamedQuery(t,n){return this.lr.set(n.name,function(i){return{name:i.name,query:fc(i.bundledQuery),readTime:Ht(i.readTime)}}(n)),d.resolve()}}/** 1093 * @license 1094 * Copyright 2022 Google LLC 1095 * 1096 * Licensed under the Apache License, Version 2.0 (the "License"); 1097 * you may not use this file except in compliance with the License. 1098 * You may obtain a copy of the License at 1099 * 1100 * http://www.apache.org/licenses/LICENSE-2.0 1101 * 1102 * Unless required by applicable law or agreed to in writing, softw
1102are 1103 * distributed under the License is distributed on an "AS IS" BASIS, 1104 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1105 * See the License for the specific language governing permissions and 1106 * limitations under the License. 1107 */class Ec{constructor(){this.overlays=new tt(v.comparator),this.hr=new Map}getOverlay(t,n){return d.resolve(this.overlays.get(n))}getOverlays(t,n){const r=Dt();return d.forEach(n,i=>this.getOverlay(t,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(t,n,r){return r.forEach((i,s)=>{this.It(t,n,s)}),d.resolve()}removeOverlaysForBatchId(t,n,r){const i=this.hr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.hr.delete(r)),d.resolve()}getOverlaysForCollection(t,n,r){const i=Dt(),s=n.length+1,o=new v(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,u=l.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===s&&l.largestBatchId>r&&i.set(l.getKey(),l)}return d.resolve(i)}getOverlaysForCollectionGroup(t,n,r,i){let s=new tt((u,h)=>u-h);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let h=s.get(u.largestBatchId);h===null&&(h=Dt(),s=s.insert(u.largestBatchId,h)),h.set(u.getKey(),u)}}const a=Dt(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((u,h)=>a.set(u,h)),!(a.size()>=i)););return d.resolve(a)}It(t,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.hr.get(i.largestBatchId).delete(r.key);this.hr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new Xh(n,r));let s=this.hr.get(n);s===void 0&&(s=K(),this.hr.set(n,s)),this.hr.set(n,s.add(r.key))}}/** 1108 * @license 1109 * Copyright 2017 Google LLC 1110 * 1111 * Licensed under the Apache License, Version 2.0 (the "License"); 1112 * you may not use this file except in compliance with the License. 1113 * You may obtain a copy of the License at 1114 * 1115 * http://www.apache.org/licenses/LICENSE-2.0 1116 * 1117 * Unless required by applicable law or agreed to in writing, software 1118 * distributed under the License is distributed on an "AS IS" BASIS, 1119 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1120 * See the License for the specific language governing permissions and 1121 * limitations under the License. 1122 */class li{constructor(){this.Pr=new Z(M.Ir),this.Tr=new Z(M.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(t,n){const r=new M(t,n);this.Pr=this.Pr.add(r),this.Tr=this.Tr.add(r)}dr(t,n){t.forEach(r=>this.addReference(r,n))}removeReference(t,n){this.Ar(new M(t,n))}Rr(t,n){t.forEach(r=>this.removeReference(r,n))}Vr(t){const n=new v(new b([])),r=new M(n,t),i=new M(n,t+1),s=[];return this.Tr.forEachInRange([r,i],o=>{this.Ar(o),s.push(o.key)}),s}mr(){this.Pr.forEach(t=>this.Ar(t))}Ar(t){this.Pr=this.Pr.delete(t),this.Tr=this.Tr.delete(t)}gr(t){const n=new v(new b([])),r=new M(n,t),i=new M(n,t+1);let s=K();return this.Tr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(t){const n=new M(t,0),r=this.Pr.firstAfterOrEqual(n);return r!==null&&t.isEqual(r.key)}}class M{constructor(t,n){this.key=t,this.pr=n}static Ir(t,n){return v.comparator(t.key,n.key)||S(t.pr,n.pr)}static Er(t,n){return S(t.pr,n.pr)||v.comparator(t.key,n.key)}}/** 1123 * @license 1124 * Copyright 2017 Google LLC 1125 * 1126 * Licensed under the Apache License, Version 2.0 (the "License"); 1127 * you may not use this file except in compliance with the License. 1128 * You may obtain a copy of the License at 1129 * 1130 * http://www.apache.org/licenses/LICENSE-2.0 1131 * 1132 * Unless required by applicable law or agreed to in writing, software 1133 * distributed under the License is distributed on an "AS IS" BASIS, 1134 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1135 * See the License for the specific language governing permissions and 1136 * limitations under the License. 1137 */class vc{constructor(t,n){this.indexManager=t,this.referenceDelegate=n,this.mutationQueue=[],this.yr=1,this.wr=new Z(M.Ir)}checkEmpty(t){return d.resolve(this.mutationQueue.length===0)}addMutationBatch(t,n,r,i){const s=this.yr;
1137this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Wh(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.wr=this.wr.add(new M(a.key,s)),this.indexManager.addToCollectionParentIndex(t,a.key.path.popLast());return d.resolve(o)}lookupMutationBatch(t,n){return d.resolve(this.Sr(n))}getNextMutationBatchAfterBatchId(t,n){const r=n+1,i=this.br(r),s=i<0?0:i;return d.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return d.resolve(this.mutationQueue.length===0?-1:this.yr-1)}getAllMutationBatches(t){return d.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,n){const r=new M(n,0),i=new M(n,Number.POSITIVE_INFINITY),s=[];return this.wr.forEachInRange([r,i],o=>{const a=this.Sr(o.pr);s.push(a)}),d.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,n){let r=new Z(S);return n.forEach(i=>{const s=new M(i,0),o=new M(i,Number.POSITIVE_INFINITY);this.wr.forEachInRange([s,o],a=>{r=r.add(a.pr)})}),d.resolve(this.Dr(r))}getAllMutationBatchesAffectingQuery(t,n){const r=n.path,i=r.length+1;let s=r;v.isDocumentKey(s)||(s=s.child(""));const o=new M(new v(s),0);let a=new Z(S);return this.wr.forEachWhile(l=>{const u=l.key.path;return!!r.isPrefixOf(u)&&(u.length===i&&(a=a.add(l.pr)),!0)},o),d.resolve(this.Dr(a))}Dr(t){const n=[];return t.forEach(r=>{const i=this.Sr(r);i!==null&&n.push(i)}),n}removeMutationBatch(t,n){U(this.vr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.wr;return d.forEach(n.mutations,i=>{const s=new M(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,i.key)}).next(()=>{this.wr=r})}Mn(t){}containsKey(t,n){const r=new M(n,0),i=this.wr.firstAfterOrEqual(r);return d.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(t){return this.mutationQueue.length,d.resolve()}vr(t,n){return this.br(t)}br(t){return this.mutationQueue.length===0?0:t-this.mutationQueue[0].batchId}Sr(t){const n=this.br(t);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** 1138 * @license 1139 * Copyright 2017 Google LLC 1140 * 1141 * Licensed under the Apache License, Version 2.0 (the "License"); 1142 * you may not use this file except in compliance with the License. 1143 * You may obtain a copy of the License at 1144 * 1145 * http://www.apache.org/licenses/LICENSE-2.0 1146 * 1147 * Unless required by applicable law or agreed to in writing, software 1148 * distributed under the License is distributed on an "AS IS" BASIS, 1149 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1150 * See the License for the specific language governing permissions and 1151 * limitations under the License. 1152 */class Tc{constructor(t){this.Cr=t,this.docs=function(){return new tt(v.comparator)}(),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.Cr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(t,r.path.popLast())}removeEntry(t){const n=this.docs.get(t);n&&(this.docs=this.docs.remove(t),this.size-=n.size)}getEntry(t,n){const r=this.docs.get(n);return d.resolve(r?r.document.mutableCopy():it.newInvalidDocument(n))}getEntries(t,n){let r=gn();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():it.newInvalidDocument(i))}),d.resolve(r)}getDocumentsMatchingQuery(t,n,r,i){let s=gn();const o=n.path,a=new v(o.child("")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:u,value:{document:h}}=l.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||hh(uh(h),r)<=0||(i.has(h.key)||oi(n,h))&&(s=s.insert(h.key,h.mutableCopy()))}return d.resolve(s)}getAllFromCollectionGroup(t,n,r,i){T()}Fr(t,n){return d.forEach(this.docs,r=>n(r))}newChangeBuffer(t){return new Ic(this)}getSize(t){return d.resolve(this.size)}}class Ic extends gc{constructor(t){super(),this.ar=t}applyChanges(t){const n=[];
1152return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.ar.addEntry(t,i)):this.ar.removeEntry(r)}),d.waitFor(n)}getFromCache(t,n){return this.ar.getEntry(t,n)}getAllFromCache(t,n){return this.ar.getEntries(t,n)}}/** 1153 * @license 1154 * Copyright 2017 Google LLC 1155 * 1156 * Licensed under the Apache License, Version 2.0 (the "License"); 1157 * you may not use this file except in compliance with the License. 1158 * You may obtain a copy of the License at 1159 * 1160 * http://www.apache.org/licenses/LICENSE-2.0 1161 * 1162 * Unless required by applicable law or agreed to in writing, software 1163 * distributed under the License is distributed on an "AS IS" BASIS, 1164 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1165 * See the License for the specific language governing permissions and 1166 * limitations under the License. 1167 */class Ac{constructor(t){this.persistence=t,this.Mr=new ne(n=>ii(n),si),this.lastRemoteSnapshotVersion=N.min(),this.highestTargetId=0,this.Or=0,this.Nr=new li,this.targetCount=0,this.Br=Yt.Nn()}forEachTarget(t,n){return this.Mr.forEach((r,i)=>n(i)),d.resolve()}getLastRemoteSnapshotVersion(t){return d.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return d.resolve(this.Or)}allocateTargetId(t){return this.highestTargetId=this.Br.next(),d.resolve(this.highestTargetId)}setTargetsMetadata(t,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Or&&(this.Or=n),d.resolve()}qn(t){this.Mr.set(t.target,t);const n=t.targetId;n>this.highestTargetId&&(this.Br=new Yt(n),this.highestTargetId=n),t.sequenceNumber>this.Or&&(this.Or=t.sequenceNumber)}addTargetData(t,n){return this.qn(n),this.targetCount+=1,d.resolve()}updateTargetData(t,n){return this.qn(n),d.resolve()}removeTargetData(t,n){return this.Mr.delete(n.target),this.Nr.Vr(n.targetId),this.targetCount-=1,d.resolve()}removeTargets(t,n,r){let i=0;const s=[];return this.Mr.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.Mr.delete(o),s.push(this.removeMatchingKeysForTargetId(t,a.targetId)),i++)}),d.waitFor(s).next(()=>i)}getTargetCount(t){return d.resolve(this.targetCount)}getTargetData(t,n){const r=this.Mr.get(n)||null;return d.resolve(r)}addMatchingKeys(t,n,r){return this.Nr.dr(n,r),d.resolve()}removeMatchingKeys(t,n,r){this.Nr.Rr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(t,o))}),d.waitFor(s)}removeMatchingKeysForTargetId(t,n){return this.Nr.Vr(n),d.resolve()}getMatchingKeysForTargetId(t,n){const r=this.Nr.gr(n);return d.resolve(r)}containsKey(t,n){return d.resolve(this.Nr.containsKey(n))}}/** 1168 * @license 1169 * Copyright 2017 Google LLC 1170 * 1171 * Licensed under the Apache License, Version 2.0 (the "License"); 1172 * you may not use this file except in compliance with the License. 1173 * You may obtain a copy of the License at 1174 * 1175 * http://www.apache.org/licenses/LICENSE-2.0 1176 * 1177 * Unless required by applicable law or agreed to in writing, software 1178 * distributed under the License is distributed on an "AS IS" BASIS, 1179 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1180 * See the License for the specific language governing permissions and 1181 * limitations under the License. 1182 */class wc{constructor(t,n){this.Lr={},this.overlays={},this.kr=new Co(0),this.qr=!1,this.qr=!0,this.referenceDelegate=t(this),this.Qr=new Ac(this),this.indexManager=new dc,this.remoteDocumentCache=function(i){return new Tc(i)}(r=>this.referenceDelegate.Kr(r)),this.serializer=new cc(n),this.$r=new yc(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let n=this.overlays[t.toKey()];return n||(n=new Ec,this.overlays[t.toKey()]=n),n}getMutationQueue(t,n){let r=this.Lr[t.toKey()];return r||(r=new vc(n,this.referenceDelegate),this.Lr[t.toKey()]=r),r}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(t,n,r){_("MemoryPersistence","Starting transaction:",t);const i=new Rc(this.kr.next());return this.referenceDelegate.Ur(),r(i).next(s=>this.referenceDelegate.Wr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Gr(t,n){return d.or(Object.values(this.Lr).map(r=>()=>r.containsKey(t,n)))}}class Rc extends fh{constructor(t){super(),this.currentSequenceNumber=t}}class ui{constructor(t){this.persistence=t,this.zr=new li,this.jr=null}static Hr(t){return new ui(t)}get Jr(){if(this.jr)return this.jr;throw T()}addReference(t,n,r){return this.zr.addReference(r,n),this.Jr.delete(r.toString()),d.resolve()}removeReference(t,n,r){return this.zr.removeReference(r,n),this.Jr.add(r.toString()),d.resolve()}markPotentiallyOrphaned(t,n){return this.Jr.add(n.toString()),d.resolve()}
1182removeTarget(t,n){this.zr.Vr(n.targetId).forEach(i=>this.Jr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,n.targetId).next(i=>{i.forEach(s=>this.Jr.add(s.toString()))}).next(()=>r.removeTargetData(t,n))}Ur(){this.jr=new Set}Wr(t){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return d.forEach(this.Jr,r=>{const i=v.fromPath(r);return this.Yr(t,i).next(s=>{s||n.removeEntry(i,N.min())})}).next(()=>(this.jr=null,n.apply(t)))}updateLimboDocument(t,n){return this.Yr(t,n).next(r=>{r?this.Jr.delete(n.toString()):this.Jr.add(n.toString())})}Kr(t){return 0}Yr(t,n){return d.or([()=>d.resolve(this.zr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(t,n),()=>this.persistence.Gr(t,n)])}}/** 1183 * @license 1184 * Copyright 2017 Google LLC 1185 * 1186 * Licensed under the Apache License, Version 2.0 (the "License"); 1187 * you may not use this file except in compliance with the License. 1188 * You may obtain a copy of the License at 1189 * 1190 * http://www.apache.org/licenses/LICENSE-2.0 1191 * 1192 * Unless required by applicable law or agreed to in writing, software 1193 * distributed under the License is distributed on an "AS IS" BASIS, 1194 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1195 * See the License for the specific language governing permissions and 1196 * limitations under the License. 1197 */class hi{constructor(t,n,r,i){this.targetId=t,this.fromCache=n,this.qi=r,this.Qi=i}static Ki(t,n){let r=K(),i=K();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new hi(t,n.fromCache,r,i)}}/** 1198 * @license 1199 * Copyright 2019 Google LLC 1200 * 1201 * Licensed under the Apache License, Version 2.0 (the "License"); 1202 * you may not use this file except in compliance with the License. 1203 * You may obtain a copy of the License at 1204 * 1205 * http://www.apache.org/licenses/LICENSE-2.0 1206 * 1207 * Unless required by applicable law or agreed to in writing, software 1208 * distributed under the License is distributed on an "AS IS" BASIS, 1209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1210 * See the License for the specific language governing permissions and 1211 * limitations under the License. 1212 */class Pc{constructor(){this.$i=!1}initialize(t,n){this.Ui=t,this.indexManager=n,this.$i=!0}getDocumentsMatchingQuery(t,n,r,i){return this.Wi(t,n).next(s=>s||this.Gi(t,n,i,r)).next(s=>s||this.zi(t,n))}Wi(t,n){if(Qi(n))return d.resolve(null);let r=Xt(n);return this.indexManager.getIndexType(t,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=Sr(n,null,"F"),r=Xt(n)),this.indexManager.getDocumentsMatchingTarget(t,r).next(s=>{const o=K(...s);return this.Ui.getDocuments(t,o).next(a=>this.indexManager.getMinOffset(t,r).next(l=>{const u=this.ji(n,a);return this.Hi(n,u,o,l.readTime)?this.Wi(t,Sr(n,null,"F")):this.Ji(t,u,n,l)}))})))}Gi(t,n,r,i){return Qi(n)||i.isEqual(N.min())?this.zi(t,n):this.Ui.getDocuments(t,r).next(s=>{const o=this.ji(n,s);return this.Hi(n,o,r,i)?this.zi(t,n):(ji()<=A.DEBUG&&_("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Wi(n)),this.Ji(t,o,n,lh(i,-1)))})}ji(t,n){let r=new Z(Oh(t));return n.forEach((i,s)=>{oi(t,s)&&(r=r.add(s))}),r}Hi(t,n,r,i){if(t.limit===null)return!1;if(r.size!==n.size)return!0;const s=t.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}zi(t,n){return ji()<=A.DEBUG&&_("QueryEngine","Using full collection scan to execute query:",Wi(n)),this.Ui.getDocumentsMatchingQuery(t,n,Tt.min())}Ji(t,n,r,i){return this.Ui.getDocumentsMatchingQuery(t,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/** 1213 * @license 1214 * Copyright 2020 Google LLC 1215 * 1216 * Licensed under the Apache License, Version 2.0 (the "License"); 1217 * you may not use this file except in compliance with the License. 1218 * You may obtain a copy of the License at 1219 * 1220 * http://www.apache.org/licenses/LICENSE-2.0 1221 * 1222 * Unless required by applicable law or agreed to in writing, software 1223 * distributed under the License is distributed on an "AS IS" BASIS, 1224 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1225 * See the License for the specific language governing permissions and 1226 * limitations under the License. 1227 */class Sc{constructor(t,n,r,i){this.persistence=t,this.Yi=n,this.serializer
1227=i,this.Zi=new tt(S),this.Xi=new ne(s=>ii(s),si),this.es=new Map,this.ts=t.getRemoteDocumentCache(),this.Qr=t.getTargetCache(),this.$r=t.getBundleCache(),this.ns(r)}ns(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new _c(this.ts,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ts.setIndexManager(this.indexManager),this.Yi.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>t.collect(n,this.Zi))}}function Cc(e,t,n,r){return new Sc(e,t,n,r)}async function ta(e,t){const n=V(e);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.ns(t),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let l=K();for(const u of i){o.push(u.batchId);for(const h of u.mutations)l=l.add(h.key)}for(const u of s){a.push(u.batchId);for(const h of u.mutations)l=l.add(h.key)}return n.localDocuments.getDocuments(r,l).next(u=>({rs:u,removedBatchIds:o,addedBatchIds:a}))})})}function Vc(e,t){const n=V(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=t.batch.keys(),s=n.ts.newChangeBuffer({trackRemovals:!0});return function(a,l,u,h){const c=u.batch,g=c.keys();let m=d.resolve();return g.forEach(w=>{m=m.next(()=>h.getEntry(l,w)).next(D=>{const P=u.docVersions.get(w);U(P!==null),D.version.compareTo(P)<0&&(c.applyToRemoteDocument(D,u),D.isValidDocument()&&(D.setReadTime(u.commitVersion),h.addEntry(D)))})}),m.next(()=>a.mutationQueue.removeMutationBatch(l,c))}(n,r,t,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let l=K();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(l=l.add(a.batch.mutations[u].key));return l}(t))).next(()=>n.localDocuments.getDocuments(r,i))})}function Dc(e){const t=V(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",n=>t.Qr.getLastRemoteSnapshotVersion(n))}function Nc(e,t){const n=V(e);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(t===void 0&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,t)))}class es{constructor(){this.activeTargetIds=Bh()}Is(t){this.activeTargetIds=this.activeTargetIds.add(t)}Ts(t){this.activeTargetIds=this.activeTargetIds.delete(t)}Ps(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class bc{constructor(){this.Ys=new es,this.Zs={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,n,r){}addLocalQueryTarget(t){return this.Ys.Is(t),this.Zs[t]||"not-current"}updateQueryState(t,n,r){this.Zs[t]=n}removeLocalQueryTarget(t){this.Ys.Ts(t)}isLocalQueryTarget(t){return this.Ys.activeTargetIds.has(t)}clearQueryState(t){delete this.Zs[t]}getAllActiveQueryTargets(){return this.Ys.activeTargetIds}isActiveQueryTarget(t){return this.Ys.activeTargetIds.has(t)}start(){return this.Ys=new es,Promise.resolve()}handleUserChange(t,n,r){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}/** 1228 * @license 1229 * Copyright 2019 Google LLC 1230 * 1231 * Licensed under the Apache License, Version 2.0 (the "License"); 1232 * you may not use this file except in compliance with the License. 1233 * You may obtain a copy of the License at 1234 * 1235 * http://www.apache.org/licenses/LICENSE-2.0 1236 * 1237 * Unless required by applicable law or agreed to in writing, software 1238 * distributed under the License is distributed on an "AS IS" BASIS, 1239 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1240 * See the License for the specific language governing permissions and 1241 * limitations under the License. 1242 */class kc{Xs(t){}shutdown(){}}/** 1243 * @license 1244 * Copyright 2019 Google LLC 1245 * 1246 * Licensed under the Apache License, Version 2.0 (the "License");
1247 * you may not use this file except in compliance with the License. 1248 * You may obtain a copy of the License at 1249 * 1250 * http://www.apache.org/licenses/LICENSE-2.0 1251 * 1252 * Unless required by applicable law or agreed to in writing, software 1253 * distributed under the License is distributed on an "AS IS" BASIS, 1254 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1255 * See the License for the specific language governing permissions and 1256 * limitations under the License. 1257 */class ns{constructor(){this.eo=()=>this.no(),this.ro=()=>this.io(),this.so=[],this.oo()}Xs(t){this.so.push(t)}shutdown(){window.removeEventListener("online",this.eo),window.removeEventListener("offline",this.ro)}oo(){window.addEventListener("online",this.eo),window.addEventListener("offline",this.ro)}no(){_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.so)t(0)}io(){_("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.so)t(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** 1258 * @license 1259 * Copyright 2023 Google LLC 1260 * 1261 * Licensed under the Apache License, Version 2.0 (the "License"); 1262 * you may not use this file except in compliance with the License. 1263 * You may obtain a copy of the License at 1264 * 1265 * http://www.apache.org/licenses/LICENSE-2.0 1266 * 1267 * Unless required by applicable law or agreed to in writing, software 1268 * distributed under the License is distributed on an "AS IS" BASIS, 1269 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1270 * See the License for the specific language governing permissions and 1271 * limitations under the License. 1272 */let Xe=null;function rr(){return Xe===null?Xe=function(){return 268435456+Math.round(2147483648*Math.random())}():Xe++,"0x"+Xe.toString(16)}/** 1273 * @license 1274 * Copyright 2020 Google LLC 1275 * 1276 * Licensed under the Apache License, Version 2.0 (the "License"); 1277 * you may not use this file except in compliance with the License. 1278 * You may obtain a copy of the License at 1279 * 1280 * http://www.apache.org/licenses/LICENSE-2.0 1281 * 1282 * Unless required by applicable law or agreed to in writing, software 1283 * distributed under the License is distributed on an "AS IS" BASIS, 1284 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1285 * See the License for the specific language governing permissions and 1286 * limitations under the License. 1287 */const Oc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/** 1288 * @license 1289 * Copyright 2017 Google LLC 1290 * 1291 * Licensed under the Apache License, Version 2.0 (the "License"); 1292 * you may not use this file except in compliance with the License. 1293 * You may obtain a copy of the License at 1294 * 1295 * http://www.apache.org/licenses/LICENSE-2.0 1296 * 1297 * Unless required by applicable law or agreed to in writing, software 1298 * distributed under the License is distributed on an "AS IS" BASIS, 1299 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1300 * See the License for the specific language governing permissions and 1301 * limitations under the License. 1302 */class Mc{constructor(t){this._o=t._o,this.ao=t.ao}uo(t){this.co=t}lo(t){this.ho=t}onMessage(t){this.Po=t}close(){this.ao()}send(t){this._o(t)}Io(){this.co()}To(t){this.ho(t)}Eo(t){this.Po(t)}}/** 1303 * @license 1304 * Copyright 2017 Google LLC 1305 * 1306 * Licensed under the Apache License, Version 2.0 (the "License"); 1307 * you may not use this file except in compliance with the License. 1308 * You may obtain a copy of the License at 1309 * 1310 * http://www.apache.org/licenses/LICENSE-2.0 1311 * 1312 * Unless required by applicable law or agreed to in writing, software 1313 * distributed under the License is distributed on an "AS IS" BASIS, 1314 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1315 * See the License for the specific language governing permissions and 1316 * limitations under the License. 1317 */const z="WebChannelConnection";class xc extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ao=r+"://"+n.host,this.Ro=`projects/${i}/databases/${s}`,this.Vo=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get mo(){return!1}fo(n,r,i,s,o){const a=rr(),l=this.po(n,r);_("RestConnection",`Sending RPC '${n}' ${a}:`,l,i);const u={"google-cloud-resource-prefix":this.Ro,"x-goog-request-params":this.Vo};return this.yo(u,s,o),this.wo(n,l,u,i).then(h=>(_("RestConnection",`Received RPC '${n}' ${a}: `,h),h),h=>{throw hn("RestConnection",`RPC '${n}' ${a} failed with error: `,h,"url: ",l,"request:",i),h})}So(n,r,i,s,o,a){return this.fo(n,r,i,s,o)}yo(n,r,i){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+ee}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEac
1317h((s,o)=>n[o]=s),i&&i.headers.forEach((s,o)=>n[o]=s)}po(n,r){const i=Oc[n];return`${this.Ao}/v1/${r}:${i}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}wo(t,n,r,i){const s=rr();return new Promise((o,a)=>{const l=new Yu;l.setWithCredentials(!0),l.listenOnce(Wu.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case nr.NO_ERROR:const h=l.getResponseJson();_(z,`XHR for RPC '${t}' ${s} received:`,JSON.stringify(h)),o(h);break;case nr.TIMEOUT:_(z,`RPC '${t}' ${s} timed out`),a(new y(f.DEADLINE_EXCEEDED,"Request time out"));break;case nr.HTTP_ERROR:const c=l.getStatus();if(_(z,`RPC '${t}' ${s} failed with status:`,c,"response text:",l.getResponseText()),c>0){let g=l.getResponseJson();Array.isArray(g)&&(g=g[0]);const m=g==null?void 0:g.error;if(m&&m.status&&m.message){const w=function(P){const Y=P.toLowerCase().replace(/_/g,"-");return Object.values(f).indexOf(Y)>=0?Y:f.UNKNOWN}(m.status);a(new y(w,m.message))}else a(new y(f.UNKNOWN,"Server responded with status "+l.getStatus()))}else a(new y(f.UNAVAILABLE,"Connection failed."));break;default:T()}}finally{_(z,`RPC '${t}' ${s} completed.`)}});const u=JSON.stringify(i);_(z,`RPC '${t}' ${s} sending request:`,i),l.send(n,"POST",u,r,15)})}bo(t,n,r){const i=rr(),s=[this.Ao,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=Ku(),a=Qu(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(l.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(l.useFetchStreams=!0),this.yo(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const h=s.join("");_(z,`Creating RPC '${t}' stream ${i}: ${h}`,l);const c=o.createWebChannel(h,l);let g=!1,m=!1;const w=new Mc({_o:P=>{m?_(z,`Not sending because RPC '${t}' stream ${i} is closed:`,P):(g||(_(z,`Opening RPC '${t}' stream ${i} transport.`),c.open(),g=!0),_(z,`RPC '${t}' stream ${i} sending:`,P),c.send(P))},ao:()=>c.close()}),D=(P,Y,nt)=>{P.listen(Y,_t=>{try{nt(_t)}catch(Pt){setTimeout(()=>{throw Pt},0)}})};return D(c,Ge.EventType.OPEN,()=>{m||_(z,`RPC '${t}' stream ${i} transport opened.`)}),D(c,Ge.EventType.CLOSE,()=>{m||(m=!0,_(z,`RPC '${t}' stream ${i} transport closed`),w.To())}),D(c,Ge.EventType.ERROR,P=>{m||(m=!0,hn(z,`RPC '${t}' stream ${i} transport errored:`,P),w.To(new y(f.UNAVAILABLE,"The operation could not be completed")))}),D(c,Ge.EventType.MESSAGE,P=>{var Y;if(!m){const nt=P.data[0];U(!!nt);const _t=nt,Pt=_t.error||((Y=_t[0])===null||Y===void 0?void 0:Y.error);if(Pt){_(z,`RPC '${t}' stream ${i} received error:`,Pt);const gi=Pt.status;let Hn=function(Ta){const _i=O[Ta];if(_i!==void 0)return Jh(_i)}(gi),mi=Pt.message;Hn===void 0&&(Hn=f.INTERNAL,mi="Unknown error status: "+gi+" with message "+Pt.message),m=!0,w.To(new y(Hn,mi)),c.close()}else _(z,`RPC '${t}' stream ${i} received:`,nt),w.Eo(nt)}}),D(a,Xu.STAT_EVENT,P=>{P.stat===Ui.PROXY?_(z,`RPC '${t}' stream ${i} detected buffering proxy`):P.stat===Ui.NOPROXY&&_(z,`RPC '${t}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{w.Io()},0),w}}function ir(){return typeof document<"u"?document:null}/** 1318 * @license 1319 * Copyright 2020 Google LLC 1320 * 1321 * Licensed under the Apache License, Version 2.0 (the "License"); 1322 * you may not use this file except in compliance with the License. 1323 * You may obtain a copy of the License at 1324 * 1325 * http://www.apache.org/licenses/LICENSE-2.0 1326 * 1327 * Unless required by applicable law or agreed to in writing, software 1328 * distributed under the License is distributed on an "AS IS" BASIS, 1329 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1330 * See the License for the specific language governing permissions and 1331 * limitations under the License. 1332 */function Un(e){return new Zh(e,!0)}/** 1333 * @license 1334 * Copyright 2017 Google LLC 1335 * 1336 * Licensed under the Apache License, Version 2.0 (the "License");
1337 * you may not use this file except in compliance with the License. 1338 * You may obtain a copy of the License at 1339 * 1340 * http://www.apache.org/licenses/LICENSE-2.0 1341 * 1342 * Unless required by applicable law or agreed to in writing, software 1343 * distributed under the License is distributed on an "AS IS" BASIS, 1344 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1345 * See the License for the specific language governing permissions and 1346 * limitations under the License. 1347 */class ea{constructor(t,n,r=1e3,i=1.5,s=6e4){this.oi=t,this.timerId=n,this.Do=r,this.vo=i,this.Co=s,this.Fo=0,this.Mo=null,this.xo=Date.now(),this.reset()}reset(){this.Fo=0}Oo(){this.Fo=this.Co}No(t){this.cancel();const n=Math.floor(this.Fo+this.Bo()),r=Math.max(0,Date.now()-this.xo),i=Math.max(0,n-r);i>0&&_("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Fo} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.Mo=this.oi.enqueueAfterDelay(this.timerId,i,()=>(this.xo=Date.now(),t())),this.Fo*=this.vo,this.Fo<this.Do&&(this.Fo=this.Do),this.Fo>this.Co&&(this.Fo=this.Co)}Lo(){this.Mo!==null&&(this.Mo.skipDelay(),this.Mo=null)}cancel(){this.Mo!==null&&(this.Mo.cancel(),this.Mo=null)}Bo(){return(Math.random()-.5)*this.Fo}}/** 1348 * @license 1349 * Copyright 2017 Google LLC 1350 * 1351 * Licensed under the Apache License, Version 2.0 (the "License"); 1352 * you may not use this file except in compliance with the License. 1353 * You may obtain a copy of the License at 1354 * 1355 * http://www.apache.org/licenses/LICENSE-2.0 1356 * 1357 * Unless required by applicable law or agreed to in writing, software 1358 * distributed under the License is distributed on an "AS IS" BASIS, 1359 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1360 * See the License for the specific language governing permissions and 1361 * limitations under the License. 1362 */class Fc{constructor(t,n,r,i,s,o,a,l){this.oi=t,this.ko=r,this.qo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.Qo=0,this.Ko=null,this.$o=null,this.stream=null,this.Uo=new ea(t,n)}Wo(){return this.state===1||this.state===5||this.Go()}Go(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.zo()}async stop(){this.Wo()&&await this.close(0)}jo(){this.state=0,this.Uo.reset()}Ho(){this.Go()&&this.Ko===null&&(this.Ko=this.oi.enqueueAfterDelay(this.ko,6e4,()=>this.Jo()))}Yo(t){this.Zo(),this.stream.send(t)}async Jo(){if(this.Go())return this.close(0)}Zo(){this.Ko&&(this.Ko.cancel(),this.Ko=null)}
1362Xo(){this.$o&&(this.$o.cancel(),this.$o=null)}async close(t,n){this.Zo(),this.Xo(),this.Uo.cancel(),this.Qo++,t!==4?this.Uo.reset():n&&n.code===f.RESOURCE_EXHAUSTED?(Mt(n.toString()),Mt("Using maximum backoff delay to prevent overloading the backend."),this.Uo.Oo()):n&&n.code===f.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.e_(),this.stream.close(),this.stream=null),this.state=t,await this.listener.lo(n)}e_(){}auth(){this.state=1;const t=this.t_(this.Qo),n=this.Qo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.Qo===n&&this.n_(r,i)},r=>{t(()=>{const i=new y(f.UNKNOWN,"Fetching auth token failed: "+r.message);return this.r_(i)})})}n_(t,n){const r=this.t_(this.Qo);this.stream=this.i_(t,n),this.stream.uo(()=>{r(()=>(this.state=2,this.$o=this.oi.enqueueAfterDelay(this.qo,1e4,()=>(this.Go()&&(this.state=3),Promise.resolve())),this.listener.uo()))}),this.stream.lo(i=>{r(()=>this.r_(i))}),this.stream.onMessage(i=>{r(()=>this.onMessage(i))})}zo(){this.state=5,this.Uo.No(async()=>{this.state=0,this.start()})}r_(t){return _("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}t_(t){return n=>{this.oi.enqueueAndForget(()=>this.Qo===t?n():(_("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Lc extends Fc{constructor(t,n,r,i,s,o){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s,this.a_=!1}get u_(){return this.a_}start(){this.a_=!1,this.lastStreamToken=void 0,super.start()}e_(){this.a_&&this.c_([])}i_(t,n){return this.connection.bo("Write",t,n)}onMessage(t){if(U(!!t.streamToken),this.lastStreamToken=t.streamToken,this.a_){this.Uo.reset();const n=ac(t.writeResults,t.commitTime),r=Ht(t.commitTime);return this.listener.l_(r,n)}return U(!t.writeResults||t.writeResults.length===0),this.a_=!0,this.listener.h_()}P_(){const t={};t.database=ic(this.serializer),this.Yo(t)}c_(t){const n={streamToken:this.lastStreamToken,writes:t.map(r=>oc(this.serializer,r))};this.Yo(n)}}/** 1363 * @license 1364 * Copyright 2017 Google LLC 1365 * 1366 * Licensed under the Apache License, Version 2.0 (the "License"); 1367 * you may not use this file except in compliance with the License. 1368 * You may obtain a copy of the License at 1369 * 1370 * http://www.apache.org/licenses/LICENSE-2.0 1371 * 1372 * Unless required by applicable law or agreed to in writing, software 1373 * distributed under the License is distributed on an "AS IS" BASIS, 1374 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1375 * See the License for the specific language governing permissions and 1376 * limitations under the License. 1377 */class Uc extends class{}{constructor(t,n,r,i){super(),this.authCredentials=t,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.I_=!1}T_(){if(this.I_)throw new y(f.FAILED_PRECONDITION,"The client has already been terminated.")}fo(t,n,r){return this.T_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.fo(t,n,r,i,s)).catch(i=>{throw i.name==="FirebaseError"?(i.code===f.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new y(f.UNKNOWN,i.toString())})}So(t,n,r,i){return this.T_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.So(t,n,r,s,o,i)).catch(s=>{throw s.name==="FirebaseError"?(s.code===f.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new y(f.UNKNOWN,s.toString())})}terminate(){this.I_=!0}}class Bc{constructor(t,n){this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.d_=0,this.A_=null,this.R_=!0}V_(){this.d_===0&&(this.m_("Unknown"),this.A_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.A_=null,this.f_("Backend didn't respond within 10 seconds."),this.m_("Offline"),Promise.resolve())))}g_(t){this.state==="Online"?this.m_("Unknown"):(this.d_++,this.d_>=1&&(this.p_(),this.f_(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.m_("Offline")))}set(t){this.p_(),this.d_=0,t==="Online"&&(this.R_=!1),this.m_(t)}m_(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}f_(t){const n=`Could not reach Cloud Firestore backend. ${t} 1378This 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.R_?(Mt(n),this.R_=!1):_("OnlineStateTracker",n)}p_(){this.A_!==null&&(this.A_.cancel(),this.A_=null)}}/** 1379 * @license 1380 * Copyright 2017 Google LLC 1381 * 1382 * Licensed under the Apache License, Version 2.0 (the "License");
1383 * you may not use this file except in compliance with the License. 1384 * You may obtain a copy of the License at 1385 * 1386 * http://www.apache.org/licenses/LICENSE-2.0 1387 * 1388 * Unless required by applicable law or agreed to in writing, software 1389 * distributed under the License is distributed on an "AS IS" BASIS, 1390 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1391 * See the License for the specific language governing permissions and 1392 * limitations under the License. 1393 */class jc{constructor(t,n,r,i,s){this.localStore=t,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.y_=[],this.w_=new Map,this.S_=new Set,this.b_=[],this.D_=s,this.D_.Xs(o=>{r.enqueueAndForget(async()=>{je(this)&&(_("RemoteStore","Restarting streams for network reachability change."),await async function(l){const u=V(l);u.S_.add(4),await Be(u),u.v_.set("Unknown"),u.S_.delete(4),await Bn(u)}(this))})}),this.v_=new Bc(r,i)}}async function Bn(e){if(je(e))for(const t of e.b_)await t(!0)}async function Be(e){for(const t of e.b_)await t(!1)}function je(e){return V(e).S_.size===0}async function na(e,t,n){if(!Mn(t))throw t;e.S_.add(1),await Be(e),e.v_.set("Offline"),n||(n=()=>Dc(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{_("RemoteStore","Retrying IndexedDB access"),await n(),e.S_.delete(1),await Bn(e)})}function ra(e,t){return t().catch(n=>na(e,n,t))}async function jn(e){const t=V(e),n=At(t);let r=t.y_.length>0?t.y_[t.y_.length-1].batchId:-1;for(;$c(t);)try{const i=await Nc(t.localStore,r);if(i===null){t.y_.length===0&&n.Ho();break}r=i.batchId,qc(t,i)}catch(i){await na(t,i)}ia(t)&&sa(t)}function $c(e){return je(e)&&e.y_.length<10}function qc(e,t){e.y_.push(t);const n=At(e);n.Go()&&n.u_&&n.c_(t.mutations)}function ia(e){return je(e)&&!At(e).Wo()&&e.y_.length>0}function sa(e){At(e).start()}async function Hc(e){At(e).P_()}async function zc(e){const t=At(e);for(const n of e.y_)t.c_(n.mutations)}async function Gc(e,t,n){const r=e.y_.shift(),i=ai.from(r,t,n);await ra(e,()=>e.remoteSyncer.applySuccessfulWrite(i)),await jn(e)}async function Kc(e,t){t&&At(e).u_&&await async function(r,i){if(function(o){return Yh(o)&&o!==f.ABORTED}(i.code)){const s=r.y_.shift();At(r).jo(),await ra(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await jn(r)}}(e,t),ia(e)&&sa(e)}async function rs(e,t){const n=V(e);n.asyncQueue.verifyOperationInProgress(),_("RemoteStore","RemoteStore received new credentials");const r=je(n);n.S_.add(3),await Be(n),r&&n.v_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.S_.delete(3),await Bn(n)}async function Qc(e,t){const n=V(e);t?(n.S_.delete(2),await Bn(n)):t||(n.S_.add(2),await Be(n),n.v_.set("Unknown"))}function At(e){return e.M_||(e.M_=function(n,r,i){const s=V(n);return s.T_(),new Lc(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(e.datastore,e.asyncQueue,{uo:Hc.bind(null,e),lo:Kc.bind(null,e),h_:zc.bind(null,e),l_:Gc.bind(null,e)}),e.b_.push(async t=>{t?(e.M_.jo(),await jn(e)):(await e.M_.stop(),e.y_.length>0&&(_("RemoteStore",`Stopping write stream with ${e.y_.length} pending writes`),e.y_=[]))})),e.M_}/** 1394 * @license 1395 * Copyright 2017 Google LLC 1396 * 1397 * Licensed under the Apache License, Version 2.0 (the "License"); 1398 * you may not use this file except in compliance with the License. 1399 * You may obtain a copy of the License at 1400 * 1401 * http://www.apache.org/licenses/LICENSE-2.0 1402 * 1403 * Unless required by applicable law or agreed to in writing, software 1404 * distributed under the License is distributed on an "AS IS" BASIS, 1405 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1406 * See the License for the specific language governing permissions and 1407 * limitations under the License. 1408 */class ci{constructor(t,n,r,i,s){this.asyncQueue=t,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new bt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}static createAndSchedule(t,n,r,i,s){const o=Date.now()+r,a=new ci(t,n,o,i,s);return a.start(r),a}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new y(f.CANCELLED,"Operation cancelled"+(t?": "+t:"")))
1408)}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function oa(e,t){if(Mt("AsyncQueue",`${t}: ${e}`),Mn(e))return new y(f.UNAVAILABLE,`${t}: ${e}`);throw e}class Wc{constructor(){this.queries=new ne(t=>Uo(t),Lo),this.onlineState="Unknown",this.B_=new Set}}function Xc(e){e.B_.forEach(t=>{t.next()})}class Yc{constructor(t,n,r,i,s,o){this.localStore=t,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.da={},this.Aa=new ne(a=>Uo(a),Lo),this.Ra=new Map,this.Va=new Set,this.ma=new tt(v.comparator),this.fa=new Map,this.ga=new li,this.pa={},this.ya=new Map,this.wa=Yt.Bn(),this.onlineState="Unknown",this.Sa=void 0}get isPrimaryClient(){return this.Sa===!0}}async function Jc(e,t,n){const r=nf(e);try{const i=await function(o,a){const l=V(o),u=F.now(),h=a.reduce((m,w)=>m.add(w.key),K());let c,g;return l.persistence.runTransaction("Locally write mutations","readwrite",m=>{let w=gn(),D=K();return l.ts.getEntries(m,h).next(P=>{w=P,w.forEach((Y,nt)=>{nt.isValidDocument()||(D=D.add(Y))})}).next(()=>l.localDocuments.getOverlayedDocuments(m,w)).next(P=>{c=P;const Y=[];for(const nt of a){const _t=Kh(nt,c.get(nt.key).overlayedDocument);_t!=null&&Y.push(new Lt(nt.key,_t,No(_t.value.mapValue),pt.exists(!0)))}return l.mutationQueue.addMutationBatch(m,u,Y,a)}).next(P=>{g=P;const Y=P.applyToLocalDocumentSet(c,D);return l.documentOverlayCache.saveOverlays(m,P.batchId,Y)})}).then(()=>({batchId:g.batchId,changes:jo(c)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,l){let u=o.pa[o.currentUser.toKey()];u||(u=new tt(S)),u=u.insert(a,l),o.pa[o.currentUser.toKey()]=u}(r,i.batchId,n),await $n(r,i.changes),await jn(r.remoteStore)}catch(i){const s=oa(i,"Failed to persist write");n.reject(s)}}function is(e,t,n){const r=V(e);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Aa.forEach((s,o)=>{const a=o.view.L_(t);a.snapshot&&i.push(a.snapshot)}),function(o,a){const l=V(o);l.onlineState=a;let u=!1;l.queries.forEach((h,c)=>{for(const g of c.listeners)g.L_(a)&&(u=!0)}),u&&Xc(l)}(r.eventManager,t),i.length&&r.da.s_(i),r.onlineState=t,r.isPrimaryClient&&r.sharedCl
1408ientState.setOnlineState(t)}}async function Zc(e,t){const n=V(e),r=t.batch.batchId;try{const i=await Vc(n.localStore,t);la(n,r,null),aa(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await $n(n,i)}catch(i){await So(i)}}async function tf(e,t,n){const r=V(e);try{const i=await function(o,a){const l=V(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let h;return l.mutationQueue.lookupMutationBatch(u,a).next(c=>(U(c!==null),h=c.keys(),l.mutationQueue.removeMutationBatch(u,c))).next(()=>l.mutationQueue.performConsistencyCheck(u)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(u,h,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,h)).next(()=>l.localDocuments.getDocuments(u,h))})}(r.localStore,t);la(r,t,n),aa(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await $n(r,i)}catch(i){await So(i)}}function aa(e,t){(e.ya.get(t)||[]).forEach(n=>{n.resolve()}),e.ya.delete(t)}function la(e,t,n){const r=V(e);let i=r.pa[r.currentUser.toKey()];if(i){const s=i.get(t);s&&(n?s.reject(n):s.resolve(),i=i.remove(t)),r.pa[r.currentUser.toKey()]=i}}async function $n(e,t,n){const r=V(e),i=[],s=[],o=[];r.Aa.isEmpty()||(r.Aa.forEach((a,l)=>{o.push(r.ba(l,t,n).then(u=>
1408{if((u||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(l.targetId,u!=null&&u.fromCache?"not-current":"current"),u){i.push(u);const h=hi.Ki(l.targetId,u);s.push(h)}}))}),await Promise.all(o),r.da.s_(i),await async function(l,u){const h=V(l);try{await h.persistence.runTransaction("notifyLocalViewChanges","readwrite",c=>d.forEach(u,g=>d.forEach(g.qi,m=>h.persistence.referenceDelegate.addReference(c,g.targetId,m)).next(()=>d.forEach(g.Qi,m=>h.persistence.referenceDelegate.removeReference(c,g.targetId,m)))))}catch(c){if(!Mn(c))throw c;_("LocalStore","Failed to update sequence numbers: "+c)}for(const c of u){const g=c.targetId;if(!c.fromCache){const m=h.Zi.get(g),w=m.snapshotVersion,D=m.withLastLimboFreeSnapshotVersion(w);h.Zi=h.Zi.insert(g,D)}}}(r.localStore,s))}async function ef(e,t){const n=V(e);if(!n.currentUser.isEqual(t)){_("SyncEngine","User change. New user:",t.toKey());const r=await ta(n.localStore,t);n.currentUser=t,function(s,o){s.ya.forEach(a=>{a.forEach(l=>{l.reject(new y(f.CANCELLED,o))})}),s.ya.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,r.removedBatchIds,r.addedBatchIds),await $n(n,r.rs)}}function nf(e){const t=V(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Zc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=tf.bind(null,t),t}class ss{constructor(){this.synchronizeTabs=!1}async initialize(t){this.serializer=Un(t.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(t),this.persistence=this.createPersistence(t),await this.persistence.start(),this.localStore=this.createLocalStore(t),this.gcScheduler=this.createGarbageCollectionScheduler(t,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(t,this.localStore)}createGarbageCollectionScheduler(t,n){return null}createIndexBackfillerScheduler(t,n){return null}createLocalStore(t){return Cc(this.persistence,new Pc,t.initialUser,this.serializer)}createPersistence(t){return new wc(ui.Hr,this.serializer)}createSharedClientState(t){return new bc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class rf{async initialize(t,n){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>is(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=ef.bind(null,this.syncEngine),await Qc(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return function(){return new Wc}()}createDatastore(t){const n=Un(t.databaseInfo.databaseId),r=function(s){return new xc(s)}(t.databaseInfo);return function(s,o,a,l){return new Uc(s,o,a,l)}(t.authCredentials,t.appCheckCredentials,r,n)}createRemoteStore(t){return function(r,i,s,o,a){return new jc(r,i,s,o,a)}(this.localStore,this.datastore,t.asyncQueue,n=>is(this.syncEngine,n,0),function(){return ns.v()?new ns:new kc}())}createSyncEngine(t,n){return function(i,s,o,a,l,u,h){const c=new Yc(i,s,o,a,l,u);return h&&(c.Sa=!0),c}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,n)}terminate(){return async function(n){const r=V(n);_("RemoteStore","RemoteStore shutting down."),r.S_.add(5),await Be(r),r.D_.shutdown(),r.v_.set("Unknown")}(this.remoteStore)}}/** 1409 * @license 1410 * Copyright 2017 Google LLC 1411 * 1412 * Licensed under the Apache License, Version 2.0 (the "License"); 1413 * you may not use this file except in compliance with the License. 1414 * You may obtain a copy of the License at 1415 * 1416 * http://www.apache.org/licenses/LICENSE-2.0 1417 * 1418 * Unless required by applicable law or agreed to in writing, software 1419 * distributed under the License is distributed on an "AS IS" BASIS, 1420 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1421 * See the License for the specific language governing permissions and 1422 * limitations under the License. 1423 */class sf{constructor(t,n,r,i){this.authCredentials=t,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=G.UNAUTHENTICATED,this.clientId=Po.V(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async s=>{_("FirestoreClient","Received user=",s.uid),await this.authCredentialListener(s),this.user=s}),this.appCheckCredentials.start(r,s=>
1423(_("FirestoreClient","Received new app check token=",s),this.appCheckCredentialListener(s,this.user)))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new y(f.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new bt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(n){const r=oa(n,"Failed to shutdown persistence");t.reject(r)}}),t.promise}}async function sr(e,t){e.asyncQueue.verifyOperationInProgress(),_("FirestoreClient","Initializing OfflineComponentProvider");const n=await e.getConfiguration();await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async i=>{r.isEqual(i)||(await ta(t.localStore,i),r=i)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function os(e,t){e.asyncQueue.verifyOperationInProgress();const n=await af(e);_("FirestoreClient","Initializing OnlineComponentProvider");const r=await e.getConfiguration();await t.initialize(n,r),e.setCredentialChangeListener(i=>rs(t.remoteStore,i)),e.setAppCheckTokenChangeListener((i,s)=>rs(t.remoteStore,s)),e._onlineComponents=t}function of(e){return e.name==="FirebaseError"?e.code===f.FAILED_PRECONDITION||e.code===f.UNIMPLEMENTED:!(typeof DOMException<"u"&&e instanceof DOMException)||e.code===22||e.code===20||e.code===11}async function af(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){_("FirestoreClient","Using user provided OfflineComponentProvider");try{await sr(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!of(n))throw n;hn("Error using user provided cache. Falling back to memory cache: "+n),await sr(e,new ss)}}else _("FirestoreClient","Using default OfflineComponentProvider"),await sr(e,new ss);return e._offlineComponents}async function lf(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(_("FirestoreClient","Using user provided OnlineComponentProvider"),await os(e,e._uninitializedComponentsProvider._online)):(_("FirestoreClient","Using default OnlineComponentProvider"),await os(e,new rf))),e._onlineComponents}function uf(e){return lf(e).then(t=>t.syncEngine)}/** 1424 * @license 1425 * Copyright 2023 Google LLC 1426 * 1427 * Licensed under the Apache License, Version 2.0 (the "License"); 1428 * you may not use this file except in compliance with the License. 1429 * You may obtain a copy of the License at 1430 * 1431 * http://www.apache.org/licenses/LICENSE-2.0 1432 * 1433 * Unless required by applicable law or agreed to in writing, software 1434 * distributed under the License is distributed on an "AS IS" BASIS, 1435 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1436 * See the License for the specific language governing permissions and 1437 * limitations under the License. 1438 */function ua(e){const t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}/** 1439 * @license 1440 * Copyright 2020 Google LLC 1441 * 1442 * Licensed under the Apache License, Version 2.0 (the "License"); 1443 * you may not use this file except in compliance with the License. 1444 * You may obtain a copy of the License at 1445 * 1446 * http://www.apache.org/licenses/LICENSE-2.0 1447 * 1448 * Unless required by applicable law or agreed to in writing, software 1449 * distributed under the License is distributed on an "AS IS" BASIS, 1450 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1451 * See the License for the specific language governing permissions and 1452 * limitations under the License. 1453 */const as=new Map;/** 1454 * @license 1455 * Copyright 2017 Google LLC 1456 * 1457 * Licensed under the Apache License, Version 2.0 (the "License");
1458 * you may not use this file except in compliance with the License. 1459 * You may obtain a copy of the License at 1460 * 1461 * http://www.apache.org/licenses/LICENSE-2.0 1462 * 1463 * Unless required by applicable law or agreed to in writing, software 1464 * distributed under the License is distributed on an "AS IS" BASIS, 1465 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1466 * See the License for the specific language governing permissions and 1467 * limitations under the License. 1468 */function ha(e,t,n){if(!n)throw new y(f.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function hf(e,t,n,r){if(t===!0&&r===!0)throw new y(f.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function ls(e){if(!v.isDocumentKey(e))throw new y(f.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function us(e){if(v.isDocumentKey(e))throw new y(f.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function fi(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return""+e;if(typeof e=="object"){if(e instanceof Array)return"an array";{const t=function(r){return r.constructor?r.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return typeof e=="function"?"a function":T()}function Dr(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new y(f.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=fi(e);throw new y(f.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}/** 1469 * @license 1470 * Copyright 2020 Google LLC 1471 * 1472 * Licensed under the Apache License, Version 2.0 (the "License"); 1473 * you may not use this file except in compliance with the License. 1474 * You may obtain a copy of the License at 1475 * 1476 * http://www.apache.org/licenses/LICENSE-2.0 1477 * 1478 * Unless required by applicable law or agreed to in writing, software 1479 * distributed under the License is distributed on an "AS IS" BASIS, 1480 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1481 * See the License for the specific language governing permissions and 1482 * limitations under the License. 1483 */class hs{constructor(t){var n,r;if(t.host===void 0){if(t.ssl!==void 0)throw new y(f.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=(n=t.ssl)===null||n===void 0||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(t.cacheSizeBytes!==-1&&t.cacheSizeBytes<1048576)throw new y(f.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}hf("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:t.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=ua((r=t.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new y(f.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new y(f.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new y(f.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class qn{constructor(t,n,r,i){this._authCredentials=t,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new hs({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new y(f.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!==void 0}_setSettings(t){if(this._settingsFrozen)throw new y(f.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new hs(t),t.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new Zu;switch(r.type){case"firstParty":return new rh(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new y(f.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
1483d credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=as.get(n);r&&(_("ComponentProvider","Removing Datastore"),as.delete(n),r.terminate())}(this),Promise.resolve()}}function cf(e,t,n,r={}){var i;const s=(e=Dr(e,qn))._getSettings(),o=`${t}:${n}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&hn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),r.mockUserToken){let a,l;if(typeof r.mockUserToken=="string")a=r.mockUserToken,l=G.MOCK_USER;else{a=ka(r.mockUserToken,(i=e._app)===null||i===void 0?void 0:i.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new y(f.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new G(u)}e._authCredentials=new th(new Ro(a,l))}}/** 1484 * @license 1485 * Copyright 2020 Google LLC 1486 * 1487 * Licensed under the Apache License, Version 2.0 (the "License"); 1488 * you may not use this file except in compliance with the License. 1489 * You may obtain a copy of the License at 1490 * 1491 * http://www.apache.org/licenses/LICENSE-2.0 1492 * 1493 * Unless required by applicable law or agreed to in writing, software 1494 * distributed under the License is distributed on an "AS IS" BASIS, 1495 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1496 * See the License for the specific language governing permissions and 1497 * limitations under the License. 1498 */class di{constructor(t,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=t}withConverter(t){return new di(this.firestore,t,this._query)}}class ht{constructor(t,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new vt(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ht(this.firestore,t,this._key)}}class vt extends di{constructor(t,n,r){super(t,n,Vh(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ht(this.firestore,null,new v(t))}withConverter(t){return new vt(this.firestore,t,this._path)}}function ff(e,t,...n){if(e=de(e),ha("collection","path",t),e instanceof qn){const r=b.fromString(t,...n);return us(r),new vt(e,null,r)}{if(!(e instanceof ht||e instanceof vt))throw new y(f.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(b.fromString(t,...n));return us(r),new vt(e.firestore,null,r)}}function Ff(e,t,...n){if(e=de(e),arguments.length===1&&(t=Po.V()),ha("doc","path",t),e instanceof qn){const r=b.fromString(t,...n);return ls(r),new ht(e,null,new v(r))}{if(!(e instanceof ht||e instanceof vt))throw new y(f.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(b.fromString(t,...n));return ls(r),new ht(e.firestore,e instanceof vt?e.converter:null,new v(r))}}/** 1499 * @license 1500 * Copyright 2020 Google LLC 1501 * 1502 * Licensed under the Apache License, Version 2.0 (the "License"); 1503 * you may not use this file except in compliance with the License. 1504 * You may obtain a copy of the License at 1505 * 1506 * http://www.apache.org/licenses/LICENSE-2.0 1507 * 1508 * Unless required by applicable law or agreed to in writing, software 1509 * distributed under the License is distributed on an "AS IS" BASIS, 1510 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1511 * See the License for the specific language governing permissions and 1512 * limitations under the License. 1513 */class df{constructor(){this.za=Promise.resolve(),this.ja=[],this.Ha=!1,this.Ja=[],this.Ya=null,this.Za=!1,this.Xa=!1,this.eu=[],this.Uo=new ea(this,"async_queue_retry"),this.tu=()=>{const n=ir();n&&_("AsyncQueue","Visibility state changed to "+n.visibilityState),this.Uo.Lo()};const t=ir();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.tu)}get isShuttingDown(){return this.Ha}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.nu(),this.ru(t)}enterRestrictedMode(t){if(!this.Ha){this.Ha=!0,this.Xa=t||!1;const n=ir();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.tu)}}enqueue(t){if(this.nu(),this.Ha)return new Promise(()=>{});const n=new bt;return this.ru(()=>this.Ha&&this.Xa?Promise.resolve():(t().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.ja.push(t),this.iu()))}
1513async iu(){if(this.ja.length!==0){try{await this.ja[0](),this.ja.shift(),this.Uo.reset()}catch(t){if(!Mn(t))throw t;_("AsyncQueue","Operation failed with retryable error: "+t)}this.ja.length>0&&this.Uo.No(()=>this.iu())}}ru(t){const n=this.za.then(()=>(this.Za=!0,t().catch(r=>{this.Ya=r,this.Za=!1;const i=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+` 1514`+o.stack),a}(r);throw Mt("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.Za=!1,r))));return this.za=n,n}enqueueAfterDelay(t,n,r){this.nu(),this.eu.indexOf(t)>-1&&(n=0);const i=ci.createAndSchedule(this,t,n,r,s=>this.su(s));return this.Ja.push(i),i}nu(){this.Ya&&T()}verifyOperationInProgress(){}async ou(){let t;do t=this.za,await t;while(t!==this.za)}_u(t){for(const n of this.Ja)if(n.timerId===t)return!0;return!1}au(t){return this.ou().then(()=>{this.Ja.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.Ja)if(n.skipDelay(),t!=="all"&&n.timerId===t)break;return this.ou()})}uu(t){this.eu.push(t)}su(t){const n=this.Ja.indexOf(t);this.Ja.splice(n,1)}}class ca extends qn{constructor(t,n,r,i){super(t,n,r,i),this.type="firestore",this._queue=function(){return new df}(),this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||fa(this),this._firestoreClient.terminate()}}function pf(e,t){const n=typeof e=="object"?e:Fl(),r=typeof e=="string"?e:t||"(default)",i=kl(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=Na("firestore");s&&cf(i,...s)}return i}function gf(e){return e._firestoreClient||fa(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function fa(e){var t,n,r;const i=e._freezeSettings(),s=function(a,l,u,h){return new mh(a,l,u,h.host,h.ssl,h.experimentalForceLongPolling,h.experimentalAutoDetectLongPolling,ua(h.experimentalLongPollingOptions),h.useFetchStreams)}(e._databaseId,((t=e._app)===null||t===void 0?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new sf(e._authCredentials,e._appCheckCredentials,e._queue,s),!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}/** 1515 * @license 1516 * Copyright 2020 Google LLC 1517 * 1518 * Licensed under the Apache License, Version 2.0 (the "License"); 1519 * you may not use this file except in compliance with the License. 1520 * You may obtain a copy of the License at 1521 * 1522 * http://www.apache.org/licenses/LICENSE-2.0 1523 * 1524 * Unless required by applicable law or agreed to in writing, software 1525 * distributed under the License is distributed on an "AS IS" BASIS, 1526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1527 * See the License for the specific language governing permissions and 1528 * limitations under the License. 1529 */class Ve{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Ve(mt.fromBase64String(t))}catch(n){throw new y(f.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(t){return new Ve(mt.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}/** 1530 * @license 1531 * Copyright 2020 Google LLC 1532 * 1533 * Licensed under the Apache License, Version 2.0 (the "License"); 1534 * you may not use this file except in compliance with the License. 1535 * You may obtain a copy of the License at 1536 * 1537 * http://www.apache.org/licenses/LICENSE-2.0 1538 * 1539 * Unless required by applicable law or agreed to in writing, software 1540 * distributed under the License is distributed on an "AS IS" BASIS, 1541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1542 * See the License for the specific language governing permissions and 1543 * limitations under the License. 1544 */class da{constructor(...t){for(let n=0;n<t.length;++n)if(t[n].length===0)throw new y(f.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Q(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}/** 1545 * @license 1546 * Copyright 2020 Google LLC 1547 * 1548 * Licensed under the Apache License, Version 2.0 (the "License");
1549 * you may not use this file except in compliance with the License. 1550 * You may obtain a copy of the License at 1551 * 1552 * http://www.apache.org/licenses/LICENSE-2.0 1553 * 1554 * Unless required by applicable law or agreed to in writing, software 1555 * distributed under the License is distributed on an "AS IS" BASIS, 1556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1557 * See the License for the specific language governing permissions and 1558 * limitations under the License. 1559 */class pa{constructor(t){this._methodName=t}}/** 1560 * @license 1561 * Copyright 2017 Google LLC 1562 * 1563 * Licensed under the Apache License, Version 2.0 (the "License"); 1564 * you may not use this file except in compliance with the License. 1565 * You may obtain a copy of the License at 1566 * 1567 * http://www.apache.org/licenses/LICENSE-2.0 1568 * 1569 * Unless required by applicable law or agreed to in writing, software 1570 * distributed under the License is distributed on an "AS IS" BASIS, 1571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1572 * See the License for the specific language governing permissions and 1573 * limitations under the License. 1574 */class ga{constructor(t,n){if(!isFinite(t)||t<-90||t>90)throw new y(f.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new y(f.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return S(this._lat,t._lat)||S(this._long,t._long)}}/** 1575 * @license 1576 * Copyright 2017 Google LLC 1577 * 1578 * Licensed under the Apache License, Version 2.0 (the "License"); 1579 * you may not use this file except in compliance with the License. 1580 * You may obtain a copy of the License at 1581 * 1582 * http://www.apache.org/licenses/LICENSE-2.0 1583 * 1584 * Unless required by applicable law or agreed to in writing, software 1585 * distributed under the License is distributed on an "AS IS" BASIS, 1586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1587 * See the License for the specific language governing permissions and 1588 * limitations under the License. 1589 */const mf=/^__.*__$/;class _f{constructor(t,n,r){this.data=t,this.fieldMask=n,this.fieldTransforms=r}toMutation(t,n){return this.fieldMask!==null?new Lt(t,this.data,this.fieldMask,n,this.fieldTransforms):new Ue(t,this.data,n,this.fieldTransforms)}}function ma(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw T()}}class pi{constructor(t,n,r,i,s,o){this.settings=t,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.cu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get lu(){return this.settings.lu}hu(t){return new pi(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Pu(t){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(t),i=this.hu({path:r,Iu:!1});return i.Tu(t),i}Eu(t){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(t),i=this.hu({path:r,Iu:!1});return i.cu(),i}du(t){return this.hu({path:void 0,Iu:!0})}Au(t){return yn(t,this.settings.methodName,this.settings.Ru||!1,this.path,this.settings.Vu)}contains(t){return this.fieldMask.find(n=>t.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>t.isPrefixOf(n.field))!==void 0}cu(){if(this.path)for(let t=0;t<this.path.length;t++)this.Tu(this.path.get(t))}Tu(t){if(t.length===0)throw this.Au("Document fields must not be empty");if(ma(this.lu)&&mf.test(t))throw this.Au('Document fields cannot begin and end with "__"')}}class yf{constructor(t,n,r){this.databaseId=t,this.ignoreUndefinedProperties=n,this.serializer=r||Un(t)}mu(t,n,r,i=!1){return new pi({lu:t,methodName:n,Vu:r,path:Q.emptyPath(),Iu:!1,Ru:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Ef(e){const t=e._freezeSettings(),n=Un(e._databaseId);
1589return new yf(e._databaseId,!!t.ignoreUndefinedProperties,n)}function vf(e,t,n,r,i,s={}){const o=e.mu(s.merge||s.mergeFields?2:0,t,n,i);va("Data must be an object, but it was:",o,r);const a=ya(r,o);let l,u;if(s.merge)l=new ot(o.fieldMask),u=o.fieldTransforms;else if(s.mergeFields){const h=[];for(const c of s.mergeFields){const g=Tf(t,c,n);if(!o.contains(g))throw new y(f.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);wf(h,g)||h.push(g)}l=new ot(h),u=o.fieldTransforms.filter(c=>l.covers(c.field))}else l=null,u=o.fieldTransforms;return new _f(new st(a),l,u)}function _a(e,t){if(Ea(e=de(e)))return va("Unsupported field value:",t,e),ya(e,t);if(e instanceof pa)return function(r,i){if(!ma(i.lu))throw i.Au(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Au(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.Iu&&t.lu!==4)throw t.Au("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let l=_a(a,i.du(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(e,t)}return function(r,i){if((r=de(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return jh(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=F.fromDate(r);return{timestampValue:Cr(i.serializer,s)}}if(r instanceof F){const s=new F(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Cr(i.serializer,s)}}if(r instanceof ga)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Ve)return{bytesValue:tc(i.serializer,r._byteString)};if(r instanceof ht){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Au(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Jo(r.firestore._databaseId||i.databaseId,r._key.path)}}throw i.Au(`Unsupported field value: ${fi(r)}`)}(e,t)}function ya(e,t){const n={};return Vo(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Le(e,(r,i)=>{const s=_a(i,t.Pu(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function Ea(e){return!(typeof e!="object"||e===null||e instanceof Array||e instanceof Date||e instanceof F||e instanceof ga||e instanceof Ve||e instanceof ht||e instanceof pa)}function va(e,t,n){if(!Ea(n)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(n)){const r=fi(n);throw r==="an object"?t.Au(e+" a custom object"):t.Au(e+" "+r)}}function Tf(e,t,n){if((t=de(t))instanceof da)return t._internalPath;if(typeof t=="string")return Af(e,t);throw yn("Field path arguments must be of type string or ",e,!1,void 0,n)}const If=new RegExp("[~\\*/\\[\\]]");function Af(e,t,n){if(t.search(If)>=0)throw yn(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new da(...t.split("."))._internalPath}catch{throw yn(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function yn(e,t,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${r}`),o&&(l+=` in document ${i}`),l+=")"),new y(f.INVALID_ARGUMENT,a+e+l)}function wf(e,t){return e.some(n=>n.isEqual(t))}/** 1590 * @license 1591 * Copyright 2020 Google LLC 1592 * 1593 * Licensed under the Apache License, Version 2.0 (the "License"); 1594 * you may not use this file except in compliance with the License. 1595 * You may obtain a copy of the License at 1596 * 1597 * http://www.apache.org/licenses/LICENSE-2.0 1598 * 1599 * Unless required by applicable law or agreed to in writing, software 1600 * distributed under the License is distributed on an "AS IS" BASIS, 1601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1602 * See the License for the specific language governing permissions and 1603 * limitations under the License. 1604 */function Rf(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}function Lf(e,t,n){e=Dr(e,ht);const r=Dr(e.firestore,ca),i=Rf(e.converter,t,n);return Pf(r,[vf(Ef(r),"setDoc",e._key,i,e.converter!==null,n).toMutation(e._key,pt.none())])}function Pf(e,t){return function(r,i){const s=new bt;return r.asyncQueue.enqueueAndForget(async()=>Jc(await uf(r),i,s)),s.promise}(gf(e),t)}(function(t,n=!0){(function(i){ee=i})(xl),en(new pe("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new ca(new eh(r.getProvider("auth-internal")),new sh(r.getProvider("app-check-internal")),function(u,h){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new y(f.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new dn(u.options.projectId,h)}(o,i),o);return s=Object.assign({useFetchStreams:n},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),$t(Bi,"4.1.2",t),$t(Bi,"4.1.2","esm2017")})();var Sf="firebase",Cf="10.3.0";/** 1605 * @license 1606 * Copyright 2020 Google LLC 1607 * 1608 * Licensed under the Apache License, Version 2.0 (the "License");
1609 * you may not use this file except in compliance with the License. 1610 * You may obtain a copy of the License at 1611 * 1612 * http://www.apache.org/licenses/LICENSE-2.0 1613 * 1614 * Unless required by applicable law or agreed to in writing, software 1615 * distributed under the License is distributed on an "AS IS" BASIS, 1616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1617 * See the License for the specific language governing permissions and 1618 * limitations under the License. 1619 */$t(Sf,Cf,"app");const Vf={apiKey:"AIzaSyBwD3AM0XKRsHnA0YU-CKTSSD4xcfDu9wU",authDomain:"singularitylabs.firebaseapp.com",projectId:"singularitylabs",storageBucket:"singularitylabs.appspot.com",messagingSenderId:"1096660154086",appId:"1:1096660154086:web:ec1872e9ceb11dad686d27"},Df=Es(Vf),Nf=pf(Df),bf=e=>ff(Nf,e),Uf=bf("waitlist");export{Ff as d,Lf as s,Uf as w};
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.