@firebase/firestore 3.7.1 → 3.7.2-canary.457fc2eeb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,11 @@ import { Component as c } from "@firebase/component";
6
6
 
7
7
  import { Logger as l, LogLevel as h } from "@firebase/logger";
8
8
 
9
- import { FirebaseError as f, getUA as d, isSafari as p, getModularInstance as v, createMockUserToken as y, deepEqual as m, getDefaultEmulatorHostnameAndPort as g, isIndexedDBAvailable as w } from "@firebase/util";
9
+ import { FirebaseError as f, getUA as d, isSafari as p, getModularInstance as v, isIndexedDBAvailable as y, createMockUserToken as m, deepEqual as g, getDefaultEmulatorHostnameAndPort as w } from "@firebase/util";
10
10
 
11
- import { XhrIo as b, EventType as I, ErrorCode as E, createWebChannelTransport as T, getStatEventTarget as S, FetchXmlHttpFactory as D, WebChannel as _, Event as x, Stat as N } from "@firebase/webchannel-wrapper";
11
+ import { XhrIo as b, EventType as I, ErrorCode as T, createWebChannelTransport as E, getStatEventTarget as S, FetchXmlHttpFactory as D, WebChannel as x, Event as _, Stat as A } from "@firebase/webchannel-wrapper";
12
12
 
13
- var A = "@firebase/firestore", C = /** @class */ function() {
13
+ var N = "@firebase/firestore", C = /** @class */ function() {
14
14
  function t(t) {
15
15
  this.uid = t;
16
16
  }
@@ -70,7 +70,7 @@ C.MOCK_USER = new C("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- var k = "9.12.1", O = new l("@firebase/firestore");
73
+ var k = "9.13.0-canary.457fc2eeb", O = new l("@firebase/firestore");
74
74
 
75
75
  /**
76
76
  * @license
@@ -1128,7 +1128,7 @@ function gt(t, e) {
1128
1128
  /** The state of an index that has not yet been backfilled. */;
1129
1129
  }
1130
1130
  return t.empty = function() {
1131
- return new t(0, Et.min());
1131
+ return new t(0, Tt.min());
1132
1132
  }, t;
1133
1133
  }();
1134
1134
 
@@ -1143,17 +1143,17 @@ function gt(t, e) {
1143
1143
  // `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches
1144
1144
  // all valid document IDs.
1145
1145
  var n = t.toTimestamp().seconds, r = t.toTimestamp().nanoseconds + 1, i = st.fromTimestamp(1e9 === r ? new ut(n + 1, 0) : new ut(n, r));
1146
- return new Et(i, ft.empty(), e);
1146
+ return new Tt(i, ft.empty(), e);
1147
1147
  }
1148
1148
 
1149
1149
  /** Creates a new offset based on the provided document. */ function It(t) {
1150
- return new Et(t.readTime, t.key, -1);
1150
+ return new Tt(t.readTime, t.key, -1);
1151
1151
  }
1152
1152
 
1153
1153
  /**
1154
1154
  * Stores the latest read time, document and batch ID that were processed for an
1155
1155
  * index.
1156
- */ var Et = /** @class */ function() {
1156
+ */ var Tt = /** @class */ function() {
1157
1157
  function t(
1158
1158
  /**
1159
1159
  * The latest read time version that has been indexed by Firestore for this
@@ -1180,7 +1180,7 @@ function gt(t, e) {
1180
1180
  }, t;
1181
1181
  }();
1182
1182
 
1183
- function Tt(t, e) {
1183
+ function Et(t, e) {
1184
1184
  var n = t.readTime.compareTo(e.readTime);
1185
1185
  return 0 !== n ? n : 0 !== (n = ft.comparator(t.documentKey, e.documentKey)) ? n : rt(t.largestBatchId, e.largestBatchId);
1186
1186
  }
@@ -1247,7 +1247,7 @@ function Tt(t, e) {
1247
1247
  * @param err - An error returned by a LocalStore operation.
1248
1248
  * @returns A Promise that resolves after we recovered, or the original error.
1249
1249
  */
1250
- function _t(t) {
1250
+ function xt(t) {
1251
1251
  return e(this, void 0, void 0, (function() {
1252
1252
  return n(this, (function(e) {
1253
1253
  if (t.code !== K.FAILED_PRECONDITION || t.message !== St) throw t;
@@ -1284,7 +1284,7 @@ function _t(t) {
1284
1284
  *
1285
1285
  * NOTE: .then() and .catch() only allow a single consumer, unlike normal
1286
1286
  * Promises.
1287
- */ var xt = /** @class */ function() {
1287
+ */ var _t = /** @class */ function() {
1288
1288
  function t(t) {
1289
1289
  var e = this;
1290
1290
  // NOTE: next/catchCallback will always point to our own wrapper functions,
@@ -1409,7 +1409,7 @@ function _t(t) {
1409
1409
  i();
1410
1410
  }));
1411
1411
  }, t;
1412
- }(), Nt = /** @class */ function() {
1412
+ }(), At = /** @class */ function() {
1413
1413
  function t(t, e) {
1414
1414
  var n = this;
1415
1415
  this.action = t, this.transaction = e, this.aborted = !1,
@@ -1460,7 +1460,7 @@ function _t(t) {
1460
1460
  var e = this.transaction.objectStore(t);
1461
1461
  return new Rt(e);
1462
1462
  }, t;
1463
- }(), At = /** @class */ function() {
1463
+ }(), Nt = /** @class */ function() {
1464
1464
  /*
1465
1465
  * Creates a new SimpleDb wrapper for IndexedDb database `name`.
1466
1466
  *
@@ -1482,7 +1482,7 @@ function _t(t) {
1482
1482
  return L("SimpleDb", "Removing database:", t), Vt(window.indexedDB.deleteDatabase(t)).toPromise();
1483
1483
  },
1484
1484
  /** Returns true if IndexedDB is available in the current environment. */ t.C = function() {
1485
- if (!w()) return !1;
1485
+ if (!y()) return !1;
1486
1486
  if (t.N()) return !0;
1487
1487
  // We extensively use indexed array values and compound keys,
1488
1488
  // which IE and Edge do not support. However, they still have indexedDB
@@ -1593,11 +1593,11 @@ function _t(t) {
1593
1593
  // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to
1594
1594
  // fire), but still return the original transactionFnResult back to the
1595
1595
  // caller.
1596
- return a.db = n.sent(), r = Nt.open(a.db, t, e ? "readonly" : "readwrite", i), s = o(r).next((function(t) {
1596
+ return a.db = n.sent(), r = At.open(a.db, t, e ? "readonly" : "readwrite", i), s = o(r).next((function(t) {
1597
1597
  return r.V(), t;
1598
1598
  })).catch((function(t) {
1599
1599
  // Abort the transaction if there was an error.
1600
- return r.abort(t), xt.reject(t);
1600
+ return r.abort(t), _t.reject(t);
1601
1601
  })).toPromise(), c = {}, s.catch((function() {})), [ 4 /*yield*/ , r.v ];
1602
1602
 
1603
1603
  case 3:
@@ -1790,7 +1790,7 @@ function _t(t) {
1790
1790
  }));
1791
1791
  }
1792
1792
  var o = this.store.getAll(n.range);
1793
- return new xt((function(t, e) {
1793
+ return new _t((function(t, e) {
1794
1794
  o.onerror = function(t) {
1795
1795
  e(t.target.error);
1796
1796
  }, o.onsuccess = function(e) {
@@ -1804,7 +1804,7 @@ function _t(t) {
1804
1804
  */
1805
1805
  t.prototype.J = function(t, e) {
1806
1806
  var n = this.store.getAll(t, null === e ? void 0 : e);
1807
- return new xt((function(t, e) {
1807
+ return new _t((function(t, e) {
1808
1808
  n.onerror = function(t) {
1809
1809
  e(t.target.error);
1810
1810
  }, n.onsuccess = function(e) {
@@ -1835,7 +1835,7 @@ function _t(t) {
1835
1835
  */
1836
1836
  t.prototype.tt = function(t) {
1837
1837
  var e = this.cursor({});
1838
- return new xt((function(n, r) {
1838
+ return new _t((function(n, r) {
1839
1839
  e.onerror = function(t) {
1840
1840
  var e = Mt(t.target.error);
1841
1841
  r(e);
@@ -1848,16 +1848,16 @@ function _t(t) {
1848
1848
  }));
1849
1849
  }, t.prototype.H = function(t, e) {
1850
1850
  var n = [];
1851
- return new xt((function(r, i) {
1851
+ return new _t((function(r, i) {
1852
1852
  t.onerror = function(t) {
1853
1853
  i(t.target.error);
1854
1854
  }, t.onsuccess = function(t) {
1855
1855
  var i = t.target.result;
1856
1856
  if (i) {
1857
1857
  var o = new Ct(i), u = e(i.primaryKey, i.value, o);
1858
- if (u instanceof xt) {
1858
+ if (u instanceof _t) {
1859
1859
  var s = u.catch((function(t) {
1860
- return o.done(), xt.reject(t);
1860
+ return o.done(), _t.reject(t);
1861
1861
  }));
1862
1862
  n.push(s);
1863
1863
  }
@@ -1865,7 +1865,7 @@ function _t(t) {
1865
1865
  } else r();
1866
1866
  };
1867
1867
  })).next((function() {
1868
- return xt.waitFor(n);
1868
+ return _t.waitFor(n);
1869
1869
  }));
1870
1870
  }, t.prototype.options = function(t, e) {
1871
1871
  var n;
@@ -1887,7 +1887,7 @@ function _t(t) {
1887
1887
  * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror
1888
1888
  * handlers to resolve / reject the PersistencePromise as appropriate.
1889
1889
  */ function Vt(t) {
1890
- return new xt((function(e, n) {
1890
+ return new _t((function(e, n) {
1891
1891
  t.onsuccess = function(t) {
1892
1892
  var n = t.target.result;
1893
1893
  e(n);
@@ -1902,7 +1902,7 @@ function _t(t) {
1902
1902
  var Lt = !1;
1903
1903
 
1904
1904
  function Mt(t) {
1905
- var e = At.D(d());
1905
+ var e = Nt.D(d());
1906
1906
  if (e >= 12.2 && e < 13) {
1907
1907
  var n = "An internal error was encountered in the Indexed Database server";
1908
1908
  if (t.message.indexOf(n) >= 0) {
@@ -1955,7 +1955,7 @@ function Mt(t) {
1955
1955
  [ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ];
1956
1956
 
1957
1957
  case 4:
1958
- return [ 4 /*yield*/ , _t(i) ];
1958
+ return [ 4 /*yield*/ , xt(i) ];
1959
1959
 
1960
1960
  case 5:
1961
1961
  n.sent(), n.label = 6;
@@ -1997,7 +1997,7 @@ function Mt(t) {
1997
1997
  },
1998
1998
  /** Writes index entries until the cap is reached. Returns the number of documents processed. */ t.prototype.it = function(t, e) {
1999
1999
  var n = this, r = new Set, i = e, o = !0;
2000
- return xt.doWhile((function() {
2000
+ return _t.doWhile((function() {
2001
2001
  return !0 === o && i > 0;
2002
2002
  }), (function() {
2003
2003
  return n.localStore.indexManager.getNextCollectionGroupToUpdate(t).next((function(e) {
@@ -2034,8 +2034,8 @@ function Mt(t) {
2034
2034
  var n = t;
2035
2035
  return e.changes.forEach((function(t, e) {
2036
2036
  var r = It(e);
2037
- Tt(r, n) > 0 && (n = r);
2038
- })), new Et(n.readTime, n.documentKey, Math.max(e.batchId, t.largestBatchId));
2037
+ Et(r, n) > 0 && (n = r);
2038
+ })), new Tt(n.readTime, n.documentKey, Math.max(e.batchId, t.largestBatchId));
2039
2039
  }, t;
2040
2040
  }(), qt = /** @class */ function() {
2041
2041
  function t(t, e) {
@@ -2914,7 +2914,7 @@ function se(t) {
2914
2914
  };
2915
2915
 
2916
2916
  /** Extracts the backend's type order for the provided value. */ function fe(t) {
2917
- return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? ne(t) ? 4 /* ServerTimestampValue */ : _e(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : q();
2917
+ return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? ne(t) ? 4 /* ServerTimestampValue */ : xe(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : q();
2918
2918
  }
2919
2919
 
2920
2920
  /** Tests `left` and `right` for equality based on the backend semantics. */ function de(t, e) {
@@ -3121,11 +3121,11 @@ function we(t, e) {
3121
3121
  return !!t && "arrayValue" in t;
3122
3122
  }
3123
3123
 
3124
- /** Returns true if `value` is a NullValue. */ function Ee(t) {
3124
+ /** Returns true if `value` is a NullValue. */ function Te(t) {
3125
3125
  return !!t && "nullValue" in t;
3126
3126
  }
3127
3127
 
3128
- /** Returns true if `value` is NaN. */ function Te(t) {
3128
+ /** Returns true if `value` is NaN. */ function Ee(t) {
3129
3129
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
3130
3130
  }
3131
3131
 
@@ -3161,11 +3161,11 @@ function we(t, e) {
3161
3161
  return Object.assign({}, t);
3162
3162
  }
3163
3163
 
3164
- /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ function _e(t) {
3164
+ /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ function xe(t) {
3165
3165
  return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
3166
3166
  }
3167
3167
 
3168
- /** Returns the lowest value for the given value type (inclusive). */ function xe(t) {
3168
+ /** Returns the lowest value for the given value type (inclusive). */ function _e(t) {
3169
3169
  return "nullValue" in t ? he : "booleanValue" in t ? {
3170
3170
  booleanValue: !1
3171
3171
  } : "integerValue" in t || "doubleValue" in t ? {
@@ -3190,7 +3190,7 @@ function we(t, e) {
3190
3190
  } : q();
3191
3191
  }
3192
3192
 
3193
- /** Returns the largest value for the given value type (exclusive). */ function Ne(t) {
3193
+ /** Returns the largest value for the given value type (exclusive). */ function Ae(t) {
3194
3194
  return "nullValue" in t ? {
3195
3195
  booleanValue: !1
3196
3196
  } : "booleanValue" in t ? {
@@ -3215,7 +3215,7 @@ function we(t, e) {
3215
3215
  } : "mapValue" in t ? le : q();
3216
3216
  }
3217
3217
 
3218
- function Ae(t, e) {
3218
+ function Ne(t, e) {
3219
3219
  var n = ve(t.value, e.value);
3220
3220
  return 0 !== n ? n : t.inclusive && !e.inclusive ? -1 : !t.inclusive && e.inclusive ? 1 : 0;
3221
3221
  }
@@ -3582,7 +3582,7 @@ function Fe(t) {
3582
3582
  switch (s.op) {
3583
3583
  case "<" /* LESS_THAN */ :
3584
3584
  case "<=" /* LESS_THAN_OR_EQUAL */ :
3585
- a = xe(s.value);
3585
+ a = _e(s.value);
3586
3586
  break;
3587
3587
 
3588
3588
  case "==" /* EQUAL */ :
@@ -3600,7 +3600,7 @@ function Fe(t) {
3600
3600
  a = he;
3601
3601
  // Remaining filters cannot be used as lower bounds.
3602
3602
  }
3603
- Ae({
3603
+ Ne({
3604
3604
  value: r,
3605
3605
  inclusive: i
3606
3606
  }, {
@@ -3612,7 +3612,7 @@ function Fe(t) {
3612
3612
  // range to see if we can narrow the scope.
3613
3613
  if (null !== n) for (var l = 0; l < t.orderBy.length; ++l) if (t.orderBy[l].field.isEqual(e)) {
3614
3614
  var h = n.position[l];
3615
- Ae({
3615
+ Ne({
3616
3616
  value: r,
3617
3617
  inclusive: i
3618
3618
  }, {
@@ -3637,7 +3637,7 @@ function Fe(t) {
3637
3637
  switch (s.op) {
3638
3638
  case ">=" /* GREATER_THAN_OR_EQUAL */ :
3639
3639
  case ">" /* GREATER_THAN */ :
3640
- a = Ne(s.value), c = !1;
3640
+ a = Ae(s.value), c = !1;
3641
3641
  break;
3642
3642
 
3643
3643
  case "==" /* EQUAL */ :
@@ -4113,7 +4113,7 @@ function wn(t, e, n) {
4113
4113
  * Returns a value for a number that's appropriate to put into a proto.
4114
4114
  * The return value is an IntegerValue if it can safely represent the value,
4115
4115
  * otherwise a DoubleValue is returned.
4116
- */ function En(t, e) {
4116
+ */ function Tn(t, e) {
4117
4117
  return ce(e) ? In(e) : bn(t, e);
4118
4118
  }
4119
4119
 
@@ -4133,7 +4133,7 @@ function wn(t, e, n) {
4133
4133
  * See the License for the specific language governing permissions and
4134
4134
  * limitations under the License.
4135
4135
  */
4136
- /** Used to represent a field transform on a mutation. */ var Tn = function() {
4136
+ /** Used to represent a field transform on a mutation. */ var En = function() {
4137
4137
  // Make sure that the structural type of `TransformOperation` is unique.
4138
4138
  // See https://github.com/microsoft/TypeScript/issues/5451
4139
4139
  this._ = void 0;
@@ -4143,7 +4143,7 @@ function wn(t, e, n) {
4143
4143
  * Computes the local transform result against the provided `previousValue`,
4144
4144
  * optionally using the provided localWriteTime.
4145
4145
  */ function Sn(t, e, n) {
4146
- return t instanceof xn ? function(t, e) {
4146
+ return t instanceof _n ? function(t, e) {
4147
4147
  var n = {
4148
4148
  fields: {
4149
4149
  __type__: {
@@ -4160,11 +4160,11 @@ function wn(t, e, n) {
4160
4160
  return e && (n.fields.__previous_value__ = e), {
4161
4161
  mapValue: n
4162
4162
  };
4163
- }(n, e) : t instanceof Nn ? An(t, e) : t instanceof Cn ? kn(t, e) : function(t, e) {
4163
+ }(n, e) : t instanceof An ? Nn(t, e) : t instanceof Cn ? kn(t, e) : function(t, e) {
4164
4164
  // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit
4165
4165
  // precision and resolves overflows by reducing precision, we do not
4166
4166
  // manually cap overflows at 2^63.
4167
- var n = _n(t, e), r = Rn(n) + Rn(t.yt);
4167
+ var n = xn(t, e), r = Rn(n) + Rn(t.yt);
4168
4168
  return be(n) && be(t.yt) ? In(r) : bn(t.It, r);
4169
4169
  }(t, e);
4170
4170
  }
@@ -4176,7 +4176,7 @@ function wn(t, e, n) {
4176
4176
  // The server just sends null as the transform result for array operations,
4177
4177
  // so we have to calculate a result the same as we do for local
4178
4178
  // applications.
4179
- return t instanceof Nn ? An(t, e) : t instanceof Cn ? kn(t, e) : n;
4179
+ return t instanceof An ? Nn(t, e) : t instanceof Cn ? kn(t, e) : n;
4180
4180
  }
4181
4181
 
4182
4182
  /**
@@ -4193,7 +4193,7 @@ function wn(t, e, n) {
4193
4193
  *
4194
4194
  * @returns a base value to store along with the mutation, or null for
4195
4195
  * idempotent transforms.
4196
- */ function _n(t, e) {
4196
+ */ function xn(t, e) {
4197
4197
  return t instanceof On ? be(n = e) || function(t) {
4198
4198
  return !!t && "doubleValue" in t;
4199
4199
  }(n) ? e : {
@@ -4202,20 +4202,20 @@ function wn(t, e, n) {
4202
4202
  var n;
4203
4203
  }
4204
4204
 
4205
- /** Transforms a value into a server-generated timestamp. */ var xn = /** @class */ function(e) {
4205
+ /** Transforms a value into a server-generated timestamp. */ var _n = /** @class */ function(e) {
4206
4206
  function n() {
4207
4207
  return null !== e && e.apply(this, arguments) || this;
4208
4208
  }
4209
4209
  return t(n, e), n;
4210
- }(Tn), Nn = /** @class */ function(e) {
4210
+ }(En), An = /** @class */ function(e) {
4211
4211
  function n(t) {
4212
4212
  var n = this;
4213
4213
  return (n = e.call(this) || this).elements = t, n;
4214
4214
  }
4215
4215
  return t(n, e), n;
4216
- }(Tn);
4216
+ }(En);
4217
4217
 
4218
- /** Transforms an array value via a union operation. */ function An(t, e) {
4218
+ /** Transforms an array value via a union operation. */ function Nn(t, e) {
4219
4219
  for (var n = Vn(e), r = function(t) {
4220
4220
  n.some((function(e) {
4221
4221
  return de(e, t);
@@ -4236,7 +4236,7 @@ function wn(t, e, n) {
4236
4236
  return (n = e.call(this) || this).elements = t, n;
4237
4237
  }
4238
4238
  return t(n, e), n;
4239
- }(Tn);
4239
+ }(En);
4240
4240
 
4241
4241
  function kn(t, e) {
4242
4242
  for (var n = Vn(e), r = function(t) {
@@ -4264,7 +4264,7 @@ function kn(t, e) {
4264
4264
  return (r = e.call(this) || this).It = t, r.yt = n, r;
4265
4265
  }
4266
4266
  return t(n, e), n;
4267
- }(Tn);
4267
+ }(En);
4268
4268
 
4269
4269
  function Rn(t) {
4270
4270
  return te(t.integerValue || t.doubleValue);
@@ -4506,7 +4506,7 @@ e) {
4506
4506
  * idempotent mutations.
4507
4507
  */ function Kn(t, e) {
4508
4508
  for (var n = null, r = 0, i = t.fieldTransforms; r < i.length; r++) {
4509
- var o = i[r], u = e.data.field(o.field), s = _n(o.transform, u || null);
4509
+ var o = i[r], u = e.data.field(o.field), s = xn(o.transform, u || null);
4510
4510
  null != s && (null === n && (n = ke.empty()), n.set(o.field, s));
4511
4511
  }
4512
4512
  return n || null;
@@ -4517,7 +4517,7 @@ function jn(t, e) {
4517
4517
  return void 0 === t && void 0 === e || !(!t || !e) && it(t, e, (function(t, e) {
4518
4518
  return function(t, e) {
4519
4519
  return t.field.isEqual(e.field) && function(t, e) {
4520
- return t instanceof Nn && e instanceof Nn || t instanceof Cn && e instanceof Cn ? it(t.elements, e.elements, de) : t instanceof On && e instanceof On ? de(t.yt, e.yt) : t instanceof xn && e instanceof xn;
4520
+ return t instanceof An && e instanceof An || t instanceof Cn && e instanceof Cn ? it(t.elements, e.elements, de) : t instanceof On && e instanceof On ? de(t.yt, e.yt) : t instanceof _n && e instanceof _n;
4521
4521
  }(t.transform, e.transform);
4522
4522
  }(t, e);
4523
4523
  }));
@@ -5031,7 +5031,7 @@ n
5031
5031
  /** An RPC error indicating why the watch failed. */ , r) {
5032
5032
  void 0 === n && (n = Zt.EMPTY_BYTE_STRING), void 0 === r && (r = null), this.state = t,
5033
5033
  this.targetIds = e, this.resumeToken = n, this.cause = r;
5034
- }, Er = /** @class */ function() {
5034
+ }, Tr = /** @class */ function() {
5035
5035
  function t() {
5036
5036
  /**
5037
5037
  * The number of pending responses (adds or removes) that we are waiting on.
@@ -5137,7 +5137,7 @@ n
5137
5137
  }, t.prototype.$t = function() {
5138
5138
  this.Vt = !0, this.vt = !0;
5139
5139
  }, t;
5140
- }(), Tr = /** @class */ function() {
5140
+ }(), Er = /** @class */ function() {
5141
5141
  function t(t) {
5142
5142
  this.Bt = t,
5143
5143
  /** The internal state of all tracked targets. */
@@ -5333,7 +5333,7 @@ n
5333
5333
  this.zt(t).Mt();
5334
5334
  }, t.prototype.zt = function(t) {
5335
5335
  var e = this.Lt.get(t);
5336
- return e || (e = new Er, this.Lt.set(t, e)), e;
5336
+ return e || (e = new Tr, this.Lt.set(t, e)), e;
5337
5337
  }, t.prototype.ne = function(t) {
5338
5338
  var e = this.qt.get(t);
5339
5339
  return e || (e = new zt(rt), this.qt = this.qt.insert(t, e)), e;
@@ -5362,7 +5362,7 @@ n
5362
5362
  */
5363
5363
  t.prototype.Jt = function(t) {
5364
5364
  var e = this;
5365
- this.Lt.set(t, new Er), this.Bt.getRemoteKeysForTarget(t).forEach((function(n) {
5365
+ this.Lt.set(t, new Tr), this.Bt.getRemoteKeysForTarget(t).forEach((function(n) {
5366
5366
  e.jt(t, n, /*updatedDocument=*/ null);
5367
5367
  }));
5368
5368
  },
@@ -5405,10 +5405,10 @@ function Dr() {
5405
5405
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5406
5406
  * See the License for the specific language governing permissions and
5407
5407
  * limitations under the License.
5408
- */ var _r = {
5408
+ */ var xr = {
5409
5409
  asc: "ASCENDING",
5410
5410
  desc: "DESCENDING"
5411
- }, xr = {
5411
+ }, _r = {
5412
5412
  "<": "LESS_THAN",
5413
5413
  "<=": "LESS_THAN_OR_EQUAL",
5414
5414
  ">": "GREATER_THAN",
@@ -5419,7 +5419,7 @@ function Dr() {
5419
5419
  in: "IN",
5420
5420
  "not-in": "NOT_IN",
5421
5421
  "array-contains-any": "ARRAY_CONTAINS_ANY"
5422
- }, Nr = function(t, e) {
5422
+ }, Ar = function(t, e) {
5423
5423
  this.databaseId = t, this.gt = e;
5424
5424
  };
5425
5425
 
@@ -5440,7 +5440,7 @@ function Dr() {
5440
5440
  /**
5441
5441
  * Returns a value for a Date that's appropriate to put into a proto.
5442
5442
  */
5443
- function Ar(t, e) {
5443
+ function Nr(t, e) {
5444
5444
  return t.gt ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
5445
5445
  seconds: "" + e.seconds,
5446
5446
  nanos: e.nanoseconds
@@ -5458,7 +5458,7 @@ function Ar(t, e) {
5458
5458
  /**
5459
5459
  * Returns a ByteString based on the proto string value.
5460
5460
  */ function kr(t, e) {
5461
- return Ar(t, e.toTimestamp());
5461
+ return Nr(t, e.toTimestamp());
5462
5462
  }
5463
5463
 
5464
5464
  function Or(t) {
@@ -5546,11 +5546,11 @@ function Kr(t, e) {
5546
5546
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
5547
5547
  return function(t, e) {
5548
5548
  var n = e.transform;
5549
- if (n instanceof xn) return {
5549
+ if (n instanceof _n) return {
5550
5550
  fieldPath: e.field.canonicalString(),
5551
5551
  setToServerValue: "REQUEST_TIME"
5552
5552
  };
5553
- if (n instanceof Nn) return {
5553
+ if (n instanceof An) return {
5554
5554
  fieldPath: e.field.canonicalString(),
5555
5555
  appendMissingElements: {
5556
5556
  values: n.elements
@@ -5583,9 +5583,9 @@ function jr(t, e) {
5583
5583
  }(e.currentDocument) : Pn.none(), r = e.updateTransforms ? e.updateTransforms.map((function(e) {
5584
5584
  return function(t, e) {
5585
5585
  var n = null;
5586
- if ("setToServerValue" in e) U("REQUEST_TIME" === e.setToServerValue), n = new xn; else if ("appendMissingElements" in e) {
5586
+ if ("setToServerValue" in e) U("REQUEST_TIME" === e.setToServerValue), n = new _n; else if ("appendMissingElements" in e) {
5587
5587
  var r = e.appendMissingElements.values || [];
5588
- n = new Nn(r);
5588
+ n = new An(r);
5589
5589
  } else if ("removeAllFromArray" in e) {
5590
5590
  var i = e.removeAllFromArray.values || [];
5591
5591
  n = new Cn(i);
@@ -5646,26 +5646,26 @@ function zr(t, e) {
5646
5646
  // visible for testing
5647
5647
  return function(t) {
5648
5648
  if ("==" /* EQUAL */ === t.op) {
5649
- if (Te(t.value)) return {
5649
+ if (Ee(t.value)) return {
5650
5650
  unaryFilter: {
5651
5651
  field: Zr(t.field),
5652
5652
  op: "IS_NAN"
5653
5653
  }
5654
5654
  };
5655
- if (Ee(t.value)) return {
5655
+ if (Te(t.value)) return {
5656
5656
  unaryFilter: {
5657
5657
  field: Zr(t.field),
5658
5658
  op: "IS_NULL"
5659
5659
  }
5660
5660
  };
5661
5661
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
5662
- if (Te(t.value)) return {
5662
+ if (Ee(t.value)) return {
5663
5663
  unaryFilter: {
5664
5664
  field: Zr(t.field),
5665
5665
  op: "IS_NOT_NAN"
5666
5666
  }
5667
5667
  };
5668
- if (Ee(t.value)) return {
5668
+ if (Te(t.value)) return {
5669
5669
  unaryFilter: {
5670
5670
  field: Zr(t.field),
5671
5671
  op: "IS_NOT_NULL"
@@ -5772,11 +5772,11 @@ function Hr(t) {
5772
5772
  }
5773
5773
 
5774
5774
  function Yr(t) {
5775
- return _r[t];
5775
+ return xr[t];
5776
5776
  }
5777
5777
 
5778
5778
  function Xr(t) {
5779
- return xr[t];
5779
+ return _r[t];
5780
5780
  }
5781
5781
 
5782
5782
  function Zr(t) {
@@ -6020,7 +6020,7 @@ function ni(t) {
6020
6020
  * there is no useful information to store as the value. The raw (unencoded)
6021
6021
  * path cannot be stored because IndexedDb doesn't store prototype
6022
6022
  * information.
6023
- */ var li = {}, hi = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], fi = [ "prefixPath", "collectionGroup", "documentId" ], di = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], pi = [ "canonicalId", "targetId" ], vi = [ "targetId", "path" ], yi = [ "path", "targetId" ], mi = [ "collectionId", "parent" ], gi = [ "indexId", "uid" ], wi = [ "uid", "sequenceNumber" ], bi = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Ii = [ "indexId", "uid", "orderedDocumentKey" ], Ei = [ "userId", "collectionPath", "documentId" ], Ti = [ "userId", "collectionPath", "largestBatchId" ], Si = [ "userId", "collectionGroup", "largestBatchId" ], Di = r(r([], r(r([], r(r([], r(r([], [ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ]), [ "clientMetadata" ])), [ "remoteDocumentGlobal" ])), [ "collectionParents" ])), [ "bundles", "namedQueries" ]), _i = r(r([], Di), [ "documentOverlays" ]), xi = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Ni = xi, Ai = r(r([], Ni), [ "indexConfiguration", "indexState", "indexEntries" ]), Ci = /** @class */ function(e) {
6023
+ */ var li = {}, hi = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], fi = [ "prefixPath", "collectionGroup", "documentId" ], di = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], pi = [ "canonicalId", "targetId" ], vi = [ "targetId", "path" ], yi = [ "path", "targetId" ], mi = [ "collectionId", "parent" ], gi = [ "indexId", "uid" ], wi = [ "uid", "sequenceNumber" ], bi = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Ii = [ "indexId", "uid", "orderedDocumentKey" ], Ti = [ "userId", "collectionPath", "documentId" ], Ei = [ "userId", "collectionPath", "largestBatchId" ], Si = [ "userId", "collectionGroup", "largestBatchId" ], Di = r(r([], r(r([], r(r([], r(r([], [ "mutationQueues", "mutations", "documentMutations", "remoteDocuments", "targets", "owner", "targetGlobal", "targetDocuments" ]), [ "clientMetadata" ])), [ "remoteDocumentGlobal" ])), [ "collectionParents" ])), [ "bundles", "namedQueries" ]), xi = r(r([], Di), [ "documentOverlays" ]), _i = [ "mutationQueues", "mutations", "documentMutations", "remoteDocumentsV14", "targets", "owner", "targetGlobal", "targetDocuments", "clientMetadata", "remoteDocumentGlobal", "collectionParents", "bundles", "namedQueries", "documentOverlays" ], Ai = _i, Ni = r(r([], Ai), [ "indexConfiguration", "indexState", "indexEntries" ]), Ci = /** @class */ function(e) {
6024
6024
  function n(t, n) {
6025
6025
  var r = this;
6026
6026
  return (r = e.call(this) || this).ie = t, r.currentSequenceNumber = n, r;
@@ -6045,7 +6045,7 @@ function ni(t) {
6045
6045
  * limitations under the License.
6046
6046
  */ function ki(t, e) {
6047
6047
  var n = G(t);
6048
- return At.M(n.ie, e);
6048
+ return Nt.M(n.ie, e);
6049
6049
  }
6050
6050
 
6051
6051
  /**
@@ -6244,7 +6244,7 @@ function ni(t) {
6244
6244
  return {
6245
6245
  name: Lr(t, e.key),
6246
6246
  fields: e.data.value.mapValue.fields,
6247
- updateTime: Ar(t, e.version.toTimestamp())
6247
+ updateTime: Nr(t, e.version.toTimestamp())
6248
6248
  };
6249
6249
  }(t.re, e); else if (e.isNoDocument()) r.noDocument = {
6250
6250
  path: n.path.toArray(),
@@ -6468,7 +6468,7 @@ function Wi(t, e, n, r) {
6468
6468
  }));
6469
6469
  }, t.prototype.getOverlays = function(t, e) {
6470
6470
  var n = this, r = cr();
6471
- return xt.forEach(e, (function(e) {
6471
+ return _t.forEach(e, (function(e) {
6472
6472
  return n.getOverlay(t, e).next((function(t) {
6473
6473
  null !== t && r.set(e, t);
6474
6474
  }));
@@ -6480,7 +6480,7 @@ function Wi(t, e, n, r) {
6480
6480
  return n.forEach((function(n, o) {
6481
6481
  var u = new Vi(e, o);
6482
6482
  i.push(r.ue(t, u));
6483
- })), xt.waitFor(i);
6483
+ })), _t.waitFor(i);
6484
6484
  }, t.prototype.removeOverlaysForBatchId = function(t, e, n) {
6485
6485
  var r = this, i = new Set;
6486
6486
  // Get the set of unique collection paths.
@@ -6493,7 +6493,7 @@ function Wi(t, e, n, r) {
6493
6493
  /*lowerOpen=*/ !1,
6494
6494
  /*upperOpen=*/ !0);
6495
6495
  o.push(Ji(t).Y("collectionPathOverlayIndex", i));
6496
- })), xt.waitFor(o);
6496
+ })), _t.waitFor(o);
6497
6497
  }, t.prototype.getOverlaysForCollection = function(t, e, n) {
6498
6498
  var r = this, i = cr(), o = ri(e), u = IDBKeyRange.bound([ this.userId, o, n ], [ this.userId, o, Number.POSITIVE_INFINITY ],
6499
6499
  /*lowerOpen=*/ !0);
@@ -6587,7 +6587,7 @@ function Wi(t, e, n, r) {
6587
6587
  e.me(ee(t.bytesValue)), this.we(e); else if ("referenceValue" in t) this.ge(t.referenceValue, e); else if ("geoPointValue" in t) {
6588
6588
  var i = t.geoPointValue;
6589
6589
  this.le(e, 45), e.fe(i.latitude || 0), e.fe(i.longitude || 0);
6590
- } else "mapValue" in t ? _e(t) ? this.le(e, Number.MAX_SAFE_INTEGER) : (this.ye(t.mapValue, e),
6590
+ } else "mapValue" in t ? xe(t) ? this.le(e, Number.MAX_SAFE_INTEGER) : (this.ye(t.mapValue, e),
6591
6591
  this.we(e)) : "arrayValue" in t ? (this.pe(t.arrayValue, e), this.we(e)) : q();
6592
6592
  }, t.prototype._e = function(t, e) {
6593
6593
  this.le(e, 25), this.Ie(t, e);
@@ -6960,37 +6960,37 @@ function ao(t, e) {
6960
6960
  this.Ye = new ho;
6961
6961
  }
6962
6962
  return t.prototype.addToCollectionParentIndex = function(t, e) {
6963
- return this.Ye.add(e), xt.resolve();
6963
+ return this.Ye.add(e), _t.resolve();
6964
6964
  }, t.prototype.getCollectionParents = function(t, e) {
6965
- return xt.resolve(this.Ye.getEntries(e));
6965
+ return _t.resolve(this.Ye.getEntries(e));
6966
6966
  }, t.prototype.addFieldIndex = function(t, e) {
6967
6967
  // Field indices are not supported with memory persistence.
6968
- return xt.resolve();
6968
+ return _t.resolve();
6969
6969
  }, t.prototype.deleteFieldIndex = function(t, e) {
6970
6970
  // Field indices are not supported with memory persistence.
6971
- return xt.resolve();
6971
+ return _t.resolve();
6972
6972
  }, t.prototype.getDocumentsMatchingTarget = function(t, e) {
6973
6973
  // Field indices are not supported with memory persistence.
6974
- return xt.resolve(null);
6974
+ return _t.resolve(null);
6975
6975
  }, t.prototype.getIndexType = function(t, e) {
6976
6976
  // Field indices are not supported with memory persistence.
6977
- return xt.resolve(0 /* NONE */);
6977
+ return _t.resolve(0 /* NONE */);
6978
6978
  }, t.prototype.getFieldIndexes = function(t, e) {
6979
6979
  // Field indices are not supported with memory persistence.
6980
- return xt.resolve([]);
6980
+ return _t.resolve([]);
6981
6981
  }, t.prototype.getNextCollectionGroupToUpdate = function(t) {
6982
6982
  // Field indices are not supported with memory persistence.
6983
- return xt.resolve(null);
6983
+ return _t.resolve(null);
6984
6984
  }, t.prototype.getMinOffset = function(t, e) {
6985
- return xt.resolve(Et.min());
6985
+ return _t.resolve(Tt.min());
6986
6986
  }, t.prototype.getMinOffsetFromCollectionGroup = function(t, e) {
6987
- return xt.resolve(Et.min());
6987
+ return _t.resolve(Tt.min());
6988
6988
  }, t.prototype.updateCollectionGroup = function(t, e, n) {
6989
6989
  // Field indices are not supported with memory persistence.
6990
- return xt.resolve();
6990
+ return _t.resolve();
6991
6991
  }, t.prototype.updateIndexEntries = function(t, e) {
6992
6992
  // Field indices are not supported with memory persistence.
6993
- return xt.resolve();
6993
+ return _t.resolve();
6994
6994
  }, t;
6995
6995
  }(), ho = /** @class */ function() {
6996
6996
  function t() {
@@ -7049,7 +7049,7 @@ function ao(t, e) {
7049
7049
  };
7050
7050
  return vo(t).put(o);
7051
7051
  }
7052
- return xt.resolve();
7052
+ return _t.resolve();
7053
7053
  }, t.prototype.getCollectionParents = function(t, e) {
7054
7054
  var n = [], r = IDBKeyRange.bound([ e, "" ], [ ot(e), "" ],
7055
7055
  /*lowerOpen=*/ !1,
@@ -7101,14 +7101,14 @@ function ao(t, e) {
7101
7101
  }));
7102
7102
  }, t.prototype.getDocumentsMatchingTarget = function(t, e) {
7103
7103
  var n = this, r = yo(t), i = !0, o = new Map;
7104
- return xt.forEach(this.tn(e), (function(e) {
7104
+ return _t.forEach(this.tn(e), (function(e) {
7105
7105
  return n.en(t, e).next((function(t) {
7106
7106
  i && (i = !!t), o.set(e, t);
7107
7107
  }));
7108
7108
  })).next((function() {
7109
7109
  if (i) {
7110
7110
  var t = pr(), u = [];
7111
- return xt.forEach(o, (function(i, o) {
7111
+ return _t.forEach(o, (function(i, o) {
7112
7112
  var s;
7113
7113
  L("IndexedDbIndexManager", "Using index " + ("id=" + (s = i).indexId + "|cg=" + s.collectionGroup + "|f=" + s.fields.map((function(t) {
7114
7114
  return t.fieldPath + ":" + t.kind;
@@ -7166,7 +7166,7 @@ function ao(t, e) {
7166
7166
  }
7167
7167
  return new Ze(n, r);
7168
7168
  }(o, i), f = n.nn(i, o, l), d = n.nn(i, o, h), p = n.sn(i, o, c), v = n.rn(i.indexId, a, f, l.inclusive, d, h.inclusive, p);
7169
- return xt.forEach(v, (function(n) {
7169
+ return _t.forEach(v, (function(n) {
7170
7170
  return r.J(n, e.limit).next((function(e) {
7171
7171
  e.forEach((function(e) {
7172
7172
  var n = ft.fromSegments(e.documentKey);
@@ -7178,7 +7178,7 @@ function ao(t, e) {
7178
7178
  return u;
7179
7179
  }));
7180
7180
  }
7181
- return xt.resolve(null);
7181
+ return _t.resolve(null);
7182
7182
  }));
7183
7183
  }, t.prototype.tn = function(t) {
7184
7184
  var e = this.Ze.get(t);
@@ -7225,7 +7225,7 @@ function ao(t, e) {
7225
7225
  }));
7226
7226
  }, t.prototype.getIndexType = function(t, e) {
7227
7227
  var n = this, r = 2 /* FULL */;
7228
- return xt.forEach(this.tn(e), (function(e) {
7228
+ return _t.forEach(this.tn(e), (function(e) {
7229
7229
  return n.en(t, e).next((function(t) {
7230
7230
  t ? 0 /* NONE */ !== r && t.fields.length < function(t) {
7231
7231
  for (var e = new zt(ht.comparator), n = !1, r = 0, i = t.filters; r < i.length; r++) {
@@ -7331,10 +7331,10 @@ function ao(t, e) {
7331
7331
  var n = this, r = mo(t), i = go(t);
7332
7332
  return (e ? r.W("collectionGroupIndex", IDBKeyRange.bound(e, e)) : r.W()).next((function(t) {
7333
7333
  var e = [];
7334
- return xt.forEach(t, (function(t) {
7334
+ return _t.forEach(t, (function(t) {
7335
7335
  return i.get([ t.indexId, n.uid ]).next((function(n) {
7336
7336
  e.push(function(t, e) {
7337
- var n = e ? new wt(e.sequenceNumber, new Et(Ui(e.readTime), new ft(ui(e.documentKey)), e.largestBatchId)) : wt.empty(), r = t.fields.map((function(t) {
7337
+ var n = e ? new wt(e.sequenceNumber, new Tt(Ui(e.readTime), new ft(ui(e.documentKey)), e.largestBatchId)) : wt.empty(), r = t.fields.map((function(t) {
7338
7338
  var e = t[0], n = t[1];
7339
7339
  return new mt(ht.fromServerFormat(e), n);
7340
7340
  }));
@@ -7356,7 +7356,7 @@ function ao(t, e) {
7356
7356
  var r = this, i = mo(t), o = go(t);
7357
7357
  return this._n(t).next((function(t) {
7358
7358
  return i.W("collectionGroupIndex", IDBKeyRange.bound(e, e)).next((function(e) {
7359
- return xt.forEach(e, (function(e) {
7359
+ return _t.forEach(e, (function(e) {
7360
7360
  return o.put(Wi(e.indexId, r.user, t, n));
7361
7361
  }));
7362
7362
  }));
@@ -7368,13 +7368,13 @@ function ao(t, e) {
7368
7368
  // data might be invalidated by other multi-tab clients, we can only trust
7369
7369
  // data within a single IndexedDB transaction. We therefore add a cache
7370
7370
  // here.
7371
- return xt.forEach(e, (function(e, i) {
7371
+ return _t.forEach(e, (function(e, i) {
7372
7372
  var o = r.get(e.collectionGroup);
7373
- return (o ? xt.resolve(o) : n.getFieldIndexes(t, e.collectionGroup)).next((function(o) {
7374
- return r.set(e.collectionGroup, o), xt.forEach(o, (function(r) {
7373
+ return (o ? _t.resolve(o) : n.getFieldIndexes(t, e.collectionGroup)).next((function(o) {
7374
+ return r.set(e.collectionGroup, o), _t.forEach(o, (function(r) {
7375
7375
  return n.wn(t, e, r).next((function(e) {
7376
7376
  var o = n.mn(i, r);
7377
- return e.isEqual(o) ? xt.resolve() : n.gn(t, i, r, e, o);
7377
+ return e.isEqual(o) ? _t.resolve() : n.gn(t, i, r, e, o);
7378
7378
  }));
7379
7379
  }));
7380
7380
  }));
@@ -7446,7 +7446,7 @@ function ao(t, e) {
7446
7446
  }), (
7447
7447
  /* onRemove= */ function(r) {
7448
7448
  u.push(o.pn(t, e, n, r));
7449
- })), xt.waitFor(u);
7449
+ })), _t.waitFor(u);
7450
7450
  }, t.prototype._n = function(t) {
7451
7451
  var e = 1;
7452
7452
  return go(t).Z({
@@ -7492,7 +7492,7 @@ function ao(t, e) {
7492
7492
  return this.getFieldIndexes(t, e).next(wo);
7493
7493
  }, t.prototype.getMinOffset = function(t, e) {
7494
7494
  var n = this;
7495
- return xt.mapArray(this.tn(e), (function(e) {
7495
+ return _t.mapArray(this.tn(e), (function(e) {
7496
7496
  return n.en(t, e).next((function(t) {
7497
7497
  return t || q();
7498
7498
  }));
@@ -7549,9 +7549,9 @@ function wo(t) {
7549
7549
  U(0 !== t.length);
7550
7550
  for (var e = t[0].indexState.offset, n = e.largestBatchId, r = 1; r < t.length; r++) {
7551
7551
  var i = t[r].indexState.offset;
7552
- Tt(i, e) < 0 && (e = i), n < i.largestBatchId && (n = i.largestBatchId);
7552
+ Et(i, e) < 0 && (e = i), n < i.largestBatchId && (n = i.largestBatchId);
7553
7553
  }
7554
- return new Et(e.readTime, e.documentKey, n);
7554
+ return new Tt(e.readTime, e.documentKey, n);
7555
7555
  }
7556
7556
 
7557
7557
  /**
@@ -7611,7 +7611,7 @@ function wo(t) {
7611
7611
  * Delete a mutation batch and the associated document mutations.
7612
7612
  * @returns A PersistencePromise of the document mutations that were removed.
7613
7613
  */
7614
- function Eo(t, e, n) {
7614
+ function To(t, e, n) {
7615
7615
  var r = t.store("mutations"), i = t.store("documentMutations"), o = [], u = IDBKeyRange.only(n.batchId), s = 0, a = r.Z({
7616
7616
  range: u
7617
7617
  }, (function(t, e, n) {
@@ -7624,14 +7624,14 @@ function Eo(t, e, n) {
7624
7624
  var f = h[l], d = ci(e, f.key.path, n.batchId);
7625
7625
  o.push(i.delete(d)), c.push(f.key);
7626
7626
  }
7627
- return xt.waitFor(o).next((function() {
7627
+ return _t.waitFor(o).next((function() {
7628
7628
  return c;
7629
7629
  }));
7630
7630
  }
7631
7631
 
7632
7632
  /**
7633
7633
  * Returns an approximate size for the given document.
7634
- */ function To(t) {
7634
+ */ function Eo(t) {
7635
7635
  if (!t) return 0;
7636
7636
  var e;
7637
7637
  if (t.document) e = t.document; else if (t.unknownDocument) e = t.unknownDocument; else {
@@ -7696,7 +7696,7 @@ var So = /** @class */ function() {
7696
7696
  return U("" !== e.uid), new t(e.isAuthenticated() ? e.uid : "", n, r, i);
7697
7697
  }, t.prototype.checkEmpty = function(t) {
7698
7698
  var e = !0, n = IDBKeyRange.bound([ this.userId, Number.NEGATIVE_INFINITY ], [ this.userId, Number.POSITIVE_INFINITY ]);
7699
- return _o(t).Z({
7699
+ return xo(t).Z({
7700
7700
  index: "userMutationsIndex",
7701
7701
  range: n
7702
7702
  }, (function(t, n, r) {
@@ -7705,7 +7705,7 @@ var So = /** @class */ function() {
7705
7705
  return e;
7706
7706
  }));
7707
7707
  }, t.prototype.addMutationBatch = function(t, e, n, r) {
7708
- var i = this, o = xo(t), u = _o(t);
7708
+ var i = this, o = _o(t), u = xo(t);
7709
7709
  // The IndexedDb implementation in Chrome (and Firefox) does not handle
7710
7710
  // compound indices that include auto-generated keys correctly. To ensure
7711
7711
  // that the index entry is added correctly in all browsers, we perform two
@@ -7740,13 +7740,13 @@ var So = /** @class */ function() {
7740
7740
  l.push(i.indexManager.addToCollectionParentIndex(t, e));
7741
7741
  })), t.addOnCommittedListener((function() {
7742
7742
  i.In[s] = a.keys();
7743
- })), xt.waitFor(l).next((function() {
7743
+ })), _t.waitFor(l).next((function() {
7744
7744
  return a;
7745
7745
  }));
7746
7746
  }));
7747
7747
  }, t.prototype.lookupMutationBatch = function(t, e) {
7748
7748
  var n = this;
7749
- return _o(t).get(e).next((function(t) {
7749
+ return xo(t).get(e).next((function(t) {
7750
7750
  return t ? (U(t.userId === n.userId), Bi(n.It, t)) : null;
7751
7751
  }));
7752
7752
  },
@@ -7759,7 +7759,7 @@ var So = /** @class */ function() {
7759
7759
  // PORTING NOTE: Multi-tab only.
7760
7760
  t.prototype.Tn = function(t, e) {
7761
7761
  var n = this;
7762
- return this.In[e] ? xt.resolve(this.In[e]) : this.lookupMutationBatch(t, e).next((function(t) {
7762
+ return this.In[e] ? _t.resolve(this.In[e]) : this.lookupMutationBatch(t, e).next((function(t) {
7763
7763
  if (t) {
7764
7764
  var r = t.keys();
7765
7765
  return n.In[e] = r, r;
@@ -7768,7 +7768,7 @@ var So = /** @class */ function() {
7768
7768
  }));
7769
7769
  }, t.prototype.getNextMutationBatchAfterBatchId = function(t, e) {
7770
7770
  var n = this, r = e + 1, i = IDBKeyRange.lowerBound([ this.userId, r ]), o = null;
7771
- return _o(t).Z({
7771
+ return xo(t).Z({
7772
7772
  index: "userMutationsIndex",
7773
7773
  range: i
7774
7774
  }, (function(t, e, i) {
@@ -7778,7 +7778,7 @@ var So = /** @class */ function() {
7778
7778
  }));
7779
7779
  }, t.prototype.getHighestUnacknowledgedBatchId = function(t) {
7780
7780
  var e = IDBKeyRange.upperBound([ this.userId, Number.POSITIVE_INFINITY ]), n = -1;
7781
- return _o(t).Z({
7781
+ return xo(t).Z({
7782
7782
  index: "userMutationsIndex",
7783
7783
  range: e,
7784
7784
  reverse: !0
@@ -7789,7 +7789,7 @@ var So = /** @class */ function() {
7789
7789
  }));
7790
7790
  }, t.prototype.getAllMutationBatches = function(t) {
7791
7791
  var e = this, n = IDBKeyRange.bound([ this.userId, -1 ], [ this.userId, Number.POSITIVE_INFINITY ]);
7792
- return _o(t).W("userMutationsIndex", n).next((function(t) {
7792
+ return xo(t).W("userMutationsIndex", n).next((function(t) {
7793
7793
  return t.map((function(t) {
7794
7794
  return Bi(e.It, t);
7795
7795
  }));
@@ -7798,7 +7798,7 @@ var So = /** @class */ function() {
7798
7798
  var n = this, r = ai(this.userId, e.path), i = IDBKeyRange.lowerBound(r), o = [];
7799
7799
  // Scan the document-mutation index starting with a prefix starting with
7800
7800
  // the given documentKey.
7801
- return xo(t).Z({
7801
+ return _o(t).Z({
7802
7802
  range: i
7803
7803
  }, (function(r, i, u) {
7804
7804
  var s = r[0], a = r[1], c = r[2], l = ui(a);
@@ -7811,7 +7811,7 @@ var So = /** @class */ function() {
7811
7811
  // can stop as soon as we hit any such row.
7812
7812
  if (s === n.userId && e.path.isEqual(l))
7813
7813
  // Look up the mutation batch in the store.
7814
- return _o(t).get(c).next((function(t) {
7814
+ return xo(t).get(c).next((function(t) {
7815
7815
  if (!t) throw q();
7816
7816
  U(t.userId === n.userId), o.push(Bi(n.It, t));
7817
7817
  }));
@@ -7822,7 +7822,7 @@ var So = /** @class */ function() {
7822
7822
  }, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function(t, e) {
7823
7823
  var n = this, r = new zt(rt), i = [];
7824
7824
  return e.forEach((function(e) {
7825
- var o = ai(n.userId, e.path), u = IDBKeyRange.lowerBound(o), s = xo(t).Z({
7825
+ var o = ai(n.userId, e.path), u = IDBKeyRange.lowerBound(o), s = _o(t).Z({
7826
7826
  range: u
7827
7827
  }, (function(t, i, o) {
7828
7828
  var u = t[0], s = t[1], a = t[2], c = ui(s);
@@ -7836,12 +7836,12 @@ var So = /** @class */ function() {
7836
7836
  u === n.userId && e.path.isEqual(c) ? r = r.add(a) : o.done();
7837
7837
  }));
7838
7838
  i.push(s);
7839
- })), xt.waitFor(i).next((function() {
7839
+ })), _t.waitFor(i).next((function() {
7840
7840
  return n.En(t, r);
7841
7841
  }));
7842
7842
  }, t.prototype.getAllMutationBatchesAffectingQuery = function(t, e) {
7843
7843
  var n = this, r = e.path, i = r.length + 1, o = ai(this.userId, r), u = IDBKeyRange.lowerBound(o), s = new zt(rt);
7844
- return xo(t).Z({
7844
+ return _o(t).Z({
7845
7845
  range: u
7846
7846
  }, (function(t, e, o) {
7847
7847
  var u = t[0], a = t[1], c = t[2], l = ui(a);
@@ -7859,19 +7859,19 @@ var So = /** @class */ function() {
7859
7859
  var n = this, r = [], i = [];
7860
7860
  // TODO(rockwood): Implement this using iterate.
7861
7861
  return e.forEach((function(e) {
7862
- i.push(_o(t).get(e).next((function(t) {
7862
+ i.push(xo(t).get(e).next((function(t) {
7863
7863
  if (null === t) throw q();
7864
7864
  U(t.userId === n.userId), r.push(Bi(n.It, t));
7865
7865
  })));
7866
- })), xt.waitFor(i).next((function() {
7866
+ })), _t.waitFor(i).next((function() {
7867
7867
  return r;
7868
7868
  }));
7869
7869
  }, t.prototype.removeMutationBatch = function(t, e) {
7870
7870
  var n = this;
7871
- return Eo(t.ie, this.userId, e).next((function(r) {
7871
+ return To(t.ie, this.userId, e).next((function(r) {
7872
7872
  return t.addOnCommittedListener((function() {
7873
7873
  n.An(e.batchId);
7874
- })), xt.forEach(r, (function(e) {
7874
+ })), _t.forEach(r, (function(e) {
7875
7875
  return n.referenceDelegate.markPotentiallyOrphaned(t, e);
7876
7876
  }));
7877
7877
  }));
@@ -7890,11 +7890,11 @@ var So = /** @class */ function() {
7890
7890
  }, t.prototype.performConsistencyCheck = function(t) {
7891
7891
  var e = this;
7892
7892
  return this.checkEmpty(t).next((function(n) {
7893
- if (!n) return xt.resolve();
7893
+ if (!n) return _t.resolve();
7894
7894
  // Verify that there are no entries in the documentMutations index if
7895
7895
  // the queue is empty.
7896
7896
  var r = IDBKeyRange.lowerBound([ e.userId ]), i = [];
7897
- return xo(t).Z({
7897
+ return _o(t).Z({
7898
7898
  range: r
7899
7899
  }, (function(t, n, r) {
7900
7900
  if (t[0] === e.userId) {
@@ -7912,7 +7912,7 @@ var So = /** @class */ function() {
7912
7912
  /** Returns the mutation queue's metadata from IndexedDb. */
7913
7913
  t.prototype.Rn = function(t) {
7914
7914
  var e = this;
7915
- return No(t).get(this.userId).next((function(t) {
7915
+ return Ao(t).get(this.userId).next((function(t) {
7916
7916
  return t || {
7917
7917
  userId: e.userId,
7918
7918
  lastAcknowledgedBatchId: -1,
@@ -7927,7 +7927,7 @@ var So = /** @class */ function() {
7927
7927
  * mutation for the given key.
7928
7928
  */ function Do(t, e, n) {
7929
7929
  var r = ai(e, n.path), i = r[1], o = IDBKeyRange.lowerBound(r), u = !1;
7930
- return xo(t).Z({
7930
+ return _o(t).Z({
7931
7931
  range: o,
7932
7932
  X: !0
7933
7933
  }, (function(t, n, r) {
@@ -7942,19 +7942,19 @@ var So = /** @class */ function() {
7942
7942
  /** Returns true if any mutation queue contains the given document. */
7943
7943
  /**
7944
7944
  * Helper to get a typed SimpleDbStore for the mutations object store.
7945
- */ function _o(t) {
7945
+ */ function xo(t) {
7946
7946
  return ki(t, "mutations");
7947
7947
  }
7948
7948
 
7949
7949
  /**
7950
7950
  * Helper to get a typed SimpleDbStore for the mutationQueues object store.
7951
- */ function xo(t) {
7951
+ */ function _o(t) {
7952
7952
  return ki(t, "documentMutations");
7953
7953
  }
7954
7954
 
7955
7955
  /**
7956
7956
  * Helper to get a typed SimpleDbStore for the mutationQueues object store.
7957
- */ function No(t) {
7957
+ */ function Ao(t) {
7958
7958
  return ki(t, "mutationQueues");
7959
7959
  }
7960
7960
 
@@ -7988,7 +7988,7 @@ var So = /** @class */ function() {
7988
7988
  * that persist across client restarts, while sync engine can independently
7989
7989
  * generate in-memory target IDs that are transient and can be reused after a
7990
7990
  * restart.
7991
- */ var Ao = /** @class */ function() {
7991
+ */ var No = /** @class */ function() {
7992
7992
  function t(t) {
7993
7993
  this.bn = t;
7994
7994
  }
@@ -8017,7 +8017,7 @@ var So = /** @class */ function() {
8017
8017
  return t.prototype.allocateTargetId = function(t) {
8018
8018
  var e = this;
8019
8019
  return this.Vn(t).next((function(n) {
8020
- var r = new Ao(n.highestTargetId);
8020
+ var r = new No(n.highestTargetId);
8021
8021
  return n.highestTargetId = r.next(), e.Sn(t, n).next((function() {
8022
8022
  return n.highestTargetId;
8023
8023
  }));
@@ -8066,7 +8066,7 @@ var So = /** @class */ function() {
8066
8066
  var a = Gi(s);
8067
8067
  a.sequenceNumber <= e && null === n.get(a.targetId) && (i++, o.push(r.removeTargetData(t, a)));
8068
8068
  })).next((function() {
8069
- return xt.waitFor(o);
8069
+ return _t.waitFor(o);
8070
8070
  })).next((function() {
8071
8071
  return i;
8072
8072
  }));
@@ -8128,14 +8128,14 @@ var So = /** @class */ function() {
8128
8128
  targetId: n,
8129
8129
  path: u
8130
8130
  })), i.push(r.referenceDelegate.addReference(t, n, e));
8131
- })), xt.waitFor(i);
8131
+ })), _t.waitFor(i);
8132
8132
  }, t.prototype.removeMatchingKeys = function(t, e, n) {
8133
8133
  var r = this, i = Ro(t);
8134
8134
  // PORTING NOTE: The reverse index (documentsTargets) is maintained by
8135
8135
  // IndexedDb.
8136
- return xt.forEach(e, (function(e) {
8136
+ return _t.forEach(e, (function(e) {
8137
8137
  var o = ri(e.path);
8138
- return xt.waitFor([ i.delete([ n, o ]), r.referenceDelegate.removeReference(t, n, e) ]);
8138
+ return _t.waitFor([ i.delete([ n, o ]), r.referenceDelegate.removeReference(t, n, e) ]);
8139
8139
  }));
8140
8140
  }, t.prototype.removeMatchingKeysForTargetId = function(t, e) {
8141
8141
  var n = Ro(t), r = IDBKeyRange.bound([ e ], [ e + 1 ],
@@ -8308,7 +8308,7 @@ function ko(t) {
8308
8308
  [ 3 /*break*/ , 6 ]) : [ 3 /*break*/ , 4 ];
8309
8309
 
8310
8310
  case 4:
8311
- return [ 4 /*yield*/ , _t(t) ];
8311
+ return [ 4 /*yield*/ , xt(t) ];
8312
8312
 
8313
8313
  case 5:
8314
8314
  e.sent(), e.label = 6;
@@ -8336,7 +8336,7 @@ function ko(t) {
8336
8336
  }));
8337
8337
  }, t.prototype.nthSequenceNumber = function(t, e) {
8338
8338
  var n = this;
8339
- if (0 === e) return xt.resolve(qt.at);
8339
+ if (0 === e) return _t.resolve(qt.at);
8340
8340
  var r = new Lo(e);
8341
8341
  return this.$n.forEachTarget(t, (function(t) {
8342
8342
  return r.On(t.sequenceNumber);
@@ -8354,7 +8354,7 @@ function ko(t) {
8354
8354
  }, t.prototype.collect = function(t, e) {
8355
8355
  var n = this;
8356
8356
  return -1 === this.params.cacheSizeCollectionThreshold ? (L("LruGarbageCollector", "Garbage collection skipped; disabled"),
8357
- xt.resolve(bo)) : this.getCacheSize(t).next((function(r) {
8357
+ _t.resolve(bo)) : this.getCacheSize(t).next((function(r) {
8358
8358
  return r < n.params.cacheSizeCollectionThreshold ? (L("LruGarbageCollector", "Garbage collection skipped; Cache size " + r + " is lower than threshold " + n.params.cacheSizeCollectionThreshold),
8359
8359
  bo) : n.Un(t, e);
8360
8360
  }));
@@ -8372,7 +8372,7 @@ function ko(t) {
8372
8372
  return i = e, s = Date.now(), c.removeOrphanedDocuments(t, n);
8373
8373
  })).next((function(t) {
8374
8374
  return a = Date.now(), R() <= h.DEBUG && L("LruGarbageCollector", "LRU Garbage Collection\n\tCounted targets in " + (o - l) + "ms\n\tDetermined least recently used " + r + " in " + (u - o) + "ms\n\tRemoved " + i + " targets in " + (s - u) + "ms\n\tRemoved " + t + " documents in " + (a - s) + "ms\nTotal Duration: " + (a - l) + "ms"),
8375
- xt.resolve({
8375
+ _t.resolve({
8376
8376
  didRun: !0,
8377
8377
  sequenceNumbersCollected: r,
8378
8378
  targetsRemoved: i,
@@ -8424,9 +8424,9 @@ function ko(t) {
8424
8424
  t.prototype.Gn = function(t, e) {
8425
8425
  return function(t, e) {
8426
8426
  var n = !1;
8427
- return No(t).tt((function(r) {
8427
+ return Ao(t).tt((function(r) {
8428
8428
  return Do(t, r, e).next((function(t) {
8429
- return t && (n = !0), xt.resolve(!t);
8429
+ return t && (n = !0), _t.resolve(!t);
8430
8430
  }));
8431
8431
  })).next((function() {
8432
8432
  return n;
@@ -8447,7 +8447,7 @@ function ko(t) {
8447
8447
  i.push(a);
8448
8448
  }
8449
8449
  })).next((function() {
8450
- return xt.waitFor(i);
8450
+ return _t.waitFor(i);
8451
8451
  })).next((function() {
8452
8452
  return r.apply(t);
8453
8453
  })).next((function() {
@@ -8584,7 +8584,7 @@ function ko(t) {
8584
8584
  t.prototype.getEntry = function(t, e) {
8585
8585
  this.assertNotApplied();
8586
8586
  var n = this.changes.get(e);
8587
- return void 0 !== n ? xt.resolve(n) : this.getFromCache(t, e);
8587
+ return void 0 !== n ? _t.resolve(n) : this.getFromCache(t, e);
8588
8588
  },
8589
8589
  /**
8590
8590
  * Looks up several entries in the cache, forwarding to
@@ -8683,7 +8683,7 @@ function ko(t) {
8683
8683
  }, (function(t, i) {
8684
8684
  r = {
8685
8685
  document: n.jn(e, i),
8686
- size: To(i)
8686
+ size: Eo(i)
8687
8687
  };
8688
8688
  })).next((function() {
8689
8689
  return r;
@@ -8708,7 +8708,7 @@ function ko(t) {
8708
8708
  var n = this, r = or(), i = new Kt(ft.comparator);
8709
8709
  return this.zn(t, e, (function(t, e) {
8710
8710
  var o = n.jn(t, e);
8711
- r = r.insert(t, o), i = i.insert(t, To(e));
8711
+ r = r.insert(t, o), i = i.insert(t, Eo(e));
8712
8712
  })).next((function() {
8713
8713
  return {
8714
8714
  documents: r,
@@ -8716,7 +8716,7 @@ function ko(t) {
8716
8716
  };
8717
8717
  }));
8718
8718
  }, t.prototype.zn = function(t, e, n) {
8719
- if (e.isEmpty()) return xt.resolve();
8719
+ if (e.isEmpty()) return _t.resolve();
8720
8720
  var i = new zt(Ho);
8721
8721
  e.forEach((function(t) {
8722
8722
  return i = i.add(t);
@@ -8749,7 +8749,7 @@ function ko(t) {
8749
8749
  return e;
8750
8750
  }));
8751
8751
  }, t.prototype.getAllFromCollectionGroup = function(t, e, n, r) {
8752
- var i = this, o = or(), u = Wo(e, n), s = Wo(e, Et.max());
8752
+ var i = this, o = or(), u = Wo(e, n), s = Wo(e, Tt.max());
8753
8753
  return Qo(t).Z({
8754
8754
  index: "collectionGroupIndex",
8755
8755
  range: IDBKeyRange.bound(u, s, !0)
@@ -8858,7 +8858,7 @@ function ko(t) {
8858
8858
  if (n.push(e.Yn.removeEntry(t, o, s.readTime)), u.isValidDocument()) {
8859
8859
  var a = Pi(e.Yn.It, u);
8860
8860
  i = i.add(o.path.popLast());
8861
- var c = To(a);
8861
+ var c = Eo(a);
8862
8862
  r += c - s.size, n.push(e.Yn.addEntry(t, o, a));
8863
8863
  } else if (r -= s.size, e.trackRemovals) {
8864
8864
  // In order to track removals, we store a "sentinel delete" in the
@@ -8870,7 +8870,7 @@ function ko(t) {
8870
8870
  }
8871
8871
  })), i.forEach((function(r) {
8872
8872
  n.push(e.Yn.indexManager.addToCollectionParentIndex(t, r));
8873
- })), n.push(this.Yn.updateMetadata(t, r)), xt.waitFor(n);
8873
+ })), n.push(this.Yn.updateMetadata(t, r)), _t.waitFor(n);
8874
8874
  }, n.prototype.getFromCache = function(t, e) {
8875
8875
  var n = this;
8876
8876
  // Record the size of everything we load from the cache so we can compute a delta later.
@@ -9151,7 +9151,7 @@ e) {
9151
9151
  }
9152
9152
  })), u.push(n.documentOverlayCache.saveOverlays(t, a, l));
9153
9153
  }; s.hasNext(); ) a();
9154
- return xt.waitFor(u);
9154
+ return _t.waitFor(u);
9155
9155
  })).next((function() {
9156
9156
  return r;
9157
9157
  }));
@@ -9200,14 +9200,14 @@ e) {
9200
9200
  t.prototype.getNextDocuments = function(t, e, n, r) {
9201
9201
  var i = this;
9202
9202
  return this.remoteDocumentCache.getAllFromCollectionGroup(t, e, n, r).next((function(o) {
9203
- var u = r - o.size > 0 ? i.documentOverlayCache.getOverlaysForCollectionGroup(t, e, n.largestBatchId, r - o.size) : xt.resolve(cr()), s = -1, a = o;
9203
+ var u = r - o.size > 0 ? i.documentOverlayCache.getOverlaysForCollectionGroup(t, e, n.largestBatchId, r - o.size) : _t.resolve(cr()), s = -1, a = o;
9204
9204
  // The callsite will use the largest batch ID together with the latest read time to create
9205
9205
  // a new index offset. Since we only process batch IDs if all remote documents have been read,
9206
9206
  // no overlay will increase the overall read time. This is why we only need to special case
9207
9207
  // the batch id.
9208
9208
  return u.next((function(e) {
9209
- return xt.forEach(e, (function(e, n) {
9210
- return s < n.largestBatchId && (s = n.largestBatchId), o.get(e) ? xt.resolve() : i.getBaseDocument(t, e, n).next((function(t) {
9209
+ return _t.forEach(e, (function(e, n) {
9210
+ return s < n.largestBatchId && (s = n.largestBatchId), o.get(e) ? _t.resolve() : i.getBaseDocument(t, e, n).next((function(t) {
9211
9211
  a = a.insert(e, t);
9212
9212
  }));
9213
9213
  })).next((function() {
@@ -9231,7 +9231,7 @@ e) {
9231
9231
  }, t.prototype.getDocumentsMatchingCollectionGroupQuery = function(t, e, n) {
9232
9232
  var r = this, i = e.collectionGroup, o = sr();
9233
9233
  return this.indexManager.getCollectionParents(t, i).next((function(u) {
9234
- return xt.forEach(u, (function(u) {
9234
+ return _t.forEach(u, (function(u) {
9235
9235
  var s = function(t, e) {
9236
9236
  return new nn(e,
9237
9237
  /*collectionGroup=*/ null, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
@@ -9268,14 +9268,14 @@ e) {
9268
9268
  }));
9269
9269
  },
9270
9270
  /** Returns a base document that can be used to apply `overlay`. */ t.prototype.getBaseDocument = function(t, e, n) {
9271
- return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : xt.resolve(Re.newInvalidDocument(e));
9271
+ return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : _t.resolve(Re.newInvalidDocument(e));
9272
9272
  }, t;
9273
9273
  }(), Zo = /** @class */ function() {
9274
9274
  function t(t) {
9275
9275
  this.It = t, this.Zn = new Map, this.ts = new Map;
9276
9276
  }
9277
9277
  return t.prototype.getBundleMetadata = function(t, e) {
9278
- return xt.resolve(this.Zn.get(e));
9278
+ return _t.resolve(this.Zn.get(e));
9279
9279
  }, t.prototype.saveBundleMetadata = function(t, e) {
9280
9280
  /** Decodes a BundleMetadata proto into a BundleMetadata object. */
9281
9281
  var n;
@@ -9283,9 +9283,9 @@ e) {
9283
9283
  id: (n = e).id,
9284
9284
  version: n.version,
9285
9285
  createTime: Or(n.createTime)
9286
- }), xt.resolve();
9286
+ }), _t.resolve();
9287
9287
  }, t.prototype.getNamedQuery = function(t, e) {
9288
- return xt.resolve(this.ts.get(e));
9288
+ return _t.resolve(this.ts.get(e));
9289
9289
  }, t.prototype.saveNamedQuery = function(t, e) {
9290
9290
  return this.ts.set(e.name, function(t) {
9291
9291
  return {
@@ -9293,7 +9293,7 @@ e) {
9293
9293
  query: ji(t.bundledQuery),
9294
9294
  readTime: Or(t.readTime)
9295
9295
  };
9296
- }(e)), xt.resolve();
9296
+ }(e)), _t.resolve();
9297
9297
  }, t;
9298
9298
  }(), Jo = /** @class */ function() {
9299
9299
  function t() {
@@ -9302,10 +9302,10 @@ e) {
9302
9302
  this.overlays = new Kt(ft.comparator), this.es = new Map;
9303
9303
  }
9304
9304
  return t.prototype.getOverlay = function(t, e) {
9305
- return xt.resolve(this.overlays.get(e));
9305
+ return _t.resolve(this.overlays.get(e));
9306
9306
  }, t.prototype.getOverlays = function(t, e) {
9307
9307
  var n = this, r = cr();
9308
- return xt.forEach(e, (function(e) {
9308
+ return _t.forEach(e, (function(e) {
9309
9309
  return n.getOverlay(t, e).next((function(t) {
9310
9310
  null !== t && r.set(e, t);
9311
9311
  }));
@@ -9316,12 +9316,12 @@ e) {
9316
9316
  var r = this;
9317
9317
  return n.forEach((function(n, i) {
9318
9318
  r.ue(t, e, i);
9319
- })), xt.resolve();
9319
+ })), _t.resolve();
9320
9320
  }, t.prototype.removeOverlaysForBatchId = function(t, e, n) {
9321
9321
  var r = this, i = this.es.get(n);
9322
9322
  return void 0 !== i && (i.forEach((function(t) {
9323
9323
  return r.overlays = r.overlays.remove(t);
9324
- })), this.es.delete(n)), xt.resolve();
9324
+ })), this.es.delete(n)), _t.resolve();
9325
9325
  }, t.prototype.getOverlaysForCollection = function(t, e, n) {
9326
9326
  for (var r = cr(), i = e.length + 1, o = new ft(e.child("")), u = this.overlays.getIteratorFrom(o); u.hasNext(); ) {
9327
9327
  var s = u.getNext().value, a = s.getKey();
@@ -9329,7 +9329,7 @@ e) {
9329
9329
  // Documents from sub-collections
9330
9330
  a.path.length === i && s.largestBatchId > n && r.set(s.getKey(), s);
9331
9331
  }
9332
- return xt.resolve(r);
9332
+ return _t.resolve(r);
9333
9333
  }, t.prototype.getOverlaysForCollectionGroup = function(t, e, n, r) {
9334
9334
  for (var i = new Kt((function(t, e) {
9335
9335
  return t - e;
@@ -9343,7 +9343,7 @@ e) {
9343
9343
  for (var a = cr(), c = i.getIterator(); c.hasNext() && (c.getNext().value.forEach((function(t, e) {
9344
9344
  return a.set(t, e);
9345
9345
  })), !(a.size() >= r)); ) ;
9346
- return xt.resolve(a);
9346
+ return _t.resolve(a);
9347
9347
  }, t.prototype.ue = function(t, e, n) {
9348
9348
  // Remove the association of the overlay to its batch id.
9349
9349
  var r = this.overlays.get(n.key);
@@ -9439,7 +9439,7 @@ e) {
9439
9439
  this.gs = new zt(tu.ss);
9440
9440
  }
9441
9441
  return t.prototype.checkEmpty = function(t) {
9442
- return xt.resolve(0 === this.mutationQueue.length);
9442
+ return _t.resolve(0 === this.mutationQueue.length);
9443
9443
  }, t.prototype.addMutationBatch = function(t, e, n, r) {
9444
9444
  var i = this.ws;
9445
9445
  this.ws++, this.mutationQueue.length > 0 && this.mutationQueue[this.mutationQueue.length - 1];
@@ -9450,24 +9450,24 @@ e) {
9450
9450
  var a = s[u];
9451
9451
  this.gs = this.gs.add(new tu(a.key, i)), this.indexManager.addToCollectionParentIndex(t, a.key.path.popLast());
9452
9452
  }
9453
- return xt.resolve(o);
9453
+ return _t.resolve(o);
9454
9454
  }, t.prototype.lookupMutationBatch = function(t, e) {
9455
- return xt.resolve(this.ys(e));
9455
+ return _t.resolve(this.ys(e));
9456
9456
  }, t.prototype.getNextMutationBatchAfterBatchId = function(t, e) {
9457
9457
  var n = e + 1, r = this.ps(n), i = r < 0 ? 0 : r;
9458
9458
  // The requested batchId may still be out of range so normalize it to the
9459
9459
  // start of the queue.
9460
- return xt.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null);
9460
+ return _t.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null);
9461
9461
  }, t.prototype.getHighestUnacknowledgedBatchId = function() {
9462
- return xt.resolve(0 === this.mutationQueue.length ? -1 : this.ws - 1);
9462
+ return _t.resolve(0 === this.mutationQueue.length ? -1 : this.ws - 1);
9463
9463
  }, t.prototype.getAllMutationBatches = function(t) {
9464
- return xt.resolve(this.mutationQueue.slice());
9464
+ return _t.resolve(this.mutationQueue.slice());
9465
9465
  }, t.prototype.getAllMutationBatchesAffectingDocumentKey = function(t, e) {
9466
9466
  var n = this, r = new tu(e, 0), i = new tu(e, Number.POSITIVE_INFINITY), o = [];
9467
9467
  return this.gs.forEachInRange([ r, i ], (function(t) {
9468
9468
  var e = n.ys(t._s);
9469
9469
  o.push(e);
9470
- })), xt.resolve(o);
9470
+ })), _t.resolve(o);
9471
9471
  }, t.prototype.getAllMutationBatchesAffectingDocumentKeys = function(t, e) {
9472
9472
  var n = this, r = new zt(rt);
9473
9473
  return e.forEach((function(t) {
@@ -9475,7 +9475,7 @@ e) {
9475
9475
  n.gs.forEachInRange([ e, i ], (function(t) {
9476
9476
  r = r.add(t._s);
9477
9477
  }));
9478
- })), xt.resolve(this.Is(r));
9478
+ })), _t.resolve(this.Is(r));
9479
9479
  }, t.prototype.getAllMutationBatchesAffectingQuery = function(t, e) {
9480
9480
  // Use the query path as a prefix for testing if a document matches the
9481
9481
  // query.
@@ -9497,7 +9497,7 @@ e) {
9497
9497
  // TODO(mcg): we'll need a different scanner when we implement
9498
9498
  // ancestor queries.
9499
9499
  e.length === r && (u = u.add(t._s)), !0);
9500
- }), o), xt.resolve(this.Is(u));
9500
+ }), o), _t.resolve(this.Is(u));
9501
9501
  }, t.prototype.Is = function(t) {
9502
9502
  var e = this, n = [];
9503
9503
  // Construct an array of matching batches, sorted by batchID to ensure that
@@ -9510,7 +9510,7 @@ e) {
9510
9510
  var n = this;
9511
9511
  U(0 === this.Ts(e.batchId, "removed")), this.mutationQueue.shift();
9512
9512
  var r = this.gs;
9513
- return xt.forEach(e.mutations, (function(i) {
9513
+ return _t.forEach(e.mutations, (function(i) {
9514
9514
  var o = new tu(i.key, e.batchId);
9515
9515
  return r = r.delete(o), n.referenceDelegate.markPotentiallyOrphaned(t, i.key);
9516
9516
  })).next((function() {
@@ -9520,9 +9520,9 @@ e) {
9520
9520
  // No-op since the memory mutation queue does not maintain a separate cache.
9521
9521
  }, t.prototype.containsKey = function(t, e) {
9522
9522
  var n = new tu(e, 0), r = this.gs.firstAfterOrEqual(n);
9523
- return xt.resolve(e.isEqual(r && r.key));
9523
+ return _t.resolve(e.isEqual(r && r.key));
9524
9524
  }, t.prototype.performConsistencyCheck = function(t) {
9525
- return this.mutationQueue.length, xt.resolve();
9525
+ return this.mutationQueue.length, _t.resolve();
9526
9526
  },
9527
9527
  /**
9528
9528
  * Finds the index of the given batchId in the mutation queue and asserts that
@@ -9599,13 +9599,13 @@ e) {
9599
9599
  e && (this.docs = this.docs.remove(t), this.size -= e.size);
9600
9600
  }, t.prototype.getEntry = function(t, e) {
9601
9601
  var n = this.docs.get(e);
9602
- return xt.resolve(n ? n.document.mutableCopy() : Re.newInvalidDocument(e));
9602
+ return _t.resolve(n ? n.document.mutableCopy() : Re.newInvalidDocument(e));
9603
9603
  }, t.prototype.getEntries = function(t, e) {
9604
9604
  var n = this, r = or();
9605
9605
  return e.forEach((function(t) {
9606
9606
  var e = n.docs.get(t);
9607
9607
  r = r.insert(t, e ? e.document.mutableCopy() : Re.newInvalidDocument(t));
9608
- })), xt.resolve(r);
9608
+ })), _t.resolve(r);
9609
9609
  }, t.prototype.getAllFromCollection = function(t, e, n) {
9610
9610
  for (var r = or(), i = new ft(e.child("")), o = this.docs.getIteratorFrom(i)
9611
9611
  // Documents are ordered by key, so we can use a prefix scan to narrow down
@@ -9613,15 +9613,15 @@ e) {
9613
9613
  ; o.hasNext(); ) {
9614
9614
  var u = o.getNext(), s = u.key, a = u.value.document;
9615
9615
  if (!e.isPrefixOf(s.path)) break;
9616
- s.path.length > e.length + 1 || Tt(It(a), n) <= 0 || (r = r.insert(a.key, a.mutableCopy()));
9616
+ s.path.length > e.length + 1 || Et(It(a), n) <= 0 || (r = r.insert(a.key, a.mutableCopy()));
9617
9617
  }
9618
- return xt.resolve(r);
9618
+ return _t.resolve(r);
9619
9619
  }, t.prototype.getAllFromCollectionGroup = function(t, e, n, r) {
9620
9620
  // This method should only be called from the IndexBackfiller if persistence
9621
9621
  // is enabled.
9622
9622
  q();
9623
9623
  }, t.prototype.As = function(t, e) {
9624
- return xt.forEach(this.docs, (function(t) {
9624
+ return _t.forEach(this.docs, (function(t) {
9625
9625
  return e(t);
9626
9626
  }));
9627
9627
  }, t.prototype.newChangeBuffer = function(t) {
@@ -9629,7 +9629,7 @@ e) {
9629
9629
  // a separate changelog and does not need special handling for removals.
9630
9630
  return new ru(this);
9631
9631
  }, t.prototype.getSize = function(t) {
9632
- return xt.resolve(this.size);
9632
+ return _t.resolve(this.size);
9633
9633
  }, t;
9634
9634
  }(), ru = /** @class */ function(e) {
9635
9635
  function n(t) {
@@ -9640,7 +9640,7 @@ e) {
9640
9640
  var e = this, n = [];
9641
9641
  return this.changes.forEach((function(r, i) {
9642
9642
  i.isValidDocument() ? n.push(e.Yn.addEntry(t, i)) : e.Yn.removeEntry(r);
9643
- })), xt.waitFor(n);
9643
+ })), _t.waitFor(n);
9644
9644
  }, n.prototype.getFromCache = function(t, e) {
9645
9645
  return this.Yn.getEntry(t, e);
9646
9646
  }, n.prototype.getAllFromCache = function(t, e) {
@@ -9665,60 +9665,60 @@ e) {
9665
9665
  * A ordered bidirectional mapping between documents and the remote target
9666
9666
  * IDs.
9667
9667
  */
9668
- this.Ps = new $o, this.targetCount = 0, this.vs = Ao.Pn();
9668
+ this.Ps = new $o, this.targetCount = 0, this.vs = No.Pn();
9669
9669
  }
9670
9670
  return t.prototype.forEachTarget = function(t, e) {
9671
9671
  return this.Rs.forEach((function(t, n) {
9672
9672
  return e(n);
9673
- })), xt.resolve();
9673
+ })), _t.resolve();
9674
9674
  }, t.prototype.getLastRemoteSnapshotVersion = function(t) {
9675
- return xt.resolve(this.lastRemoteSnapshotVersion);
9675
+ return _t.resolve(this.lastRemoteSnapshotVersion);
9676
9676
  }, t.prototype.getHighestSequenceNumber = function(t) {
9677
- return xt.resolve(this.bs);
9677
+ return _t.resolve(this.bs);
9678
9678
  }, t.prototype.allocateTargetId = function(t) {
9679
- return this.highestTargetId = this.vs.next(), xt.resolve(this.highestTargetId);
9679
+ return this.highestTargetId = this.vs.next(), _t.resolve(this.highestTargetId);
9680
9680
  }, t.prototype.setTargetsMetadata = function(t, e, n) {
9681
9681
  return n && (this.lastRemoteSnapshotVersion = n), e > this.bs && (this.bs = e),
9682
- xt.resolve();
9682
+ _t.resolve();
9683
9683
  }, t.prototype.Dn = function(t) {
9684
9684
  this.Rs.set(t.target, t);
9685
9685
  var e = t.targetId;
9686
- e > this.highestTargetId && (this.vs = new Ao(e), this.highestTargetId = e), t.sequenceNumber > this.bs && (this.bs = t.sequenceNumber);
9686
+ e > this.highestTargetId && (this.vs = new No(e), this.highestTargetId = e), t.sequenceNumber > this.bs && (this.bs = t.sequenceNumber);
9687
9687
  }, t.prototype.addTargetData = function(t, e) {
9688
- return this.Dn(e), this.targetCount += 1, xt.resolve();
9688
+ return this.Dn(e), this.targetCount += 1, _t.resolve();
9689
9689
  }, t.prototype.updateTargetData = function(t, e) {
9690
- return this.Dn(e), xt.resolve();
9690
+ return this.Dn(e), _t.resolve();
9691
9691
  }, t.prototype.removeTargetData = function(t, e) {
9692
9692
  return this.Rs.delete(e.target), this.Ps.ls(e.targetId), this.targetCount -= 1,
9693
- xt.resolve();
9693
+ _t.resolve();
9694
9694
  }, t.prototype.removeTargets = function(t, e, n) {
9695
9695
  var r = this, i = 0, o = [];
9696
9696
  return this.Rs.forEach((function(u, s) {
9697
9697
  s.sequenceNumber <= e && null === n.get(s.targetId) && (r.Rs.delete(u), o.push(r.removeMatchingKeysForTargetId(t, s.targetId)),
9698
9698
  i++);
9699
- })), xt.waitFor(o).next((function() {
9699
+ })), _t.waitFor(o).next((function() {
9700
9700
  return i;
9701
9701
  }));
9702
9702
  }, t.prototype.getTargetCount = function(t) {
9703
- return xt.resolve(this.targetCount);
9703
+ return _t.resolve(this.targetCount);
9704
9704
  }, t.prototype.getTargetData = function(t, e) {
9705
9705
  var n = this.Rs.get(e) || null;
9706
- return xt.resolve(n);
9706
+ return _t.resolve(n);
9707
9707
  }, t.prototype.addMatchingKeys = function(t, e, n) {
9708
- return this.Ps.us(e, n), xt.resolve();
9708
+ return this.Ps.us(e, n), _t.resolve();
9709
9709
  }, t.prototype.removeMatchingKeys = function(t, e, n) {
9710
9710
  this.Ps.hs(e, n);
9711
9711
  var r = this.persistence.referenceDelegate, i = [];
9712
9712
  return r && e.forEach((function(e) {
9713
9713
  i.push(r.markPotentiallyOrphaned(t, e));
9714
- })), xt.waitFor(i);
9714
+ })), _t.waitFor(i);
9715
9715
  }, t.prototype.removeMatchingKeysForTargetId = function(t, e) {
9716
- return this.Ps.ls(e), xt.resolve();
9716
+ return this.Ps.ls(e), _t.resolve();
9717
9717
  }, t.prototype.getMatchingKeysForTargetId = function(t, e) {
9718
9718
  var n = this.Ps.ds(e);
9719
- return xt.resolve(n);
9719
+ return _t.resolve(n);
9720
9720
  }, t.prototype.containsKey = function(t, e) {
9721
- return xt.resolve(this.Ps.containsKey(e));
9721
+ return _t.resolve(this.Ps.containsKey(e));
9722
9722
  }, t;
9723
9723
  }(), ou = /** @class */ function() {
9724
9724
  /**
@@ -9778,7 +9778,7 @@ e) {
9778
9778
  return i.raiseOnCommittedEvent(), t;
9779
9779
  }));
9780
9780
  }, t.prototype.Ms = function(t, e) {
9781
- return xt.or(Object.values(this.Vs).map((function(n) {
9781
+ return _t.or(Object.values(this.Vs).map((function(n) {
9782
9782
  return function() {
9783
9783
  return n.containsKey(t, e);
9784
9784
  };
@@ -9808,11 +9808,11 @@ e) {
9808
9808
  enumerable: !1,
9809
9809
  configurable: !0
9810
9810
  }), t.prototype.addReference = function(t, e, n) {
9811
- return this.Fs.addReference(n, e), this.Ls.delete(n.toString()), xt.resolve();
9811
+ return this.Fs.addReference(n, e), this.Ls.delete(n.toString()), _t.resolve();
9812
9812
  }, t.prototype.removeReference = function(t, e, n) {
9813
- return this.Fs.removeReference(n, e), this.Ls.add(n.toString()), xt.resolve();
9813
+ return this.Fs.removeReference(n, e), this.Ls.add(n.toString()), _t.resolve();
9814
9814
  }, t.prototype.markPotentiallyOrphaned = function(t, e) {
9815
- return this.Ls.add(e.toString()), xt.resolve();
9815
+ return this.Ls.add(e.toString()), _t.resolve();
9816
9816
  }, t.prototype.removeTarget = function(t, e) {
9817
9817
  var n = this;
9818
9818
  this.Fs.ls(e.targetId).forEach((function(t) {
@@ -9831,7 +9831,7 @@ e) {
9831
9831
  }, t.prototype.Os = function(t) {
9832
9832
  var e = this, n = this.persistence.getRemoteDocumentCache().newChangeBuffer();
9833
9833
  // Remove newly orphaned documents.
9834
- return xt.forEach(this.Ls, (function(r) {
9834
+ return _t.forEach(this.Ls, (function(r) {
9835
9835
  var i = ft.fromPath(r);
9836
9836
  return e.Us(t, i).next((function(t) {
9837
9837
  t || n.removeEntry(i, st.min());
@@ -9849,8 +9849,8 @@ e) {
9849
9849
  return 0;
9850
9850
  }, t.prototype.Us = function(t, e) {
9851
9851
  var n = this;
9852
- return xt.or([ function() {
9853
- return xt.resolve(n.Fs.containsKey(e));
9852
+ return _t.or([ function() {
9853
+ return _t.resolve(n.Fs.containsKey(e));
9854
9854
  }, function() {
9855
9855
  return n.persistence.getTargetCache().containsKey(t, e);
9856
9856
  }, function() {
@@ -9868,7 +9868,7 @@ e) {
9868
9868
  * to SCHEMA_VERSION. Different values of toVersion are only used for testing
9869
9869
  * and local feature development.
9870
9870
  */ return t.prototype.$ = function(t, e, n, r) {
9871
- var i = this, o = new Nt("createOrUpgrade", e);
9871
+ var i = this, o = new At("createOrUpgrade", e);
9872
9872
  n < 1 && r >= 1 && (function(t) {
9873
9873
  t.createObjectStore("owner");
9874
9874
  }(t), function(t) {
@@ -9885,7 +9885,7 @@ e) {
9885
9885
  }(t));
9886
9886
  // Migration 2 to populate the targetGlobal object no longer needed since
9887
9887
  // migration 3 unconditionally clears it.
9888
- var u = xt.resolve();
9888
+ var u = _t.resolve();
9889
9889
  return n < 3 && r >= 3 && (
9890
9890
  // Brand new clients don't need to drop and recreate--only clients that
9891
9891
  // potentially have corrupt data.
@@ -9925,7 +9925,7 @@ e) {
9925
9925
  var r = e.store("mutations"), i = n.map((function(t) {
9926
9926
  return r.put(t);
9927
9927
  }));
9928
- return xt.waitFor(i);
9928
+ return _t.waitFor(i);
9929
9929
  }));
9930
9930
  }(t, o);
9931
9931
  }))), u = u.next((function() {
@@ -9968,9 +9968,9 @@ e) {
9968
9968
  }))), n < 12 && r >= 12 && (u = u.next((function() {
9969
9969
  !function(t) {
9970
9970
  var e = t.createObjectStore("documentOverlays", {
9971
- keyPath: Ei
9971
+ keyPath: Ti
9972
9972
  });
9973
- e.createIndex("collectionPathOverlayIndex", Ti, {
9973
+ e.createIndex("collectionPathOverlayIndex", Ei, {
9974
9974
  unique: !1
9975
9975
  }), e.createIndex("collectionGroupOverlayIndex", Si, {
9976
9976
  unique: !1
@@ -10010,7 +10010,7 @@ e) {
10010
10010
  }, t.prototype.Ks = function(t) {
10011
10011
  var e = 0;
10012
10012
  return t.store("remoteDocuments").Z((function(t, n) {
10013
- e += To(n);
10013
+ e += Eo(n);
10014
10014
  })).next((function() {
10015
10015
  var n = {
10016
10016
  byteSize: e
@@ -10020,13 +10020,13 @@ e) {
10020
10020
  }, t.prototype.qs = function(t) {
10021
10021
  var e = this, n = t.store("mutationQueues"), r = t.store("mutations");
10022
10022
  return n.W().next((function(n) {
10023
- return xt.forEach(n, (function(n) {
10023
+ return _t.forEach(n, (function(n) {
10024
10024
  var i = IDBKeyRange.bound([ n.userId, -1 ], [ n.userId, n.lastAcknowledgedBatchId ]);
10025
10025
  return r.W("userMutationsIndex", i).next((function(r) {
10026
- return xt.forEach(r, (function(r) {
10026
+ return _t.forEach(r, (function(r) {
10027
10027
  U(r.userId === n.userId);
10028
10028
  var i = Bi(e.It, r);
10029
- return Eo(t, n.userId, i).next((function() {}));
10029
+ return To(t, n.userId, i).next((function() {}));
10030
10030
  }));
10031
10031
  }));
10032
10032
  }));
@@ -10045,7 +10045,7 @@ e) {
10045
10045
  return [ 0, ri(t) ];
10046
10046
  }(o);
10047
10047
  r.push(e.get(u).next((function(n) {
10048
- return n ? xt.resolve() : function(n) {
10048
+ return n ? _t.resolve() : function(n) {
10049
10049
  return e.put({
10050
10050
  targetId: 0,
10051
10051
  path: ri(n),
@@ -10054,7 +10054,7 @@ e) {
10054
10054
  }(o);
10055
10055
  })));
10056
10056
  })).next((function() {
10057
- return xt.waitFor(r);
10057
+ return _t.waitFor(r);
10058
10058
  }));
10059
10059
  }));
10060
10060
  }, t.prototype.Qs = function(t, e) {
@@ -10110,7 +10110,7 @@ e) {
10110
10110
  };
10111
10111
  r.push(o.put(s));
10112
10112
  })).next((function() {
10113
- return xt.waitFor(r);
10113
+ return _t.waitFor(r);
10114
10114
  }));
10115
10115
  }, t.prototype.zs = function(t, e) {
10116
10116
  var n = this, r = e.store("mutations"), i = Go(this.It), o = new ou(su.Bs, this.It.re);
@@ -10121,7 +10121,7 @@ e) {
10121
10121
  Bi(n.It, t).keys().forEach((function(t) {
10122
10122
  return i = i.add(t);
10123
10123
  })), r.set(t.userId, i);
10124
- })), xt.forEach(r, (function(t, r) {
10124
+ })), _t.forEach(r, (function(t, r) {
10125
10125
  var u = new C(r), s = Zi.oe(n.It, u), a = o.getIndexManager(u), c = So.oe(u, n.It, a, o.referenceDelegate);
10126
10126
  return new Xo(i, c, s, a).recalculateAndSaveOverlaysForDocumentKeys(new Ci(e, qt.at), t).next();
10127
10127
  }));
@@ -10192,7 +10192,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10192
10192
  return Promise.resolve();
10193
10193
  }, !t.C()) throw new j(K.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
10194
10194
  this.referenceDelegate = new Fo(this, i), this.ii = n + "main", this.It = new Mi(a),
10195
- this.ri = new At(this.ii, this.Xs, new au(this.It)), this.Cs = new Co(this.referenceDelegate, this.It),
10195
+ this.ri = new Nt(this.ii, this.Xs, new au(this.It)), this.Cs = new Co(this.referenceDelegate, this.It),
10196
10196
  this.remoteDocumentCache = Go(this.It), this.Ns = new Hi, this.window && this.window.localStorage ? this.oi = this.window.localStorage : (this.oi = null,
10197
10197
  !1 === l && M("IndexedDbPersistence", "LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."));
10198
10198
  }
@@ -10336,7 +10336,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10336
10336
  }, t.prototype.fi = function(t) {
10337
10337
  var e = this;
10338
10338
  return fu(t).get("owner").next((function(t) {
10339
- return xt.resolve(e.mi(t));
10339
+ return _t.resolve(e.mi(t));
10340
10340
  }));
10341
10341
  }, t.prototype.gi = function(t) {
10342
10342
  return du(t).delete(this.clientId);
@@ -10360,7 +10360,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10360
10360
  return -1 === n.indexOf(t);
10361
10361
  }));
10362
10362
  // Delete metadata for clients that are no longer considered active.
10363
- return xt.forEach(r, (function(t) {
10363
+ return _t.forEach(r, (function(t) {
10364
10364
  return e.delete(t.clientId);
10365
10365
  })).next((function() {
10366
10366
  return r;
@@ -10411,7 +10411,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10411
10411
  */
10412
10412
  t.prototype.di = function(t) {
10413
10413
  var e = this;
10414
- return this.Ys ? xt.resolve(!0) : fu(t).get("owner").next((function(n) {
10414
+ return this.Ys ? _t.resolve(!0) : fu(t).get("owner").next((function(n) {
10415
10415
  // A client is eligible for the primary lease if:
10416
10416
  // - its network is enabled and the client's tab is in the foreground.
10417
10417
  // - its network is enabled and no other client's tab is in the
@@ -10531,7 +10531,7 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10531
10531
  }, t.prototype.runTransaction = function(t, e, n) {
10532
10532
  var r = this;
10533
10533
  L("IndexedDbPersistence", "Starting transaction:", t);
10534
- var i, o, u = "readonly" === e ? "readonly" : "readwrite", s = 15 === (i = this.Xs) ? Ai : 14 === i ? Ni : 13 === i ? xi : 12 === i ? _i : 11 === i ? Di : void q();
10534
+ var i, o, u = "readonly" === e ? "readonly" : "readwrite", s = 15 === (i = this.Xs) ? Ni : 14 === i ? Ai : 13 === i ? _i : 12 === i ? xi : 11 === i ? Di : void q();
10535
10535
  /** Returns the object stores for the provided schema. */
10536
10536
  // Do all transactions as readwrite against all object stores, since we
10537
10537
  // are the only reader/writer.
@@ -10579,12 +10579,12 @@ var lu = "Failed to obtain exclusive access to the persistence layer. To allow s
10579
10579
  };
10580
10580
  return fu(t).put("owner", e);
10581
10581
  }, t.C = function() {
10582
- return At.C();
10582
+ return Nt.C();
10583
10583
  },
10584
10584
  /** Checks the primary lease and removes it if we are the current primary. */ t.prototype._i = function(t) {
10585
10585
  var e = this, n = fu(t);
10586
10586
  return n.get("owner").next((function(t) {
10587
- return e.mi(t) ? (L("IndexedDbPersistence", "Releasing primary lease."), n.delete("owner")) : xt.resolve();
10587
+ return e.mi(t) ? (L("IndexedDbPersistence", "Releasing primary lease."), n.delete("owner")) : _t.resolve();
10588
10588
  }));
10589
10589
  },
10590
10590
  /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ t.prototype.pi = function(t, e) {
@@ -10809,7 +10809,7 @@ var vu = /** @class */ function() {
10809
10809
  // Queries that match all documents don't benefit from using
10810
10810
  // key-based lookups. It is more efficient to scan all documents in a
10811
10811
  // collection, rather than to perform individual lookups.
10812
- return xt.resolve(null);
10812
+ return _t.resolve(null);
10813
10813
  var r = hn(e);
10814
10814
  return this.indexManager.getIndexType(t, r).next((function(i) {
10815
10815
  return 0 /* NONE */ === i ? null : (null !== e.limit && 1 /* PARTIAL */ === i && (
@@ -10885,7 +10885,7 @@ var vu = /** @class */ function() {
10885
10885
  return !!i && (i.hasPendingWrites || i.version.compareTo(r) > 0);
10886
10886
  }, t.prototype.Mi = function(t, e) {
10887
10887
  return R() <= h.DEBUG && L("QueryEngine", "Using full collection scan to execute query:", vn(e)),
10888
- this.Ni.getDocumentsMatchingQuery(t, e, Et.min());
10888
+ this.Ni.getDocumentsMatchingQuery(t, e, Tt.min());
10889
10889
  },
10890
10890
  /**
10891
10891
  * Combines the results from an indexed execution with the remaining documents
@@ -11078,7 +11078,7 @@ function wu(t, r) {
11078
11078
  trackRemovals: !0
11079
11079
  });
11080
11080
  return function(t, e, n, r) {
11081
- var i = n.batch, o = i.keys(), u = xt.resolve();
11081
+ var i = n.batch, o = i.keys(), u = _t.resolve();
11082
11082
  return o.forEach((function(t) {
11083
11083
  u = u.next((function() {
11084
11084
  return r.getEntry(e, t);
@@ -11127,7 +11127,7 @@ function wu(t, r) {
11127
11127
  *
11128
11128
  * LocalDocuments are re-calculated if there are remaining mutations in the
11129
11129
  * queue.
11130
- */ function Eu(t, e) {
11130
+ */ function Tu(t, e) {
11131
11131
  var n = G(t), r = e.snapshotVersion, i = n.Ui;
11132
11132
  return n.persistence.runTransaction("Apply remote event", "readwrite-primary", (function(t) {
11133
11133
  var o = n.Gi.newChangeBuffer({
@@ -11183,7 +11183,7 @@ function wu(t, r) {
11183
11183
  })),
11184
11184
  // Each loop iteration only affects its "own" doc, so it's safe to get all
11185
11185
  // the remote documents in advance in a single call.
11186
- u.push(Tu(t, o, e.documentUpdates).next((function(t) {
11186
+ u.push(Eu(t, o, e.documentUpdates).next((function(t) {
11187
11187
  s = t.Wi, a = t.zi;
11188
11188
  }))), !r.isEqual(st.min())) {
11189
11189
  var c = n.Cs.getLastRemoteSnapshotVersion(t).next((function(e) {
@@ -11191,7 +11191,7 @@ function wu(t, r) {
11191
11191
  }));
11192
11192
  u.push(c);
11193
11193
  }
11194
- return xt.waitFor(u).next((function() {
11194
+ return _t.waitFor(u).next((function() {
11195
11195
  return o.apply(t);
11196
11196
  })).next((function() {
11197
11197
  return n.localDocuments.getLocalViewOfDocuments(t, s, a);
@@ -11212,7 +11212,7 @@ function wu(t, r) {
11212
11212
  * @param documentBuffer - Document buffer to collect the resulted changes to be
11213
11213
  * applied to storage.
11214
11214
  * @param documents - Documents to be applied.
11215
- */ function Tu(t, e, n) {
11215
+ */ function Eu(t, e, n) {
11216
11216
  var r = pr(), i = pr();
11217
11217
  return n.forEach((function(t) {
11218
11218
  return r = r.add(t);
@@ -11272,7 +11272,7 @@ function Su(t, e) {
11272
11272
  // This target has been listened to previously, so reuse the
11273
11273
  // previous targetID.
11274
11274
  // TODO(mcg): freshen last accessed date?
11275
- r = i, xt.resolve(r)) : n.Cs.allocateTargetId(t).next((function(i) {
11275
+ r = i, _t.resolve(r)) : n.Cs.allocateTargetId(t).next((function(i) {
11276
11276
  return r = new Li(e, i, 0 /* Listen */ , t.currentSequenceNumber), n.Cs.addTargetData(t, r).next((function() {
11277
11277
  return r;
11278
11278
  }));
@@ -11300,7 +11300,7 @@ function Su(t, e) {
11300
11300
  * Releasing a non-existing `Target` is a no-op.
11301
11301
  */
11302
11302
  // PORTING NOTE: `keepPersistedTargetData` is multi-tab only.
11303
- function _u(t, r, i) {
11303
+ function xu(t, r, i) {
11304
11304
  return e(this, void 0, void 0, (function() {
11305
11305
  var e, o, u, s;
11306
11306
  return n(this, (function(n) {
@@ -11343,12 +11343,12 @@ function _u(t, r, i) {
11343
11343
  *
11344
11344
  * @param usePreviousResults - Whether results from previous executions can
11345
11345
  * be used to optimize this query execution.
11346
- */ function xu(t, e, n) {
11346
+ */ function _u(t, e, n) {
11347
11347
  var r = G(t), i = st.min(), o = pr();
11348
11348
  return r.persistence.runTransaction("Execute query", "readonly", (function(t) {
11349
11349
  return function(t, e, n) {
11350
11350
  var r = G(t), i = r.qi.get(n);
11351
- return void 0 !== i ? xt.resolve(r.Ui.get(i)) : r.Cs.getTargetData(e, n);
11351
+ return void 0 !== i ? _t.resolve(r.Ui.get(i)) : r.Cs.getTargetData(e, n);
11352
11352
  }(r, t, hn(e)).next((function(e) {
11353
11353
  if (e) return i = e.lastLimboFreeSnapshotVersion, r.Cs.getMatchingKeysForTargetId(t, e.targetId).next((function(t) {
11354
11354
  o = t;
@@ -11365,7 +11365,7 @@ function _u(t, r, i) {
11365
11365
  }
11366
11366
 
11367
11367
  // PORTING NOTE: Multi-Tab only.
11368
- function Nu(t, e) {
11368
+ function Au(t, e) {
11369
11369
  var n = G(t), r = G(n.Cs), i = n.Ui.get(e);
11370
11370
  return i ? Promise.resolve(i.target) : n.persistence.runTransaction("Get target data", "readonly", (function(t) {
11371
11371
  return r.se(t, e).next((function(t) {
@@ -11381,7 +11381,7 @@ function Nu(t, e) {
11381
11381
  * since the prior call.
11382
11382
  */
11383
11383
  // PORTING NOTE: Multi-Tab only.
11384
- function Au(t, e) {
11384
+ function Nu(t, e) {
11385
11385
  var n = G(t), r = n.Ki.get(e) || st.min();
11386
11386
  // Get the current maximum read time for the collection. This should always
11387
11387
  // exist, but to reduce the chance for regressions we default to
@@ -11437,7 +11437,7 @@ function Cu(t, e, n) {
11437
11437
  // Allocates a target to hold all document keys from the bundle, such that
11438
11438
  // they will not get garbage collected right away.
11439
11439
  return p = n.sent(), [ 2 /*return*/ , e.persistence.runTransaction("Apply bundle documents", "readwrite", (function(t) {
11440
- return Tu(t, d, s).next((function(e) {
11440
+ return Eu(t, d, s).next((function(e) {
11441
11441
  return d.apply(t), e;
11442
11442
  })).next((function(n) {
11443
11443
  return e.Cs.removeMatchingKeysForTargetId(t, p.targetId).next((function() {
@@ -11993,28 +11993,31 @@ var Mu = /** @class */ function() {
11993
11993
  return new Promise((function(i, o) {
11994
11994
  var u = new b;
11995
11995
  u.setWithCredentials(!0), u.listenOnce(I.COMPLETE, (function() {
11996
+ var e;
11996
11997
  try {
11997
11998
  switch (u.getLastErrorCode()) {
11998
- case E.NO_ERROR:
11999
- var e = u.getResponseJson();
12000
- L("Connection", "XHR received:", JSON.stringify(e)), i(e);
11999
+ case T.NO_ERROR:
12000
+ var n = u.getResponseJson();
12001
+ L("Connection", "XHR received:", JSON.stringify(n)), i(n);
12001
12002
  break;
12002
12003
 
12003
- case E.TIMEOUT:
12004
+ case T.TIMEOUT:
12004
12005
  L("Connection", 'RPC "' + t + '" timed out'), o(new j(K.DEADLINE_EXCEEDED, "Request time out"));
12005
12006
  break;
12006
12007
 
12007
- case E.HTTP_ERROR:
12008
- var n = u.getStatus();
12009
- if (L("Connection", 'RPC "' + t + '" failed with status:', n, "response text:", u.getResponseText()),
12010
- n > 0) {
12011
- var r = u.getResponseJson().error;
12012
- if (r && r.status && r.message) {
12013
- var s = function(t) {
12008
+ case T.HTTP_ERROR:
12009
+ var r = u.getStatus();
12010
+ if (L("Connection", 'RPC "' + t + '" failed with status:', r, "response text:", u.getResponseText()),
12011
+ r > 0) {
12012
+ var s = u.getResponseJson();
12013
+ Array.isArray(s) && (s = s[0]);
12014
+ var a = null === (e = s) || void 0 === e ? void 0 : e.error;
12015
+ if (a && a.status && a.message) {
12016
+ var c = function(t) {
12014
12017
  var e = t.toLowerCase().replace(/_/g, "-");
12015
12018
  return Object.values(K).indexOf(e) >= 0 ? e : K.UNKNOWN;
12016
- }(r.status);
12017
- o(new j(s, r.message));
12019
+ }(a.status);
12020
+ o(new j(c, a.message));
12018
12021
  } else o(new j(K.UNKNOWN, "Server responded with status " + u.getStatus()));
12019
12022
  } else
12020
12023
  // If we received an HTTP_ERROR but there's no status code,
@@ -12033,7 +12036,7 @@ var Mu = /** @class */ function() {
12033
12036
  u.send(e, "POST", s, n, 15);
12034
12037
  }));
12035
12038
  }, n.prototype.wo = function(t, e, n) {
12036
- var r = [ this.oo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = T(), o = S(), u = {
12039
+ var r = [ this.oo, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = E(), o = S(), u = {
12037
12040
  // Required for backend stickiness, routing behavior is based on this
12038
12041
  // parameter.
12039
12042
  httpSessionIdParam: "gsessionid",
@@ -12100,13 +12103,13 @@ var Mu = /** @class */ function() {
12100
12103
  // exception and rethrow using a setTimeout so they become visible again.
12101
12104
  // Note that eventually this function could go away if we are confident
12102
12105
  // enough the code is exception free.
12103
- return f(a, _.EventType.OPEN, (function() {
12106
+ return f(a, x.EventType.OPEN, (function() {
12104
12107
  l || L("Connection", "WebChannel transport opened.");
12105
- })), f(a, _.EventType.CLOSE, (function() {
12108
+ })), f(a, x.EventType.CLOSE, (function() {
12106
12109
  l || (l = !0, L("Connection", "WebChannel transport closed"), h.io());
12107
- })), f(a, _.EventType.ERROR, (function(t) {
12110
+ })), f(a, x.EventType.ERROR, (function(t) {
12108
12111
  l || (l = !0, P("Connection", "WebChannel transport errored:", t), h.io(new j(K.UNAVAILABLE, "The operation could not be completed")));
12109
- })), f(a, _.EventType.MESSAGE, (function(t) {
12112
+ })), f(a, x.EventType.MESSAGE, (function(t) {
12110
12113
  var e;
12111
12114
  if (!l) {
12112
12115
  var n = t.data[0];
@@ -12138,8 +12141,8 @@ var Mu = /** @class */ function() {
12138
12141
  l = !0, h.io(new j(u, s)), a.close();
12139
12142
  } else L("Connection", "WebChannel received:", n), h.ro(n);
12140
12143
  }
12141
- })), f(o, x.STAT_EVENT, (function(t) {
12142
- t.stat === N.PROXY ? L("Connection", "Detected buffering proxy") : t.stat === N.NOPROXY && L("Connection", "Detected no buffering proxy");
12144
+ })), f(o, _.STAT_EVENT, (function(t) {
12145
+ t.stat === A.PROXY ? L("Connection", "Detected buffering proxy") : t.stat === A.NOPROXY && L("Connection", "Detected no buffering proxy");
12143
12146
  })), setTimeout((function() {
12144
12147
  // Technically we could/should wait for the WebChannel opened event,
12145
12148
  // but because we want to send the first message with the WebChannel
@@ -12266,7 +12269,7 @@ function Hu() {
12266
12269
  * See the License for the specific language governing permissions and
12267
12270
  * limitations under the License.
12268
12271
  */ function Xu(t) {
12269
- return new Nr(t, /* useProto3Json= */ !0);
12272
+ return new Ar(t, /* useProto3Json= */ !0);
12270
12273
  }
12271
12274
 
12272
12275
  /**
@@ -12357,14 +12360,14 @@ function Hu() {
12357
12360
  }, t;
12358
12361
  }(), Ju = /** @class */ function() {
12359
12362
  function t(t, e, n, r, i, o, u, s) {
12360
- this.Hs = t, this.vo = n, this.Vo = r, this.So = i, this.authCredentialsProvider = o,
12363
+ this.Hs = t, this.vo = n, this.Vo = r, this.connection = i, this.authCredentialsProvider = o,
12361
12364
  this.appCheckCredentialsProvider = u, this.listener = s, this.state = 0 /* Initial */ ,
12362
12365
  /**
12363
12366
  * A close count that's incremented every time the stream is closed; used by
12364
12367
  * getCloseGuardedDispatcher() to invalidate callbacks that happen after
12365
12368
  * close.
12366
12369
  */
12367
- this.Do = 0, this.Co = null, this.xo = null, this.stream = null, this.No = new Zu(t, e)
12370
+ this.So = 0, this.Do = null, this.Co = null, this.stream = null, this.xo = new Zu(t, e)
12368
12371
  /**
12369
12372
  * Returns true if start() has been called and no error has occurred. True
12370
12373
  * indicates the stream is open or in the process of opening (which
@@ -12373,14 +12376,14 @@ function Hu() {
12373
12376
  * outbound requests.
12374
12377
  */;
12375
12378
  }
12376
- return t.prototype.ko = function() {
12377
- return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.Oo();
12379
+ return t.prototype.No = function() {
12380
+ return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.ko();
12378
12381
  },
12379
12382
  /**
12380
12383
  * Returns true if the underlying RPC is open (the onOpen() listener has been
12381
12384
  * called) and the stream is ready for outbound requests.
12382
12385
  */
12383
- t.prototype.Oo = function() {
12386
+ t.prototype.ko = function() {
12384
12387
  return 2 /* Open */ === this.state || 3 /* Healthy */ === this.state;
12385
12388
  },
12386
12389
  /**
@@ -12391,7 +12394,7 @@ function Hu() {
12391
12394
  * When start returns, isStarted() will return true.
12392
12395
  */
12393
12396
  t.prototype.start = function() {
12394
- 4 /* Error */ !== this.state ? this.auth() : this.Mo();
12397
+ 4 /* Error */ !== this.state ? this.auth() : this.Oo();
12395
12398
  },
12396
12399
  /**
12397
12400
  * Stops the RPC. This call is idempotent and allowed regardless of the
@@ -12404,7 +12407,7 @@ function Hu() {
12404
12407
  return n(this, (function(t) {
12405
12408
  switch (t.label) {
12406
12409
  case 0:
12407
- return this.ko() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ];
12410
+ return this.No() ? [ 4 /*yield*/ , this.close(0 /* Initial */) ] : [ 3 /*break*/ , 2 ];
12408
12411
 
12409
12412
  case 1:
12410
12413
  t.sent(), t.label = 2;
@@ -12423,8 +12426,8 @@ function Hu() {
12423
12426
  * Each error will call the onClose() listener. That function can decide to
12424
12427
  * inhibit backoff if required.
12425
12428
  */
12426
- t.prototype.Fo = function() {
12427
- this.state = 0 /* Initial */ , this.No.reset();
12429
+ t.prototype.Mo = function() {
12430
+ this.state = 0 /* Initial */ , this.xo.reset();
12428
12431
  },
12429
12432
  /**
12430
12433
  * Marks this stream as idle. If no further actions are performed on the
@@ -12436,29 +12439,29 @@ function Hu() {
12436
12439
  * Only streams that are in state 'Open' can be marked idle, as all other
12437
12440
  * states imply pending network operations.
12438
12441
  */
12439
- t.prototype.$o = function() {
12442
+ t.prototype.Fo = function() {
12440
12443
  var t = this;
12441
12444
  // Starts the idle time if we are in state 'Open' and are not yet already
12442
12445
  // running a timer (in which case the previous idle timeout still applies).
12443
- this.Oo() && null === this.Co && (this.Co = this.Hs.enqueueAfterDelay(this.vo, 6e4, (function() {
12444
- return t.Bo();
12446
+ this.ko() && null === this.Do && (this.Do = this.Hs.enqueueAfterDelay(this.vo, 6e4, (function() {
12447
+ return t.$o();
12445
12448
  })));
12446
12449
  },
12447
- /** Sends a message to the underlying stream. */ t.prototype.Lo = function(t) {
12448
- this.Uo(), this.stream.send(t);
12450
+ /** Sends a message to the underlying stream. */ t.prototype.Bo = function(t) {
12451
+ this.Lo(), this.stream.send(t);
12449
12452
  },
12450
- /** Called by the idle timer when the stream should close due to inactivity. */ t.prototype.Bo = function() {
12453
+ /** Called by the idle timer when the stream should close due to inactivity. */ t.prototype.$o = function() {
12451
12454
  return e(this, void 0, void 0, (function() {
12452
12455
  return n(this, (function(t) {
12453
- return this.Oo() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ];
12456
+ return this.ko() ? [ 2 /*return*/ , this.close(0 /* Initial */) ] : [ 2 /*return*/ ];
12454
12457
  }));
12455
12458
  }));
12456
12459
  },
12457
- /** Marks the stream as active again. */ t.prototype.Uo = function() {
12458
- this.Co && (this.Co.cancel(), this.Co = null);
12460
+ /** Marks the stream as active again. */ t.prototype.Lo = function() {
12461
+ this.Do && (this.Do.cancel(), this.Do = null);
12459
12462
  },
12460
- /** Cancels the health check delayed operation. */ t.prototype.qo = function() {
12461
- this.xo && (this.xo.cancel(), this.xo = null);
12463
+ /** Cancels the health check delayed operation. */ t.prototype.Uo = function() {
12464
+ this.Co && (this.Co.cancel(), this.Co = null);
12462
12465
  },
12463
12466
  /**
12464
12467
  * Closes the stream and cleans up as necessary:
@@ -12480,15 +12483,15 @@ function Hu() {
12480
12483
  case 0:
12481
12484
  // Notify the listener that the stream closed.
12482
12485
  // Cancel any outstanding timers (they're guaranteed not to execute).
12483
- return this.Uo(), this.qo(), this.No.cancel(),
12486
+ return this.Lo(), this.Uo(), this.xo.cancel(),
12484
12487
  // Invalidates any stream-related callbacks (e.g. from auth or the
12485
12488
  // underlying stream), guaranteeing they won't execute.
12486
- this.Do++, 4 /* Error */ !== t ?
12489
+ this.So++, 4 /* Error */ !== t ?
12487
12490
  // If this is an intentional close ensure we don't delay our next connection attempt.
12488
- this.No.reset() : r && r.code === K.RESOURCE_EXHAUSTED ? (
12491
+ this.xo.reset() : r && r.code === K.RESOURCE_EXHAUSTED ? (
12489
12492
  // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
12490
12493
  M(r.toString()), M("Using maximum backoff delay to prevent overloading the backend."),
12491
- this.No.Ao()) : r && r.code === K.UNAUTHENTICATED && 3 /* Healthy */ !== this.state && (
12494
+ this.xo.Ao()) : r && r.code === K.UNAUTHENTICATED && 3 /* Healthy */ !== this.state && (
12492
12495
  // "unauthenticated" error means the token was rejected. This should rarely
12493
12496
  // happen since both Auth and AppCheck ensure a sufficient TTL when we
12494
12497
  // request a token. If a user manually resets their system clock this can
@@ -12497,7 +12500,7 @@ function Hu() {
12497
12500
  // to ensure that we fetch a new token.
12498
12501
  this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()),
12499
12502
  // Clean up the underlying stream because we are no longer interested in events.
12500
- null !== this.stream && (this.Ko(), this.stream.close(), this.stream = null),
12503
+ null !== this.stream && (this.qo(), this.stream.close(), this.stream = null),
12501
12504
  // This state must be assigned before calling onClose() to allow the callback to
12502
12505
  // inhibit backoff or otherwise manipulate the state in its non-started state.
12503
12506
  this.state = t, [ 4 /*yield*/ , this.listener.Zr(r) ];
@@ -12514,10 +12517,10 @@ function Hu() {
12514
12517
  * Can be overridden to perform additional cleanup before the stream is closed.
12515
12518
  * Calling super.tearDown() is not required.
12516
12519
  */
12517
- t.prototype.Ko = function() {}, t.prototype.auth = function() {
12520
+ t.prototype.qo = function() {}, t.prototype.auth = function() {
12518
12521
  var t = this;
12519
12522
  this.state = 1 /* Starting */;
12520
- var e = this.Go(this.Do), n = this.Do;
12523
+ var e = this.Ko(this.So), n = this.So;
12521
12524
  // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
12522
12525
  Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((function(e) {
12523
12526
  var r = e[0], i = e[1];
@@ -12525,37 +12528,37 @@ function Hu() {
12525
12528
  // TODO(mikelehen): We really should just use dispatchIfNotClosed
12526
12529
  // and let this dispatch onto the queue, but that opened a spec test can
12527
12530
  // of worms that I don't want to deal with in this PR.
12528
- t.Do === n &&
12531
+ t.So === n &&
12529
12532
  // Normally we'd have to schedule the callback on the AsyncQueue.
12530
12533
  // However, the following calls are safe to be called outside the
12531
12534
  // AsyncQueue since they don't chain asynchronous calls
12532
- t.Qo(r, i);
12535
+ t.Go(r, i);
12533
12536
  }), (function(n) {
12534
12537
  e((function() {
12535
12538
  var e = new j(K.UNKNOWN, "Fetching auth token failed: " + n.message);
12536
- return t.jo(e);
12539
+ return t.Qo(e);
12537
12540
  }));
12538
12541
  }));
12539
- }, t.prototype.Qo = function(t, e) {
12540
- var n = this, r = this.Go(this.Do);
12541
- this.stream = this.Wo(t, e), this.stream.Yr((function() {
12542
+ }, t.prototype.Go = function(t, e) {
12543
+ var n = this, r = this.Ko(this.So);
12544
+ this.stream = this.jo(t, e), this.stream.Yr((function() {
12542
12545
  r((function() {
12543
- return n.state = 2 /* Open */ , n.xo = n.Hs.enqueueAfterDelay(n.Vo, 1e4, (function() {
12544
- return n.Oo() && (n.state = 3 /* Healthy */), Promise.resolve();
12546
+ return n.state = 2 /* Open */ , n.Co = n.Hs.enqueueAfterDelay(n.Vo, 1e4, (function() {
12547
+ return n.ko() && (n.state = 3 /* Healthy */), Promise.resolve();
12545
12548
  })), n.listener.Yr();
12546
12549
  }));
12547
12550
  })), this.stream.Zr((function(t) {
12548
12551
  r((function() {
12549
- return n.jo(t);
12552
+ return n.Qo(t);
12550
12553
  }));
12551
12554
  })), this.stream.onMessage((function(t) {
12552
12555
  r((function() {
12553
12556
  return n.onMessage(t);
12554
12557
  }));
12555
12558
  }));
12556
- }, t.prototype.Mo = function() {
12559
+ }, t.prototype.Oo = function() {
12557
12560
  var t = this;
12558
- this.state = 5 /* Backoff */ , this.No.Ro((function() {
12561
+ this.state = 5 /* Backoff */ , this.xo.Ro((function() {
12559
12562
  return e(t, void 0, void 0, (function() {
12560
12563
  return n(this, (function(t) {
12561
12564
  return this.state = 0 /* Initial */ , this.start(), [ 2 /*return*/ ];
@@ -12564,7 +12567,7 @@ function Hu() {
12564
12567
  }));
12565
12568
  },
12566
12569
  // Visible for tests
12567
- t.prototype.jo = function(t) {
12570
+ t.prototype.Qo = function(t) {
12568
12571
  // In theory the stream could close cleanly, however, in our current model
12569
12572
  // we never expect this to happen because if we stop a stream ourselves,
12570
12573
  // this callback will never be called. To prevent cases where we retry
@@ -12577,11 +12580,11 @@ function Hu() {
12577
12580
  * us to turn auth / stream callbacks into no-ops if the stream is closed /
12578
12581
  * re-opened, etc.
12579
12582
  */
12580
- t.prototype.Go = function(t) {
12583
+ t.prototype.Ko = function(t) {
12581
12584
  var e = this;
12582
12585
  return function(n) {
12583
12586
  e.Hs.enqueueAndForget((function() {
12584
- return e.Do === t ? n() : (L("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
12587
+ return e.So === t ? n() : (L("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
12585
12588
  Promise.resolve());
12586
12589
  }));
12587
12590
  };
@@ -12592,11 +12595,11 @@ function Hu() {
12592
12595
  return (s = e.call(this, t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, i, u) || this).It = o,
12593
12596
  s;
12594
12597
  }
12595
- return t(n, e), n.prototype.Wo = function(t, e) {
12596
- return this.So.wo("Listen", t, e);
12598
+ return t(n, e), n.prototype.jo = function(t, e) {
12599
+ return this.connection.wo("Listen", t, e);
12597
12600
  }, n.prototype.onMessage = function(t) {
12598
12601
  // A successful response means the stream is healthy
12599
- this.No.reset();
12602
+ this.xo.reset();
12600
12603
  var e = function(t, e) {
12601
12604
  var n;
12602
12605
  if ("targetChange" in e) {
@@ -12633,15 +12636,15 @@ function Hu() {
12633
12636
  e.documentRemove;
12634
12637
  var b = e.documentRemove;
12635
12638
  b.document;
12636
- var I = Mr(t, b.document), E = b.removedTargetIds || [];
12637
- n = new wr([], E, I, null);
12639
+ var I = Mr(t, b.document), T = b.removedTargetIds || [];
12640
+ n = new wr([], T, I, null);
12638
12641
  } else {
12639
12642
  if (!("filter" in e)) return q();
12640
12643
  e.filter;
12641
- var T = e.filter;
12642
- T.targetId;
12643
- var S = T.count || 0, D = new tr(S), _ = T.targetId;
12644
- n = new br(_, D);
12644
+ var E = e.filter;
12645
+ E.targetId;
12646
+ var S = E.count || 0, D = new tr(S), x = E.targetId;
12647
+ n = new br(x, D);
12645
12648
  }
12646
12649
  return n;
12647
12650
  }(this.It, t), n = function(t) {
@@ -12652,7 +12655,7 @@ function Hu() {
12652
12655
  var e = t.targetChange;
12653
12656
  return e.targetIds && e.targetIds.length ? st.min() : e.readTime ? Or(e.readTime) : st.min();
12654
12657
  }(t);
12655
- return this.listener.zo(e, n);
12658
+ return this.listener.Wo(e, n);
12656
12659
  },
12657
12660
  /**
12658
12661
  * Registers interest in the results of the given target. If the target
@@ -12660,7 +12663,7 @@ function Hu() {
12660
12663
  * affect the target will be streamed back as WatchChange messages that
12661
12664
  * reference the targetId.
12662
12665
  */
12663
- n.prototype.Ho = function(t) {
12666
+ n.prototype.zo = function(t) {
12664
12667
  var e = {};
12665
12668
  e.database = qr(this.It), e.addTarget = function(t, e) {
12666
12669
  var n, r = e.target;
@@ -12672,7 +12675,7 @@ function Hu() {
12672
12675
  // TODO(wuandy): Consider removing above check because it is most likely true.
12673
12676
  // Right now, many tests depend on this behaviour though (leaving min() out
12674
12677
  // of serialization).
12675
- n.readTime = Ar(t, e.snapshotVersion.toTimestamp())), n;
12678
+ n.readTime = Nr(t, e.snapshotVersion.toTimestamp())), n;
12676
12679
  }(this.It, t);
12677
12680
  var n = function(t, e) {
12678
12681
  var n = function(t, e) {
@@ -12694,48 +12697,48 @@ function Hu() {
12694
12697
  "goog-listen-tags": n
12695
12698
  };
12696
12699
  }(this.It, t);
12697
- n && (e.labels = n), this.Lo(e);
12700
+ n && (e.labels = n), this.Bo(e);
12698
12701
  },
12699
12702
  /**
12700
12703
  * Unregisters interest in the results of the target associated with the
12701
12704
  * given targetId.
12702
12705
  */
12703
- n.prototype.Jo = function(t) {
12706
+ n.prototype.Ho = function(t) {
12704
12707
  var e = {};
12705
- e.database = qr(this.It), e.removeTarget = t, this.Lo(e);
12708
+ e.database = qr(this.It), e.removeTarget = t, this.Bo(e);
12706
12709
  }, n;
12707
12710
  }(Ju), ts = /** @class */ function(e) {
12708
12711
  function n(t, n, r, i, o, u) {
12709
12712
  var s = this;
12710
12713
  return (s = e.call(this, t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , n, r, i, u) || this).It = o,
12711
- s.Yo = !1, s;
12714
+ s.Jo = !1, s;
12712
12715
  }
12713
- return t(n, e), Object.defineProperty(n.prototype, "Xo", {
12716
+ return t(n, e), Object.defineProperty(n.prototype, "Yo", {
12714
12717
  /**
12715
12718
  * Tracks whether or not a handshake has been successfully exchanged and
12716
12719
  * the stream is ready to accept mutations.
12717
12720
  */
12718
12721
  get: function() {
12719
- return this.Yo;
12722
+ return this.Jo;
12720
12723
  },
12721
12724
  enumerable: !1,
12722
12725
  configurable: !0
12723
12726
  }),
12724
12727
  // Override of PersistentStream.start
12725
12728
  n.prototype.start = function() {
12726
- this.Yo = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);
12727
- }, n.prototype.Ko = function() {
12728
- this.Yo && this.Zo([]);
12729
- }, n.prototype.Wo = function(t, e) {
12730
- return this.So.wo("Write", t, e);
12729
+ this.Jo = !1, this.lastStreamToken = void 0, e.prototype.start.call(this);
12730
+ }, n.prototype.qo = function() {
12731
+ this.Jo && this.Xo([]);
12732
+ }, n.prototype.jo = function(t, e) {
12733
+ return this.connection.wo("Write", t, e);
12731
12734
  }, n.prototype.onMessage = function(t) {
12732
12735
  if (
12733
12736
  // Always capture the last stream token.
12734
- U(!!t.streamToken), this.lastStreamToken = t.streamToken, this.Yo) {
12737
+ U(!!t.streamToken), this.lastStreamToken = t.streamToken, this.Jo) {
12735
12738
  // A successful first write response means the stream is healthy,
12736
12739
  // Note, that we could consider a successful handshake healthy, however,
12737
12740
  // the write itself might be causing an error we want to back off from.
12738
- this.No.reset();
12741
+ this.xo.reset();
12739
12742
  var e = function(t, e) {
12740
12743
  return t && t.length > 0 ? (U(void 0 !== e), t.map((function(t) {
12741
12744
  return function(t, e) {
@@ -12751,46 +12754,46 @@ function Hu() {
12751
12754
  }(t, e);
12752
12755
  }))) : [];
12753
12756
  }(t.writeResults, t.commitTime), n = Or(t.commitTime);
12754
- return this.listener.tu(n, e);
12757
+ return this.listener.Zo(n, e);
12755
12758
  }
12756
12759
  // The first response is always the handshake response
12757
- return U(!t.writeResults || 0 === t.writeResults.length), this.Yo = !0,
12758
- this.listener.eu();
12760
+ return U(!t.writeResults || 0 === t.writeResults.length), this.Jo = !0,
12761
+ this.listener.tu();
12759
12762
  },
12760
12763
  /**
12761
12764
  * Sends an initial streamToken to the server, performing the handshake
12762
12765
  * required to make the StreamingWrite RPC work. Subsequent
12763
12766
  * calls should wait until onHandshakeComplete was called.
12764
12767
  */
12765
- n.prototype.nu = function() {
12768
+ n.prototype.eu = function() {
12766
12769
  // TODO(dimond): Support stream resumption. We intentionally do not set the
12767
12770
  // stream token on the handshake, ignoring any stream token we might have.
12768
12771
  var t = {};
12769
- t.database = qr(this.It), this.Lo(t);
12772
+ t.database = qr(this.It), this.Bo(t);
12770
12773
  },
12771
- /** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Zo = function(t) {
12774
+ /** Sends a group of mutations to the Firestore backend to apply. */ n.prototype.Xo = function(t) {
12772
12775
  var e = this, n = {
12773
12776
  streamToken: this.lastStreamToken,
12774
12777
  writes: t.map((function(t) {
12775
12778
  return Kr(e.It, t);
12776
12779
  }))
12777
12780
  };
12778
- this.Lo(n);
12781
+ this.Bo(n);
12779
12782
  }, n;
12780
12783
  }(Ju), es = /** @class */ function(e) {
12781
12784
  function n(t, n, r, i) {
12782
12785
  var o = this;
12783
12786
  return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
12784
- o.So = r, o.It = i, o.su = !1, o;
12787
+ o.connection = r, o.It = i, o.nu = !1, o;
12785
12788
  }
12786
- return t(n, e), n.prototype.iu = function() {
12787
- if (this.su) throw new j(K.FAILED_PRECONDITION, "The client has already been terminated.");
12789
+ return t(n, e), n.prototype.su = function() {
12790
+ if (this.nu) throw new j(K.FAILED_PRECONDITION, "The client has already been terminated.");
12788
12791
  },
12789
12792
  /** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.ao = function(t, e, n) {
12790
12793
  var r = this;
12791
- return this.iu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
12794
+ return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
12792
12795
  var o = i[0], u = i[1];
12793
- return r.So.ao(t, e, n, o, u);
12796
+ return r.connection.ao(t, e, n, o, u);
12794
12797
  })).catch((function(t) {
12795
12798
  throw "FirebaseError" === t.name ? (t.code === K.UNAUTHENTICATED && (r.authCredentials.invalidateToken(),
12796
12799
  r.appCheckCredentials.invalidateToken()), t) : new j(K.UNKNOWN, t.toString());
@@ -12798,15 +12801,15 @@ function Hu() {
12798
12801
  },
12799
12802
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype._o = function(t, e, n, r) {
12800
12803
  var i = this;
12801
- return this.iu(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(o) {
12804
+ return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(o) {
12802
12805
  var u = o[0], s = o[1];
12803
- return i.So._o(t, e, n, u, s, r);
12806
+ return i.connection._o(t, e, n, u, s, r);
12804
12807
  })).catch((function(t) {
12805
12808
  throw "FirebaseError" === t.name ? (t.code === K.UNAUTHENTICATED && (i.authCredentials.invalidateToken(),
12806
12809
  i.appCheckCredentials.invalidateToken()), t) : new j(K.UNKNOWN, t.toString());
12807
12810
  }));
12808
12811
  }, n.prototype.terminate = function() {
12809
- this.su = !0;
12812
+ this.nu = !0;
12810
12813
  }, n;
12811
12814
  }((function() {}));
12812
12815
 
@@ -12879,19 +12882,19 @@ var ns = /** @class */ function() {
12879
12882
  * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
12880
12883
  * Offline.
12881
12884
  */
12882
- this.ru = 0,
12885
+ this.iu = 0,
12883
12886
  /**
12884
12887
  * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we
12885
12888
  * transition from OnlineState.Unknown to OnlineState.Offline without waiting
12886
12889
  * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).
12887
12890
  */
12888
- this.ou = null,
12891
+ this.ru = null,
12889
12892
  /**
12890
12893
  * Whether the client should log a warning message if it fails to connect to
12891
12894
  * the backend (initially true, cleared after a successful stream, or if we've
12892
12895
  * logged the message already).
12893
12896
  */
12894
- this.uu = !0
12897
+ this.ou = !0
12895
12898
  /**
12896
12899
  * Called by RemoteStore when a watch stream is started (including on each
12897
12900
  * backoff attempt).
@@ -12900,10 +12903,10 @@ var ns = /** @class */ function() {
12900
12903
  * the onlineStateTimer.
12901
12904
  */;
12902
12905
  }
12903
- return t.prototype.cu = function() {
12906
+ return t.prototype.uu = function() {
12904
12907
  var t = this;
12905
- 0 === this.ru && (this.au("Unknown" /* Unknown */), this.ou = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (function() {
12906
- return t.ou = null, t.hu("Backend didn't respond within 10 seconds."), t.au("Offline" /* Offline */),
12908
+ 0 === this.iu && (this.cu("Unknown" /* Unknown */), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (function() {
12909
+ return t.ru = null, t.au("Backend didn't respond within 10 seconds."), t.cu("Offline" /* Offline */),
12907
12910
  Promise.resolve();
12908
12911
  })));
12909
12912
  },
@@ -12913,10 +12916,10 @@ var ns = /** @class */ function() {
12913
12916
  * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
12914
12917
  * actually transition to the 'Offline' state.
12915
12918
  */
12916
- t.prototype.lu = function(t) {
12917
- "Online" /* Online */ === this.state ? this.au("Unknown" /* Unknown */) : (this.ru++,
12918
- this.ru >= 1 && (this.fu(), this.hu("Connection failed 1 times. Most recent error: " + t.toString()),
12919
- this.au("Offline" /* Offline */)));
12919
+ t.prototype.hu = function(t) {
12920
+ "Online" /* Online */ === this.state ? this.cu("Unknown" /* Unknown */) : (this.iu++,
12921
+ this.iu >= 1 && (this.lu(), this.au("Connection failed 1 times. Most recent error: " + t.toString()),
12922
+ this.cu("Offline" /* Offline */)));
12920
12923
  },
12921
12924
  /**
12922
12925
  * Explicitly sets the OnlineState to the specified state.
@@ -12926,17 +12929,17 @@ var ns = /** @class */ function() {
12926
12929
  * handleWatchStreamStart() and handleWatchStreamFailure().
12927
12930
  */
12928
12931
  t.prototype.set = function(t) {
12929
- this.fu(), this.ru = 0, "Online" /* Online */ === t && (
12932
+ this.lu(), this.iu = 0, "Online" /* Online */ === t && (
12930
12933
  // We've connected to watch at least once. Don't warn the developer
12931
12934
  // about being offline going forward.
12932
- this.uu = !1), this.au(t);
12933
- }, t.prototype.au = function(t) {
12935
+ this.ou = !1), this.cu(t);
12936
+ }, t.prototype.cu = function(t) {
12934
12937
  t !== this.state && (this.state = t, this.onlineStateHandler(t));
12935
- }, t.prototype.hu = function(t) {
12938
+ }, t.prototype.au = function(t) {
12936
12939
  var e = "Could not reach Cloud Firestore backend. " + t + "\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";
12937
- this.uu ? (M(e), this.uu = !1) : L("OnlineStateTracker", e);
12938
- }, t.prototype.fu = function() {
12939
- null !== this.ou && (this.ou.cancel(), this.ou = null);
12940
+ this.ou ? (M(e), this.ou = !1) : L("OnlineStateTracker", e);
12941
+ }, t.prototype.lu = function() {
12942
+ null !== this.ru && (this.ru.cancel(), this.ru = null);
12940
12943
  }, t;
12941
12944
  }(), rs = function(
12942
12945
  /**
@@ -12964,7 +12967,7 @@ r, i, o, u) {
12964
12967
  * purely based on order, and so we can just shift() writes from the front of
12965
12968
  * the writePipeline as we receive responses.
12966
12969
  */
12967
- this.du = [],
12970
+ this.fu = [],
12968
12971
  /**
12969
12972
  * A mapping of watched targets that the client cares about tracking and the
12970
12973
  * user has explicitly called a 'listen' for this target.
@@ -12974,12 +12977,12 @@ r, i, o, u) {
12974
12977
  * to the server. The targets removed with unlistens are removed eagerly
12975
12978
  * without waiting for confirmation from the listen stream.
12976
12979
  */
12977
- this._u = new Map,
12980
+ this.du = new Map,
12978
12981
  /**
12979
12982
  * A set of reasons for why the RemoteStore may be offline. If empty, the
12980
12983
  * RemoteStore may start its network connections.
12981
12984
  */
12982
- this.wu = new Set,
12985
+ this._u = new Set,
12983
12986
  /**
12984
12987
  * Event handlers that get called when the network is disabled or enabled.
12985
12988
  *
@@ -12987,7 +12990,7 @@ r, i, o, u) {
12987
12990
  * underlying streams (to support tree-shakeable streams). On Android and iOS,
12988
12991
  * the streams are created during construction of RemoteStore.
12989
12992
  */
12990
- this.mu = [], this.gu = u, this.gu.qr((function(t) {
12993
+ this.wu = [], this.mu = u, this.mu.qr((function(t) {
12991
12994
  i.enqueueAndForget((function() {
12992
12995
  return e(s, void 0, void 0, (function() {
12993
12996
  return n(this, (function(t) {
@@ -13000,10 +13003,10 @@ r, i, o, u) {
13000
13003
  return n(this, (function(n) {
13001
13004
  switch (n.label) {
13002
13005
  case 0:
13003
- return (e = G(t)).wu.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , os(e) ];
13006
+ return (e = G(t))._u.add(4 /* ConnectivityChange */), [ 4 /*yield*/ , os(e) ];
13004
13007
 
13005
13008
  case 1:
13006
- return n.sent(), e.yu.set("Unknown" /* Unknown */), e.wu.delete(4 /* ConnectivityChange */),
13009
+ return n.sent(), e.gu.set("Unknown" /* Unknown */), e._u.delete(4 /* ConnectivityChange */),
13007
13010
  [ 4 /*yield*/ , is(e) ];
13008
13011
 
13009
13012
  case 2:
@@ -13022,7 +13025,7 @@ r, i, o, u) {
13022
13025
  }));
13023
13026
  }));
13024
13027
  }));
13025
- })), this.yu = new ns(i, o);
13028
+ })), this.gu = new ns(i, o);
13026
13029
  };
13027
13030
 
13028
13031
  /**
@@ -13047,7 +13050,7 @@ r, i, o, u) {
13047
13050
  switch (n.label) {
13048
13051
  case 0:
13049
13052
  if (!fs(t)) return [ 3 /*break*/ , 4 ];
13050
- e = 0, r = t.mu, n.label = 1;
13053
+ e = 0, r = t.wu, n.label = 1;
13051
13054
 
13052
13055
  case 1:
13053
13056
  return e < r.length ? [ 4 /*yield*/ , (0, r[e])(/* enabled= */ !0) ] : [ 3 /*break*/ , 4 ];
@@ -13074,7 +13077,7 @@ r, i, o, u) {
13074
13077
  return n(this, (function(n) {
13075
13078
  switch (n.label) {
13076
13079
  case 0:
13077
- e = 0, r = t.mu, n.label = 1;
13080
+ e = 0, r = t.wu, n.label = 1;
13078
13081
 
13079
13082
  case 1:
13080
13083
  return e < r.length ? [ 4 /*yield*/ , (0, r[e])(/* enabled= */ !1) ] : [ 3 /*break*/ , 4 ];
@@ -13097,30 +13100,30 @@ r, i, o, u) {
13097
13100
  * is a no-op if the target of given `TargetData` is already being listened to.
13098
13101
  */ function us(t, e) {
13099
13102
  var n = G(t);
13100
- n._u.has(e.targetId) || (
13103
+ n.du.has(e.targetId) || (
13101
13104
  // Mark this as something the client is currently listening for.
13102
- n._u.set(e.targetId, e), hs(n) ?
13105
+ n.du.set(e.targetId, e), hs(n) ?
13103
13106
  // The listen will be sent in onWatchStreamOpen
13104
- ls(n) : Ns(n).Oo() && as(n, e));
13107
+ ls(n) : As(n).ko() && as(n, e));
13105
13108
  }
13106
13109
 
13107
13110
  /**
13108
13111
  * Removes the listen from server. It is a no-op if the given target id is
13109
13112
  * not being listened to.
13110
13113
  */ function ss(t, e) {
13111
- var n = G(t), r = Ns(n);
13112
- n._u.delete(e), r.Oo() && cs(n, e), 0 === n._u.size && (r.Oo() ? r.$o() : fs(n) &&
13114
+ var n = G(t), r = As(n);
13115
+ n.du.delete(e), r.ko() && cs(n, e), 0 === n.du.size && (r.ko() ? r.Fo() : fs(n) &&
13113
13116
  // Revert to OnlineState.Unknown if the watch stream is not open and we
13114
13117
  // have no listeners, since without any listens to send we cannot
13115
13118
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
13116
- n.yu.set("Unknown" /* Unknown */));
13119
+ n.gu.set("Unknown" /* Unknown */));
13117
13120
  }
13118
13121
 
13119
13122
  /**
13120
13123
  * We need to increment the the expected number of pending responses we're due
13121
13124
  * from watch so we wait for the ack to process any messages from this target.
13122
13125
  */ function as(t, e) {
13123
- t.pu.Mt(e.targetId), Ns(t).Ho(e)
13126
+ t.yu.Mt(e.targetId), As(t).zo(e)
13124
13127
  /**
13125
13128
  * We need to increment the expected number of pending responses we're due
13126
13129
  * from watch so we wait for the removal on the server before we process any
@@ -13129,18 +13132,18 @@ r, i, o, u) {
13129
13132
  }
13130
13133
 
13131
13134
  function cs(t, e) {
13132
- t.pu.Mt(e), Ns(t).Jo(e);
13135
+ t.yu.Mt(e), As(t).Ho(e);
13133
13136
  }
13134
13137
 
13135
13138
  function ls(t) {
13136
- t.pu = new Tr({
13139
+ t.yu = new Er({
13137
13140
  getRemoteKeysForTarget: function(e) {
13138
13141
  return t.remoteSyncer.getRemoteKeysForTarget(e);
13139
13142
  },
13140
13143
  se: function(e) {
13141
- return t._u.get(e) || null;
13144
+ return t.du.get(e) || null;
13142
13145
  }
13143
- }), Ns(t).start(), t.yu.cu()
13146
+ }), As(t).start(), t.gu.uu()
13144
13147
  /**
13145
13148
  * Returns whether the watch stream should be started because it's necessary
13146
13149
  * and has not yet been started.
@@ -13148,21 +13151,21 @@ function ls(t) {
13148
13151
  }
13149
13152
 
13150
13153
  function hs(t) {
13151
- return fs(t) && !Ns(t).ko() && t._u.size > 0;
13154
+ return fs(t) && !As(t).No() && t.du.size > 0;
13152
13155
  }
13153
13156
 
13154
13157
  function fs(t) {
13155
- return 0 === G(t).wu.size;
13158
+ return 0 === G(t)._u.size;
13156
13159
  }
13157
13160
 
13158
13161
  function ds(t) {
13159
- t.pu = void 0;
13162
+ t.yu = void 0;
13160
13163
  }
13161
13164
 
13162
13165
  function ps(t) {
13163
13166
  return e(this, void 0, void 0, (function() {
13164
13167
  return n(this, (function(e) {
13165
- return t._u.forEach((function(e, n) {
13168
+ return t.du.forEach((function(e, n) {
13166
13169
  as(t, e);
13167
13170
  })), [ 2 /*return*/ ];
13168
13171
  }));
@@ -13174,11 +13177,11 @@ function vs(t, r) {
13174
13177
  return n(this, (function(e) {
13175
13178
  return ds(t),
13176
13179
  // If we still need the watch stream, retry the connection.
13177
- hs(t) ? (t.yu.lu(r), ls(t)) :
13180
+ hs(t) ? (t.gu.hu(r), ls(t)) :
13178
13181
  // No need to restart watch stream because there are no active targets.
13179
13182
  // The online state is set to unknown because there is no active attempt
13180
13183
  // at establishing a connection
13181
- t.yu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
13184
+ t.gu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
13182
13185
  }));
13183
13186
  }));
13184
13187
  }
@@ -13189,7 +13192,7 @@ function ys(t, r, i) {
13189
13192
  return n(this, (function(a) {
13190
13193
  switch (a.label) {
13191
13194
  case 0:
13192
- if (t.yu.set("Online" /* Online */), !(r instanceof Ir && 2 /* Removed */ === r.state && r.cause))
13195
+ if (t.gu.set("Online" /* Online */), !(r instanceof Ir && 2 /* Removed */ === r.state && r.cause))
13193
13196
  // Mark the client as online since we got a message from the server
13194
13197
  return [ 3 /*break*/ , 6 ];
13195
13198
  a.label = 1;
@@ -13206,10 +13209,10 @@ function ys(t, r, i) {
13206
13209
  e = r.cause, i = 0, o = r.targetIds, n.label = 1;
13207
13210
 
13208
13211
  case 1:
13209
- return i < o.length ? (u = o[i], t._u.has(u) ? [ 4 /*yield*/ , t.remoteSyncer.rejectListen(u, e) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ];
13212
+ return i < o.length ? (u = o[i], t.du.has(u) ? [ 4 /*yield*/ , t.remoteSyncer.rejectListen(u, e) ] : [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 5 ];
13210
13213
 
13211
13214
  case 2:
13212
- n.sent(), t._u.delete(u), t.pu.removeTarget(u), n.label = 3;
13215
+ n.sent(), t.du.delete(u), t.yu.removeTarget(u), n.label = 3;
13213
13216
 
13214
13217
  case 3:
13215
13218
  n.label = 4;
@@ -13238,7 +13241,7 @@ function ys(t, r, i) {
13238
13241
  return [ 3 /*break*/ , 13 ];
13239
13242
 
13240
13243
  case 6:
13241
- if (r instanceof wr ? t.pu.Gt(r) : r instanceof br ? t.pu.Yt(r) : t.pu.Wt(r), i.isEqual(st.min())) return [ 3 /*break*/ , 13 ];
13244
+ if (r instanceof wr ? t.yu.Gt(r) : r instanceof br ? t.yu.Yt(r) : t.yu.Wt(r), i.isEqual(st.min())) return [ 3 /*break*/ , 13 ];
13242
13245
  a.label = 7;
13243
13246
 
13244
13247
  case 7:
@@ -13252,24 +13255,24 @@ function ys(t, r, i) {
13252
13255
  * SyncEngine.
13253
13256
  */
13254
13257
  function(t, e) {
13255
- var n = t.pu.te(e);
13258
+ var n = t.yu.te(e);
13256
13259
  // Update in-memory resume tokens. LocalStore will update the
13257
13260
  // persistent view of these when applying the completed RemoteEvent.
13258
13261
  return n.targetChanges.forEach((function(n, r) {
13259
13262
  if (n.resumeToken.approximateByteSize() > 0) {
13260
- var i = t._u.get(r);
13263
+ var i = t.du.get(r);
13261
13264
  // A watched target might have been removed already.
13262
- i && t._u.set(r, i.withResumeToken(n.resumeToken, e));
13265
+ i && t.du.set(r, i.withResumeToken(n.resumeToken, e));
13263
13266
  }
13264
13267
  })),
13265
13268
  // Re-establish listens for the targets that have been invalidated by
13266
13269
  // existence filter mismatches.
13267
13270
  n.targetMismatches.forEach((function(e) {
13268
- var n = t._u.get(e);
13271
+ var n = t.du.get(e);
13269
13272
  if (n) {
13270
13273
  // Clear the resume token for the target, since we're in a known mismatch
13271
13274
  // state.
13272
- t._u.set(e, n.withResumeToken(Zt.EMPTY_BYTE_STRING, n.snapshotVersion)),
13275
+ t.du.set(e, n.withResumeToken(Zt.EMPTY_BYTE_STRING, n.snapshotVersion)),
13273
13276
  // Cause a hard reset by unwatching and rewatching immediately, but
13274
13277
  // deliberately don't send a resume token so that we get a full update.
13275
13278
  cs(t, e);
@@ -13322,11 +13325,11 @@ function ys(t, r, i) {
13322
13325
  case 0:
13323
13326
  if (!Ot(r)) throw r;
13324
13327
  // Disable network and raise offline snapshots
13325
- return t.wu.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , os(t) ];
13328
+ return t._u.add(1 /* IndexedDbFailed */), [ 4 /*yield*/ , os(t) ];
13326
13329
 
13327
13330
  case 1:
13328
13331
  // Disable network and raise offline snapshots
13329
- return u.sent(), t.yu.set("Offline" /* Offline */), i || (
13332
+ return u.sent(), t.gu.set("Offline" /* Offline */), i || (
13330
13333
  // Use a simple read operation to determine if IndexedDB recovered.
13331
13334
  // Ideally, we would expose a health check directly on SimpleDb, but
13332
13335
  // RemoteStore only has access to persistence through LocalStore.
@@ -13342,7 +13345,7 @@ function ys(t, r, i) {
13342
13345
  return L("RemoteStore", "Retrying IndexedDB access"), [ 4 /*yield*/ , i() ];
13343
13346
 
13344
13347
  case 1:
13345
- return e.sent(), t.wu.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , is(t) ];
13348
+ return e.sent(), t._u.delete(1 /* IndexedDbFailed */), [ 4 /*yield*/ , is(t) ];
13346
13349
 
13347
13350
  case 2:
13348
13351
  return e.sent(), [ 2 /*return*/ ];
@@ -13370,7 +13373,7 @@ function ws(t) {
13370
13373
  return n(this, (function(n) {
13371
13374
  switch (n.label) {
13372
13375
  case 0:
13373
- e = G(t), r = As(e), i = e.du.length > 0 ? e.du[e.du.length - 1].batchId : -1, n.label = 1;
13376
+ e = G(t), r = Ns(e), i = e.fu.length > 0 ? e.fu[e.fu.length - 1].batchId : -1, n.label = 1;
13374
13377
 
13375
13378
  case 1:
13376
13379
  if (!
@@ -13379,7 +13382,7 @@ function ws(t) {
13379
13382
  * enabled and the write pipeline is not full).
13380
13383
  */
13381
13384
  function(t) {
13382
- return fs(t) && t.du.length < 10;
13385
+ return fs(t) && t.fu.length < 10;
13383
13386
  }
13384
13387
  /**
13385
13388
  * Queues additional writes to be sent to the write stream, sending them
@@ -13391,11 +13394,11 @@ function ws(t) {
13391
13394
  return n.trys.push([ 2, 4, , 6 ]), [ 4 /*yield*/ , Su(e.localStore, i) ];
13392
13395
 
13393
13396
  case 3:
13394
- return null === (o = n.sent()) ? (0 === e.du.length && r.$o(), [ 3 /*break*/ , 7 ]) : (i = o.batchId,
13397
+ return null === (o = n.sent()) ? (0 === e.fu.length && r.Fo(), [ 3 /*break*/ , 7 ]) : (i = o.batchId,
13395
13398
  function(t, e) {
13396
- t.du.push(e);
13397
- var n = As(t);
13398
- n.Oo() && n.Xo && n.Zo(e.mutations);
13399
+ t.fu.push(e);
13400
+ var n = Ns(t);
13401
+ n.ko() && n.Yo && n.Xo(e.mutations);
13399
13402
  }(e, o), [ 3 /*break*/ , 6 ]);
13400
13403
 
13401
13404
  case 4:
@@ -13415,27 +13418,27 @@ function ws(t) {
13415
13418
  }
13416
13419
 
13417
13420
  function bs(t) {
13418
- return fs(t) && !As(t).ko() && t.du.length > 0;
13421
+ return fs(t) && !Ns(t).No() && t.fu.length > 0;
13419
13422
  }
13420
13423
 
13421
13424
  function Is(t) {
13422
- As(t).start();
13425
+ Ns(t).start();
13423
13426
  }
13424
13427
 
13425
- function Es(t) {
13428
+ function Ts(t) {
13426
13429
  return e(this, void 0, void 0, (function() {
13427
13430
  return n(this, (function(e) {
13428
- return As(t).nu(), [ 2 /*return*/ ];
13431
+ return Ns(t).eu(), [ 2 /*return*/ ];
13429
13432
  }));
13430
13433
  }));
13431
13434
  }
13432
13435
 
13433
- function Ts(t) {
13436
+ function Es(t) {
13434
13437
  return e(this, void 0, void 0, (function() {
13435
13438
  var e, r, i, o;
13436
13439
  return n(this, (function(n) {
13437
13440
  // Send the write pipeline now that the stream is established.
13438
- for (e = As(t), r = 0, i = t.du; r < i.length; r++) o = i[r], e.Zo(o.mutations);
13441
+ for (e = Ns(t), r = 0, i = t.fu; r < i.length; r++) o = i[r], e.Xo(o.mutations);
13439
13442
  return [ 2 /*return*/ ];
13440
13443
  }));
13441
13444
  }));
@@ -13447,7 +13450,7 @@ function Ss(t, r, i) {
13447
13450
  return n(this, (function(n) {
13448
13451
  switch (n.label) {
13449
13452
  case 0:
13450
- return e = t.du.shift(), o = Ri.from(e, r, i), [ 4 /*yield*/ , gs(t, (function() {
13453
+ return e = t.fu.shift(), o = Ri.from(e, r, i), [ 4 /*yield*/ , gs(t, (function() {
13451
13454
  return t.remoteSyncer.applySuccessfulWrite(o);
13452
13455
  })) ];
13453
13456
 
@@ -13470,17 +13473,17 @@ function Ds(t, r) {
13470
13473
  return n(this, (function(i) {
13471
13474
  switch (i.label) {
13472
13475
  case 0:
13473
- return r && As(t).Xo ? [ 4 /*yield*/ , function(t, r) {
13476
+ return r && Ns(t).Yo ? [ 4 /*yield*/ , function(t, r) {
13474
13477
  return e(this, void 0, void 0, (function() {
13475
13478
  var e, i;
13476
13479
  return n(this, (function(n) {
13477
13480
  switch (n.label) {
13478
13481
  case 0:
13479
- return er(i = r.code) && i !== K.ABORTED ? (e = t.du.shift(),
13482
+ return er(i = r.code) && i !== K.ABORTED ? (e = t.fu.shift(),
13480
13483
  // In this case it's also unlikely that the server itself is melting
13481
13484
  // down -- this was just a bad request so inhibit backoff on the next
13482
13485
  // restart.
13483
- As(t).Fo(), [ 4 /*yield*/ , gs(t, (function() {
13486
+ Ns(t).Mo(), [ 4 /*yield*/ , gs(t, (function() {
13484
13487
  return t.remoteSyncer.rejectFailedWrite(e.batchId, r);
13485
13488
  })) ]) : [ 3 /*break*/ , 3 ];
13486
13489
 
@@ -13520,7 +13523,7 @@ function Ds(t, r) {
13520
13523
  }));
13521
13524
  }
13522
13525
 
13523
- function _s(t, r) {
13526
+ function xs(t, r) {
13524
13527
  return e(this, void 0, void 0, (function() {
13525
13528
  var e, i;
13526
13529
  return n(this, (function(n) {
@@ -13531,15 +13534,15 @@ function _s(t, r) {
13531
13534
  // Tear down and re-create our network streams. This will ensure we get a
13532
13535
  // fresh auth token for the new user and re-fill the write pipeline with
13533
13536
  // new mutations from the LocalStore (since mutations are per-user).
13534
- e.wu.add(3 /* CredentialChange */), [ 4 /*yield*/ , os(e) ];
13537
+ e._u.add(3 /* CredentialChange */), [ 4 /*yield*/ , os(e) ];
13535
13538
 
13536
13539
  case 1:
13537
13540
  return n.sent(), i &&
13538
13541
  // Don't set the network status to Unknown if we are offline.
13539
- e.yu.set("Unknown" /* Unknown */), [ 4 /*yield*/ , e.remoteSyncer.handleCredentialChange(r) ];
13542
+ e.gu.set("Unknown" /* Unknown */), [ 4 /*yield*/ , e.remoteSyncer.handleCredentialChange(r) ];
13540
13543
 
13541
13544
  case 2:
13542
- return n.sent(), e.wu.delete(3 /* CredentialChange */), [ 4 /*yield*/ , is(e) ];
13545
+ return n.sent(), e._u.delete(3 /* CredentialChange */), [ 4 /*yield*/ , is(e) ];
13543
13546
 
13544
13547
  case 3:
13545
13548
  // Tear down and re-create our network streams. This will ensure we get a
@@ -13553,22 +13556,22 @@ function _s(t, r) {
13553
13556
 
13554
13557
  /**
13555
13558
  * Toggles the network state when the client gains or loses its primary lease.
13556
- */ function xs(t, r) {
13559
+ */ function _s(t, r) {
13557
13560
  return e(this, void 0, void 0, (function() {
13558
13561
  var e;
13559
13562
  return n(this, (function(n) {
13560
13563
  switch (n.label) {
13561
13564
  case 0:
13562
- return e = G(t), r ? (e.wu.delete(2 /* IsSecondary */), [ 4 /*yield*/ , is(e) ]) : [ 3 /*break*/ , 2 ];
13565
+ return e = G(t), r ? (e._u.delete(2 /* IsSecondary */), [ 4 /*yield*/ , is(e) ]) : [ 3 /*break*/ , 2 ];
13563
13566
 
13564
13567
  case 1:
13565
13568
  return n.sent(), [ 3 /*break*/ , 5 ];
13566
13569
 
13567
13570
  case 2:
13568
- return r ? [ 3 /*break*/ , 4 ] : (e.wu.add(2 /* IsSecondary */), [ 4 /*yield*/ , os(e) ]);
13571
+ return r ? [ 3 /*break*/ , 4 ] : (e._u.add(2 /* IsSecondary */), [ 4 /*yield*/ , os(e) ]);
13569
13572
 
13570
13573
  case 3:
13571
- n.sent(), e.yu.set("Unknown" /* Unknown */), n.label = 4;
13574
+ n.sent(), e.gu.set("Unknown" /* Unknown */), n.label = 4;
13572
13575
 
13573
13576
  case 4:
13574
13577
  n.label = 5;
@@ -13587,26 +13590,26 @@ function _s(t, r) {
13587
13590
  *
13588
13591
  * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
13589
13592
  * This is not done on Web to allow it to be tree-shaken.
13590
- */ function Ns(t) {
13593
+ */ function As(t) {
13591
13594
  var r = this;
13592
- return t.Iu || (
13595
+ return t.pu || (
13593
13596
  // Create stream (but note that it is not started yet).
13594
- t.Iu = function(t, e, n) {
13597
+ t.pu = function(t, e, n) {
13595
13598
  var r = G(t);
13596
- return r.iu(), new $u(e, r.So, r.authCredentials, r.appCheckCredentials, r.It, n);
13599
+ return r.su(), new $u(e, r.connection, r.authCredentials, r.appCheckCredentials, r.It, n);
13597
13600
  }(t.datastore, t.asyncQueue, {
13598
13601
  Yr: ps.bind(null, t),
13599
13602
  Zr: vs.bind(null, t),
13600
- zo: ys.bind(null, t)
13601
- }), t.mu.push((function(i) {
13603
+ Wo: ys.bind(null, t)
13604
+ }), t.wu.push((function(i) {
13602
13605
  return e(r, void 0, void 0, (function() {
13603
13606
  return n(this, (function(e) {
13604
13607
  switch (e.label) {
13605
13608
  case 0:
13606
- return i ? (t.Iu.Fo(), hs(t) ? ls(t) : t.yu.set("Unknown" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ];
13609
+ return i ? (t.pu.Mo(), hs(t) ? ls(t) : t.gu.set("Unknown" /* Unknown */), [ 3 /*break*/ , 3 ]) : [ 3 /*break*/ , 1 ];
13607
13610
 
13608
13611
  case 1:
13609
- return [ 4 /*yield*/ , t.Iu.stop() ];
13612
+ return [ 4 /*yield*/ , t.pu.stop() ];
13610
13613
 
13611
13614
  case 2:
13612
13615
  e.sent(), ds(t), e.label = 3;
@@ -13616,7 +13619,7 @@ function _s(t, r) {
13616
13619
  }
13617
13620
  }));
13618
13621
  }));
13619
- }))), t.Iu
13622
+ }))), t.pu
13620
13623
  /**
13621
13624
  * If not yet initialized, registers the WriteStream and its network state
13622
13625
  * callback with `remoteStoreImpl`. Returns the existing stream if one is
@@ -13627,42 +13630,42 @@ function _s(t, r) {
13627
13630
  */;
13628
13631
  }
13629
13632
 
13630
- function As(t) {
13633
+ function Ns(t) {
13631
13634
  var r = this;
13632
- return t.Tu || (
13635
+ return t.Iu || (
13633
13636
  // Create stream (but note that it is not started yet).
13634
- t.Tu = function(t, e, n) {
13637
+ t.Iu = function(t, e, n) {
13635
13638
  var r = G(t);
13636
- return r.iu(), new ts(e, r.So, r.authCredentials, r.appCheckCredentials, r.It, n);
13639
+ return r.su(), new ts(e, r.connection, r.authCredentials, r.appCheckCredentials, r.It, n);
13637
13640
  }(t.datastore, t.asyncQueue, {
13638
- Yr: Es.bind(null, t),
13641
+ Yr: Ts.bind(null, t),
13639
13642
  Zr: Ds.bind(null, t),
13640
- eu: Ts.bind(null, t),
13641
- tu: Ss.bind(null, t)
13642
- }), t.mu.push((function(i) {
13643
+ tu: Es.bind(null, t),
13644
+ Zo: Ss.bind(null, t)
13645
+ }), t.wu.push((function(i) {
13643
13646
  return e(r, void 0, void 0, (function() {
13644
13647
  return n(this, (function(e) {
13645
13648
  switch (e.label) {
13646
13649
  case 0:
13647
- return i ? (t.Tu.Fo(), [ 4 /*yield*/ , ws(t) ]) : [ 3 /*break*/ , 2 ];
13650
+ return i ? (t.Iu.Mo(), [ 4 /*yield*/ , ws(t) ]) : [ 3 /*break*/ , 2 ];
13648
13651
 
13649
13652
  case 1:
13650
13653
  // This will start the write stream if necessary.
13651
13654
  return e.sent(), [ 3 /*break*/ , 4 ];
13652
13655
 
13653
13656
  case 2:
13654
- return [ 4 /*yield*/ , t.Tu.stop() ];
13657
+ return [ 4 /*yield*/ , t.Iu.stop() ];
13655
13658
 
13656
13659
  case 3:
13657
- e.sent(), t.du.length > 0 && (L("RemoteStore", "Stopping write stream with " + t.du.length + " pending writes"),
13658
- t.du = []), e.label = 4;
13660
+ e.sent(), t.fu.length > 0 && (L("RemoteStore", "Stopping write stream with " + t.fu.length + " pending writes"),
13661
+ t.fu = []), e.label = 4;
13659
13662
 
13660
13663
  case 4:
13661
13664
  return [ 2 /*return*/ ];
13662
13665
  }
13663
13666
  }));
13664
13667
  }));
13665
- }))), t.Tu
13668
+ }))), t.Iu
13666
13669
  /**
13667
13670
  * @license
13668
13671
  * Copyright 2017 Google LLC
@@ -13861,25 +13864,25 @@ var Cs = /** @class */ function() {
13861
13864
  }, t;
13862
13865
  }(), Rs = /** @class */ function() {
13863
13866
  function t() {
13864
- this.Eu = new Kt(ft.comparator);
13867
+ this.Tu = new Kt(ft.comparator);
13865
13868
  }
13866
13869
  return t.prototype.track = function(t) {
13867
- var e = t.doc.key, n = this.Eu.get(e);
13870
+ var e = t.doc.key, n = this.Tu.get(e);
13868
13871
  n ?
13869
13872
  // Merge the new change with the existing change.
13870
- 0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Eu = this.Eu.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Eu = this.Eu.insert(e, {
13873
+ 0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Tu = this.Tu.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Tu = this.Tu.insert(e, {
13871
13874
  type: n.type,
13872
13875
  doc: t.doc
13873
- }) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Eu = this.Eu.insert(e, {
13876
+ }) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
13874
13877
  type: 2 /* Modified */ ,
13875
13878
  doc: t.doc
13876
- }) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Eu = this.Eu.insert(e, {
13879
+ }) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.insert(e, {
13877
13880
  type: 0 /* Added */ ,
13878
13881
  doc: t.doc
13879
- }) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Eu = this.Eu.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Eu = this.Eu.insert(e, {
13882
+ }) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
13880
13883
  type: 1 /* Removed */ ,
13881
13884
  doc: n.doc
13882
- }) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Eu = this.Eu.insert(e, {
13885
+ }) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Tu = this.Tu.insert(e, {
13883
13886
  type: 2 /* Modified */ ,
13884
13887
  doc: t.doc
13885
13888
  }) :
@@ -13890,10 +13893,10 @@ var Cs = /** @class */ function() {
13890
13893
  // Removed->Modified
13891
13894
  // Metadata->Added
13892
13895
  // Removed->Metadata
13893
- q() : this.Eu = this.Eu.insert(e, t);
13894
- }, t.prototype.Au = function() {
13896
+ q() : this.Tu = this.Tu.insert(e, t);
13897
+ }, t.prototype.Eu = function() {
13895
13898
  var t = [];
13896
- return this.Eu.inorderTraversal((function(e, n) {
13899
+ return this.Tu.inorderTraversal((function(e, n) {
13897
13900
  t.push(n);
13898
13901
  })), t;
13899
13902
  }, t;
@@ -13928,11 +13931,11 @@ var Cs = /** @class */ function() {
13928
13931
  return !0;
13929
13932
  }, t;
13930
13933
  }(), Ls = function() {
13931
- this.Ru = void 0, this.listeners = [];
13934
+ this.Au = void 0, this.listeners = [];
13932
13935
  }, Ms = function() {
13933
13936
  this.queries = new rr((function(t) {
13934
13937
  return pn(t);
13935
- }), dn), this.onlineState = "Unknown" /* Unknown */ , this.bu = new Set;
13938
+ }), dn), this.onlineState = "Unknown" /* Unknown */ , this.Ru = new Set;
13936
13939
  };
13937
13940
 
13938
13941
  /**
@@ -13968,7 +13971,7 @@ var Cs = /** @class */ function() {
13968
13971
  return n.trys.push([ 1, 3, , 4 ]), s = u, [ 4 /*yield*/ , e.onListen(i) ];
13969
13972
 
13970
13973
  case 2:
13971
- return s.Ru = n.sent(), [ 3 /*break*/ , 4 ];
13974
+ return s.Au = n.sent(), [ 3 /*break*/ , 4 ];
13972
13975
 
13973
13976
  case 3:
13974
13977
  return a = n.sent(), c = ks(a, "Initialization of query '" + vn(r.query) + "' failed"),
@@ -13977,7 +13980,7 @@ var Cs = /** @class */ function() {
13977
13980
  case 4:
13978
13981
  return e.queries.set(i, u), u.listeners.push(r),
13979
13982
  // Run global snapshot listeners if a consistent snapshot has been emitted.
13980
- r.Pu(e.onlineState), u.Ru && r.vu(u.Ru) && Bs(e), [ 2 /*return*/ ];
13983
+ r.bu(e.onlineState), u.Au && r.Pu(u.Au) && Bs(e), [ 2 /*return*/ ];
13981
13984
  }
13982
13985
  }));
13983
13986
  }));
@@ -13998,9 +14001,9 @@ function qs(t, e) {
13998
14001
  var u = o[i], s = u.query, a = n.queries.get(s);
13999
14002
  if (a) {
14000
14003
  for (var c = 0, l = a.listeners; c < l.length; c++) {
14001
- l[c].vu(u) && (r = !0);
14004
+ l[c].Pu(u) && (r = !0);
14002
14005
  }
14003
- a.Ru = u;
14006
+ a.Au = u;
14004
14007
  }
14005
14008
  }
14006
14009
  r && Bs(n);
@@ -14018,7 +14021,7 @@ function Us(t, e, n) {
14018
14021
 
14019
14022
  // Call all global snapshot listeners that have been set.
14020
14023
  function Bs(t) {
14021
- t.bu.forEach((function(t) {
14024
+ t.Ru.forEach((function(t) {
14022
14025
  t.next();
14023
14026
  }));
14024
14027
  }
@@ -14030,12 +14033,12 @@ function Bs(t) {
14030
14033
  * It uses an Observer to dispatch events.
14031
14034
  */ var Gs = /** @class */ function() {
14032
14035
  function t(t, e, n) {
14033
- this.query = t, this.Vu = e,
14036
+ this.query = t, this.vu = e,
14034
14037
  /**
14035
14038
  * Initial snapshots (e.g. from cache) may not be propagated to the wrapped
14036
14039
  * observer. This flag is set to true once we've actually raised an event.
14037
14040
  */
14038
- this.Su = !1, this.Du = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {}
14041
+ this.Vu = !1, this.Su = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {}
14039
14042
  /**
14040
14043
  * Applies the new ViewSnapshot to this listener, raising a user-facing event
14041
14044
  * if applicable (depending on what changed, whether the user has opted into
@@ -14043,7 +14046,7 @@ function Bs(t) {
14043
14046
  * indeed raised.
14044
14047
  */;
14045
14048
  }
14046
- return t.prototype.vu = function(t) {
14049
+ return t.prototype.Pu = function(t) {
14047
14050
  if (!this.options.includeMetadataChanges) {
14048
14051
  for (
14049
14052
  // Remove the metadata only changes.
@@ -14055,17 +14058,17 @@ function Bs(t) {
14055
14058
  /* excludesMetadataChanges= */ !0, t.hasCachedResults);
14056
14059
  }
14057
14060
  var o = !1;
14058
- return this.Su ? this.Cu(t) && (this.Vu.next(t), o = !0) : this.xu(t, this.onlineState) && (this.Nu(t),
14059
- o = !0), this.Du = t, o;
14061
+ return this.Vu ? this.Du(t) && (this.vu.next(t), o = !0) : this.Cu(t, this.onlineState) && (this.xu(t),
14062
+ o = !0), this.Su = t, o;
14060
14063
  }, t.prototype.onError = function(t) {
14061
- this.Vu.error(t);
14064
+ this.vu.error(t);
14062
14065
  },
14063
- /** Returns whether a snapshot was raised. */ t.prototype.Pu = function(t) {
14066
+ /** Returns whether a snapshot was raised. */ t.prototype.bu = function(t) {
14064
14067
  this.onlineState = t;
14065
14068
  var e = !1;
14066
- return this.Du && !this.Su && this.xu(this.Du, t) && (this.Nu(this.Du), e = !0),
14069
+ return this.Su && !this.Vu && this.Cu(this.Su, t) && (this.xu(this.Su), e = !0),
14067
14070
  e;
14068
- }, t.prototype.xu = function(t, e) {
14071
+ }, t.prototype.Cu = function(t, e) {
14069
14072
  // Always raise the first event when we're synced
14070
14073
  if (!t.fromCache) return !0;
14071
14074
  // NOTE: We consider OnlineState.Unknown as online (it should become Offline
@@ -14073,32 +14076,32 @@ function Bs(t) {
14073
14076
  var n = "Offline" /* Offline */ !== e;
14074
14077
  // Don't raise the event if we're online, aren't synced yet (checked
14075
14078
  // above) and are waiting for a sync.
14076
- return (!this.options.ku || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
14079
+ return (!this.options.Nu || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
14077
14080
  // Raise data from cache if we have any documents, have cached results before,
14078
14081
  // or we are offline.
14079
- }, t.prototype.Cu = function(t) {
14082
+ }, t.prototype.Du = function(t) {
14080
14083
  // We don't need to handle includeDocumentMetadataChanges here because
14081
14084
  // the Metadata only changes have already been stripped out if needed.
14082
14085
  // At this point the only changes we will see are the ones we should
14083
14086
  // propagate.
14084
14087
  if (t.docChanges.length > 0) return !0;
14085
- var e = this.Du && this.Du.hasPendingWrites !== t.hasPendingWrites;
14088
+ var e = this.Su && this.Su.hasPendingWrites !== t.hasPendingWrites;
14086
14089
  return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges;
14087
14090
  // Generally we should have hit one of the cases above, but it's possible
14088
14091
  // to get here if there were only metadata docChanges and they got
14089
14092
  // stripped out.
14090
- }, t.prototype.Nu = function(t) {
14093
+ }, t.prototype.xu = function(t) {
14091
14094
  t = Vs.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache, t.hasCachedResults),
14092
- this.Su = !0, this.Vu.next(t);
14095
+ this.Vu = !0, this.vu.next(t);
14093
14096
  }, t;
14094
14097
  }(), Ks = /** @class */ function() {
14095
14098
  function t(t,
14096
14099
  // How many bytes this element takes to store in the bundle.
14097
14100
  e) {
14098
- this.payload = t, this.byteLength = e;
14101
+ this.ku = t, this.byteLength = e;
14099
14102
  }
14100
14103
  return t.prototype.Ou = function() {
14101
- return "metadata" in this.payload;
14104
+ return "metadata" in this.ku;
14102
14105
  }, t;
14103
14106
  }(), js = /** @class */ function() {
14104
14107
  function t(t) {
@@ -14134,13 +14137,13 @@ function Bs(t) {
14134
14137
  return t.prototype.Fu = function(t) {
14135
14138
  this.progress.bytesLoaded += t.byteLength;
14136
14139
  var e = this.progress.documentsLoaded;
14137
- if (t.payload.namedQuery) this.queries.push(t.payload.namedQuery); else if (t.payload.documentMetadata) {
14140
+ if (t.ku.namedQuery) this.queries.push(t.ku.namedQuery); else if (t.ku.documentMetadata) {
14138
14141
  this.documents.push({
14139
- metadata: t.payload.documentMetadata
14140
- }), t.payload.documentMetadata.exists || ++e;
14141
- var n = ct.fromString(t.payload.documentMetadata.name);
14142
+ metadata: t.ku.documentMetadata
14143
+ }), t.ku.documentMetadata.exists || ++e;
14144
+ var n = ct.fromString(t.ku.documentMetadata.name);
14142
14145
  this.collectionGroups.add(n.get(n.length - 2));
14143
- } else t.payload.document && (this.documents[this.documents.length - 1].document = t.payload.document,
14146
+ } else t.ku.document && (this.documents[this.documents.length - 1].document = t.ku.document,
14144
14147
  ++e);
14145
14148
  return e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e,
14146
14149
  Object.assign({}, this.progress)) : null;
@@ -14353,7 +14356,7 @@ function zs(t) {
14353
14356
  var r = this, i = this.Qu;
14354
14357
  this.Qu = t.Qu, this.mutatedKeys = t.mutatedKeys;
14355
14358
  // Sort changes based on type and query comparator
14356
- var o = t.zu.Au();
14359
+ var o = t.zu.Eu();
14357
14360
  o.sort((function(t, e) {
14358
14361
  return function(t, e) {
14359
14362
  var n = function(t) {
@@ -14392,7 +14395,7 @@ function zs(t) {
14392
14395
  * Applies an OnlineState change to the view, potentially generating a
14393
14396
  * ViewChange if the view's syncState changes as a result.
14394
14397
  */
14395
- t.prototype.Pu = function(t) {
14398
+ t.prototype.bu = function(t) {
14396
14399
  return this.current && "Offline" /* Offline */ === t ? (
14397
14400
  // If we're offline, set `current` to false and then call applyChanges()
14398
14401
  // to refresh our syncState and generate a ViewChange as appropriate. We
@@ -14538,7 +14541,7 @@ n) {
14538
14541
  /** Stores user completion handlers, indexed by User and BatchId. */
14539
14542
  this.hc = {},
14540
14543
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
14541
- this.lc = new Map, this.fc = Ao.vn(), this.onlineState = "Unknown" /* Unknown */ ,
14544
+ this.lc = new Map, this.fc = No.vn(), this.onlineState = "Unknown" /* Unknown */ ,
14542
14545
  // The primary state is set to `true` or `false` immediately after Firestore
14543
14546
  // startup. In the interim, a client should only be considered primary if
14544
14547
  // `isPrimary` is true.
@@ -14564,7 +14567,7 @@ function $s(t, r) {
14564
14567
  return n(this, (function(n) {
14565
14568
  switch (n.label) {
14566
14569
  case 0:
14567
- return e = Na(t), (u = e.ic.get(r)) ? (
14570
+ return e = Aa(t), (u = e.ic.get(r)) ? (
14568
14571
  // PORTING NOTE: With Multi-Tab Web, it is possible that a query view
14569
14572
  // already exists when EventManager calls us for the first time. This
14570
14573
  // happens when the primary tab is already listening to this query on
@@ -14609,7 +14612,7 @@ function $s(t, r) {
14609
14612
  return n(this, (function(n) {
14610
14613
  switch (n.label) {
14611
14614
  case 0:
14612
- return e = r.view.Wu(i), e.$i ? [ 4 /*yield*/ , xu(t.localStore, r.query,
14615
+ return e = r.view.Wu(i), e.$i ? [ 4 /*yield*/ , _u(t.localStore, r.query,
14613
14616
  /* usePreviousResults= */ !1).then((function(t) {
14614
14617
  var n = t.documents;
14615
14618
  return r.view.Wu(n, e);
@@ -14629,7 +14632,7 @@ function $s(t, r) {
14629
14632
  }));
14630
14633
  }));
14631
14634
  }(t, r, i, o);
14632
- }, [ 4 /*yield*/ , xu(t.localStore, r,
14635
+ }, [ 4 /*yield*/ , _u(t.localStore, r,
14633
14636
  /* usePreviousResults= */ !0) ];
14634
14637
 
14635
14638
  case 1:
@@ -14654,11 +14657,11 @@ function $s(t, r) {
14654
14657
  }))), void e.ic.delete(r)) ] : e.isPrimaryClient ? (
14655
14658
  // We need to remove the local query target first to allow us to verify
14656
14659
  // whether any other client is still interested in this target.
14657
- e.sharedClientState.removeLocalQueryTarget(i.targetId), e.sharedClientState.isActiveQueryTarget(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , _u(e.localStore, i.targetId,
14660
+ e.sharedClientState.removeLocalQueryTarget(i.targetId), e.sharedClientState.isActiveQueryTarget(i.targetId) ? [ 3 /*break*/ , 2 ] : [ 4 /*yield*/ , xu(e.localStore, i.targetId,
14658
14661
  /*keepPersistedTargetData=*/ !1).then((function() {
14659
14662
  e.sharedClientState.clearQueryState(i.targetId), ss(e.remoteStore, i.targetId),
14660
14663
  ha(e, i.targetId);
14661
- })).catch(_t) ]) : [ 3 /*break*/ , 3 ];
14664
+ })).catch(xt) ]) : [ 3 /*break*/ , 3 ];
14662
14665
 
14663
14666
  case 1:
14664
14667
  n.sent(), n.label = 2;
@@ -14667,7 +14670,7 @@ function $s(t, r) {
14667
14670
  return [ 3 /*break*/ , 5 ];
14668
14671
 
14669
14672
  case 3:
14670
- return ha(e, i.targetId), [ 4 /*yield*/ , _u(e.localStore, i.targetId,
14673
+ return ha(e, i.targetId), [ 4 /*yield*/ , xu(e.localStore, i.targetId,
14671
14674
  /*keepPersistedTargetData=*/ !0) ];
14672
14675
 
14673
14676
  case 4:
@@ -14695,7 +14698,7 @@ function $s(t, r) {
14695
14698
  return n(this, (function(n) {
14696
14699
  switch (n.label) {
14697
14700
  case 0:
14698
- e = Aa(t), n.label = 1;
14701
+ e = Na(t), n.label = 1;
14699
14702
 
14700
14703
  case 1:
14701
14704
  return n.trys.push([ 1, 5, , 6 ]), [ 4 /*yield*/ , function(t, e) {
@@ -14781,7 +14784,7 @@ function $s(t, r) {
14781
14784
  e = G(t), n.label = 1;
14782
14785
 
14783
14786
  case 1:
14784
- return n.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , Eu(e.localStore, r) ];
14787
+ return n.trys.push([ 1, 4, , 6 ]), [ 4 /*yield*/ , Tu(e.localStore, r) ];
14785
14788
 
14786
14789
  case 2:
14787
14790
  return i = n.sent(),
@@ -14801,7 +14804,7 @@ function $s(t, r) {
14801
14804
  return n.sent(), [ 3 /*break*/ , 6 ];
14802
14805
 
14803
14806
  case 4:
14804
- return [ 4 /*yield*/ , _t(n.sent()) ];
14807
+ return [ 4 /*yield*/ , xt(n.sent()) ];
14805
14808
 
14806
14809
  case 5:
14807
14810
  return n.sent(), [ 3 /*break*/ , 6 ];
@@ -14825,7 +14828,7 @@ function $s(t, r) {
14825
14828
  if (r.isPrimaryClient && 0 /* RemoteStore */ === n || !r.isPrimaryClient && 1 /* SharedClientState */ === n) {
14826
14829
  var i = [];
14827
14830
  r.ic.forEach((function(t, n) {
14828
- var r = n.view.Pu(e);
14831
+ var r = n.view.bu(e);
14829
14832
  r.snapshot && i.push(r.snapshot);
14830
14833
  })), function(t, e) {
14831
14834
  var n = G(t);
@@ -14834,10 +14837,10 @@ function $s(t, r) {
14834
14837
  n.queries.forEach((function(t, n) {
14835
14838
  for (var i = 0, o = n.listeners; i < o.length; i++) {
14836
14839
  // Run global snapshot listeners if a consistent snapshot has been emitted.
14837
- o[i].Pu(e) && (r = !0);
14840
+ o[i].bu(e) && (r = !0);
14838
14841
  }
14839
14842
  })), r && Bs(n);
14840
- }(r.eventManager, e), i.length && r.sc.zo(i), r.onlineState = e, r.isPrimaryClient && r.sharedClientState.setOnlineState(e);
14843
+ }(r.eventManager, e), i.length && r.sc.Wo(i), r.onlineState = e, r.isPrimaryClient && r.sharedClientState.setOnlineState(e);
14841
14844
  }
14842
14845
  }
14843
14846
 
@@ -14878,10 +14881,10 @@ function $s(t, r) {
14878
14881
  e.uc = e.uc.remove(u), e.cc.delete(r), va(e), [ 3 /*break*/ , 4 ];
14879
14882
 
14880
14883
  case 2:
14881
- return [ 4 /*yield*/ , _u(e.localStore, r,
14884
+ return [ 4 /*yield*/ , xu(e.localStore, r,
14882
14885
  /* keepPersistedTargetData */ !1).then((function() {
14883
14886
  return ha(e, r, i);
14884
- })).catch(_t) ];
14887
+ })).catch(xt) ];
14885
14888
 
14886
14889
  case 3:
14887
14890
  n.sent(), n.label = 4;
@@ -14921,7 +14924,7 @@ function ua(t, r) {
14921
14924
  return n.sent(), [ 3 /*break*/ , 6 ];
14922
14925
 
14923
14926
  case 4:
14924
- return [ 4 /*yield*/ , _t(n.sent()) ];
14927
+ return [ 4 /*yield*/ , xt(n.sent()) ];
14925
14928
 
14926
14929
  case 5:
14927
14930
  return n.sent(), [ 3 /*break*/ , 6 ];
@@ -14977,7 +14980,7 @@ function sa(t, r, i) {
14977
14980
  return n.sent(), [ 3 /*break*/ , 6 ];
14978
14981
 
14979
14982
  case 4:
14980
- return [ 4 /*yield*/ , _t(n.sent()) ];
14983
+ return [ 4 /*yield*/ , xt(n.sent()) ];
14981
14984
 
14982
14985
  case 5:
14983
14986
  return n.sent(), [ 3 /*break*/ , 6 ];
@@ -15119,7 +15122,7 @@ function ya(t, r, i) {
15119
15122
  })), [ 4 /*yield*/ , Promise.all(a) ]);
15120
15123
 
15121
15124
  case 1:
15122
- return c.sent(), o.sc.zo(u), [ 4 /*yield*/ , function(t, r) {
15125
+ return c.sent(), o.sc.Wo(u), [ 4 /*yield*/ , function(t, r) {
15123
15126
  return e(this, void 0, void 0, (function() {
15124
15127
  var e, i, o, u, s, a, c, l, h;
15125
15128
  return n(this, (function(n) {
@@ -15129,11 +15132,11 @@ function ya(t, r, i) {
15129
15132
 
15130
15133
  case 1:
15131
15134
  return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , e.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (function(t) {
15132
- return xt.forEach(r, (function(n) {
15133
- return xt.forEach(n.Si, (function(r) {
15135
+ return _t.forEach(r, (function(n) {
15136
+ return _t.forEach(n.Si, (function(r) {
15134
15137
  return e.persistence.referenceDelegate.addReference(t, n.targetId, r);
15135
15138
  })).next((function() {
15136
- return xt.forEach(n.Di, (function(r) {
15139
+ return _t.forEach(n.Di, (function(r) {
15137
15140
  return e.persistence.referenceDelegate.removeReference(t, n.targetId, r);
15138
15141
  }));
15139
15142
  }));
@@ -15226,7 +15229,7 @@ function ga(t, e) {
15226
15229
  return n(this, (function(n) {
15227
15230
  switch (n.label) {
15228
15231
  case 0:
15229
- return [ 4 /*yield*/ , xu((e = G(t)).localStore, r.query,
15232
+ return [ 4 /*yield*/ , _u((e = G(t)).localStore, r.query,
15230
15233
  /* usePreviousResults= */ !0) ];
15231
15234
 
15232
15235
  case 1:
@@ -15246,7 +15249,7 @@ function ba(t, r) {
15246
15249
  return e(this, void 0, void 0, (function() {
15247
15250
  var e;
15248
15251
  return n(this, (function(n) {
15249
- return [ 2 /*return*/ , Au((e = G(t)).localStore, r).then((function(t) {
15252
+ return [ 2 /*return*/ , Nu((e = G(t)).localStore, r).then((function(t) {
15250
15253
  return ya(e, t);
15251
15254
  })) ];
15252
15255
  }));
@@ -15265,7 +15268,7 @@ function Ia(t, r, i, o) {
15265
15268
  var n = G(t), r = G(n.mutationQueue);
15266
15269
  return n.persistence.runTransaction("Lookup mutation documents", "readonly", (function(t) {
15267
15270
  return r.Tn(t, e).next((function(e) {
15268
- return e ? n.localDocuments.getDocuments(t, e) : xt.resolve(null);
15271
+ return e ? n.localDocuments.getDocuments(t, e) : _t.resolve(null);
15269
15272
  }));
15270
15273
  }));
15271
15274
  }((e = G(t)).localStore, r) ];
@@ -15312,17 +15315,17 @@ function Ia(t, r, i, o) {
15312
15315
 
15313
15316
  /** Applies a query target change from a different tab. */
15314
15317
  // PORTING NOTE: Multi-Tab only.
15315
- function Ea(t, r) {
15318
+ function Ta(t, r) {
15316
15319
  return e(this, void 0, void 0, (function() {
15317
15320
  var e, i, o, u, s, a, c, l;
15318
15321
  return n(this, (function(n) {
15319
15322
  switch (n.label) {
15320
15323
  case 0:
15321
- return Na(e = G(t)), Aa(e), !0 !== r || !0 === e.dc ? [ 3 /*break*/ , 3 ] : (i = e.sharedClientState.getAllActiveQueryTargets(),
15322
- [ 4 /*yield*/ , Ta(e, i.toArray()) ]);
15324
+ return Aa(e = G(t)), Na(e), !0 !== r || !0 === e.dc ? [ 3 /*break*/ , 3 ] : (i = e.sharedClientState.getAllActiveQueryTargets(),
15325
+ [ 4 /*yield*/ , Ea(e, i.toArray()) ]);
15323
15326
 
15324
15327
  case 1:
15325
- return o = n.sent(), e.dc = !0, [ 4 /*yield*/ , xs(e.remoteStore, !0) ];
15328
+ return o = n.sent(), e.dc = !0, [ 4 /*yield*/ , _s(e.remoteStore, !0) ];
15326
15329
 
15327
15330
  case 2:
15328
15331
  for (n.sent(), u = 0, s = o; u < s.length; u++) a = s[u], us(e.remoteStore, a);
@@ -15332,13 +15335,13 @@ function Ea(t, r) {
15332
15335
  return !1 !== r || !1 === e.dc ? [ 3 /*break*/ , 7 ] : (c = [], l = Promise.resolve(),
15333
15336
  e.rc.forEach((function(t, n) {
15334
15337
  e.sharedClientState.isLocalQueryTarget(n) ? c.push(n) : l = l.then((function() {
15335
- return ha(e, n), _u(e.localStore, n,
15338
+ return ha(e, n), xu(e.localStore, n,
15336
15339
  /*keepPersistedTargetData=*/ !0);
15337
15340
  })), ss(e.remoteStore, n);
15338
15341
  })), [ 4 /*yield*/ , l ]);
15339
15342
 
15340
15343
  case 4:
15341
- return n.sent(), [ 4 /*yield*/ , Ta(e, c) ];
15344
+ return n.sent(), [ 4 /*yield*/ , Ea(e, c) ];
15342
15345
 
15343
15346
  case 5:
15344
15347
  return n.sent(),
@@ -15348,7 +15351,7 @@ function Ea(t, r) {
15348
15351
  e.cc.forEach((function(t, n) {
15349
15352
  ss(e.remoteStore, n);
15350
15353
  })), e.ac.fs(), e.cc = new Map, e.uc = new Kt(ft.comparator);
15351
- }(e), e.dc = !1, [ 4 /*yield*/ , xs(e.remoteStore, !1) ];
15354
+ }(e), e.dc = !1, [ 4 /*yield*/ , _s(e.remoteStore, !1) ];
15352
15355
 
15353
15356
  case 6:
15354
15357
  n.sent(), n.label = 7;
@@ -15360,7 +15363,7 @@ function Ea(t, r) {
15360
15363
  }));
15361
15364
  }
15362
15365
 
15363
- function Ta(t, r, i) {
15366
+ function Ea(t, r, i) {
15364
15367
  return e(this, void 0, void 0, (function() {
15365
15368
  var e, i, o, u, s, a, c, l, h, f, d, p, v, y;
15366
15369
  return n(this, (function(n) {
@@ -15391,7 +15394,7 @@ function Ta(t, r, i) {
15391
15394
  return [ 3 /*break*/ , 11 ];
15392
15395
 
15393
15396
  case 7:
15394
- return [ 4 /*yield*/ , Nu(e.localStore, a) ];
15397
+ return [ 4 /*yield*/ , Au(e.localStore, a) ];
15395
15398
 
15396
15399
  case 8:
15397
15400
  return y = n.sent(), [ 4 /*yield*/ , Du(e.localStore, y) ];
@@ -15410,7 +15413,7 @@ function Ta(t, r, i) {
15410
15413
  return u++, [ 3 /*break*/ , 1 ];
15411
15414
 
15412
15415
  case 13:
15413
- return [ 2 /*return*/ , (e.sc.zo(o), i) ];
15416
+ return [ 2 /*return*/ , (e.sc.Wo(o), i) ];
15414
15417
  }
15415
15418
  }));
15416
15419
  }));
@@ -15440,7 +15443,7 @@ function Da(t) {
15440
15443
 
15441
15444
  /** Applies a query target change from a different tab. */
15442
15445
  // PORTING NOTE: Multi-Tab only.
15443
- function _a(t, r, i, o) {
15446
+ function xa(t, r, i, o) {
15444
15447
  return e(this, void 0, void 0, (function() {
15445
15448
  var e, u, s, a;
15446
15449
  return n(this, (function(n) {
@@ -15462,7 +15465,7 @@ function _a(t, r, i, o) {
15462
15465
  return [ 3 /*break*/ , 6 ];
15463
15466
 
15464
15467
  case 1:
15465
- return [ 4 /*yield*/ , Au(e.localStore, mn(u[0])) ];
15468
+ return [ 4 /*yield*/ , Nu(e.localStore, mn(u[0])) ];
15466
15469
 
15467
15470
  case 2:
15468
15471
  return s = n.sent(), a = mr.createSynthesizedRemoteEventForCurrentChange(r, "current" === i, Zt.EMPTY_BYTE_STRING),
@@ -15472,7 +15475,7 @@ function _a(t, r, i, o) {
15472
15475
  return n.sent(), [ 3 /*break*/ , 7 ];
15473
15476
 
15474
15477
  case 4:
15475
- return [ 4 /*yield*/ , _u(e.localStore, r,
15478
+ return [ 4 /*yield*/ , xu(e.localStore, r,
15476
15479
  /* keepPersistedTargetData */ !0) ];
15477
15480
 
15478
15481
  case 5:
@@ -15488,19 +15491,19 @@ function _a(t, r, i, o) {
15488
15491
  }));
15489
15492
  }
15490
15493
 
15491
- /** Adds or removes Watch targets for queries from different tabs. */ function xa(t, r, i) {
15494
+ /** Adds or removes Watch targets for queries from different tabs. */ function _a(t, r, i) {
15492
15495
  return e(this, void 0, void 0, (function() {
15493
15496
  var e, o, u, s, a, c, l, h, f, d;
15494
15497
  return n(this, (function(p) {
15495
15498
  switch (p.label) {
15496
15499
  case 0:
15497
- if (!(e = Na(t)).dc) return [ 3 /*break*/ , 10 ];
15500
+ if (!(e = Aa(t)).dc) return [ 3 /*break*/ , 10 ];
15498
15501
  o = 0, u = r, p.label = 1;
15499
15502
 
15500
15503
  case 1:
15501
15504
  return o < u.length ? (s = u[o], e.rc.has(s) ? (
15502
15505
  // A target might have been added in a previous attempt
15503
- L("SyncEngine", "Adding an already active target " + s), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , Nu(e.localStore, s) ]) : [ 3 /*break*/ , 6 ];
15506
+ L("SyncEngine", "Adding an already active target " + s), [ 3 /*break*/ , 5 ]) : [ 4 /*yield*/ , Au(e.localStore, s) ]) : [ 3 /*break*/ , 6 ];
15504
15507
 
15505
15508
  case 2:
15506
15509
  return a = p.sent(), [ 4 /*yield*/ , Du(e.localStore, a) ];
@@ -15520,10 +15523,10 @@ function _a(t, r, i, o) {
15520
15523
  return n(this, (function(n) {
15521
15524
  switch (n.label) {
15522
15525
  case 0:
15523
- return e.rc.has(t) ? [ 4 /*yield*/ , _u(e.localStore, t,
15526
+ return e.rc.has(t) ? [ 4 /*yield*/ , xu(e.localStore, t,
15524
15527
  /* keepPersistedTargetData */ !1).then((function() {
15525
15528
  ss(e.remoteStore, t), ha(e, t);
15526
- })).catch(_t) ] : [ 3 /*break*/ , 2 ];
15529
+ })).catch(xt) ] : [ 3 /*break*/ , 2 ];
15527
15530
 
15528
15531
  // Release queries that are still active.
15529
15532
  case 1:
@@ -15552,14 +15555,14 @@ function _a(t, r, i, o) {
15552
15555
  }));
15553
15556
  }
15554
15557
 
15555
- function Na(t) {
15558
+ function Aa(t) {
15556
15559
  var e = G(t);
15557
15560
  return e.remoteStore.remoteSyncer.applyRemoteEvent = ra.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = ga.bind(null, e),
15558
- e.remoteStore.remoteSyncer.rejectListen = oa.bind(null, e), e.sc.zo = qs.bind(null, e.eventManager),
15561
+ e.remoteStore.remoteSyncer.rejectListen = oa.bind(null, e), e.sc.Wo = qs.bind(null, e.eventManager),
15559
15562
  e.sc.wc = Us.bind(null, e.eventManager), e;
15560
15563
  }
15561
15564
 
15562
- function Aa(t) {
15565
+ function Na(t) {
15563
15566
  var e = G(t);
15564
15567
  return e.remoteStore.remoteSyncer.applySuccessfulWrite = ua.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = sa.bind(null, e),
15565
15568
  e
@@ -15745,7 +15748,7 @@ var ka = /** @class */ function() {
15745
15748
 
15746
15749
  case 2:
15747
15750
  // Enqueue writes from a previous session
15748
- return n.sent(), [ 4 /*yield*/ , Aa(this.Ac.syncEngine) ];
15751
+ return n.sent(), [ 4 /*yield*/ , Na(this.Ac.syncEngine) ];
15749
15752
 
15750
15753
  case 3:
15751
15754
  // Enqueue writes from a previous session
@@ -15797,8 +15800,8 @@ var ka = /** @class */ function() {
15797
15800
  case 1:
15798
15801
  return u.sent(), i = this.Ac.syncEngine, this.sharedClientState instanceof Bu ? (this.sharedClientState.syncEngine = {
15799
15802
  Fr: Ia.bind(null, i),
15800
- $r: _a.bind(null, i),
15801
- Br: xa.bind(null, i),
15803
+ $r: xa.bind(null, i),
15804
+ Br: _a.bind(null, i),
15802
15805
  vi: Da.bind(null, i),
15803
15806
  Mr: ba.bind(null, i)
15804
15807
  }, [ 4 /*yield*/ , this.sharedClientState.start() ]) : [ 3 /*break*/ , 3 ];
@@ -15814,7 +15817,7 @@ var ka = /** @class */ function() {
15814
15817
  return n(this, (function(e) {
15815
15818
  switch (e.label) {
15816
15819
  case 0:
15817
- return [ 4 /*yield*/ , Ea(this.Ac.syncEngine, t) ];
15820
+ return [ 4 /*yield*/ , Ta(this.Ac.syncEngine, t) ];
15818
15821
 
15819
15822
  case 1:
15820
15823
  return e.sent(), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start() : t || this.gcScheduler.stop()),
@@ -15853,7 +15856,7 @@ var ka = /** @class */ function() {
15853
15856
  /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = function(t) {
15854
15857
  return ia(e.syncEngine, t, 1 /* SharedClientState */);
15855
15858
  }, this.remoteStore.remoteSyncer.handleCredentialChange = ma.bind(null, this.syncEngine),
15856
- [ 4 /*yield*/ , xs(this.remoteStore, this.syncEngine.isPrimaryClient) ]);
15859
+ [ 4 /*yield*/ , _s(this.remoteStore, this.syncEngine.isPrimaryClient) ]);
15857
15860
 
15858
15861
  case 1:
15859
15862
  n.sent(), n.label = 2;
@@ -15889,14 +15892,14 @@ var ka = /** @class */ function() {
15889
15892
  return n(this, (function(n) {
15890
15893
  switch (n.label) {
15891
15894
  case 0:
15892
- return e = G(t), L("RemoteStore", "RemoteStore shutting down."), e.wu.add(5 /* Shutdown */),
15895
+ return e = G(t), L("RemoteStore", "RemoteStore shutting down."), e._u.add(5 /* Shutdown */),
15893
15896
  [ 4 /*yield*/ , os(e) ];
15894
15897
 
15895
15898
  case 1:
15896
- return n.sent(), e.gu.shutdown(),
15899
+ return n.sent(), e.mu.shutdown(),
15897
15900
  // Set the OnlineState to Unknown (rather than Offline) to avoid potentially
15898
15901
  // triggering spurious listener events with cached data, etc.
15899
- e.yu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
15902
+ e.gu.set("Unknown" /* Unknown */), [ 2 /*return*/ ];
15900
15903
  }
15901
15904
  }));
15902
15905
  }));
@@ -16138,7 +16141,7 @@ function Qa(t, e, n, r) {
16138
16141
  if ("string" == typeof r.mockUserToken) u = r.mockUserToken, s = C.MOCK_USER; else {
16139
16142
  // Let createMockUserToken validate first (catches common mistakes like
16140
16143
  // invalid field "uid" and missing field "sub" / "user_id".)
16141
- u = y(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
16144
+ u = m(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
16142
16145
  var a = r.mockUserToken.sub || r.mockUserToken.user_id;
16143
16146
  if (!a) throw new j(K.INVALID_ARGUMENT, "mockUserToken must contain 'sub' or 'user_id' field!");
16144
16147
  s = new C(a);
@@ -16462,7 +16465,7 @@ function tc(t, r) {
16462
16465
  return t.prototype.next = function(t) {
16463
16466
  this.observer.next && this.Rc(this.observer.next, t);
16464
16467
  }, t.prototype.error = function(t) {
16465
- this.observer.error ? this.Rc(this.observer.error, t) : M("Uncaught Error in snapshot listener:", t);
16468
+ this.observer.error ? this.Rc(this.observer.error, t) : M("Uncaught Error in snapshot listener:", t.toString());
16466
16469
  }, t.prototype.bc = function() {
16467
16470
  this.muted = !0;
16468
16471
  }, t.prototype.Rc = function(t, e) {
@@ -16486,7 +16489,7 @@ function tc(t, r) {
16486
16489
  this.buffer = new Uint8Array, this.vc = new TextDecoder("utf-8"),
16487
16490
  // Read the metadata (which is the first element).
16488
16491
  this.Vc().then((function(t) {
16489
- t && t.Ou() ? n.metadata.resolve(t.payload.metadata) : n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n " + JSON.stringify(null == t ? void 0 : t.payload)));
16492
+ t && t.Ou() ? n.metadata.resolve(t.ku.metadata) : n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n " + JSON.stringify(null == t ? void 0 : t.ku)));
16490
16493
  }), (function(t) {
16491
16494
  return n.metadata.reject(t);
16492
16495
  }));
@@ -16681,7 +16684,7 @@ function tc(t, r) {
16681
16684
  },
16682
16685
  parent: n.parent
16683
16686
  };
16684
- }(e.It, hn(r)), o = i.parent, e.So.co || delete i.parent, [ 4 /*yield*/ , e._o("RunAggregationQuery", o, i, /*expectedResponseCount=*/ 1) ];
16687
+ }(e.It, hn(r)), o = i.parent, e.connection.co || delete i.parent, [ 4 /*yield*/ , e._o("RunAggregationQuery", o, i, /*expectedResponseCount=*/ 1) ];
16685
16688
 
16686
16689
  case 1:
16687
16690
  return [ 2 /*return*/ , n.sent().filter((function(t) {
@@ -16884,14 +16887,14 @@ function tc(t, r) {
16884
16887
  }(), sc = /** @class */ function() {
16885
16888
  function t(t, e, n, r, i) {
16886
16889
  this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
16887
- this.deferred = i, this.kc = n.maxAttempts, this.No = new Zu(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
16890
+ this.deferred = i, this.kc = n.maxAttempts, this.xo = new Zu(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
16888
16891
  /** Runs the transaction and sets the result on deferred. */;
16889
16892
  }
16890
16893
  return t.prototype.run = function() {
16891
16894
  this.kc -= 1, this.Oc();
16892
16895
  }, t.prototype.Oc = function() {
16893
16896
  var t = this;
16894
- this.No.Ro((function() {
16897
+ this.xo.Ro((function() {
16895
16898
  return e(t, void 0, void 0, (function() {
16896
16899
  var t, e, r = this;
16897
16900
  return n(this, (function(n) {
@@ -16928,7 +16931,7 @@ function tc(t, r) {
16928
16931
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
16929
16932
  // non-matching document versions with ABORTED. These errors should be retried.
16930
16933
  var e = t.code;
16931
- return "aborted" === e || "failed-precondition" === e || !er(e);
16934
+ return "aborted" === e || "failed-precondition" === e || "already-exists" === e || !er(e);
16932
16935
  }
16933
16936
  return !1;
16934
16937
  }, t;
@@ -17110,9 +17113,9 @@ function lc(t, r) {
17110
17113
  // The CredentialChangeListener of the online component provider takes
17111
17114
  // precedence over the offline component provider.
17112
17115
  t.setCredentialChangeListener((function(t) {
17113
- return _s(r.remoteStore, t);
17116
+ return xs(r.remoteStore, t);
17114
17117
  })), t.setAppCheckTokenChangeListener((function(t, e) {
17115
- return _s(r.remoteStore, e);
17118
+ return xs(r.remoteStore, e);
17116
17119
  })), t.onlineComponents = r, [ 2 /*return*/ ];
17117
17120
  }
17118
17121
  }));
@@ -17235,7 +17238,7 @@ function gc(t) {
17235
17238
  }
17236
17239
  }), u = new Gs(on(n.path), o, {
17237
17240
  includeMetadataChanges: !0,
17238
- ku: !0
17241
+ Nu: !0
17239
17242
  });
17240
17243
  return Ps(t, u);
17241
17244
  }, [ 4 /*yield*/ , gc(t) ];
@@ -17272,7 +17275,7 @@ function bc(t, r, i) {
17272
17275
  }
17273
17276
  }), u = new Gs(n, o, {
17274
17277
  includeMetadataChanges: !0,
17275
- ku: !0
17278
+ Nu: !0
17276
17279
  });
17277
17280
  return Ps(t, u);
17278
17281
  }, [ 4 /*yield*/ , gc(t) ];
@@ -17309,13 +17312,13 @@ var Ic = /** @class */ function() {
17309
17312
  // List of TimerIds to fast-forward delays for.
17310
17313
  this.jc = [],
17311
17314
  // Backoff timer used to schedule retries for retryable operations
17312
- this.No = new Zu(this, "async_queue_retry" /* AsyncQueueRetry */),
17315
+ this.xo = new Zu(this, "async_queue_retry" /* AsyncQueueRetry */),
17313
17316
  // Visibility handler that triggers an immediate retry of all retryable
17314
17317
  // operations. Meant to speed up recovery when we regain file system access
17315
17318
  // after page comes into foreground.
17316
17319
  this.Wc = function() {
17317
17320
  var e = Yu();
17318
- e && L("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.No.Po();
17321
+ e && L("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.xo.Po();
17319
17322
  };
17320
17323
  var e = Yu();
17321
17324
  e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Wc);
@@ -17381,7 +17384,7 @@ var Ic = /** @class */ function() {
17381
17384
  return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Lc[0]() ];
17382
17385
 
17383
17386
  case 2:
17384
- return n.sent(), this.Lc.shift(), this.No.reset(), [ 3 /*break*/ , 4 ];
17387
+ return n.sent(), this.Lc.shift(), this.xo.reset(), [ 3 /*break*/ , 4 ];
17385
17388
 
17386
17389
  case 3:
17387
17390
  if (!Ot(t = n.sent())) throw t;
@@ -17401,7 +17404,7 @@ var Ic = /** @class */ function() {
17401
17404
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
17402
17405
  // new backoff on every call, there is only ever a single additional
17403
17406
  // operation in the queue.
17404
- this.No.Ro((function() {
17407
+ this.xo.Ro((function() {
17405
17408
  return e.Jc();
17406
17409
  })), n.label = 5;
17407
17410
 
@@ -17516,7 +17519,7 @@ var Ic = /** @class */ function() {
17516
17519
  }, t;
17517
17520
  }();
17518
17521
 
17519
- function Ec(t) {
17522
+ function Tc(t) {
17520
17523
  /**
17521
17524
  * Returns true if obj is an object and contains at least one of the specified
17522
17525
  * methods.
@@ -17531,7 +17534,7 @@ function Ec(t) {
17531
17534
  }(t);
17532
17535
  }
17533
17536
 
17534
- var Tc = /** @class */ function() {
17537
+ var Ec = /** @class */ function() {
17535
17538
  function t() {
17536
17539
  this._progressObserver = {}, this._taskCompletionResolver = new Q, this._lastProgress = {
17537
17540
  taskState: "Running",
@@ -17617,7 +17620,7 @@ var Tc = /** @class */ function() {
17617
17620
  return this._firestoreClient ||
17618
17621
  // The client must be initialized to ensure that all subsequent API
17619
17622
  // usage throws an exception.
17620
- Ac(this), this._firestoreClient.terminate();
17623
+ Nc(this), this._firestoreClient.terminate();
17621
17624
  }, n;
17622
17625
  }(ja);
17623
17626
 
@@ -17650,14 +17653,14 @@ var Tc = /** @class */ function() {
17650
17653
  * @param databaseId - The name of database.
17651
17654
  * @returns A newly initialized {@link Firestore} instance.
17652
17655
  */
17653
- function _c(t, e, n) {
17656
+ function xc(t, e, n) {
17654
17657
  n || (n = "(default)");
17655
17658
  var r = _getProvider(t, "firestore");
17656
17659
  if (r.isInitialized(n)) {
17657
17660
  var i = r.getImmediate({
17658
17661
  identifier: n
17659
17662
  }), o = r.getOptions(n);
17660
- if (m(o, e)) return i;
17663
+ if (g(o, e)) return i;
17661
17664
  throw new j(K.FAILED_PRECONDITION, "initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.");
17662
17665
  }
17663
17666
  if (void 0 !== e.cacheSizeBytes && -1 !== e.cacheSizeBytes && e.cacheSizeBytes < 1048576) throw new j(K.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
@@ -17667,12 +17670,12 @@ function _c(t, e, n) {
17667
17670
  });
17668
17671
  }
17669
17672
 
17670
- function xc(t, e) {
17673
+ function _c(t, e) {
17671
17674
  var n = "object" == typeof t ? t : s(), i = "string" == typeof t ? t : e || "(default)", o = _getProvider(n, "firestore").getImmediate({
17672
17675
  identifier: i
17673
17676
  });
17674
17677
  if (!o._initialized) {
17675
- var u = g("firestore");
17678
+ var u = w("firestore");
17676
17679
  u && Qa.apply(void 0, r([ o ], u));
17677
17680
  }
17678
17681
  return o;
@@ -17680,11 +17683,11 @@ function xc(t, e) {
17680
17683
 
17681
17684
  /**
17682
17685
  * @internal
17683
- */ function Nc(t) {
17684
- return t._firestoreClient || Ac(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
17686
+ */ function Ac(t) {
17687
+ return t._firestoreClient || Nc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
17685
17688
  }
17686
17689
 
17687
- function Ac(t) {
17690
+ function Nc(t) {
17688
17691
  var e, n = t._freezeSettings(), r = function(t, e, n, r) {
17689
17692
  return new oe(t, e, n, r.host, r.ssl, r.experimentalForceLongPolling, r.experimentalAutoDetectLongPolling, r.useFetchStreams);
17690
17693
  }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
@@ -17715,7 +17718,7 @@ function Ac(t) {
17715
17718
  * @returns A `Promise` that represents successfully enabling persistent storage.
17716
17719
  */ function Cc(t, e) {
17717
17720
  Uc(t = Ua(t, Dc));
17718
- var n = Nc(t), r = t._freezeSettings(), i = new Va;
17721
+ var n = Ac(t), r = t._freezeSettings(), i = new Va;
17719
17722
  return Oc(n, i, new Oa(i, r.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
17720
17723
  }
17721
17724
 
@@ -17742,7 +17745,7 @@ function Ac(t) {
17742
17745
  * storage.
17743
17746
  */ function kc(t) {
17744
17747
  Uc(t = Ua(t, Dc));
17745
- var e = Nc(t), n = t._freezeSettings(), r = new Va;
17748
+ var e = Ac(t), n = t._freezeSettings(), r = new Va;
17746
17749
  return Oc(e, r, new Ra(r, n.cacheSizeBytes));
17747
17750
  }
17748
17751
 
@@ -17808,7 +17811,7 @@ function Rc(t) {
17808
17811
  return n(this, (function(n) {
17809
17812
  switch (n.label) {
17810
17813
  case 0:
17811
- return At.C() ? (e = t + "main", [ 4 /*yield*/ , At.delete(e) ]) : [ 2 /*return*/ , Promise.resolve() ];
17814
+ return Nt.C() ? (e = t + "main", [ 4 /*yield*/ , Nt.delete(e) ]) : [ 2 /*return*/ , Promise.resolve() ];
17812
17815
 
17813
17816
  case 1:
17814
17817
  return n.sent(), [ 2 /*return*/ ];
@@ -17864,7 +17867,7 @@ function Vc(t) {
17864
17867
  }));
17865
17868
  }));
17866
17869
  })), i.promise;
17867
- }(Nc(t = Ua(t, Dc)));
17870
+ }(Ac(t = Ua(t, Dc)));
17868
17871
  }
17869
17872
 
17870
17873
  /**
@@ -17889,14 +17892,14 @@ function Vc(t) {
17889
17892
  case 2:
17890
17893
  return r = n.sent(), [ 2 /*return*/ , (e.setNetworkEnabled(!0), function(t) {
17891
17894
  var e = G(t);
17892
- return e.wu.delete(0 /* UserDisabled */), is(e);
17895
+ return e._u.delete(0 /* UserDisabled */), is(e);
17893
17896
  }(r)) ];
17894
17897
  }
17895
17898
  }));
17896
17899
  }));
17897
17900
  }));
17898
17901
  }
17899
- /** Disables the network connection. Pending operations will not complete. */ (Nc(t = Ua(t, Dc)));
17902
+ /** Disables the network connection. Pending operations will not complete. */ (Ac(t = Ua(t, Dc)));
17900
17903
  }
17901
17904
 
17902
17905
  /**
@@ -17927,12 +17930,12 @@ function Vc(t) {
17927
17930
  return n(this, (function(n) {
17928
17931
  switch (n.label) {
17929
17932
  case 0:
17930
- return (e = G(t)).wu.add(0 /* UserDisabled */), [ 4 /*yield*/ , os(e) ];
17933
+ return (e = G(t))._u.add(0 /* UserDisabled */), [ 4 /*yield*/ , os(e) ];
17931
17934
 
17932
17935
  case 1:
17933
17936
  return n.sent(),
17934
17937
  // Set the OnlineState to Offline so get()s return from cache, etc.
17935
- e.yu.set("Offline" /* Offline */), [ 2 /*return*/ ];
17938
+ e.gu.set("Offline" /* Offline */), [ 2 /*return*/ ];
17936
17939
  }
17937
17940
  }));
17938
17941
  }));
@@ -17946,7 +17949,7 @@ function Vc(t) {
17946
17949
  * Returns a Promise that resolves when all writes that were pending at the time
17947
17950
  * this method was called received server acknowledgement. An acknowledgement
17948
17951
  * can be either acceptance or rejection.
17949
- */ (Nc(t = Ua(t, Dc)));
17952
+ */ (Ac(t = Ua(t, Dc)));
17950
17953
  }
17951
17954
 
17952
17955
  /**
@@ -17986,7 +17989,7 @@ function Vc(t) {
17986
17989
  }
17987
17990
 
17988
17991
  function Fc(t, r) {
17989
- var i = Nc(t = Ua(t, Dc)), o = new Tc;
17992
+ var i = Ac(t = Ua(t, Dc)), o = new Ec;
17990
17993
  /**
17991
17994
  * Takes an updateFunction in which a set of reads and writes can be performed
17992
17995
  * atomically. In the updateFunction, the client can read and write values
@@ -18064,7 +18067,7 @@ function qc(t, r) {
18064
18067
  }));
18065
18068
  }));
18066
18069
  }));
18067
- }(Nc(t = Ua(t, Dc)), r).then((function(e) {
18070
+ }(Ac(t = Ua(t, Dc)), r).then((function(e) {
18068
18071
  return e ? new Wa(t, null, e.query) : null;
18069
18072
  }));
18070
18073
  }
@@ -18518,7 +18521,7 @@ var nl = /** @class */ function(e) {
18518
18521
  return null !== e && e.apply(this, arguments) || this;
18519
18522
  }
18520
18523
  return t(n, e), n.prototype._toFieldTransform = function(t) {
18521
- return new Ln(t.path, new xn);
18524
+ return new Ln(t.path, new _n);
18522
18525
  }, n.prototype.isEqual = function(t) {
18523
18526
  return t instanceof n;
18524
18527
  }, n;
@@ -18531,7 +18534,7 @@ var nl = /** @class */ function(e) {
18531
18534
  var e = el(this, t,
18532
18535
  /*array=*/ !0), n = this._a.map((function(t) {
18533
18536
  return cl(t, e);
18534
- })), r = new Nn(n);
18537
+ })), r = new An(n);
18535
18538
  return new Ln(t.path, r);
18536
18539
  }, n.prototype.isEqual = function(t) {
18537
18540
  // TODO(mrschmidt): Implement isEquals
@@ -18558,7 +18561,7 @@ var nl = /** @class */ function(e) {
18558
18561
  return (r = e.call(this, t) || this).wa = n, r;
18559
18562
  }
18560
18563
  return t(n, e), n.prototype._toFieldTransform = function(t) {
18561
- var e = new On(t.It, En(t.It, this.wa));
18564
+ var e = new On(t.It, Tn(t.It, this.wa));
18562
18565
  return new Ln(t.path, e);
18563
18566
  }, n.prototype.isEqual = function(t) {
18564
18567
  // TODO(mrschmidt): Implement isEquals
@@ -18687,7 +18690,7 @@ var nl = /** @class */ function(e) {
18687
18690
  if (null === (t = v(t))) return {
18688
18691
  nullValue: "NULL_VALUE"
18689
18692
  };
18690
- if ("number" == typeof t) return En(e.It, t);
18693
+ if ("number" == typeof t) return Tn(e.It, t);
18691
18694
  if ("boolean" == typeof t) return {
18692
18695
  booleanValue: t
18693
18696
  };
@@ -18697,7 +18700,7 @@ var nl = /** @class */ function(e) {
18697
18700
  if (t instanceof Date) {
18698
18701
  var n = ut.fromDate(t);
18699
18702
  return {
18700
- timestampValue: Ar(e.It, n)
18703
+ timestampValue: Nr(e.It, n)
18701
18704
  };
18702
18705
  }
18703
18706
  if (t instanceof ut) {
@@ -18706,7 +18709,7 @@ var nl = /** @class */ function(e) {
18706
18709
  // truncation immediately without waiting for the backend to do that.
18707
18710
  var r = new ut(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
18708
18711
  return {
18709
- timestampValue: Ar(e.It, r)
18712
+ timestampValue: Nr(e.It, r)
18710
18713
  };
18711
18714
  }
18712
18715
  if (t instanceof Qc) return {
@@ -18962,7 +18965,7 @@ function bl(t, e) {
18962
18965
  * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
18963
18966
  * can then be passed to {@link query} to create a new query instance that
18964
18967
  * also contains this `QueryConstraint`.
18965
- */ var El = function() {};
18968
+ */ var Tl = function() {};
18966
18969
 
18967
18970
  /**
18968
18971
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -18972,7 +18975,7 @@ function bl(t, e) {
18972
18975
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
18973
18976
  * @throws if any of the provided query constraints cannot be combined with the
18974
18977
  * existing or new constraints.
18975
- */ function Tl(t) {
18978
+ */ function El(t) {
18976
18979
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
18977
18980
  for (var r = 0, i = e; r < i.length; r++) {
18978
18981
  var o = i[r];
@@ -19065,7 +19068,7 @@ var Sl = /** @class */ function(e) {
19065
19068
  return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
19066
19069
  }(t._query, n));
19067
19070
  }, n;
19068
- }(El);
19071
+ }(Tl);
19069
19072
 
19070
19073
  /**
19071
19074
  * Creates a {@link QueryConstraint} that enforces that documents must contain the
@@ -19082,7 +19085,7 @@ var Sl = /** @class */ function(e) {
19082
19085
  return new Sl(i, r, n);
19083
19086
  }
19084
19087
 
19085
- var _l = /** @class */ function(e) {
19088
+ var xl = /** @class */ function(e) {
19086
19089
  function n(t, n) {
19087
19090
  var r = this;
19088
19091
  return (r = e.call(this) || this).ma = t, r.pa = n, r.type = "orderBy", r;
@@ -19106,7 +19109,7 @@ var _l = /** @class */ function(e) {
19106
19109
  return new nn(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
19107
19110
  }(t._query, e));
19108
19111
  }, n;
19109
- }(El);
19112
+ }(Tl);
19110
19113
 
19111
19114
  /**
19112
19115
  * Creates a {@link QueryConstraint} that sorts the query result by the
@@ -19116,13 +19119,13 @@ var _l = /** @class */ function(e) {
19116
19119
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
19117
19120
  * not specified, order will be ascending.
19118
19121
  * @returns The created {@link Query}.
19119
- */ function xl(t, e) {
19122
+ */ function _l(t, e) {
19120
19123
  void 0 === e && (e = "asc");
19121
19124
  var n = e, r = bl("orderBy", t);
19122
- return new _l(r, n);
19125
+ return new xl(r, n);
19123
19126
  }
19124
19127
 
19125
- var Nl = /** @class */ function(e) {
19128
+ var Al = /** @class */ function(e) {
19126
19129
  function n(t, n, r) {
19127
19130
  var i = this;
19128
19131
  return (i = e.call(this) || this).type = t, i.Ia = n, i.Ta = r, i;
@@ -19130,15 +19133,15 @@ var Nl = /** @class */ function(e) {
19130
19133
  return t(n, e), n.prototype._apply = function(t) {
19131
19134
  return new Wa(t.firestore, t.converter, fn(t._query, this.Ia, this.Ta));
19132
19135
  }, n;
19133
- }(El);
19136
+ }(Tl);
19134
19137
 
19135
19138
  /**
19136
19139
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
19137
19140
  *
19138
19141
  * @param limit - The maximum number of items to return.
19139
19142
  * @returns The created {@link Query}.
19140
- */ function Al(t) {
19141
- return Ba("limit", t), new Nl("limit", t, "F" /* First */)
19143
+ */ function Nl(t) {
19144
+ return Ba("limit", t), new Al("limit", t, "F" /* First */)
19142
19145
  /**
19143
19146
  * Creates a {@link QueryConstraint} that only returns the last matching documents.
19144
19147
  *
@@ -19151,7 +19154,7 @@ var Nl = /** @class */ function(e) {
19151
19154
  }
19152
19155
 
19153
19156
  function Cl(t) {
19154
- return Ba("limitToLast", t), new Nl("limitToLast", t, "L" /* Last */);
19157
+ return Ba("limitToLast", t), new Al("limitToLast", t, "L" /* Last */);
19155
19158
  }
19156
19159
 
19157
19160
  var kl = /** @class */ function(e) {
@@ -19165,7 +19168,7 @@ var kl = /** @class */ function(e) {
19165
19168
  return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
19166
19169
  }(t._query, e));
19167
19170
  }, n;
19168
- }(El);
19171
+ }(Tl);
19169
19172
 
19170
19173
  function Ol() {
19171
19174
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
@@ -19190,7 +19193,7 @@ var Vl = /** @class */ function(e) {
19190
19193
  return new nn(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
19191
19194
  }(t._query, e));
19192
19195
  }, n;
19193
- }(El);
19196
+ }(Tl);
19194
19197
 
19195
19198
  function Ll() {
19196
19199
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
@@ -19570,9 +19573,10 @@ var Kl = /** @class */ function(e) {
19570
19573
  if (t._snapshot.oldDocs.isEmpty()) {
19571
19574
  var n = 0;
19572
19575
  return t._snapshot.docChanges.map((function(e) {
19573
- return {
19576
+ var r = new zl(t._firestore, t._userDataWriter, e.doc.key, e.doc, new jl(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
19577
+ return e.doc, {
19574
19578
  type: "added",
19575
- doc: new zl(t._firestore, t._userDataWriter, e.doc.key, e.doc, new jl(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter),
19579
+ doc: r,
19576
19580
  oldIndex: -1,
19577
19581
  newIndex: n++
19578
19582
  };
@@ -19674,7 +19678,7 @@ var Kl = /** @class */ function(e) {
19674
19678
  */ function Xl(t) {
19675
19679
  t = Ua(t, za);
19676
19680
  var e = Ua(t.firestore, Dc);
19677
- return wc(Nc(e), t._key).then((function(n) {
19681
+ return wc(Ac(e), t._key).then((function(n) {
19678
19682
  return lh(e, t, n);
19679
19683
  }));
19680
19684
  }
@@ -19700,7 +19704,7 @@ var Zl = /** @class */ function(e) {
19700
19704
  * current document contents.
19701
19705
  */ function Jl(t) {
19702
19706
  t = Ua(t, za);
19703
- var r = Ua(t.firestore, Dc), i = Nc(r), o = new Zl(r);
19707
+ var r = Ua(t.firestore, Dc), i = Ac(r), o = new Zl(r);
19704
19708
  return function(t, r) {
19705
19709
  var i = this, o = new Q;
19706
19710
  return t.asyncQueue.enqueueAndForget((function() {
@@ -19758,7 +19762,7 @@ var Zl = /** @class */ function(e) {
19758
19762
  */ function $l(t) {
19759
19763
  t = Ua(t, za);
19760
19764
  var e = Ua(t.firestore, Dc);
19761
- return wc(Nc(e), t._key, {
19765
+ return wc(Ac(e), t._key, {
19762
19766
  source: "server"
19763
19767
  }).then((function(n) {
19764
19768
  return lh(e, t, n);
@@ -19776,7 +19780,7 @@ var Zl = /** @class */ function(e) {
19776
19780
  * @returns A `Promise` that will be resolved with the results of the query.
19777
19781
  */ function th(t) {
19778
19782
  t = Ua(t, Wa);
19779
- var e = Ua(t.firestore, Dc), n = Nc(e), r = new Zl(e);
19783
+ var e = Ua(t.firestore, Dc), n = Ac(e), r = new Zl(e);
19780
19784
  return Il(t._query), bc(n, t._query).then((function(n) {
19781
19785
  return new Wl(e, r, t, n);
19782
19786
  }))
@@ -19790,7 +19794,7 @@ var Zl = /** @class */ function(e) {
19790
19794
 
19791
19795
  function eh(t) {
19792
19796
  t = Ua(t, Wa);
19793
- var r = Ua(t.firestore, Dc), i = Nc(r), o = new Zl(r);
19797
+ var r = Ua(t.firestore, Dc), i = Ac(r), o = new Zl(r);
19794
19798
  return function(t, r) {
19795
19799
  var i = this, o = new Q;
19796
19800
  return t.asyncQueue.enqueueAndForget((function() {
@@ -19805,7 +19809,7 @@ function eh(t) {
19805
19809
  return n(this, (function(n) {
19806
19810
  switch (n.label) {
19807
19811
  case 0:
19808
- return n.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , xu(t, r,
19812
+ return n.trys.push([ 0, 2, , 3 ]), [ 4 /*yield*/ , _u(t, r,
19809
19813
  /* usePreviousResults= */ !0) ];
19810
19814
 
19811
19815
  case 1:
@@ -19841,7 +19845,7 @@ function eh(t) {
19841
19845
  * @returns A `Promise` that will be resolved with the results of the query.
19842
19846
  */ function nh(t) {
19843
19847
  t = Ua(t, Wa);
19844
- var e = Ua(t.firestore, Dc), n = Nc(e), r = new Zl(e);
19848
+ var e = Ua(t.firestore, Dc), n = Ac(e), r = new Zl(e);
19845
19849
  return bc(n, t._query, {
19846
19850
  source: "server"
19847
19851
  }).then((function(n) {
@@ -19897,11 +19901,11 @@ function sh(t) {
19897
19901
  var a = {
19898
19902
  includeMetadataChanges: !1
19899
19903
  }, c = 0;
19900
- "object" != typeof u[c] || Ec(u[c]) || (a = u[c], c++);
19904
+ "object" != typeof u[c] || Tc(u[c]) || (a = u[c], c++);
19901
19905
  var l, h, f, d = {
19902
19906
  includeMetadataChanges: a.includeMetadataChanges
19903
19907
  };
19904
- if (Ec(u[c])) {
19908
+ if (Tc(u[c])) {
19905
19909
  var p = u[c];
19906
19910
  u[c] = null === (r = p.next) || void 0 === r ? void 0 : r.bind(p), u[c + 1] = null === (i = p.error) || void 0 === i ? void 0 : i.bind(p),
19907
19911
  u[c + 2] = null === (o = p.complete) || void 0 === o ? void 0 : o.bind(p);
@@ -19955,7 +19959,7 @@ function sh(t) {
19955
19959
  }));
19956
19960
  }));
19957
19961
  };
19958
- }(Nc(h), f, d, l);
19962
+ }(Ac(h), f, d, l);
19959
19963
  }
19960
19964
 
19961
19965
  function ah(t, r) {
@@ -19968,7 +19972,7 @@ function ah(t, r) {
19968
19972
  switch (n.label) {
19969
19973
  case 0:
19970
19974
  return e = function(t, e) {
19971
- G(t).bu.add(e),
19975
+ G(t).Ru.add(e),
19972
19976
  // Immediately fire an initial event, indicating all existing listeners
19973
19977
  // are in-sync.
19974
19978
  e.next();
@@ -19987,7 +19991,7 @@ function ah(t, r) {
19987
19991
  switch (n.label) {
19988
19992
  case 0:
19989
19993
  return e = function(t, e) {
19990
- G(t).bu.delete(e);
19994
+ G(t).Ru.delete(e);
19991
19995
  }, [ 4 /*yield*/ , gc(t) ];
19992
19996
 
19993
19997
  case 1:
@@ -19997,7 +20001,7 @@ function ah(t, r) {
19997
20001
  }));
19998
20002
  }));
19999
20003
  };
20000
- }(Nc(t = Ua(t, Dc)), Ec(r) ? r : {
20004
+ }(Ac(t = Ua(t, Dc)), Tc(r) ? r : {
20001
20005
  next: r
20002
20006
  });
20003
20007
  }
@@ -20022,7 +20026,7 @@ function ah(t, r) {
20022
20026
  }));
20023
20027
  }));
20024
20028
  })), o.promise;
20025
- }(Nc(t), r);
20029
+ }(Ac(t), r);
20026
20030
  }
20027
20031
 
20028
20032
  /**
@@ -20061,7 +20065,7 @@ function ah(t, r) {
20061
20065
  * @returns `true` if the objects are "equal", as defined above, or `false`
20062
20066
  * otherwise.
20063
20067
  */ function hh(t, e) {
20064
- return $a(t.query, e.query) && m(t.data(), e.data());
20068
+ return $a(t.query, e.query) && g(t.data(), e.data());
20065
20069
  }
20066
20070
 
20067
20071
  /**
@@ -20134,7 +20138,7 @@ function ah(t, r) {
20134
20138
  }));
20135
20139
  }));
20136
20140
  })), u.promise;
20137
- }(Nc(r), t, new Zl(r));
20141
+ }(Ac(r), t, new Zl(r));
20138
20142
  }
20139
20143
 
20140
20144
  /**
@@ -20381,7 +20385,7 @@ function ah(t, r) {
20381
20385
  }));
20382
20386
  }));
20383
20387
  })), u.promise;
20384
- }(Nc(t), (function(e) {
20388
+ }(Ac(t), (function(e) {
20385
20389
  return r(new mh(t, e));
20386
20390
  }), o);
20387
20391
  }
@@ -20444,7 +20448,7 @@ function ah(t, r) {
20444
20448
  * @param elements - The elements to remove from the array.
20445
20449
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
20446
20450
  * `updateDoc()`
20447
- */ function Eh() {
20451
+ */ function Th() {
20448
20452
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
20449
20453
  // NOTE: We don't actually parse the data until it's used in set() or
20450
20454
  // update() since we'd need the Firestore instance to do this.
@@ -20469,7 +20473,7 @@ function ah(t, r) {
20469
20473
  * @param n - The value to increment by.
20470
20474
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
20471
20475
  * `updateDoc()`
20472
- */ function Th(t) {
20476
+ */ function Eh(t) {
20473
20477
  return new ol("increment", t);
20474
20478
  }
20475
20479
 
@@ -20500,7 +20504,7 @@ function ah(t, r) {
20500
20504
  * @returns A {@link WriteBatch} that can be used to atomically execute multiple
20501
20505
  * writes.
20502
20506
  */ function Sh(t) {
20503
- return Nc(t = Ua(t, Dc)), new ph(t, (function(e) {
20507
+ return Ac(t = Ua(t, Dc)), new ph(t, (function(e) {
20504
20508
  return ch(t, e);
20505
20509
  }))
20506
20510
  /**
@@ -20522,7 +20526,7 @@ function ah(t, r) {
20522
20526
  }
20523
20527
 
20524
20528
  function Dh(t, i) {
20525
- var o, u = Nc(t = Ua(t, Dc));
20529
+ var o, u = Ac(t = Ua(t, Dc));
20526
20530
  // PORTING NOTE: We don't return an error if the user has not enabled
20527
20531
  // persistence since `enableIndexeddbPersistence()` can fail on the Web.
20528
20532
  if (!(null === (o = u.offlineComponents) || void 0 === o ? void 0 : o.indexBackfillerScheduler)) return P("Cannot enable indexes when persistence is disabled"),
@@ -20537,9 +20541,9 @@ function Dh(t, i) {
20537
20541
  }
20538
20542
  }(t) : t, n = [];
20539
20543
  if (Array.isArray(e.indexes)) for (var r = 0, i = e.indexes; r < i.length; r++) {
20540
- var o = i[r], u = _h(o, "collectionGroup"), s = [];
20544
+ var o = i[r], u = xh(o, "collectionGroup"), s = [];
20541
20545
  if (Array.isArray(o.fields)) for (var a = 0, c = o.fields; a < c.length; a++) {
20542
- var l = c[a], h = vl("setIndexConfiguration", _h(l, "fieldPath"));
20546
+ var l = c[a], h = vl("setIndexConfiguration", xh(l, "fieldPath"));
20543
20547
  "CONTAINS" === l.arrayConfig ? s.push(new mt(h, 2 /* CONTAINS */)) : "ASCENDING" === l.order ? s.push(new mt(h, 0 /* ASCENDING */)) : "DESCENDING" === l.order && s.push(new mt(h, 1 /* DESCENDING */));
20544
20548
  }
20545
20549
  n.push(new dt(dt.UNKNOWN_ID, u, s, wt.empty()));
@@ -20573,7 +20577,7 @@ function Dh(t, i) {
20573
20577
  u.push(o.deleteFieldIndex(t, e));
20574
20578
  }));
20575
20579
  })).next((function() {
20576
- return xt.waitFor(u);
20580
+ return _t.waitFor(u);
20577
20581
  }));
20578
20582
  })) ];
20579
20583
  }));
@@ -20582,7 +20586,7 @@ function Dh(t, i) {
20582
20586
  }));
20583
20587
  }
20584
20588
 
20585
- function _h(t, e) {
20589
+ function xh(t, e) {
20586
20590
  if ("string" != typeof t[e]) throw new j(K.INVALID_ARGUMENT, "Missing string value for: " + e);
20587
20591
  return t[e];
20588
20592
  }
@@ -20599,9 +20603,9 @@ function _h(t, e) {
20599
20603
  return r = Object.assign({
20600
20604
  useFetchStreams: yh
20601
20605
  }, r), o._setSettings(r), o;
20602
- }), "PUBLIC").setMultipleInstances(!0)), u(A, "3.7.1", void 0),
20606
+ }), "PUBLIC").setMultipleInstances(!0)), u(N, "3.7.2-canary.457fc2eeb", void 0),
20603
20607
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
20604
- u(A, "3.7.1", "esm5");
20608
+ u(N, "3.7.2-canary.457fc2eeb", "esm5");
20605
20609
 
20606
- export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint, Tc as LoadBundleTask, Wa as Query, El as QueryConstraint, zl as QueryDocumentSnapshot, Wl as QuerySnapshot, jl as SnapshotMetadata, ut as Timestamp, mh as Transaction, ph as WriteBatch, ue as _DatabaseId, ft as _DocumentKey, tt as _EmptyAppCheckTokenProvider, W as _EmptyAuthCredentialsProvider, ht as _FieldPath, Ua as _cast, B as _debugAssert, Xt as _isBase64Available, P as _logWarn, Ma as _validateIsNotUsedTogether, uh as addDoc, hh as aggregateQuerySnapshotEqual, Eh as arrayRemove, Ih as arrayUnion, Rc as clearIndexedDbPersistence, Ya as collection, Xa as collectionGroup, Qa as connectFirestoreEmulator, oh as deleteDoc, wh as deleteField, Mc as disableNetwork, Za as doc, Kc as documentId, Cc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Lc as enableNetwork, Ml as endAt, Ll as endBefore, Nc as ensureFirestoreConfigured, ch as executeWrite, fh as getCountFromServer, Xl as getDoc, Jl as getDocFromCache, $l as getDocFromServer, th as getDocs, eh as getDocsFromCache, nh as getDocsFromServer, xc as getFirestore, Th as increment, _c as initializeFirestore, Al as limit, Cl as limitToLast, Fc as loadBundle, qc as namedQuery, sh as onSnapshot, ah as onSnapshotsInSync, xl as orderBy, Tl as query, $a as queryEqual, Ja as refEqual, gh as runTransaction, bh as serverTimestamp, rh as setDoc, Dh as setIndexConfiguration, V as setLogLevel, Yl as snapshotEqual, Rl as startAfter, Ol as startAt, Pc as terminate, ih as updateDoc, Vc as waitForPendingWrites, Dl as where, Sh as writeBatch };
20610
+ export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint, Ec as LoadBundleTask, Wa as Query, Tl as QueryConstraint, zl as QueryDocumentSnapshot, Wl as QuerySnapshot, jl as SnapshotMetadata, ut as Timestamp, mh as Transaction, ph as WriteBatch, ue as _DatabaseId, ft as _DocumentKey, tt as _EmptyAppCheckTokenProvider, W as _EmptyAuthCredentialsProvider, ht as _FieldPath, Ua as _cast, B as _debugAssert, Xt as _isBase64Available, P as _logWarn, Ma as _validateIsNotUsedTogether, uh as addDoc, hh as aggregateQuerySnapshotEqual, Th as arrayRemove, Ih as arrayUnion, Rc as clearIndexedDbPersistence, Ya as collection, Xa as collectionGroup, Qa as connectFirestoreEmulator, oh as deleteDoc, wh as deleteField, Mc as disableNetwork, Za as doc, Kc as documentId, Cc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Lc as enableNetwork, Ml as endAt, Ll as endBefore, Ac as ensureFirestoreConfigured, ch as executeWrite, fh as getCountFromServer, Xl as getDoc, Jl as getDocFromCache, $l as getDocFromServer, th as getDocs, eh as getDocsFromCache, nh as getDocsFromServer, _c as getFirestore, Eh as increment, xc as initializeFirestore, Nl as limit, Cl as limitToLast, Fc as loadBundle, qc as namedQuery, sh as onSnapshot, ah as onSnapshotsInSync, _l as orderBy, El as query, $a as queryEqual, Ja as refEqual, gh as runTransaction, bh as serverTimestamp, rh as setDoc, Dh as setIndexConfiguration, V as setLogLevel, Yl as snapshotEqual, Rl as startAfter, Ol as startAt, Pc as terminate, ih as updateDoc, Vc as waitForPendingWrites, Dl as where, Sh as writeBatch };
20607
20611
  //# sourceMappingURL=index.esm5.js.map