@firebase/firestore 3.2.1 → 3.3.0-canary.3a9435447

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/firestore/src/lite-api/reference.d.ts +4 -4
  3. package/dist/index.d.ts +4 -4
  4. package/dist/index.esm2017.js +720 -720
  5. package/dist/index.esm2017.js.map +1 -1
  6. package/dist/index.esm5.js +975 -975
  7. package/dist/index.esm5.js.map +1 -1
  8. package/dist/index.node.cjs.js +6 -6
  9. package/dist/index.node.cjs.js.map +1 -1
  10. package/dist/index.node.mjs +6 -6
  11. package/dist/index.node.mjs.map +1 -1
  12. package/dist/index.rn.js +7 -7
  13. package/dist/index.rn.js.map +1 -1
  14. package/dist/internal.d.ts +4 -4
  15. package/dist/lite/firestore/src/lite-api/reference.d.ts +4 -4
  16. package/dist/lite/index.browser.esm2017.js +1084 -1084
  17. package/dist/lite/index.browser.esm2017.js.map +1 -1
  18. package/dist/lite/index.browser.esm5.js +10 -10
  19. package/dist/lite/index.browser.esm5.js.map +1 -1
  20. package/dist/lite/index.d.ts +4 -4
  21. package/dist/lite/index.node.cjs.js +2 -2
  22. package/dist/lite/index.node.cjs.js.map +1 -1
  23. package/dist/lite/index.node.mjs +2 -2
  24. package/dist/lite/index.node.mjs.map +1 -1
  25. package/dist/lite/index.rn.esm2017.js +2 -2
  26. package/dist/lite/index.rn.esm2017.js.map +1 -1
  27. package/dist/lite/internal.d.ts +4 -4
  28. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +109 -109
  29. package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +4 -4
  30. package/dist/lite/private.d.ts +4 -4
  31. package/dist/packages/firestore/dist/index.esm2017.d.ts +102 -102
  32. package/dist/packages/firestore/src/lite-api/reference.d.ts +4 -4
  33. package/dist/private.d.ts +4 -4
  34. package/package.json +11 -9
@@ -66,7 +66,7 @@ D.MOCK_USER = new D("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let C = "9.3.0";
69
+ let C = "9.4.0-canary.3a9435447";
70
70
 
71
71
  /**
72
72
  * @license
@@ -904,11 +904,11 @@ class it {
904
904
  return e;
905
905
  }
906
906
 
907
- function ct(t, e) {
907
+ function at(t, e) {
908
908
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
909
909
  }
910
910
 
911
- function at(t) {
911
+ function ct(t) {
912
912
  for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
913
913
  return !0;
914
914
  }
@@ -1701,7 +1701,7 @@ function Ot(t) {
1701
1701
  fields: {}
1702
1702
  }
1703
1703
  };
1704
- return ct(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Bt(n))), e;
1704
+ return at(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Bt(n))), e;
1705
1705
  }
1706
1706
  if (t.arrayValue) {
1707
1707
  const e = {
@@ -1816,7 +1816,7 @@ function Ot(t) {
1816
1816
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
1817
1817
  * entries.
1818
1818
  */ applyChanges(t, e, n) {
1819
- ct(e, ((e, n) => t[e] = n));
1819
+ at(e, ((e, n) => t[e] = n));
1820
1820
  for (const e of n) delete t[e];
1821
1821
  }
1822
1822
  clone() {
@@ -1828,7 +1828,7 @@ function Ot(t) {
1828
1828
  * Returns a FieldMask built from all fields in a MapValue.
1829
1829
  */ function qt(t) {
1830
1830
  const e = [];
1831
- return ct(t.fields, ((t, n) => {
1831
+ return at(t.fields, ((t, n) => {
1832
1832
  const s = new ft([ t ]);
1833
1833
  if (Lt(n)) {
1834
1834
  const t = qt(n.mapValue).fields;
@@ -2004,7 +2004,7 @@ function Wt(t) {
2004
2004
  // TODO(b/29183165): Make this collision robust.
2005
2005
  return t.field.canonicalString() + t.dir;
2006
2006
  }(t))).join(","), At(e.limit) || (t += "|l:", t += e.limit), e.startAt && (t += "|lb:",
2007
- t += ce(e.startAt)), e.endAt && (t += "|ub:", t += ce(e.endAt)), e.A = t;
2007
+ t += ae(e.startAt)), e.endAt && (t += "|ub:", t += ae(e.endAt)), e.A = t;
2008
2008
  }
2009
2009
  return e.A;
2010
2010
  }
@@ -2019,7 +2019,7 @@ function Gt(t) {
2019
2019
  /** Filter that matches on key fields (i.e. '__name__'). */ })).join(", ")}]`),
2020
2020
  At(t.limit) || (e += ", limit: " + t.limit), t.orderBy.length > 0 && (e += `, orderBy: [${t.orderBy.map((t => function(t) {
2021
2021
  return `${t.field.canonicalString()} (${t.dir})`;
2022
- }(t))).join(", ")}]`), t.startAt && (e += ", startAt: " + ce(t.startAt)), t.endAt && (e += ", endAt: " + ce(t.endAt)),
2022
+ }(t))).join(", ")}]`), t.startAt && (e += ", startAt: " + ae(t.startAt)), t.endAt && (e += ", endAt: " + ae(t.endAt)),
2023
2023
  `Target(${e})`;
2024
2024
  }
2025
2025
 
@@ -2187,14 +2187,14 @@ function ee(t, e) {
2187
2187
  }
2188
2188
  }
2189
2189
 
2190
- function ce(t) {
2190
+ function ae(t) {
2191
2191
  // TODO(b/29183165): Make this collision robust.
2192
2192
  return `${t.before ? "b" : "a"}:${t.position.map((t => Nt(t))).join(",")}`;
2193
2193
  }
2194
2194
 
2195
2195
  /**
2196
2196
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2197
- */ class ae {
2197
+ */ class ce {
2198
2198
  constructor(t, e = "asc" /* ASCENDING */) {
2199
2199
  this.field = t, this.dir = e;
2200
2200
  }
@@ -2256,16 +2256,16 @@ function le(t, e) {
2256
2256
  * Initializes a Query with a path and optional additional query constraints.
2257
2257
  * Path must currently be empty if this is a collection group query.
2258
2258
  */
2259
- constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, c = null) {
2259
+ constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, a = null) {
2260
2260
  this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
2261
- this.limit = i, this.limitType = r, this.startAt = o, this.endAt = c, this.V = null,
2261
+ this.limit = i, this.limitType = r, this.startAt = o, this.endAt = a, this.V = null,
2262
2262
  // The corresponding `Target` of this `Query` instance.
2263
2263
  this.S = null, this.startAt, this.endAt;
2264
2264
  }
2265
2265
  }
2266
2266
 
2267
- /** Creates a new Query instance with the options provided. */ function de(t, e, n, s, i, r, o, c) {
2268
- return new fe(t, e, n, s, i, r, o, c);
2267
+ /** Creates a new Query instance with the options provided. */ function de(t, e, n, s, i, r, o, a) {
2268
+ return new fe(t, e, n, s, i, r, o, a);
2269
2269
  }
2270
2270
 
2271
2271
  /** Creates a new Query for a query that matches all documents at `path` */ function we(t) {
@@ -2319,14 +2319,14 @@ function pe(t) {
2319
2319
  // In order to implicitly add key ordering, we must also add the
2320
2320
  // inequality filter field for it to be a valid query.
2321
2321
  // Note that the default inequality field and key ordering is ascending.
2322
- t.isKeyField() || e.V.push(new ae(t)), e.V.push(new ae(ft.keyField(), "asc" /* ASCENDING */)); else {
2322
+ t.isKeyField() || e.V.push(new ce(t)), e.V.push(new ce(ft.keyField(), "asc" /* ASCENDING */)); else {
2323
2323
  let t = !1;
2324
2324
  for (const n of e.explicitOrderBy) e.V.push(n), n.field.isKeyField() && (t = !0);
2325
2325
  if (!t) {
2326
2326
  // The order of the implicit key ordering always matches the last
2327
2327
  // explicit order by
2328
2328
  const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2329
- e.V.push(new ae(ft.keyField(), t));
2329
+ e.V.push(new ce(ft.keyField(), t));
2330
2330
  }
2331
2331
  }
2332
2332
  }
@@ -2342,7 +2342,7 @@ function pe(t) {
2342
2342
  const t = [];
2343
2343
  for (const n of Te(e)) {
2344
2344
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2345
- t.push(new ae(n.field, e));
2345
+ t.push(new ce(n.field, e));
2346
2346
  }
2347
2347
  // We need to swap the cursors to match the now-flipped query ordering.
2348
2348
  const n = e.endAt ? new oe(e.endAt.position, !e.endAt.before) : null, s = e.startAt ? new oe(e.startAt.position, !e.startAt.before) : null;
@@ -2919,8 +2919,8 @@ function sn(t) {
2919
2919
  const s = new Map;
2920
2920
  B(t.length === n.length);
2921
2921
  for (let i = 0; i < n.length; i++) {
2922
- const r = t[i], o = r.transform, c = e.data.field(r.field);
2923
- s.set(r.field, ke(o, c, n[i]));
2922
+ const r = t[i], o = r.transform, a = e.data.field(r.field);
2923
+ s.set(r.field, ke(o, a, n[i]));
2924
2924
  }
2925
2925
  return s;
2926
2926
  }
@@ -2945,13 +2945,13 @@ function sn(t) {
2945
2945
  return s;
2946
2946
  }
2947
2947
 
2948
- /** A mutation that deletes the document at the given key. */ class cn extends He {
2948
+ /** A mutation that deletes the document at the given key. */ class an extends He {
2949
2949
  constructor(t, e) {
2950
2950
  super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2951
2951
  }
2952
2952
  }
2953
2953
 
2954
- class an extends He {
2954
+ class cn extends He {
2955
2955
  constructor(t, e) {
2956
2956
  super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2957
2957
  }
@@ -3933,10 +3933,10 @@ class $n {
3933
3933
  /**
3934
3934
  * Processes and adds the DocumentWatchChange to the current set of changes.
3935
3935
  */ rt(t) {
3936
- for (const e of t.k) t.$ && t.$.isFoundDocument() ? this.ot(e, t.$) : this.ct(e, t.key, t.$);
3937
- for (const e of t.removedTargetIds) this.ct(e, t.key, t.$);
3936
+ for (const e of t.k) t.$ && t.$.isFoundDocument() ? this.ot(e, t.$) : this.at(e, t.key, t.$);
3937
+ for (const e of t.removedTargetIds) this.at(e, t.key, t.$);
3938
3938
  }
3939
- /** Processes and adds the WatchTargetChange to the current set of changes. */ at(t) {
3939
+ /** Processes and adds the WatchTargetChange to the current set of changes. */ ct(t) {
3940
3940
  this.forEachTarget(t, (e => {
3941
3941
  const n = this.ut(e);
3942
3942
  switch (t.state) {
@@ -4004,7 +4004,7 @@ class $n {
4004
4004
  // until it is resolved, essentially exposing inconsistency between
4005
4005
  // queries.
4006
4006
  const n = new Pt(t.path);
4007
- this.ct(e, n, Kt.newNoDocument(n, rt.min()));
4007
+ this.at(e, n, Kt.newNoDocument(n, rt.min()));
4008
4008
  } else B(1 === n); else {
4009
4009
  this.wt(e) !== n && (
4010
4010
  // Existence filter mismatch: We reset the mapping and raise a new
@@ -4031,7 +4031,7 @@ class $n {
4031
4031
  // instead resulting in an explicit delete message and we could
4032
4032
  // remove this special logic.
4033
4033
  const e = new Pt(i.target.path);
4034
- null !== this.nt.get(e) || this.gt(s, e) || this.ct(s, e, Kt.newNoDocument(e, t));
4034
+ null !== this.nt.get(e) || this.gt(s, e) || this.at(s, e, Kt.newNoDocument(e, t));
4035
4035
  }
4036
4036
  n.K && (e.set(s, n.W()), n.G());
4037
4037
  }
@@ -4070,7 +4070,7 @@ class $n {
4070
4070
  * to update the remote document cache.
4071
4071
  */
4072
4072
  // Visible for testing.
4073
- ct(t, e, n) {
4073
+ at(t, e, n) {
4074
4074
  if (!this.ht(t)) return;
4075
4075
  const s = this.ut(t);
4076
4076
  this.gt(t, e) ? s.H(e, 1 /* Removed */) :
@@ -4125,7 +4125,7 @@ class $n {
4125
4125
  */ lt(t) {
4126
4126
  this.et.set(t, new kn);
4127
4127
  this.tt.getRemoteKeysForTarget(t).forEach((e => {
4128
- this.ct(t, e, /*updatedDocument=*/ null);
4128
+ this.at(t, e, /*updatedDocument=*/ null);
4129
4129
  }));
4130
4130
  }
4131
4131
  /**
@@ -4322,7 +4322,7 @@ function ns(t, e) {
4322
4322
  }(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
4323
4323
  return t.D ? (B(void 0 === e || "string" == typeof e), _t.fromBase64String(e || "")) : (B(void 0 === e || e instanceof Uint8Array),
4324
4324
  _t.fromUint8Array(e || new Uint8Array));
4325
- }(t, e.targetChange.resumeToken), o = e.targetChange.cause, c = o && function(t) {
4325
+ }(t, e.targetChange.resumeToken), o = e.targetChange.cause, a = o && function(t) {
4326
4326
  const e = void 0 === t.code ? K.UNKNOWN : dn(t.code);
4327
4327
  return new j(e, t.message || "");
4328
4328
  }
@@ -4334,7 +4334,7 @@ function ns(t, e) {
4334
4334
  * our generated proto interfaces say Int32Value must be. But GRPC actually
4335
4335
  * expects a { value: <number> } struct.
4336
4336
  */ (o);
4337
- n = new xn(s, i, r, c || null);
4337
+ n = new xn(s, i, r, a || null);
4338
4338
  } else if ("documentChange" in e) {
4339
4339
  e.documentChange;
4340
4340
  const s = e.documentChange;
@@ -4343,14 +4343,14 @@ function ns(t, e) {
4343
4343
  mapValue: {
4344
4344
  fields: s.document.fields
4345
4345
  }
4346
- }), c = Kt.newFoundDocument(i, r, o), a = s.targetIds || [], u = s.removedTargetIds || [];
4347
- n = new Cn(a, u, c.key, c);
4346
+ }), a = Kt.newFoundDocument(i, r, o), c = s.targetIds || [], u = s.removedTargetIds || [];
4347
+ n = new Cn(c, u, a.key, a);
4348
4348
  } else if ("documentDelete" in e) {
4349
4349
  e.documentDelete;
4350
4350
  const s = e.documentDelete;
4351
4351
  s.document;
4352
- const i = zn(t, s.document), r = s.readTime ? jn(s.readTime) : rt.min(), o = Kt.newNoDocument(i, r), c = s.removedTargetIds || [];
4353
- n = new Cn([], c, o.key, o);
4352
+ const i = zn(t, s.document), r = s.readTime ? jn(s.readTime) : rt.min(), o = Kt.newNoDocument(i, r), a = s.removedTargetIds || [];
4353
+ n = new Cn([], a, o.key, o);
4354
4354
  } else if ("documentRemove" in e) {
4355
4355
  e.documentRemove;
4356
4356
  const s = e.documentRemove;
@@ -4374,13 +4374,13 @@ function ss(t, e) {
4374
4374
  let n;
4375
4375
  if (e instanceof en) n = {
4376
4376
  update: Zn(t, e.key, e.value)
4377
- }; else if (e instanceof cn) n = {
4377
+ }; else if (e instanceof an) n = {
4378
4378
  delete: Gn(t, e.key)
4379
4379
  }; else if (e instanceof nn) n = {
4380
4380
  update: Zn(t, e.key, e.data),
4381
4381
  updateMask: ps(e.fieldMask)
4382
4382
  }; else {
4383
- if (!(e instanceof an)) return L();
4383
+ if (!(e instanceof cn)) return L();
4384
4384
  n = {
4385
4385
  verify: Gn(t, e.key)
4386
4386
  };
@@ -4450,11 +4450,11 @@ function is(t, e) {
4450
4450
  }
4451
4451
  if (e.delete) {
4452
4452
  const s = zn(t, e.delete);
4453
- return new cn(s, n);
4453
+ return new an(s, n);
4454
4454
  }
4455
4455
  if (e.verify) {
4456
4456
  const s = zn(t, e.verify);
4457
- return new an(s, n);
4457
+ return new cn(s, n);
4458
4458
  }
4459
4459
  return L();
4460
4460
  }
@@ -4479,7 +4479,7 @@ function os(t, e) {
4479
4479
  };
4480
4480
  }
4481
4481
 
4482
- function cs(t, e) {
4482
+ function as(t, e) {
4483
4483
  // Dissect the path into parent, collectionId, and optional key filter.
4484
4484
  const n = {
4485
4485
  structuredQuery: {}
@@ -4563,7 +4563,7 @@ function cs(t, e) {
4563
4563
  e.endAt && (n.structuredQuery.endAt = ls(e.endAt)), n;
4564
4564
  }
4565
4565
 
4566
- function as(t) {
4566
+ function cs(t) {
4567
4567
  let e = Jn(t.parent);
4568
4568
  const n = t.structuredQuery, s = n.from ? n.from.length : 0;
4569
4569
  let i = null;
@@ -4576,7 +4576,7 @@ function as(t) {
4576
4576
  n.where && (r = hs(n.where));
4577
4577
  let o = [];
4578
4578
  n.orderBy && (o = n.orderBy.map((t => function(t) {
4579
- return new ae(ms(t.field),
4579
+ return new ce(ms(t.field),
4580
4580
  // visible for testing
4581
4581
  function(t) {
4582
4582
  switch (t) {
@@ -4593,15 +4593,15 @@ function as(t) {
4593
4593
  // visible for testing
4594
4594
  (t.direction));
4595
4595
  }(t))));
4596
- let c = null;
4597
- n.limit && (c = function(t) {
4596
+ let a = null;
4597
+ n.limit && (a = function(t) {
4598
4598
  let e;
4599
4599
  return e = "object" == typeof t ? t.value : t, At(e) ? null : e;
4600
4600
  }(n.limit));
4601
- let a = null;
4602
- n.startAt && (a = fs(n.startAt));
4601
+ let c = null;
4602
+ n.startAt && (c = fs(n.startAt));
4603
4603
  let u = null;
4604
- return n.endAt && (u = fs(n.endAt)), de(e, i, o, r, c, "F" /* First */ , a, u);
4604
+ return n.endAt && (u = fs(n.endAt)), de(e, i, o, r, a, "F" /* First */ , c, u);
4605
4605
  }
4606
4606
 
4607
4607
  function us(t, e) {
@@ -6199,8 +6199,8 @@ function ei(t, e) {
6199
6199
  return L();
6200
6200
  }
6201
6201
 
6202
- /** Encodes a document for storage locally. */ function ci(t, e, n) {
6203
- const s = ai(n), i = e.key.path.popLast().toArray();
6202
+ /** Encodes a document for storage locally. */ function ai(t, e, n) {
6203
+ const s = ci(n), i = e.key.path.popLast().toArray();
6204
6204
  if (e.isFoundDocument()) {
6205
6205
  const n = function(t, e) {
6206
6206
  return {
@@ -6229,7 +6229,7 @@ function ei(t, e) {
6229
6229
  return L();
6230
6230
  }
6231
6231
 
6232
- function ai(t) {
6232
+ function ci(t) {
6233
6233
  const e = t.toTimestamp();
6234
6234
  return [ e.seconds, e.nanoseconds ];
6235
6235
  }
@@ -6276,14 +6276,14 @@ function fi(t, e) {
6276
6276
  var i;
6277
6277
  return void 0 !== t.query.documents ? (B(1 === (i = t.query).documents.length),
6278
6278
  s = Ee(we(Jn(i.documents[0])))) : s = function(t) {
6279
- return Ee(as(t));
6279
+ return Ee(cs(t));
6280
6280
  }(t.query), new ii(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, _t.fromBase64String(t.resumeToken));
6281
6281
  }
6282
6282
 
6283
6283
  /** Encodes TargetData into a DbTarget for storage locally. */ function wi(t, e) {
6284
6284
  const n = hi(e.snapshotVersion), s = hi(e.lastLimboFreeSnapshotVersion);
6285
6285
  let i;
6286
- i = Ht(e.target) ? os(t.Wt, e.target) : cs(t.Wt, e.target);
6286
+ i = Ht(e.target) ? os(t.Wt, e.target) : as(t.Wt, e.target);
6287
6287
  // We can't store the resumeToken as a ByteString in IndexedDb, so we
6288
6288
  // convert it to a base64 string for storage.
6289
6289
  const r = e.resumeToken.toBase64();
@@ -6301,7 +6301,7 @@ function fi(t, e) {
6301
6301
  * including features exists only in SDKs (for example: limit-to-last).
6302
6302
  */
6303
6303
  function _i(t) {
6304
- const e = as({
6304
+ const e = cs({
6305
6305
  parent: t.parent,
6306
6306
  structuredQuery: t.structuredQuery
6307
6307
  });
@@ -6567,12 +6567,12 @@ class Ri {
6567
6567
  */
6568
6568
  function bi(t, e, n) {
6569
6569
  const s = t.store(Vs.store), i = t.store(Ss.store), r = [], o = IDBKeyRange.only(n.batchId);
6570
- let c = 0;
6571
- const a = s.Kt({
6570
+ let a = 0;
6571
+ const c = s.Kt({
6572
6572
  range: o
6573
- }, ((t, e, n) => (c++, n.delete())));
6574
- r.push(a.next((() => {
6575
- B(1 === c);
6573
+ }, ((t, e, n) => (a++, n.delete())));
6574
+ r.push(c.next((() => {
6575
+ B(1 === a);
6576
6576
  })));
6577
6577
  const u = [];
6578
6578
  for (const t of n.mutations) {
@@ -6672,20 +6672,20 @@ class vi {
6672
6672
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6673
6673
  return r.add({}).next((o => {
6674
6674
  B("number" == typeof o);
6675
- const c = new ni(o, e, n, s), a = function(t, e, n) {
6675
+ const a = new ni(o, e, n, s), c = function(t, e, n) {
6676
6676
  const s = n.baseMutations.map((e => ss(t.Wt, e))), i = n.mutations.map((e => ss(t.Wt, e)));
6677
6677
  return new Vs(e, n.batchId, n.localWriteTime.toMillis(), s, i);
6678
- }(this.N, this.userId, c), u = [];
6678
+ }(this.N, this.userId, a), u = [];
6679
6679
  let h = new gn(((t, e) => et(t.canonicalString(), e.canonicalString())));
6680
6680
  for (const t of s) {
6681
6681
  const e = Ss.key(this.userId, t.key.path, o);
6682
- h = h.add(t.key.path.popLast()), u.push(r.put(a)), u.push(i.put(e, Ss.PLACEHOLDER));
6682
+ h = h.add(t.key.path.popLast()), u.push(r.put(c)), u.push(i.put(e, Ss.PLACEHOLDER));
6683
6683
  }
6684
6684
  return h.forEach((e => {
6685
6685
  u.push(this.Ht.addToCollectionParentIndex(t, e));
6686
6686
  })), t.addOnCommittedListener((() => {
6687
- this.Jt[o] = c.keys();
6688
- })), js.waitFor(u).next((() => c));
6687
+ this.Jt[o] = a.keys();
6688
+ })), js.waitFor(u).next((() => a));
6689
6689
  }));
6690
6690
  }
6691
6691
  lookupMutationBatch(t, e) {
@@ -6739,7 +6739,7 @@ class vi {
6739
6739
  return Di(t).Kt({
6740
6740
  range: s
6741
6741
  }, ((n, s, r) => {
6742
- const [o, c, a] = n, u = Rs(c);
6742
+ const [o, a, c] = n, u = Rs(a);
6743
6743
  // Only consider rows matching exactly the specific key of
6744
6744
  // interest. Note that because we order by path first, and we
6745
6745
  // order terminators before path separators, we'll encounter all
@@ -6749,7 +6749,7 @@ class vi {
6749
6749
  // can stop as soon as we hit any such row.
6750
6750
  if (o === this.userId && e.path.isEqual(u))
6751
6751
  // Look up the mutation batch in the store.
6752
- return Si(t).get(a).next((t => {
6752
+ return Si(t).get(c).next((t => {
6753
6753
  if (!t) throw L();
6754
6754
  B(t.userId === this.userId), i.push(fi(this.N, t));
6755
6755
  }));
@@ -6763,7 +6763,7 @@ class vi {
6763
6763
  const i = Ss.prefixForPath(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = Di(t).Kt({
6764
6764
  range: r
6765
6765
  }, ((t, s, i) => {
6766
- const [r, o, c] = t, a = Rs(o);
6766
+ const [r, o, a] = t, c = Rs(o);
6767
6767
  // Only consider rows matching exactly the specific key of
6768
6768
  // interest. Note that because we order by path first, and we
6769
6769
  // order terminators before path separators, we'll encounter all
@@ -6771,7 +6771,7 @@ class vi {
6771
6771
  // the rows for documentKey will occur before any rows for
6772
6772
  // documents nested in a subcollection beneath documentKey so we
6773
6773
  // can stop as soon as we hit any such row.
6774
- r === this.userId && e.path.isEqual(a) ? n = n.add(c) : i.done();
6774
+ r === this.userId && e.path.isEqual(c) ? n = n.add(a) : i.done();
6775
6775
  }));
6776
6776
  s.push(o);
6777
6777
  })), js.waitFor(s).next((() => this.Zt(t, n)));
@@ -6785,14 +6785,14 @@ class vi {
6785
6785
  return Di(t).Kt({
6786
6786
  range: r
6787
6787
  }, ((t, e, i) => {
6788
- const [r, c, a] = t, u = Rs(c);
6788
+ const [r, a, c] = t, u = Rs(a);
6789
6789
  r === this.userId && n.isPrefixOf(u) ?
6790
6790
  // Rows with document keys more than one segment longer than the
6791
6791
  // query path can't be matches. For example, a query on 'rooms'
6792
6792
  // can't match the document /rooms/abc/messages/xyx.
6793
6793
  // TODO(mcg): we'll need a different scanner when we implement
6794
6794
  // ancestor queries.
6795
- u.length === s && (o = o.add(a)) : i.done();
6795
+ u.length === s && (o = o.add(c)) : i.done();
6796
6796
  })).next((() => this.Zt(t, o)));
6797
6797
  }
6798
6798
  Zt(t, e) {
@@ -6861,8 +6861,8 @@ class vi {
6861
6861
  range: r,
6862
6862
  qt: !0
6863
6863
  }, ((t, n, s) => {
6864
- const [r, c, /*batchID*/ a] = t;
6865
- r === e && c === i && (o = !0), s.done();
6864
+ const [r, a, /*batchID*/ c] = t;
6865
+ r === e && a === i && (o = !0), s.done();
6866
6866
  })).next((() => o));
6867
6867
  }
6868
6868
 
@@ -6979,11 +6979,11 @@ class Ni {
6979
6979
  e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.oe(t, s))));
6980
6980
  }
6981
6981
  addTargetData(t, e) {
6982
- return this.ce(t, e).next((() => this.re(t).next((n => (n.targetCount += 1, this.ae(e, n),
6982
+ return this.ae(t, e).next((() => this.re(t).next((n => (n.targetCount += 1, this.ce(e, n),
6983
6983
  this.oe(t, n))))));
6984
6984
  }
6985
6985
  updateTargetData(t, e) {
6986
- return this.ce(t, e);
6986
+ return this.ae(t, e);
6987
6987
  }
6988
6988
  removeTargetData(t, e) {
6989
6989
  return this.removeMatchingKeysForTargetId(t, e.targetId).next((() => ki(t).delete(e.targetId))).next((() => this.re(t))).next((e => (B(e.targetCount > 0),
@@ -6997,8 +6997,8 @@ class Ni {
6997
6997
  let s = 0;
6998
6998
  const i = [];
6999
6999
  return ki(t).Kt(((r, o) => {
7000
- const c = di(o);
7001
- c.sequenceNumber <= e && null === n.get(c.targetId) && (s++, i.push(this.removeTargetData(t, c)));
7000
+ const a = di(o);
7001
+ a.sequenceNumber <= e && null === n.get(a.targetId) && (s++, i.push(this.removeTargetData(t, a)));
7002
7002
  })).next((() => js.waitFor(i))).next((() => s));
7003
7003
  }
7004
7004
  /**
@@ -7015,14 +7015,14 @@ class Ni {
7015
7015
  oe(t, e) {
7016
7016
  return $i(t).put(Os.key, e);
7017
7017
  }
7018
- ce(t, e) {
7018
+ ae(t, e) {
7019
7019
  return ki(t).put(wi(this.N, e));
7020
7020
  }
7021
7021
  /**
7022
7022
  * In-place updates the provided metadata to account for values in the given
7023
7023
  * TargetData. Saving is done separately. Returns true if there were any
7024
7024
  * changes to the metadata.
7025
- */ ae(t, e) {
7025
+ */ ce(t, e) {
7026
7026
  let n = !1;
7027
7027
  return t.targetId > e.highestTargetId && (e.highestTargetId = t.targetId, n = !0),
7028
7028
  t.sequenceNumber > e.highestListenSequenceNumber && (e.highestListenSequenceNumber = t.sequenceNumber,
@@ -7267,16 +7267,16 @@ class Ni {
7267
7267
  return this.me.getCacheSize(t);
7268
7268
  }
7269
7269
  pe(t, e) {
7270
- let n, s, i, r, o, a, u;
7270
+ let n, s, i, r, o, c, u;
7271
7271
  const h = Date.now();
7272
7272
  return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
7273
7273
  // Cap at the configured max
7274
7274
  e > this.params.maximumSequenceNumbersToCollect ? ($("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
7275
7275
  s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
7276
- o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, a = Date.now(),
7276
+ o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, c = Date.now(),
7277
7277
  this.removeOrphanedDocuments(t, n)))).next((t => {
7278
7278
  if (u = Date.now(), x() <= LogLevel.DEBUG) {
7279
- $("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (a - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - a) + "ms\n" + `Total Duration: ${u - h}ms`);
7279
+ $("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (c - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - c) + "ms\n" + `Total Duration: ${u - h}ms`);
7280
7280
  }
7281
7281
  return js.resolve({
7282
7282
  didRun: !0,
@@ -7474,12 +7474,12 @@ function Ki(t, e) {
7474
7474
  return !1;
7475
7475
  }
7476
7476
  forEach(t) {
7477
- ct(this.inner, ((e, n) => {
7477
+ at(this.inner, ((e, n) => {
7478
7478
  for (const [e, s] of n) t(e, s);
7479
7479
  }));
7480
7480
  }
7481
7481
  isEmpty() {
7482
- return at(this.inner);
7482
+ return ct(this.inner);
7483
7483
  }
7484
7484
  }
7485
7485
 
@@ -7702,7 +7702,7 @@ function Ki(t, e) {
7702
7702
  // Execute an index-free query and filter by read time. This is safe
7703
7703
  // since all document changes to queries that have a
7704
7704
  // lastLimboFreeSnapshotVersion (`sinceReadTime`) have a read time set.
7705
- const t = e.path.toArray(), s = ai(n);
7705
+ const t = e.path.toArray(), s = ci(n);
7706
7706
  r.range = IDBKeyRange.lowerBound([ t, s ],
7707
7707
  /* open= */ !0), r.index = Ns.collectionReadTimeIndex;
7708
7708
  }
@@ -7773,16 +7773,16 @@ class Gi extends Qi {
7773
7773
  return this.changes.forEach(((i, r) => {
7774
7774
  const o = this.De.get(i);
7775
7775
  if (r.document.isValidDocument()) {
7776
- const c = ci(this.Se.N, r.document, this.getReadTime(i));
7776
+ const a = ai(this.Se.N, r.document, this.getReadTime(i));
7777
7777
  s = s.add(i.path.popLast());
7778
- const a = Pi(c);
7779
- n += a - o, e.push(this.Se.addEntry(t, i, c));
7778
+ const c = Pi(a);
7779
+ n += c - o, e.push(this.Se.addEntry(t, i, a));
7780
7780
  } else if (n -= o, this.trackRemovals) {
7781
7781
  // In order to track removals, we store a "sentinel delete" in the
7782
7782
  // RemoteDocumentCache. This entry is represented by a NoDocument
7783
7783
  // with a version of 0 and ignored by `maybeDecodeDocument()` but
7784
7784
  // preserved in `getNewDocumentChanges()`.
7785
- const n = ci(this.Se.N, Kt.newNoDocument(i, rt.min()), this.getReadTime(i));
7785
+ const n = ai(this.Se.N, Kt.newNoDocument(i, rt.min()), this.getReadTime(i));
7786
7786
  e.push(this.Se.addEntry(t, i, n));
7787
7787
  } else e.push(this.Se.removeEntry(t, i));
7788
7788
  })), s.forEach((n => {
@@ -8106,14 +8106,14 @@ class tr {
8106
8106
  * Whether to synchronize the in-memory state of multiple tabs and share
8107
8107
  * access to local persistence.
8108
8108
  */
8109
- t, e, n, s, i, r, o, c, a,
8109
+ t, e, n, s, i, r, o, a, c,
8110
8110
  /**
8111
8111
  * If set to true, forcefully obtains database access. Existing tabs will
8112
8112
  * no longer be able to access IndexedDB.
8113
8113
  */
8114
8114
  u) {
8115
8115
  if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
8116
- this.Oe = i, this.window = r, this.document = o, this.Fe = a, this.Me = u, this.Le = null,
8116
+ this.Oe = i, this.window = r, this.document = o, this.Fe = c, this.Me = u, this.Le = null,
8117
8117
  this.Be = !1, this.isPrimary = !1, this.networkEnabled = !0,
8118
8118
  /** Our window.unload handler, if registered. */
8119
8119
  this.Ue = null, this.inForeground = !1,
@@ -8125,7 +8125,7 @@ class tr {
8125
8125
  this.je = Number.NEGATIVE_INFINITY,
8126
8126
  /** A listener to notify on primary state changes. */
8127
8127
  this.Qe = t => Promise.resolve(), !tr.bt()) throw new j(K.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
8128
- this.referenceDelegate = new qi(this, s), this.We = e + "main", this.N = new ri(c),
8128
+ this.referenceDelegate = new qi(this, s), this.We = e + "main", this.N = new ri(a),
8129
8129
  this.Ge = new Ws(this.We, 11, new Yi(this.N)), this.ze = new xi(this.referenceDelegate, this.N),
8130
8130
  this.Ht = new Ei, this.He = function(t, e) {
8131
8131
  return new Wi(t, e);
@@ -8203,7 +8203,7 @@ class tr {
8203
8203
  if (this.isPrimary) return this.sn(t).next((t => {
8204
8204
  t || (this.isPrimary = !1, this.Oe.enqueueRetryable((() => this.Qe(!1))));
8205
8205
  }));
8206
- })).next((() => this.rn(t))).next((e => this.isPrimary && !e ? this.on(t).next((() => !1)) : !!e && this.cn(t).next((() => !0)))))).catch((t => {
8206
+ })).next((() => this.rn(t))).next((e => this.isPrimary && !e ? this.on(t).next((() => !1)) : !!e && this.an(t).next((() => !0)))))).catch((t => {
8207
8207
  if (Hs(t))
8208
8208
  // Proceed with the existing state. Any subsequent access to
8209
8209
  // IndexedDB will verify the lease.
@@ -8216,7 +8216,7 @@ class tr {
8216
8216
  }));
8217
8217
  }
8218
8218
  sn(t) {
8219
- return er(t).get(Ps.key).next((t => js.resolve(this.an(t))));
8219
+ return er(t).get(Ps.key).next((t => js.resolve(this.cn(t))));
8220
8220
  }
8221
8221
  un(t) {
8222
8222
  return nr(t).delete(this.clientId);
@@ -8250,7 +8250,7 @@ class tr {
8250
8250
  */ en() {
8251
8251
  this.Ke = this.Oe.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.Xe().then((() => this.hn())).then((() => this.en()))));
8252
8252
  }
8253
- /** Checks whether `client` is the local client. */ an(t) {
8253
+ /** Checks whether `client` is the local client. */ cn(t) {
8254
8254
  return !!t && t.ownerId === this.clientId;
8255
8255
  }
8256
8256
  /**
@@ -8272,8 +8272,8 @@ class tr {
8272
8272
  // the foreground.
8273
8273
  // - the `forceOwningTab` setting was passed in.
8274
8274
  if (null !== e && this.ln(e.leaseTimestampMs, 5e3) && !this.wn(e.ownerId)) {
8275
- if (this.an(e) && this.networkEnabled) return !0;
8276
- if (!this.an(e)) {
8275
+ if (this.cn(e) && this.networkEnabled) return !0;
8276
+ if (!this.cn(e)) {
8277
8277
  if (!e.allowTabSynchronization)
8278
8278
  // Fail the `canActAsPrimary` check if the current leaseholder has
8279
8279
  // not opted into multi-tab synchronization. If this happens at
@@ -8359,7 +8359,7 @@ class tr {
8359
8359
  if (!e) throw O(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
8360
8360
  this.Oe.enqueueRetryable((() => this.Qe(!1))), new j(K.FAILED_PRECONDITION, qs);
8361
8361
  return n(i);
8362
- })).next((t => this.cn(i).next((() => t)))) : this.Tn(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
8362
+ })).next((t => this.an(i).next((() => t)))) : this.Tn(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
8363
8363
  t)));
8364
8364
  }
8365
8365
  /**
@@ -8370,13 +8370,13 @@ class tr {
8370
8370
  // be turned off.
8371
8371
  Tn(t) {
8372
8372
  return er(t).get(Ps.key).next((t => {
8373
- if (null !== t && this.ln(t.leaseTimestampMs, 5e3) && !this.wn(t.ownerId) && !this.an(t) && !(this.Me || this.allowTabSynchronization && t.allowTabSynchronization)) throw new j(K.FAILED_PRECONDITION, Zi);
8373
+ if (null !== t && this.ln(t.leaseTimestampMs, 5e3) && !this.wn(t.ownerId) && !this.cn(t) && !(this.Me || this.allowTabSynchronization && t.allowTabSynchronization)) throw new j(K.FAILED_PRECONDITION, Zi);
8374
8374
  }));
8375
8375
  }
8376
8376
  /**
8377
8377
  * Obtains or extends the new primary lease for the local client. This
8378
8378
  * method does not verify that the client is eligible for this lease.
8379
- */ cn(t) {
8379
+ */ an(t) {
8380
8380
  const e = new Ps(this.clientId, this.allowTabSynchronization, Date.now());
8381
8381
  return er(t).put(Ps.key, e);
8382
8382
  }
@@ -8385,7 +8385,7 @@ class tr {
8385
8385
  }
8386
8386
  /** Checks the primary lease and removes it if we are the current primary. */ on(t) {
8387
8387
  const e = er(t);
8388
- return e.get(Ps.key).next((t => this.an(t) ? ($("IndexedDbPersistence", "Releasing primary lease."),
8388
+ return e.get(Ps.key).next((t => this.cn(t) ? ($("IndexedDbPersistence", "Releasing primary lease."),
8389
8389
  e.delete(Ps.key)) : js.resolve()));
8390
8390
  }
8391
8391
  /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ ln(t, e) {
@@ -8417,10 +8417,10 @@ class tr {
8417
8417
  // Note: In theory, this should be scheduled on the AsyncQueue since it
8418
8418
  // accesses internal state. We execute this code directly during shutdown
8419
8419
  // to make sure it gets a chance to run.
8420
- this._n(), isSafari() && navigator.appVersion.match("Version/14") &&
8421
- // On Safari 14, we do not run any cleanup actions as it might trigger
8422
- // a bug that prevents Safari from re-opening IndexedDB during the
8423
- // next page load.
8420
+ this._n(), isSafari() && navigator.appVersion.match(/Version\/1[45]/) &&
8421
+ // On Safari 14 and 15, we do not run any cleanup actions as it might
8422
+ // trigger a bug that prevents Safari from re-opening IndexedDB during
8423
+ // the next page load.
8424
8424
  // See https://bugs.webkit.org/show_bug.cgi?id=226547
8425
8425
  this.Oe.enterRestrictedMode(/* purgeExistingTasks= */ !0), this.Oe.enqueueAndForget((() => this.shutdown()));
8426
8426
  }, this.window.addEventListener("pagehide", this.Ue));
@@ -8717,7 +8717,7 @@ class ir {
8717
8717
  * another document that is in the local cache.
8718
8718
  *
8719
8719
  * - Queries that have never been CURRENT or free of limbo documents.
8720
- */ class cr {
8720
+ */ class ar {
8721
8721
  /** Sets the document view to query against. */
8722
8722
  $n(t) {
8723
8723
  this.On = t;
@@ -8805,7 +8805,7 @@ class ir {
8805
8805
  * This is useful to implement optional features (like bundles) in free
8806
8806
  * functions, such that they are tree-shakeable.
8807
8807
  */
8808
- class ar {
8808
+ class cr {
8809
8809
  constructor(
8810
8810
  /** Manages our in-memory or durable persistence. */
8811
8811
  t, e, n, s) {
@@ -8837,7 +8837,7 @@ class ar {
8837
8837
  function ur(
8838
8838
  /** Manages our in-memory or durable persistence. */
8839
8839
  t, e, n, s) {
8840
- return new ar(t, e, n, s);
8840
+ return new cr(t, e, n, s);
8841
8841
  }
8842
8842
 
8843
8843
  /**
@@ -8956,16 +8956,16 @@ function fr(t) {
8956
8956
  i = n.Un;
8957
8957
  const o = [];
8958
8958
  e.targetChanges.forEach(((e, r) => {
8959
- const c = i.get(r);
8960
- if (!c) return;
8959
+ const a = i.get(r);
8960
+ if (!a) return;
8961
8961
  // Only update the remote keys if the target is still active. This
8962
8962
  // ensures that we can persist the updated target data along with
8963
8963
  // the updated assignment.
8964
8964
  o.push(n.ze.removeMatchingKeys(t, e.removedDocuments, r).next((() => n.ze.addMatchingKeys(t, e.addedDocuments, r))));
8965
- const a = e.resumeToken;
8965
+ const c = e.resumeToken;
8966
8966
  // Update the resume token if the change includes one.
8967
- if (a.approximateByteSize() > 0) {
8968
- const u = c.withResumeToken(a, s).withSequenceNumber(t.currentSequenceNumber);
8967
+ if (c.approximateByteSize() > 0) {
8968
+ const u = a.withResumeToken(c, s).withSequenceNumber(t.currentSequenceNumber);
8969
8969
  i = i.insert(r, u),
8970
8970
  // Update the target data if there are target changes (or if
8971
8971
  // sufficient time has passed since the last update).
@@ -8998,10 +8998,10 @@ function fr(t) {
8998
8998
  }
8999
8999
  /**
9000
9000
  * Notifies local store of the changed views to locally pin documents.
9001
- */ (c, u, e) && o.push(n.ze.updateTargetData(t, u));
9001
+ */ (a, u, e) && o.push(n.ze.updateTargetData(t, u));
9002
9002
  }
9003
9003
  }));
9004
- let c = Tn();
9004
+ let a = Tn();
9005
9005
  // HACK: The only reason we allow a null snapshot version is so that we
9006
9006
  // can synthesize remote events when we get permission denied errors while
9007
9007
  // trying to resolve the state of a locally cached document that is in
@@ -9012,12 +9012,12 @@ function fr(t) {
9012
9012
  // Each loop iteration only affects its "own" doc, so it's safe to get all the remote
9013
9013
  // documents in advance in a single call.
9014
9014
  o.push(wr(t, r, e.documentUpdates, s, void 0).next((t => {
9015
- c = t;
9015
+ a = t;
9016
9016
  }))), !s.isEqual(rt.min())) {
9017
9017
  const e = n.ze.getLastRemoteSnapshotVersion(t).next((e => n.ze.setTargetsMetadata(t, t.currentSequenceNumber, s)));
9018
9018
  o.push(e);
9019
9019
  }
9020
- return js.waitFor(o).next((() => r.apply(t))).next((() => n.Qn.vn(t, c))).next((() => c));
9020
+ return js.waitFor(o).next((() => r.apply(t))).next((() => n.Qn.vn(t, a))).next((() => a));
9021
9021
  })).then((t => (n.Un = i, t)));
9022
9022
  }
9023
9023
 
@@ -9044,7 +9044,7 @@ i) {
9044
9044
  return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
9045
9045
  let r = Tn();
9046
9046
  return n.forEach(((n, o) => {
9047
- const c = t.get(n), a = (null == i ? void 0 : i.get(n)) || s;
9047
+ const a = t.get(n), c = (null == i ? void 0 : i.get(n)) || s;
9048
9048
  // Note: The order of the steps below is important, since we want
9049
9049
  // to ensure that rejected limbo resolutions (which fabricate
9050
9050
  // NoDocuments with SnapshotVersion.min()) never add documents to
@@ -9053,8 +9053,8 @@ i) {
9053
9053
  // NoDocuments with SnapshotVersion.min() are used in manufactured
9054
9054
  // events. We remove these documents from cache since we lost
9055
9055
  // access.
9056
- e.removeEntry(n, a), r = r.insert(n, o)) : !c.isValidDocument() || o.version.compareTo(c.version) > 0 || 0 === o.version.compareTo(c.version) && c.hasPendingWrites ? (e.addEntry(o, a),
9057
- r = r.insert(n, o)) : $("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", c.version, " Watch version:", o.version);
9056
+ e.removeEntry(n, c), r = r.insert(n, o)) : !a.isValidDocument() || o.version.compareTo(a.version) > 0 || 0 === o.version.compareTo(a.version) && a.hasPendingWrites ? (e.addEntry(o, c),
9057
+ r = r.insert(n, o)) : $("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", a.version, " Watch version:", o.version);
9058
9058
  })), r;
9059
9059
  }));
9060
9060
  }
@@ -9171,11 +9171,11 @@ function Tr(t) {
9171
9171
  const e = q(t);
9172
9172
  return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
9173
9173
  const s = q(t);
9174
- let i = Tn(), r = ai(n);
9175
- const o = Hi(e), c = IDBKeyRange.lowerBound(r, !0);
9174
+ let i = Tn(), r = ci(n);
9175
+ const o = Hi(e), a = IDBKeyRange.lowerBound(r, !0);
9176
9176
  return o.Kt({
9177
9177
  index: Ns.readTimeIndex,
9178
- range: c
9178
+ range: a
9179
9179
  }, ((t, e) => {
9180
9180
  // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
9181
9181
  // the documents directly since we want to keep sentinel deletes.
@@ -9232,12 +9232,12 @@ async function Er(t) {
9232
9232
  */
9233
9233
  async function Ir(t, e, n, s) {
9234
9234
  const i = q(t);
9235
- let r = Pn(), o = Tn(), c = Rn();
9235
+ let r = Pn(), o = Tn(), a = Rn();
9236
9236
  for (const t of n) {
9237
9237
  const n = e.zn(t.metadata.name);
9238
- t.document && (r = r.add(n)), o = o.insert(n, e.Hn(t)), c = c.insert(n, e.Jn(t.metadata.readTime));
9238
+ t.document && (r = r.add(n)), o = o.insert(n, e.Hn(t)), a = a.insert(n, e.Jn(t.metadata.readTime));
9239
9239
  }
9240
- const a = i.jn.newChangeBuffer({
9240
+ const c = i.jn.newChangeBuffer({
9241
9241
  trackRemovals: !0
9242
9242
  }), u = await mr(i, function(t) {
9243
9243
  // It is OK that the path used for the query is not valid, because this will
@@ -9246,7 +9246,7 @@ async function Ir(t, e, n, s) {
9246
9246
  }(s));
9247
9247
  // Allocates a target to hold all document keys from the bundle, such that
9248
9248
  // they will not get garbage collected right away.
9249
- return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => wr(t, a, o, rt.min(), c).next((e => (a.apply(t),
9249
+ return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => wr(t, c, o, rt.min(), a).next((e => (c.apply(t),
9250
9250
  e))).next((e => i.ze.removeMatchingKeysForTargetId(t, u.targetId).next((() => i.ze.addMatchingKeys(t, r, u.targetId))).next((() => i.Qn.vn(t, e))).next((() => e))))));
9251
9251
  }
9252
9252
 
@@ -9749,16 +9749,16 @@ class Sr extends Qi {
9749
9749
  return n && (this.lastRemoteSnapshotVersion = n), e > this.Is && (this.Is = e),
9750
9750
  js.resolve();
9751
9751
  }
9752
- ce(t) {
9752
+ ae(t) {
9753
9753
  this.Es.set(t.target, t);
9754
9754
  const e = t.targetId;
9755
9755
  e > this.highestTargetId && (this.Rs = new Ni(e), this.highestTargetId = e), t.sequenceNumber > this.Is && (this.Is = t.sequenceNumber);
9756
9756
  }
9757
9757
  addTargetData(t, e) {
9758
- return this.ce(e), this.targetCount += 1, js.resolve();
9758
+ return this.ae(e), this.targetCount += 1, js.resolve();
9759
9759
  }
9760
9760
  updateTargetData(t, e) {
9761
- return this.ce(e), js.resolve();
9761
+ return this.ae(e), js.resolve();
9762
9762
  }
9763
9763
  removeTargetData(t, e) {
9764
9764
  return this.Es.delete(e.target), this.As.cs(e.targetId), this.targetCount -= 1,
@@ -10301,12 +10301,12 @@ class Ur {
10301
10301
  if (this.started) {
10302
10302
  if (null !== e.key) if (this.Ws.test(e.key)) {
10303
10303
  if (null == e.newValue) {
10304
- const t = this.ci(e.key);
10305
- return this.ai(t, null);
10304
+ const t = this.ai(e.key);
10305
+ return this.ci(t, null);
10306
10306
  }
10307
10307
  {
10308
10308
  const t = this.ui(e.key, e.newValue);
10309
- if (t) return this.ai(t.clientId, t);
10309
+ if (t) return this.ci(t.clientId, t);
10310
10310
  }
10311
10311
  } else if (this.Gs.test(e.key)) {
10312
10312
  if (null !== e.newValue) {
@@ -10376,7 +10376,7 @@ class Ur {
10376
10376
  /**
10377
10377
  * Parses a client state key in WebStorage. Returns null if the key does not
10378
10378
  * match the expected key format.
10379
- */ ci(t) {
10379
+ */ ai(t) {
10380
10380
  const e = this.Ws.exec(t);
10381
10381
  return e ? e[1] : null;
10382
10382
  }
@@ -10384,7 +10384,7 @@ class Ur {
10384
10384
  * Parses a client state in WebStorage. Returns 'null' if the value could not
10385
10385
  * be parsed.
10386
10386
  */ ui(t, e) {
10387
- const n = this.ci(t);
10387
+ const n = this.ai(t);
10388
10388
  return Lr.$s(n, e);
10389
10389
  }
10390
10390
  /**
@@ -10414,7 +10414,7 @@ class Ur {
10414
10414
  di(t) {
10415
10415
  return this.syncEngine.mi(t.targetId, t.state, t.error);
10416
10416
  }
10417
- ai(t, e) {
10417
+ ci(t, e) {
10418
10418
  const n = e ? this.qs.insert(t, e) : this.qs.remove(t), s = this.ti(this.qs), i = this.ti(n), r = [], o = [];
10419
10419
  return i.forEach((t => {
10420
10420
  s.has(t) || r.push(t);
@@ -10740,8 +10740,8 @@ class {
10740
10740
  $("Connection", 'RPC "' + t + '" completed.');
10741
10741
  }
10742
10742
  }));
10743
- const c = JSON.stringify(s);
10744
- o.send(e, "POST", c, n, 15);
10743
+ const a = JSON.stringify(s);
10744
+ o.send(e, "POST", a, n, 15);
10745
10745
  }));
10746
10746
  }
10747
10747
  ji(t, e) {
@@ -10788,22 +10788,22 @@ class {
10788
10788
  isMobileCordova() || isReactNative() || isElectron() || isIE() || isUWP() || isBrowserExtension() || (r.httpHeadersOverwriteParam = "$httpHeaders");
10789
10789
  const o = n.join("");
10790
10790
  $("Connection", "Creating WebChannel: " + o, r);
10791
- const c = s.createWebChannel(o, r);
10791
+ const a = s.createWebChannel(o, r);
10792
10792
  // WebChannel supports sending the first message with the handshake - saving
10793
10793
  // a network round trip. However, it will have to call send in the same
10794
10794
  // JS event loop as open. In order to enforce this, we delay actually
10795
10795
  // opening the WebChannel until send is called. Whether we have called
10796
10796
  // open is tracked with this variable.
10797
- let a = !1, u = !1;
10797
+ let c = !1, u = !1;
10798
10798
  // A flag to determine whether the stream was closed (by us or through an
10799
10799
  // error/close event) to avoid delivering multiple close events or sending
10800
10800
  // on a closed stream
10801
10801
  const h = new Gr({
10802
10802
  vi: t => {
10803
- u ? $("Connection", "Not sending because WebChannel is closed:", t) : (a || ($("Connection", "Opening WebChannel transport."),
10804
- c.open(), a = !0), $("Connection", "WebChannel sending:", t), c.send(t));
10803
+ u ? $("Connection", "Not sending because WebChannel is closed:", t) : (c || ($("Connection", "Opening WebChannel transport."),
10804
+ a.open(), c = !0), $("Connection", "WebChannel sending:", t), a.send(t));
10805
10805
  },
10806
- Vi: () => c.close()
10806
+ Vi: () => a.close()
10807
10807
  }), g = (t, e, n) => {
10808
10808
  // TODO(dimond): closure typing seems broken because WebChannel does
10809
10809
  // not implement goog.events.Listenable
@@ -10821,13 +10821,13 @@ class {
10821
10821
  // exception and rethrow using a setTimeout so they become visible again.
10822
10822
  // Note that eventually this function could go away if we are confident
10823
10823
  // enough the code is exception free.
10824
- return g(c, WebChannel.EventType.OPEN, (() => {
10824
+ return g(a, WebChannel.EventType.OPEN, (() => {
10825
10825
  u || $("Connection", "WebChannel transport opened.");
10826
- })), g(c, WebChannel.EventType.CLOSE, (() => {
10826
+ })), g(a, WebChannel.EventType.CLOSE, (() => {
10827
10827
  u || (u = !0, $("Connection", "WebChannel transport closed"), h.$i());
10828
- })), g(c, WebChannel.EventType.ERROR, (t => {
10828
+ })), g(a, WebChannel.EventType.ERROR, (t => {
10829
10829
  u || (u = !0, F("Connection", "WebChannel transport errored:", t), h.$i(new j(K.UNAVAILABLE, "The operation could not be completed")));
10830
- })), g(c, WebChannel.EventType.MESSAGE, (t => {
10830
+ })), g(a, WebChannel.EventType.MESSAGE, (t => {
10831
10831
  var e;
10832
10832
  if (!u) {
10833
10833
  const n = t.data[0];
@@ -10857,7 +10857,7 @@ class {
10857
10857
  }(t), n = i.message;
10858
10858
  void 0 === e && (e = K.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
10859
10859
  // Mark closed so no further events are propagated
10860
- u = !0, h.$i(new j(e, n)), c.close();
10860
+ u = !0, h.$i(new j(e, n)), a.close();
10861
10861
  } else $("Connection", "WebChannel received:", n), h.Oi(n);
10862
10862
  }
10863
10863
  })), g(i, Event.STAT_EVENT, (t => {
@@ -11080,7 +11080,7 @@ class Zr {
11080
11080
  * getCloseGuardedDispatcher() to invalidate callbacks that happen after
11081
11081
  * close.
11082
11082
  */
11083
- this.ir = 0, this.rr = null, this.cr = null, this.stream = null, this.ar = new Xr(t, e);
11083
+ this.ir = 0, this.rr = null, this.ar = null, this.stream = null, this.cr = new Xr(t, e);
11084
11084
  }
11085
11085
  /**
11086
11086
  * Returns true if start() has been called and no error has occurred. True
@@ -11122,7 +11122,7 @@ class Zr {
11122
11122
  * Each error will call the onClose() listener. That function can decide to
11123
11123
  * inhibit backoff if required.
11124
11124
  */ dr() {
11125
- this.state = 0 /* Initial */ , this.ar.reset();
11125
+ this.state = 0 /* Initial */ , this.cr.reset();
11126
11126
  }
11127
11127
  /**
11128
11128
  * Marks this stream as idle. If no further actions are performed on the
@@ -11151,7 +11151,7 @@ class Zr {
11151
11151
  this.rr && (this.rr.cancel(), this.rr = null);
11152
11152
  }
11153
11153
  /** Cancels the health check delayed operation. */ yr() {
11154
- this.cr && (this.cr.cancel(), this.cr = null);
11154
+ this.ar && (this.ar.cancel(), this.ar = null);
11155
11155
  }
11156
11156
  /**
11157
11157
  * Closes the stream and cleans up as necessary:
@@ -11167,15 +11167,15 @@ class Zr {
11167
11167
  * @param error - the error the connection was closed with.
11168
11168
  */ async close(t, e) {
11169
11169
  // Cancel any outstanding timers (they're guaranteed not to execute).
11170
- this.gr(), this.yr(), this.ar.cancel(),
11170
+ this.gr(), this.yr(), this.cr.cancel(),
11171
11171
  // Invalidates any stream-related callbacks (e.g. from auth or the
11172
11172
  // underlying stream), guaranteeing they won't execute.
11173
11173
  this.ir++, 4 /* Error */ !== t ?
11174
11174
  // If this is an intentional close ensure we don't delay our next connection attempt.
11175
- this.ar.reset() : e && e.code === K.RESOURCE_EXHAUSTED ? (
11175
+ this.cr.reset() : e && e.code === K.RESOURCE_EXHAUSTED ? (
11176
11176
  // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
11177
11177
  O(e.toString()), O("Using maximum backoff delay to prevent overloading the backend."),
11178
- this.ar.Yi()) : e && e.code === K.UNAUTHENTICATED && 3 /* Healthy */ !== this.state &&
11178
+ this.cr.Yi()) : e && e.code === K.UNAUTHENTICATED && 3 /* Healthy */ !== this.state &&
11179
11179
  // "unauthenticated" error means the token was rejected. This should rarely
11180
11180
  // happen since both Auth and AppCheck ensure a sufficient TTL when we
11181
11181
  // request a token. If a user manually resets their system clock this can
@@ -11219,7 +11219,7 @@ class Zr {
11219
11219
  Er(t) {
11220
11220
  const e = this.Tr(this.ir);
11221
11221
  this.stream = this.Ar(t), this.stream.Si((() => {
11222
- e((() => (this.state = 2 /* Open */ , this.cr = this.Oe.enqueueAfterDelay(this.nr, 1e4, (() => (this.hr() && (this.state = 3 /* Healthy */),
11222
+ e((() => (this.state = 2 /* Open */ , this.ar = this.Oe.enqueueAfterDelay(this.nr, 1e4, (() => (this.hr() && (this.state = 3 /* Healthy */),
11223
11223
  Promise.resolve()))), this.listener.Si())));
11224
11224
  })), this.stream.Ci((t => {
11225
11225
  e((() => this.Ir(t)));
@@ -11228,7 +11228,7 @@ class Zr {
11228
11228
  }));
11229
11229
  }
11230
11230
  lr() {
11231
- this.state = 5 /* Backoff */ , this.ar.Xi((async () => {
11231
+ this.state = 5 /* Backoff */ , this.cr.Xi((async () => {
11232
11232
  this.state = 0 /* Initial */ , this.start();
11233
11233
  }));
11234
11234
  }
@@ -11269,7 +11269,7 @@ class Zr {
11269
11269
  }
11270
11270
  onMessage(t) {
11271
11271
  // A successful response means the stream is healthy
11272
- this.ar.reset();
11272
+ this.cr.reset();
11273
11273
  const e = ns(this.N, t), n = function(t) {
11274
11274
  // We have only reached a consistent snapshot for the entire stream if there
11275
11275
  // is a read_time set and it applies to all targets (i.e. the list of
@@ -11293,7 +11293,7 @@ class Zr {
11293
11293
  return n = Ht(s) ? {
11294
11294
  documents: os(t, s)
11295
11295
  } : {
11296
- query: cs(t, s)
11296
+ query: as(t, s)
11297
11297
  }, n.targetId = e.targetId, e.resumeToken.approximateByteSize() > 0 ? n.resumeToken = qn(t, e.resumeToken) : e.snapshotVersion.compareTo(rt.min()) > 0 && (
11298
11298
  // TODO(wuandy): Consider removing above check because it is most likely true.
11299
11299
  // Right now, many tests depend on this behaviour though (leaving min() out
@@ -11356,7 +11356,7 @@ class Zr {
11356
11356
  // A successful first write response means the stream is healthy,
11357
11357
  // Note, that we could consider a successful handshake healthy, however,
11358
11358
  // the write itself might be causing an error we want to back off from.
11359
- this.ar.reset();
11359
+ this.cr.reset();
11360
11360
  const e = rs(t.writeResults, t.commitTime), n = jn(t.commitTime);
11361
11361
  return this.listener.Dr(n, e);
11362
11362
  }
@@ -11608,7 +11608,7 @@ async function ro(t) {
11608
11608
  * Starts new listen for the given target. Uses resume token if provided. It
11609
11609
  * is a no-op if the target of given `TargetData` is already being listened to.
11610
11610
  */
11611
- function co(t, e) {
11611
+ function ao(t, e) {
11612
11612
  const n = q(t);
11613
11613
  n.Qr.has(e.targetId) || (
11614
11614
  // Mark this as something the client is currently listening for.
@@ -11620,7 +11620,7 @@ function co(t, e) {
11620
11620
  /**
11621
11621
  * Removes the listen from server. It is a no-op if the given target id is
11622
11622
  * not being listened to.
11623
- */ function ao(t, e) {
11623
+ */ function co(t, e) {
11624
11624
  const n = q(t), s = Co(n);
11625
11625
  n.Qr.delete(e), s.hr() && ho(n, e), 0 === n.Qr.size && (s.hr() ? s.wr() : wo(n) &&
11626
11626
  // Revert to OnlineState.Unknown if the watch stream is not open and we
@@ -11708,7 +11708,7 @@ async function yo(t, e, n) {
11708
11708
  } catch (n) {
11709
11709
  $("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n),
11710
11710
  await po(t, n);
11711
- } else if (e instanceof Cn ? t.Jr.rt(e) : e instanceof Nn ? t.Jr.ft(e) : t.Jr.at(e),
11711
+ } else if (e instanceof Cn ? t.Jr.rt(e) : e instanceof Nn ? t.Jr.ft(e) : t.Jr.ct(e),
11712
11712
  !n.isEqual(rt.min())) try {
11713
11713
  const e = await fr(t.localStore);
11714
11714
  n.compareTo(e) >= 0 &&
@@ -12194,9 +12194,9 @@ class xo {
12194
12194
  }
12195
12195
 
12196
12196
  class Fo {
12197
- constructor(t, e, n, s, i, r, o, c) {
12197
+ constructor(t, e, n, s, i, r, o, a) {
12198
12198
  this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
12199
- this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = c;
12199
+ this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = a;
12200
12200
  }
12201
12201
  /** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
12202
12202
  const i = [];
@@ -12320,7 +12320,7 @@ function jo(t) {
12320
12320
  * Initial snapshots (e.g. from cache) may not be propagated to the wrapped
12321
12321
  * observer. This flag is set to true once we've actually raised an event.
12322
12322
  */
12323
- this.co = !1, this.ao = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
12323
+ this.ao = !1, this.co = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
12324
12324
  }
12325
12325
  /**
12326
12326
  * Applies the new ViewSnapshot to this listener, raising a user-facing event
@@ -12336,8 +12336,8 @@ function jo(t) {
12336
12336
  /* excludesMetadataChanges= */ !0);
12337
12337
  }
12338
12338
  let e = !1;
12339
- return this.co ? this.uo(t) && (this.oo.next(t), e = !0) : this.ho(t, this.onlineState) && (this.lo(t),
12340
- e = !0), this.ao = t, e;
12339
+ return this.ao ? this.uo(t) && (this.oo.next(t), e = !0) : this.ho(t, this.onlineState) && (this.lo(t),
12340
+ e = !0), this.co = t, e;
12341
12341
  }
12342
12342
  onError(t) {
12343
12343
  this.oo.error(t);
@@ -12345,7 +12345,7 @@ function jo(t) {
12345
12345
  /** Returns whether a snapshot was raised. */ io(t) {
12346
12346
  this.onlineState = t;
12347
12347
  let e = !1;
12348
- return this.ao && !this.co && this.ho(this.ao, t) && (this.lo(this.ao), e = !0),
12348
+ return this.co && !this.ao && this.ho(this.co, t) && (this.lo(this.co), e = !0),
12349
12349
  e;
12350
12350
  }
12351
12351
  ho(t, e) {
@@ -12365,14 +12365,14 @@ function jo(t) {
12365
12365
  // At this point the only changes we will see are the ones we should
12366
12366
  // propagate.
12367
12367
  if (t.docChanges.length > 0) return !0;
12368
- const e = this.ao && this.ao.hasPendingWrites !== t.hasPendingWrites;
12368
+ const e = this.co && this.co.hasPendingWrites !== t.hasPendingWrites;
12369
12369
  return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges;
12370
12370
  // Generally we should have hit one of the cases above, but it's possible
12371
12371
  // to get here if there were only metadata docChanges and they got
12372
12372
  // stripped out.
12373
12373
  }
12374
12374
  lo(t) {
12375
- t = Fo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.co = !0,
12375
+ t = Fo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
12376
12376
  this.oo.next(t);
12377
12377
  }
12378
12378
  }
@@ -12579,7 +12579,7 @@ class Yo {
12579
12579
  // deletes. So we keep this doc at the old limit to compare the updates to.
12580
12580
  // Note that this should never get used in a refill (when previousChanges is
12581
12581
  // set), because there will only be adds -- no deletes or updates.
12582
- const c = _e(this.query) && s.size === this.query.limit ? s.last() : null, a = me(this.query) && s.size === this.query.limit ? s.first() : null;
12582
+ const a = _e(this.query) && s.size === this.query.limit ? s.last() : null, c = me(this.query) && s.size === this.query.limit ? s.first() : null;
12583
12583
  // Drop documents out to meet limit/limitToLast requirement.
12584
12584
  if (t.inorderTraversal(((t, e) => {
12585
12585
  const u = s.get(t), h = Pe(this.query, e) ? e : null, l = !!u && this.mutatedKeys.has(u.key), f = !!h && (h.hasLocalMutations ||
@@ -12595,7 +12595,7 @@ class Yo {
12595
12595
  }), d = !0) : this.vo(u, h) || (n.track({
12596
12596
  type: 2 /* Modified */ ,
12597
12597
  doc: h
12598
- }), d = !0, (c && this.Io(h, c) > 0 || a && this.Io(h, a) < 0) && (
12598
+ }), d = !0, (a && this.Io(h, a) > 0 || c && this.Io(h, c) < 0) && (
12599
12599
  // This doc moved from inside the limit to outside the limit.
12600
12600
  // That means there may be some other doc in the local cache
12601
12601
  // that should be included instead.
@@ -12606,7 +12606,7 @@ class Yo {
12606
12606
  }), d = !0) : u && !h && (n.track({
12607
12607
  type: 1 /* Removed */ ,
12608
12608
  doc: u
12609
- }), d = !0, (c || a) && (
12609
+ }), d = !0, (a || c) && (
12610
12610
  // A doc was removed from a full limit query. We'll need to
12611
12611
  // requery from the local cache to see if we know about some other
12612
12612
  // doc that should be in the results.
@@ -12690,10 +12690,10 @@ class Yo {
12690
12690
  * See the License for the specific language governing permissions and
12691
12691
  * limitations under the License.
12692
12692
  */ (t.type, e.type) || this.Io(t.doc, e.doc))), this.Vo(n);
12693
- const r = e ? this.So() : [], o = 0 === this.Eo.size && this.current ? 1 /* Synced */ : 0 /* Local */ , c = o !== this.To;
12694
- if (this.To = o, 0 !== i.length || c) {
12693
+ const r = e ? this.So() : [], o = 0 === this.Eo.size && this.current ? 1 /* Synced */ : 0 /* Local */ , a = o !== this.To;
12694
+ if (this.To = o, 0 !== i.length || a) {
12695
12695
  return {
12696
- snapshot: new Fo(this.query, t.Ao, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
12696
+ snapshot: new Fo(this.query, t.Ao, s, i, t.mutatedKeys, 0 /* Local */ === o, a,
12697
12697
  /* excludesMetadataChanges= */ !1),
12698
12698
  Do: r
12699
12699
  };
@@ -12816,7 +12816,7 @@ class Zo {
12816
12816
  }
12817
12817
  }
12818
12818
 
12819
- /** Tracks a limbo resolution. */ class tc {
12819
+ /** Tracks a limbo resolution. */ class ta {
12820
12820
  constructor(t) {
12821
12821
  this.key = t,
12822
12822
  /**
@@ -12841,7 +12841,7 @@ class Zo {
12841
12841
  * the class is not exported so they are only accessible from this module.
12842
12842
  * This is useful to implement optional features (like bundles) in free
12843
12843
  * functions, such that they are tree-shakeable.
12844
- */ class ec {
12844
+ */ class ea {
12845
12845
  constructor(t, e, n,
12846
12846
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
12847
12847
  s, i, r) {
@@ -12887,8 +12887,8 @@ class Zo {
12887
12887
  * server. All the subsequent view snapshots or errors are sent to the
12888
12888
  * subscribed handlers. Returns the initial snapshot.
12889
12889
  */
12890
- async function nc(t, e) {
12891
- const n = Cc(t);
12890
+ async function na(t, e) {
12891
+ const n = Ca(t);
12892
12892
  let s, i;
12893
12893
  const r = n.Oo.get(e);
12894
12894
  if (r)
@@ -12900,7 +12900,7 @@ async function nc(t, e) {
12900
12900
  // case and calls `listen` to obtain this ID.
12901
12901
  s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
12902
12902
  const t = await mr(n.localStore, Ee(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
12903
- s = t.targetId, i = await sc(n, e, s, "current" === r), n.isPrimaryClient && co(n.remoteStore, t);
12903
+ s = t.targetId, i = await sa(n, e, s, "current" === r), n.isPrimaryClient && ao(n.remoteStore, t);
12904
12904
  }
12905
12905
  return i;
12906
12906
  }
@@ -12908,7 +12908,7 @@ async function nc(t, e) {
12908
12908
  /**
12909
12909
  * Registers a view for a previously unknown query and computes its initial
12910
12910
  * snapshot.
12911
- */ async function sc(t, e, n, s) {
12911
+ */ async function sa(t, e, n, s) {
12912
12912
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
12913
12913
  // targets based on view changes. This allows us to only depend on Limbo
12914
12914
  // changes when user code includes queries.
@@ -12922,17 +12922,17 @@ async function nc(t, e) {
12922
12922
  /* usePreviousResults= */ !1).then((({documents: t}) => e.view.bo(t, i))));
12923
12923
  const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
12924
12924
  /* updateLimboDocuments= */ t.isPrimaryClient, r);
12925
- return mc(t, e.targetId, o.Do), o.snapshot;
12925
+ return ma(t, e.targetId, o.Do), o.snapshot;
12926
12926
  }(t, e, n, s);
12927
12927
  const i = await yr(t.localStore, e,
12928
- /* usePreviousResults= */ !0), r = new Xo(e, i.Gn), o = r.bo(i.documents), c = Dn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
12929
- /* updateLimboDocuments= */ t.isPrimaryClient, c);
12930
- mc(t, n, a.Do);
12928
+ /* usePreviousResults= */ !0), r = new Xo(e, i.Gn), o = r.bo(i.documents), a = Dn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
12929
+ /* updateLimboDocuments= */ t.isPrimaryClient, a);
12930
+ ma(t, n, c.Do);
12931
12931
  const u = new Zo(e, n, r);
12932
- return t.Oo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]), a.snapshot;
12932
+ return t.Oo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]), c.snapshot;
12933
12933
  }
12934
12934
 
12935
- /** Stops listening to the query. */ async function ic(t, e) {
12935
+ /** Stops listening to the query. */ async function ia(t, e) {
12936
12936
  const n = q(t), s = n.Oo.get(e), i = n.Fo.get(s.targetId);
12937
12937
  if (i.length > 1) return n.Fo.set(s.targetId, i.filter((t => !Ae(t, e)))), void n.Oo.delete(e);
12938
12938
  // No other queries are mapped to the target, clean up the query and the target.
@@ -12942,10 +12942,10 @@ async function nc(t, e) {
12942
12942
  n.sharedClientState.removeLocalQueryTarget(s.targetId);
12943
12943
  n.sharedClientState.isActiveQueryTarget(s.targetId) || await gr(n.localStore, s.targetId,
12944
12944
  /*keepPersistedTargetData=*/ !1).then((() => {
12945
- n.sharedClientState.clearQueryState(s.targetId), ao(n.remoteStore, s.targetId),
12946
- wc(n, s.targetId);
12945
+ n.sharedClientState.clearQueryState(s.targetId), co(n.remoteStore, s.targetId),
12946
+ wa(n, s.targetId);
12947
12947
  })).catch(Fi);
12948
- } else wc(n, s.targetId), await gr(n.localStore, s.targetId,
12948
+ } else wa(n, s.targetId), await gr(n.localStore, s.targetId,
12949
12949
  /*keepPersistedTargetData=*/ !0);
12950
12950
  }
12951
12951
 
@@ -12958,8 +12958,8 @@ async function nc(t, e) {
12958
12958
  * have completed, *not* when the write was acked by the backend. The
12959
12959
  * userCallback is resolved once the write was acked/rejected by the
12960
12960
  * backend (or failed locally for any other reason).
12961
- */ async function rc(t, e, n) {
12962
- const s = Nc(t);
12961
+ */ async function ra(t, e, n) {
12962
+ const s = Na(t);
12963
12963
  try {
12964
12964
  const t = await function(t, e) {
12965
12965
  const n = q(t), s = it.now(), i = e.reduce(((t, e) => t.add(e.key)), Pn());
@@ -12994,7 +12994,7 @@ async function nc(t, e) {
12994
12994
  /**
12995
12995
  * Resolves or rejects the user callback for the given batch and then discards
12996
12996
  * it.
12997
- */ (s, t.batchId, n), await pc(s, t.changes), await Eo(s.remoteStore);
12997
+ */ (s, t.batchId, n), await pa(s, t.changes), await Eo(s.remoteStore);
12998
12998
  } catch (t) {
12999
12999
  // If we can't persist the mutation, we reject the user callback and
13000
13000
  // don't send the mutation. The user can then retry the write.
@@ -13007,7 +13007,7 @@ async function nc(t, e) {
13007
13007
  * Applies one remote event to the sync engine, notifying any views of the
13008
13008
  * changes, and releasing any pending mutation batches that would become
13009
13009
  * visible because of the snapshot version the remote event contains.
13010
- */ async function oc(t, e) {
13010
+ */ async function oa(t, e) {
13011
13011
  const n = q(t);
13012
13012
  try {
13013
13013
  const t = await dr(n.localStore, e);
@@ -13020,7 +13020,7 @@ async function nc(t, e) {
13020
13020
  B(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
13021
13021
  t.addedDocuments.size > 0 ? s.ko = !0 : t.modifiedDocuments.size > 0 ? B(s.ko) : t.removedDocuments.size > 0 && (B(s.ko),
13022
13022
  s.ko = !1));
13023
- })), await pc(n, t, e);
13023
+ })), await pa(n, t, e);
13024
13024
  } catch (t) {
13025
13025
  await Fi(t);
13026
13026
  }
@@ -13029,7 +13029,7 @@ async function nc(t, e) {
13029
13029
  /**
13030
13030
  * Applies an OnlineState change to the sync engine and notifies any views of
13031
13031
  * the change.
13032
- */ function cc(t, e, n) {
13032
+ */ function aa(t, e, n) {
13033
13033
  const s = q(t);
13034
13034
  // If we are the secondary client, we explicitly ignore the remote store's
13035
13035
  // online state (the local client may go offline, even though the primary
@@ -13063,7 +13063,7 @@ async function nc(t, e) {
13063
13063
  * @param err - A description of the condition that has forced the rejection.
13064
13064
  * Nearly always this will be an indication that the user is no longer
13065
13065
  * authorized to see the data matching the target.
13066
- */ async function ac(t, e, n) {
13066
+ */ async function ca(t, e, n) {
13067
13067
  const s = q(t);
13068
13068
  // PORTING NOTE: Multi-tab only.
13069
13069
  s.sharedClientState.updateQueryState(e, "rejected", n);
@@ -13080,18 +13080,18 @@ async function nc(t, e) {
13080
13080
  const n = Pn().add(r), i = new Sn(rt.min(),
13081
13081
  /* targetChanges= */ new Map,
13082
13082
  /* targetMismatches= */ new gn(et), t, n);
13083
- await oc(s, i),
13083
+ await oa(s, i),
13084
13084
  // Since this query failed, we won't want to manually unlisten to it.
13085
13085
  // We only remove it from bookkeeping after we successfully applied the
13086
13086
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
13087
13087
  // this query when the RemoteStore restarts the Watch stream, which should
13088
13088
  // re-trigger the target failure.
13089
- s.Lo = s.Lo.remove(r), s.Bo.delete(e), yc(s);
13089
+ s.Lo = s.Lo.remove(r), s.Bo.delete(e), ya(s);
13090
13090
  } else await gr(s.localStore, e,
13091
- /* keepPersistedTargetData */ !1).then((() => wc(s, e, n))).catch(Fi);
13091
+ /* keepPersistedTargetData */ !1).then((() => wa(s, e, n))).catch(Fi);
13092
13092
  }
13093
13093
 
13094
- async function uc(t, e) {
13094
+ async function ua(t, e) {
13095
13095
  const n = q(t), s = e.batch.batchId;
13096
13096
  try {
13097
13097
  const t = await lr(n.localStore, e);
@@ -13099,14 +13099,14 @@ async function uc(t, e) {
13099
13099
  // raise events immediately (depending on whether the watcher is caught
13100
13100
  // up), so we raise user callbacks first so that they consistently happen
13101
13101
  // before listen events.
13102
- dc(n, s, /*error=*/ null), fc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13103
- await pc(n, t);
13102
+ da(n, s, /*error=*/ null), fa(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13103
+ await pa(n, t);
13104
13104
  } catch (t) {
13105
13105
  await Fi(t);
13106
13106
  }
13107
13107
  }
13108
13108
 
13109
- async function hc(t, e, n) {
13109
+ async function ha(t, e, n) {
13110
13110
  const s = q(t);
13111
13111
  try {
13112
13112
  const t = await function(t, e) {
@@ -13126,8 +13126,8 @@ async function hc(t, e, n) {
13126
13126
  // raise events immediately (depending on whether the watcher is caught up),
13127
13127
  // so we raise user callbacks first so that they consistently happen before
13128
13128
  // listen events.
13129
- dc(s, e, n), fc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13130
- await pc(s, t);
13129
+ da(s, e, n), fa(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13130
+ await pa(s, t);
13131
13131
  } catch (n) {
13132
13132
  await Fi(n);
13133
13133
  }
@@ -13136,7 +13136,7 @@ async function hc(t, e, n) {
13136
13136
  /**
13137
13137
  * Registers a user callback that resolves when all pending mutations at the moment of calling
13138
13138
  * are acknowledged .
13139
- */ async function lc(t, e) {
13139
+ */ async function la(t, e) {
13140
13140
  const n = q(t);
13141
13141
  wo(n.remoteStore) || $("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
13142
13142
  try {
@@ -13158,13 +13158,13 @@ async function hc(t, e, n) {
13158
13158
  /**
13159
13159
  * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
13160
13160
  * if there are any.
13161
- */ function fc(t, e) {
13161
+ */ function fa(t, e) {
13162
13162
  (t.Ko.get(e) || []).forEach((t => {
13163
13163
  t.resolve();
13164
13164
  })), t.Ko.delete(e);
13165
13165
  }
13166
13166
 
13167
- /** Reject all outstanding callbacks waiting for pending writes to complete. */ function dc(t, e, n) {
13167
+ /** Reject all outstanding callbacks waiting for pending writes to complete. */ function da(t, e, n) {
13168
13168
  const s = q(t);
13169
13169
  let i = s.qo[s.currentUser.toKey()];
13170
13170
  // NOTE: Mutations restored from persistence won't have callbacks, so it's
@@ -13175,39 +13175,39 @@ async function hc(t, e, n) {
13175
13175
  }
13176
13176
  }
13177
13177
 
13178
- function wc(t, e, n = null) {
13178
+ function wa(t, e, n = null) {
13179
13179
  t.sharedClientState.removeLocalQueryTarget(e);
13180
13180
  for (const s of t.Fo.get(e)) t.Oo.delete(s), n && t.$o.Go(s, n);
13181
13181
  if (t.Fo.delete(e), t.isPrimaryClient) {
13182
13182
  t.Uo.cs(e).forEach((e => {
13183
13183
  t.Uo.containsKey(e) ||
13184
13184
  // We removed the last reference for this key
13185
- _c(t, e);
13185
+ _a(t, e);
13186
13186
  }));
13187
13187
  }
13188
13188
  }
13189
13189
 
13190
- function _c(t, e) {
13190
+ function _a(t, e) {
13191
13191
  t.Mo.delete(e.path.canonicalString());
13192
13192
  // It's possible that the target already got removed because the query failed. In that case,
13193
13193
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
13194
13194
  const n = t.Lo.get(e);
13195
- null !== n && (ao(t.remoteStore, n), t.Lo = t.Lo.remove(e), t.Bo.delete(n), yc(t));
13195
+ null !== n && (co(t.remoteStore, n), t.Lo = t.Lo.remove(e), t.Bo.delete(n), ya(t));
13196
13196
  }
13197
13197
 
13198
- function mc(t, e, n) {
13199
- for (const s of n) if (s instanceof Jo) t.Uo.addReference(s.key, e), gc(t, s); else if (s instanceof Yo) {
13198
+ function ma(t, e, n) {
13199
+ for (const s of n) if (s instanceof Jo) t.Uo.addReference(s.key, e), ga(t, s); else if (s instanceof Yo) {
13200
13200
  $("SyncEngine", "Document no longer in limbo: " + s.key), t.Uo.removeReference(s.key, e);
13201
13201
  t.Uo.containsKey(s.key) ||
13202
13202
  // We removed the last reference for this key
13203
- _c(t, s.key);
13203
+ _a(t, s.key);
13204
13204
  } else L();
13205
13205
  }
13206
13206
 
13207
- function gc(t, e) {
13207
+ function ga(t, e) {
13208
13208
  const n = e.key, s = n.path.canonicalString();
13209
13209
  t.Lo.get(n) || t.Mo.has(s) || ($("SyncEngine", "New document in limbo: " + n), t.Mo.add(s),
13210
- yc(t));
13210
+ ya(t));
13211
13211
  }
13212
13212
 
13213
13213
  /**
@@ -13217,23 +13217,23 @@ function gc(t, e) {
13217
13217
  * Without bounding the number of concurrent resolutions, the server can fail
13218
13218
  * with "resource exhausted" errors which can lead to pathological client
13219
13219
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
13220
- */ function yc(t) {
13220
+ */ function ya(t) {
13221
13221
  for (;t.Mo.size > 0 && t.Lo.size < t.maxConcurrentLimboResolutions; ) {
13222
13222
  const e = t.Mo.values().next().value;
13223
13223
  t.Mo.delete(e);
13224
13224
  const n = new Pt(ht.fromString(e)), s = t.jo.next();
13225
- t.Bo.set(s, new tc(n)), t.Lo = t.Lo.insert(n, s), co(t.remoteStore, new ii(Ee(we(n.path)), s, 2 /* LimboResolution */ , X.T));
13225
+ t.Bo.set(s, new ta(n)), t.Lo = t.Lo.insert(n, s), ao(t.remoteStore, new ii(Ee(we(n.path)), s, 2 /* LimboResolution */ , X.T));
13226
13226
  }
13227
13227
  }
13228
13228
 
13229
- async function pc(t, e, n) {
13229
+ async function pa(t, e, n) {
13230
13230
  const s = q(t), i = [], r = [], o = [];
13231
- s.Oo.isEmpty() || (s.Oo.forEach(((t, c) => {
13232
- o.push(s.Wo(c, e, n).then((t => {
13231
+ s.Oo.isEmpty() || (s.Oo.forEach(((t, a) => {
13232
+ o.push(s.Wo(a, e, n).then((t => {
13233
13233
  if (t) {
13234
- s.isPrimaryClient && s.sharedClientState.updateQueryState(c.targetId, t.fromCache ? "not-current" : "current"),
13234
+ s.isPrimaryClient && s.sharedClientState.updateQueryState(a.targetId, t.fromCache ? "not-current" : "current"),
13235
13235
  i.push(t);
13236
- const e = or.kn(c.targetId, t);
13236
+ const e = or.kn(a.targetId, t);
13237
13237
  r.push(e);
13238
13238
  }
13239
13239
  })));
@@ -13260,7 +13260,7 @@ async function pc(t, e, n) {
13260
13260
  }(s.localStore, r));
13261
13261
  }
13262
13262
 
13263
- async function Tc(t, e) {
13263
+ async function Ta(t, e) {
13264
13264
  const n = q(t);
13265
13265
  if (!n.currentUser.isEqual(e)) {
13266
13266
  $("SyncEngine", "User change. New user:", e.toKey());
@@ -13275,11 +13275,11 @@ async function Tc(t, e) {
13275
13275
  })), t.Ko.clear();
13276
13276
  }(n, "'waitForPendingWrites' promise is rejected due to a user change."),
13277
13277
  // TODO(b/114226417): Consider calling this only in the primary tab.
13278
- n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await pc(n, t.Wn);
13278
+ n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await pa(n, t.Wn);
13279
13279
  }
13280
13280
  }
13281
13281
 
13282
- function Ec(t, e) {
13282
+ function Ea(t, e) {
13283
13283
  const n = q(t), s = n.Bo.get(e);
13284
13284
  if (s && s.ko) return Pn().add(s.key);
13285
13285
  {
@@ -13297,10 +13297,10 @@ function Ec(t, e) {
13297
13297
  /**
13298
13298
  * Reconcile the list of synced documents in an existing view with those
13299
13299
  * from persistence.
13300
- */ async function Ic(t, e) {
13300
+ */ async function Ia(t, e) {
13301
13301
  const n = q(t), s = await yr(n.localStore, e.query,
13302
13302
  /* usePreviousResults= */ !0), i = e.view.No(s);
13303
- return n.isPrimaryClient && mc(n, e.targetId, i.Do), i;
13303
+ return n.isPrimaryClient && ma(n, e.targetId, i.Do), i;
13304
13304
  }
13305
13305
 
13306
13306
  /**
@@ -13308,14 +13308,14 @@ function Ec(t, e) {
13308
13308
  * snapshots if needed.
13309
13309
  */
13310
13310
  // PORTING NOTE: Multi-Tab only.
13311
- async function Ac(t) {
13311
+ async function Aa(t) {
13312
13312
  const e = q(t);
13313
- return Tr(e.localStore).then((t => pc(e, t)));
13313
+ return Tr(e.localStore).then((t => pa(e, t)));
13314
13314
  }
13315
13315
 
13316
13316
  /** Applies a mutation state to an existing batch. */
13317
13317
  // PORTING NOTE: Multi-Tab only.
13318
- async function Rc(t, e, n, s) {
13318
+ async function Ra(t, e, n, s) {
13319
13319
  const i = q(t), r = await function(t, e) {
13320
13320
  const n = q(t), s = q(n.In);
13321
13321
  return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Xt(t, e).next((e => e ? n.Qn.Pn(t, e) : js.resolve(null)))));
@@ -13329,11 +13329,11 @@ async function Rc(t, e, n, s) {
13329
13329
  await Eo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
13330
13330
  // NOTE: Both these methods are no-ops for batches that originated from
13331
13331
  // other clients.
13332
- dc(i, e, s || null), fc(i, e), function(t, e) {
13332
+ da(i, e, s || null), fa(i, e), function(t, e) {
13333
13333
  q(q(t).In).te(e);
13334
13334
  }
13335
13335
  // PORTING NOTE: Multi-Tab only.
13336
- (i.localStore, e)) : L(), await pc(i, r)) :
13336
+ (i.localStore, e)) : L(), await pa(i, r)) :
13337
13337
  // A throttled tab may not have seen the mutation before it was completed
13338
13338
  // and removed from the mutation queue, in which case we won't have cached
13339
13339
  // the affected documents. In this case we can safely ignore the update
@@ -13346,31 +13346,31 @@ async function Rc(t, e, n, s) {
13346
13346
 
13347
13347
  /** Applies a query target change from a different tab. */
13348
13348
  // PORTING NOTE: Multi-Tab only.
13349
- async function bc(t, e) {
13349
+ async function ba(t, e) {
13350
13350
  const n = q(t);
13351
- if (Cc(n), Nc(n), !0 === e && !0 !== n.Qo) {
13351
+ if (Ca(n), Na(n), !0 === e && !0 !== n.Qo) {
13352
13352
  // Secondary tabs only maintain Views for their local listeners and the
13353
13353
  // Views internal state may not be 100% populated (in particular
13354
13354
  // secondary tabs don't track syncedDocuments, the set of documents the
13355
13355
  // server considers to be in the target). So when a secondary becomes
13356
13356
  // primary, we need to need to make sure that all views for all targets
13357
13357
  // match the state on disk.
13358
- const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Pc(n, t.toArray());
13358
+ const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Pa(n, t.toArray());
13359
13359
  n.Qo = !0, await Do(n.remoteStore, !0);
13360
- for (const t of e) co(n.remoteStore, t);
13360
+ for (const t of e) ao(n.remoteStore, t);
13361
13361
  } else if (!1 === e && !1 !== n.Qo) {
13362
13362
  const t = [];
13363
13363
  let e = Promise.resolve();
13364
13364
  n.Fo.forEach(((s, i) => {
13365
- n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (wc(n, i),
13365
+ n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (wa(n, i),
13366
13366
  gr(n.localStore, i,
13367
- /*keepPersistedTargetData=*/ !0)))), ao(n.remoteStore, i);
13368
- })), await e, await Pc(n, t),
13367
+ /*keepPersistedTargetData=*/ !0)))), co(n.remoteStore, i);
13368
+ })), await e, await Pa(n, t),
13369
13369
  // PORTING NOTE: Multi-Tab only.
13370
13370
  function(t) {
13371
13371
  const e = q(t);
13372
13372
  e.Bo.forEach(((t, n) => {
13373
- ao(e.remoteStore, n);
13373
+ co(e.remoteStore, n);
13374
13374
  })), e.Uo.us(), e.Bo = new Map, e.Lo = new wn(Pt.comparator);
13375
13375
  }
13376
13376
  /**
@@ -13388,7 +13388,7 @@ async function bc(t, e) {
13388
13388
  }
13389
13389
  }
13390
13390
 
13391
- async function Pc(t, e, n) {
13391
+ async function Pa(t, e, n) {
13392
13392
  const s = q(t), i = [], r = [];
13393
13393
  for (const t of e) {
13394
13394
  let e;
@@ -13400,14 +13400,14 @@ async function Pc(t, e, n) {
13400
13400
  // state (the list of syncedDocuments may have gotten out of sync).
13401
13401
  e = await mr(s.localStore, Ee(n[0]));
13402
13402
  for (const t of n) {
13403
- const e = s.Oo.get(t), n = await Ic(s, e);
13403
+ const e = s.Oo.get(t), n = await Ia(s, e);
13404
13404
  n.snapshot && r.push(n.snapshot);
13405
13405
  }
13406
13406
  } else {
13407
13407
  // For queries that never executed on this client, we need to
13408
13408
  // allocate the target in LocalStore and initialize a new View.
13409
13409
  const n = await pr(s.localStore, t);
13410
- e = await mr(s.localStore, n), await sc(s, vc(n), t,
13410
+ e = await mr(s.localStore, n), await sa(s, va(n), t,
13411
13411
  /*current=*/ !1);
13412
13412
  }
13413
13413
  i.push(e);
@@ -13426,20 +13426,20 @@ async function Pc(t, e, n) {
13426
13426
  * difference will not cause issues.
13427
13427
  */
13428
13428
  // PORTING NOTE: Multi-Tab only.
13429
- function vc(t) {
13429
+ function va(t) {
13430
13430
  return de(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
13431
13431
  }
13432
13432
 
13433
13433
  /** Returns the IDs of the clients that are currently active. */
13434
13434
  // PORTING NOTE: Multi-Tab only.
13435
- function Vc(t) {
13435
+ function Va(t) {
13436
13436
  const e = q(t);
13437
13437
  return q(q(e.localStore).persistence).pn();
13438
13438
  }
13439
13439
 
13440
13440
  /** Applies a query target change from a different tab. */
13441
13441
  // PORTING NOTE: Multi-Tab only.
13442
- async function Sc(t, e, n, s) {
13442
+ async function Sa(t, e, n, s) {
13443
13443
  const i = q(t);
13444
13444
  if (i.Qo)
13445
13445
  // If we receive a target state notification via WebStorage, we are
@@ -13449,13 +13449,13 @@ async function Sc(t, e, n, s) {
13449
13449
  case "not-current":
13450
13450
  {
13451
13451
  const t = await Tr(i.localStore), s = Sn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
13452
- await pc(i, t, s);
13452
+ await pa(i, t, s);
13453
13453
  break;
13454
13454
  }
13455
13455
 
13456
13456
  case "rejected":
13457
13457
  await gr(i.localStore, e,
13458
- /* keepPersistedTargetData */ !0), wc(i, e, s);
13458
+ /* keepPersistedTargetData */ !0), wa(i, e, s);
13459
13459
  break;
13460
13460
 
13461
13461
  default:
@@ -13463,8 +13463,8 @@ async function Sc(t, e, n, s) {
13463
13463
  }
13464
13464
  }
13465
13465
 
13466
- /** Adds or removes Watch targets for queries from different tabs. */ async function Dc(t, e, n) {
13467
- const s = Cc(t);
13466
+ /** Adds or removes Watch targets for queries from different tabs. */ async function Da(t, e, n) {
13467
+ const s = Ca(t);
13468
13468
  if (s.Qo) {
13469
13469
  for (const t of e) {
13470
13470
  if (s.Fo.has(t)) {
@@ -13473,8 +13473,8 @@ async function Sc(t, e, n, s) {
13473
13473
  continue;
13474
13474
  }
13475
13475
  const e = await pr(s.localStore, t), n = await mr(s.localStore, e);
13476
- await sc(s, vc(e), n.targetId,
13477
- /*current=*/ !1), co(s.remoteStore, n);
13476
+ await sa(s, va(e), n.targetId,
13477
+ /*current=*/ !1), ao(s.remoteStore, n);
13478
13478
  }
13479
13479
  for (const t of n)
13480
13480
  // Check that the target is still active since the target might have been
@@ -13483,21 +13483,21 @@ async function Sc(t, e, n, s) {
13483
13483
  // Release queries that are still active.
13484
13484
  await gr(s.localStore, t,
13485
13485
  /* keepPersistedTargetData */ !1).then((() => {
13486
- ao(s.remoteStore, t), wc(s, t);
13486
+ co(s.remoteStore, t), wa(s, t);
13487
13487
  })).catch(Fi);
13488
13488
  }
13489
13489
  }
13490
13490
 
13491
- function Cc(t) {
13491
+ function Ca(t) {
13492
13492
  const e = q(t);
13493
- return e.remoteStore.remoteSyncer.applyRemoteEvent = oc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Ec.bind(null, e),
13494
- e.remoteStore.remoteSyncer.rejectListen = ac.bind(null, e), e.$o.Rr = qo.bind(null, e.eventManager),
13493
+ return e.remoteStore.remoteSyncer.applyRemoteEvent = oa.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Ea.bind(null, e),
13494
+ e.remoteStore.remoteSyncer.rejectListen = ca.bind(null, e), e.$o.Rr = qo.bind(null, e.eventManager),
13495
13495
  e.$o.Go = Ko.bind(null, e.eventManager), e;
13496
13496
  }
13497
13497
 
13498
- function Nc(t) {
13498
+ function Na(t) {
13499
13499
  const e = q(t);
13500
- return e.remoteStore.remoteSyncer.applySuccessfulWrite = uc.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = hc.bind(null, e),
13500
+ return e.remoteStore.remoteSyncer.applySuccessfulWrite = ua.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = ha.bind(null, e),
13501
13501
  e;
13502
13502
  }
13503
13503
 
@@ -13508,7 +13508,7 @@ function Nc(t) {
13508
13508
  * @param syncEngine - SyncEngine to use.
13509
13509
  * @param bundleReader - Bundle to load into the SDK.
13510
13510
  * @param task - LoadBundleTask used to update the loading progress to public API.
13511
- */ function xc(t, e, n) {
13511
+ */ function xa(t, e, n) {
13512
13512
  const s = q(t);
13513
13513
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
13514
13514
  (async function(t, e, n) {
@@ -13540,7 +13540,7 @@ function Nc(t) {
13540
13540
  // TODO(b/160876443): This currently raises snapshots with
13541
13541
  // `fromCache=false` if users already listen to some queries and bundles
13542
13542
  // has newer version.
13543
- await pc(t, o.En,
13543
+ await pa(t, o.En,
13544
13544
  /* remoteEvent */ void 0),
13545
13545
  // Save metadata, so loading the same bundle will skip.
13546
13546
  await function(t, e) {
@@ -13579,7 +13579,7 @@ function Nc(t) {
13579
13579
  }));
13580
13580
  }
13581
13581
 
13582
- class kc {
13582
+ class ka {
13583
13583
  constructor() {
13584
13584
  this.synchronizeTabs = !1;
13585
13585
  }
@@ -13591,7 +13591,7 @@ class kc {
13591
13591
  return null;
13592
13592
  }
13593
13593
  Xo(t) {
13594
- return ur(this.persistence, new cr, t.initialUser, this.N);
13594
+ return ur(this.persistence, new ar, t.initialUser, this.N);
13595
13595
  }
13596
13596
  Jo(t) {
13597
13597
  return new Cr(xr.Ns, this.N);
@@ -13607,21 +13607,21 @@ class kc {
13607
13607
 
13608
13608
  /**
13609
13609
  * Provides all components needed for Firestore with IndexedDB persistence.
13610
- */ class $c extends kc {
13610
+ */ class $a extends ka {
13611
13611
  constructor(t, e, n) {
13612
13612
  super(), this.Zo = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
13613
13613
  }
13614
13614
  async initialize(t) {
13615
13615
  await super.initialize(t), await Er(this.localStore), await this.Zo.initialize(this, t),
13616
13616
  // Enqueue writes from a previous session
13617
- await Nc(this.Zo.syncEngine), await Eo(this.Zo.remoteStore),
13617
+ await Na(this.Zo.syncEngine), await Eo(this.Zo.remoteStore),
13618
13618
  // NOTE: This will immediately call the listener, so we make sure to
13619
13619
  // set it after localStore / remoteStore are started.
13620
13620
  await this.persistence.nn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
13621
13621
  Promise.resolve())));
13622
13622
  }
13623
13623
  Xo(t) {
13624
- return ur(this.persistence, new cr, t.initialUser, this.N);
13624
+ return ur(this.persistence, new ar, t.initialUser, this.N);
13625
13625
  }
13626
13626
  Yo(t) {
13627
13627
  const e = this.persistence.referenceDelegate.garbageCollector;
@@ -13643,7 +13643,7 @@ class kc {
13643
13643
  * In the legacy client, this provider is used to provide both multi-tab and
13644
13644
  * non-multi-tab persistence since we cannot tell at build time whether
13645
13645
  * `synchronizeTabs` will be enabled.
13646
- */ class Oc extends $c {
13646
+ */ class Oa extends $a {
13647
13647
  constructor(t, e) {
13648
13648
  super(t, e, /* forceOwnership= */ !1), this.Zo = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
13649
13649
  }
@@ -13651,16 +13651,16 @@ class kc {
13651
13651
  await super.initialize(t);
13652
13652
  const e = this.Zo.syncEngine;
13653
13653
  this.sharedClientState instanceof qr && (this.sharedClientState.syncEngine = {
13654
- _i: Rc.bind(null, e),
13655
- mi: Sc.bind(null, e),
13656
- gi: Dc.bind(null, e),
13657
- pn: Vc.bind(null, e),
13658
- wi: Ac.bind(null, e)
13654
+ _i: Ra.bind(null, e),
13655
+ mi: Sa.bind(null, e),
13656
+ gi: Da.bind(null, e),
13657
+ pn: Va.bind(null, e),
13658
+ wi: Aa.bind(null, e)
13659
13659
  }, await this.sharedClientState.start()),
13660
13660
  // NOTE: This will immediately call the listener, so we make sure to
13661
13661
  // set it after localStore / remoteStore are started.
13662
13662
  await this.persistence.nn((async t => {
13663
- await bc(this.Zo.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13663
+ await ba(this.Zo.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13664
13664
  }));
13665
13665
  }
13666
13666
  Ho(t) {
@@ -13674,13 +13674,13 @@ class kc {
13674
13674
  /**
13675
13675
  * Initializes and wires the components that are needed to interface with the
13676
13676
  * network.
13677
- */ class Fc {
13677
+ */ class Fa {
13678
13678
  async initialize(t, e) {
13679
13679
  this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
13680
13680
  this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
13681
13681
  this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
13682
- /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => cc(this.syncEngine, t, 1 /* SharedClientState */),
13683
- this.remoteStore.remoteSyncer.handleCredentialChange = Tc.bind(null, this.syncEngine),
13682
+ /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => aa(this.syncEngine, t, 1 /* SharedClientState */),
13683
+ this.remoteStore.remoteSyncer.handleCredentialChange = Ta.bind(null, this.syncEngine),
13684
13684
  await Do(this.remoteStore, this.syncEngine.isPrimaryClient));
13685
13685
  }
13686
13686
  createEventManager(t) {
@@ -13694,7 +13694,7 @@ class kc {
13694
13694
  }(t.credentials, n, e);
13695
13695
  }
13696
13696
  createRemoteStore(t) {
13697
- return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => cc(this.syncEngine, t, 0 /* RemoteStore */),
13697
+ return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => aa(this.syncEngine, t, 0 /* RemoteStore */),
13698
13698
  r = Qr.bt() ? new Qr : new jr, new io(e, n, s, i, r);
13699
13699
  var e, n, s, i, r;
13700
13700
  /** Re-enables the network. Idempotent. */ }
@@ -13702,8 +13702,8 @@ class kc {
13702
13702
  return function(t, e, n,
13703
13703
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
13704
13704
  s, i, r, o) {
13705
- const c = new ec(t, e, n, s, i, r);
13706
- return o && (c.Qo = !0), c;
13705
+ const a = new ea(t, e, n, s, i, r);
13706
+ return o && (a.Qo = !0), a;
13707
13707
  }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
13708
13708
  }
13709
13709
  terminate() {
@@ -13745,7 +13745,7 @@ class kc {
13745
13745
  * @param bytesPerRead - How many bytes each `read()` from the returned reader
13746
13746
  * will read.
13747
13747
  */
13748
- function Mc(t, e = 10240) {
13748
+ function Ma(t, e = 10240) {
13749
13749
  let n = 0;
13750
13750
  // The TypeScript definition for ReadableStreamReader changed. We use
13751
13751
  // `any` here to allow this code to compile with different versions.
@@ -13811,7 +13811,7 @@ function Mc(t, e = 10240) {
13811
13811
  * asynchronously. To allow immediate silencing, a mute call is added which
13812
13812
  * causes events scheduled to no longer be raised.
13813
13813
  */
13814
- class Lc {
13814
+ class La {
13815
13815
  constructor(t) {
13816
13816
  this.observer = t,
13817
13817
  /**
@@ -13821,15 +13821,15 @@ class Lc {
13821
13821
  this.muted = !1;
13822
13822
  }
13823
13823
  next(t) {
13824
- this.observer.next && this.tc(this.observer.next, t);
13824
+ this.observer.next && this.ta(this.observer.next, t);
13825
13825
  }
13826
13826
  error(t) {
13827
- this.observer.error ? this.tc(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
13827
+ this.observer.error ? this.ta(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
13828
13828
  }
13829
- ec() {
13829
+ ea() {
13830
13830
  this.muted = !0;
13831
13831
  }
13832
- tc(t, e) {
13832
+ ta(t, e) {
13833
13833
  this.muted || setTimeout((() => {
13834
13834
  this.muted || t(e);
13835
13835
  }), 0);
@@ -13857,32 +13857,32 @@ class Lc {
13857
13857
  *
13858
13858
  * Takes a bundle stream or buffer, and presents abstractions to read bundled
13859
13859
  * elements out of the underlying content.
13860
- */ class Bc {
13860
+ */ class Ba {
13861
13861
  constructor(
13862
13862
  /** The reader to read from underlying binary bundle data source. */
13863
13863
  t, e) {
13864
- this.nc = t, this.N = e,
13864
+ this.na = t, this.N = e,
13865
13865
  /** Cached bundle metadata. */
13866
13866
  this.metadata = new Q,
13867
13867
  /**
13868
13868
  * Internal buffer to hold bundle content, accumulating incomplete element
13869
13869
  * content.
13870
13870
  */
13871
- this.buffer = new Uint8Array, this.sc = new TextDecoder("utf-8"),
13871
+ this.buffer = new Uint8Array, this.sa = new TextDecoder("utf-8"),
13872
13872
  // Read the metadata (which is the first element).
13873
- this.ic().then((t => {
13873
+ this.ia().then((t => {
13874
13874
  t && t.wo() ? this.metadata.resolve(t.payload.metadata) : this.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)}`));
13875
13875
  }), (t => this.metadata.reject(t)));
13876
13876
  }
13877
13877
  close() {
13878
- return this.nc.cancel();
13878
+ return this.na.cancel();
13879
13879
  }
13880
13880
  async getMetadata() {
13881
13881
  return this.metadata.promise;
13882
13882
  }
13883
13883
  async zo() {
13884
13884
  // Makes sure metadata is read before proceeding.
13885
- return await this.getMetadata(), this.ic();
13885
+ return await this.getMetadata(), this.ia();
13886
13886
  }
13887
13887
  /**
13888
13888
  * Reads from the head of internal buffer, and pulling more data from
@@ -13893,15 +13893,15 @@ class Lc {
13893
13893
  *
13894
13894
  * Returns either the bundled element, or null if we have reached the end of
13895
13895
  * the stream.
13896
- */ async ic() {
13897
- const t = await this.rc();
13896
+ */ async ia() {
13897
+ const t = await this.ra();
13898
13898
  if (null === t) return null;
13899
- const e = this.sc.decode(t), n = Number(e);
13900
- isNaN(n) && this.oc(`length string (${e}) is not valid number`);
13901
- const s = await this.cc(n);
13899
+ const e = this.sa.decode(t), n = Number(e);
13900
+ isNaN(n) && this.oa(`length string (${e}) is not valid number`);
13901
+ const s = await this.aa(n);
13902
13902
  return new Wo(JSON.parse(s), t.length + n);
13903
13903
  }
13904
- /** First index of '{' from the underlying buffer. */ ac() {
13904
+ /** First index of '{' from the underlying buffer. */ ca() {
13905
13905
  return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
13906
13906
  }
13907
13907
  /**
@@ -13909,17 +13909,17 @@ class Lc {
13909
13909
  * return the content.
13910
13910
  *
13911
13911
  * If reached end of the stream, returns a null.
13912
- */ async rc() {
13913
- for (;this.ac() < 0; ) {
13914
- if (await this.uc()) break;
13912
+ */ async ra() {
13913
+ for (;this.ca() < 0; ) {
13914
+ if (await this.ua()) break;
13915
13915
  }
13916
13916
  // Broke out of the loop because underlying stream is closed, and there
13917
13917
  // happens to be no more data to process.
13918
13918
  if (0 === this.buffer.length) return null;
13919
- const t = this.ac();
13919
+ const t = this.ca();
13920
13920
  // Broke out of the loop because underlying stream is closed, but still
13921
13921
  // cannot find an open bracket.
13922
- t < 0 && this.oc("Reached the end of bundle when a length string is expected.");
13922
+ t < 0 && this.oa("Reached the end of bundle when a length string is expected.");
13923
13923
  const e = this.buffer.slice(0, t);
13924
13924
  // Update the internal buffer to drop the read length.
13925
13925
  return this.buffer = this.buffer.slice(t), e;
@@ -13929,23 +13929,23 @@ class Lc {
13929
13929
  * number of bytes, pulling more data from the underlying stream if needed.
13930
13930
  *
13931
13931
  * Returns a string decoded from the read bytes.
13932
- */ async cc(t) {
13932
+ */ async aa(t) {
13933
13933
  for (;this.buffer.length < t; ) {
13934
- await this.uc() && this.oc("Reached the end of bundle when more is expected.");
13934
+ await this.ua() && this.oa("Reached the end of bundle when more is expected.");
13935
13935
  }
13936
- const e = this.sc.decode(this.buffer.slice(0, t));
13936
+ const e = this.sa.decode(this.buffer.slice(0, t));
13937
13937
  // Update the internal buffer to drop the read json string.
13938
13938
  return this.buffer = this.buffer.slice(t), e;
13939
13939
  }
13940
- oc(t) {
13940
+ oa(t) {
13941
13941
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
13942
- throw this.nc.cancel(), new Error(`Invalid bundle format: ${t}`);
13942
+ throw this.na.cancel(), new Error(`Invalid bundle format: ${t}`);
13943
13943
  }
13944
13944
  /**
13945
13945
  * Pulls more data from underlying stream to internal buffer.
13946
13946
  * Returns a boolean indicating whether the stream is finished.
13947
- */ async uc() {
13948
- const t = await this.nc.read();
13947
+ */ async ua() {
13948
+ const t = await this.na.read();
13949
13949
  if (!t.done) {
13950
13950
  const e = new Uint8Array(this.buffer.length + t.value.length);
13951
13951
  e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
@@ -13974,7 +13974,7 @@ class Lc {
13974
13974
  * Internal transaction object responsible for accumulating the mutations to
13975
13975
  * perform and the base versions for any documents read.
13976
13976
  */
13977
- class Uc {
13977
+ class Ua {
13978
13978
  constructor(t) {
13979
13979
  this.datastore = t,
13980
13980
  // The version of each document that was read during this transaction.
@@ -14002,11 +14002,11 @@ class Uc {
14002
14002
  const e = es(n.N, t);
14003
14003
  o.set(e.key.toString(), e);
14004
14004
  }));
14005
- const c = [];
14005
+ const a = [];
14006
14006
  return e.forEach((t => {
14007
14007
  const e = o.get(t.toString());
14008
- B(!!e), c.push(e);
14009
- })), c;
14008
+ B(!!e), a.push(e);
14009
+ })), a;
14010
14010
  }(this.datastore, t);
14011
14011
  return e.forEach((t => this.recordVersion(t))), e;
14012
14012
  }
@@ -14022,7 +14022,7 @@ class Uc {
14022
14022
  this.writtenDocs.add(t.toString());
14023
14023
  }
14024
14024
  delete(t) {
14025
- this.write(new cn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
14025
+ this.write(new an(t, this.precondition(t))), this.writtenDocs.add(t.toString());
14026
14026
  }
14027
14027
  async commit() {
14028
14028
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
@@ -14035,7 +14035,7 @@ class Uc {
14035
14035
  // a `verify` operation.
14036
14036
  t.forEach(((t, e) => {
14037
14037
  const n = Pt.fromPath(e);
14038
- this.mutations.push(new an(n, this.precondition(n)));
14038
+ this.mutations.push(new cn(n, this.precondition(n)));
14039
14039
  })), await async function(t, e) {
14040
14040
  const n = q(t), s = Yn(n.N) + "/documents", i = {
14041
14041
  writes: e.map((t => ss(n.N, t)))
@@ -14115,29 +14115,29 @@ class Uc {
14115
14115
  * TransactionRunner encapsulates the logic needed to run and retry transactions
14116
14116
  * with backoff.
14117
14117
  */
14118
- class qc {
14118
+ class qa {
14119
14119
  constructor(t, e, n, s) {
14120
14120
  this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
14121
- this.hc = 5, this.ar = new Xr(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
14121
+ this.ha = 5, this.cr = new Xr(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
14122
14122
  }
14123
14123
  /** Runs the transaction and sets the result on deferred. */ run() {
14124
- this.hc -= 1, this.lc();
14124
+ this.ha -= 1, this.la();
14125
14125
  }
14126
- lc() {
14127
- this.ar.Xi((async () => {
14128
- const t = new Uc(this.datastore), e = this.fc(t);
14126
+ la() {
14127
+ this.cr.Xi((async () => {
14128
+ const t = new Ua(this.datastore), e = this.fa(t);
14129
14129
  e && e.then((e => {
14130
14130
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
14131
14131
  this.deferred.resolve(e);
14132
14132
  })).catch((t => {
14133
- this.dc(t);
14133
+ this.da(t);
14134
14134
  }))));
14135
14135
  })).catch((t => {
14136
- this.dc(t);
14136
+ this.da(t);
14137
14137
  }));
14138
14138
  }));
14139
14139
  }
14140
- fc(t) {
14140
+ fa(t) {
14141
14141
  try {
14142
14142
  const e = this.updateFunction(t);
14143
14143
  return !At(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
@@ -14147,11 +14147,11 @@ class qc {
14147
14147
  return this.deferred.reject(t), null;
14148
14148
  }
14149
14149
  }
14150
- dc(t) {
14151
- this.hc > 0 && this.wc(t) ? (this.hc -= 1, this.asyncQueue.enqueueAndForget((() => (this.lc(),
14150
+ da(t) {
14151
+ this.ha > 0 && this.wa(t) ? (this.ha -= 1, this.asyncQueue.enqueueAndForget((() => (this.la(),
14152
14152
  Promise.resolve())))) : this.deferred.reject(t);
14153
14153
  }
14154
- wc(t) {
14154
+ wa(t) {
14155
14155
  if ("FirebaseError" === t.name) {
14156
14156
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
14157
14157
  // non-matching document versions with ABORTED. These errors should be retried.
@@ -14183,7 +14183,7 @@ class qc {
14183
14183
  * pieces of the client SDK architecture. It is responsible for creating the
14184
14184
  * async queue that is shared by all of the other components in the system.
14185
14185
  */
14186
- class Kc {
14186
+ class Ka {
14187
14187
  constructor(t,
14188
14188
  /**
14189
14189
  * Asynchronous queue responsible for all of our internal processing. When
@@ -14237,7 +14237,7 @@ class Kc {
14237
14237
  }
14238
14238
  }
14239
14239
 
14240
- async function jc(t, e) {
14240
+ async function ja(t, e) {
14241
14241
  t.asyncQueue.verifyOperationInProgress(), $("FirestoreClient", "Initializing OfflineComponentProvider");
14242
14242
  const n = await t.getConfiguration();
14243
14243
  await e.initialize(n);
@@ -14250,9 +14250,9 @@ async function jc(t, e) {
14250
14250
  e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
14251
14251
  }
14252
14252
 
14253
- async function Qc(t, e) {
14253
+ async function Qa(t, e) {
14254
14254
  t.asyncQueue.verifyOperationInProgress();
14255
- const n = await Wc(t);
14255
+ const n = await Wa(t);
14256
14256
  $("FirestoreClient", "Initializing OnlineComponentProvider");
14257
14257
  const s = await t.getConfiguration();
14258
14258
  await e.initialize(n, s),
@@ -14272,41 +14272,41 @@ async function Qc(t, e) {
14272
14272
  }(e.remoteStore, t))), t.onlineComponents = e;
14273
14273
  }
14274
14274
 
14275
- async function Wc(t) {
14275
+ async function Wa(t) {
14276
14276
  return t.offlineComponents || ($("FirestoreClient", "Using default OfflineComponentProvider"),
14277
- await jc(t, new kc)), t.offlineComponents;
14277
+ await ja(t, new ka)), t.offlineComponents;
14278
14278
  }
14279
14279
 
14280
- async function Gc(t) {
14280
+ async function Ga(t) {
14281
14281
  return t.onlineComponents || ($("FirestoreClient", "Using default OnlineComponentProvider"),
14282
- await Qc(t, new Fc)), t.onlineComponents;
14282
+ await Qa(t, new Fa)), t.onlineComponents;
14283
14283
  }
14284
14284
 
14285
- function zc(t) {
14286
- return Wc(t).then((t => t.persistence));
14285
+ function za(t) {
14286
+ return Wa(t).then((t => t.persistence));
14287
14287
  }
14288
14288
 
14289
- function Hc(t) {
14290
- return Wc(t).then((t => t.localStore));
14289
+ function Ha(t) {
14290
+ return Wa(t).then((t => t.localStore));
14291
14291
  }
14292
14292
 
14293
- function Jc(t) {
14294
- return Gc(t).then((t => t.remoteStore));
14293
+ function Ja(t) {
14294
+ return Ga(t).then((t => t.remoteStore));
14295
14295
  }
14296
14296
 
14297
- function Yc(t) {
14298
- return Gc(t).then((t => t.syncEngine));
14297
+ function Ya(t) {
14298
+ return Ga(t).then((t => t.syncEngine));
14299
14299
  }
14300
14300
 
14301
- async function Xc(t) {
14302
- const e = await Gc(t), n = e.eventManager;
14303
- return n.onListen = nc.bind(null, e.syncEngine), n.onUnlisten = ic.bind(null, e.syncEngine),
14301
+ async function Xa(t) {
14302
+ const e = await Ga(t), n = e.eventManager;
14303
+ return n.onListen = na.bind(null, e.syncEngine), n.onUnlisten = ia.bind(null, e.syncEngine),
14304
14304
  n;
14305
14305
  }
14306
14306
 
14307
- /** Enables the network connection and re-enqueues all pending operations. */ function Zc(t) {
14307
+ /** Enables the network connection and re-enqueues all pending operations. */ function Za(t) {
14308
14308
  return t.asyncQueue.enqueue((async () => {
14309
- const e = await zc(t), n = await Jc(t);
14309
+ const e = await za(t), n = await Ja(t);
14310
14310
  return e.setNetworkEnabled(!0), function(t) {
14311
14311
  const e = q(t);
14312
14312
  return e.Wr.delete(0 /* UserDisabled */), ro(e);
@@ -14314,9 +14314,9 @@ async function Xc(t) {
14314
14314
  }));
14315
14315
  }
14316
14316
 
14317
- /** Disables the network connection. Pending operations will not complete. */ function ta(t) {
14317
+ /** Disables the network connection. Pending operations will not complete. */ function tc(t) {
14318
14318
  return t.asyncQueue.enqueue((async () => {
14319
- const e = await zc(t), n = await Jc(t);
14319
+ const e = await za(t), n = await Ja(t);
14320
14320
  return e.setNetworkEnabled(!1), async function(t) {
14321
14321
  const e = q(t);
14322
14322
  e.Wr.add(0 /* UserDisabled */), await oo(e),
@@ -14330,7 +14330,7 @@ async function Xc(t) {
14330
14330
  * Returns a Promise that resolves when all writes that were pending at the time
14331
14331
  * this method was called received server acknowledgement. An acknowledgement
14332
14332
  * can be either acceptance or rejection.
14333
- */ function ea(t, e) {
14333
+ */ function ec(t, e) {
14334
14334
  const n = new Q;
14335
14335
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14336
14336
  try {
@@ -14347,19 +14347,19 @@ async function Xc(t) {
14347
14347
  /**
14348
14348
  * Retrieves a latency-compensated document from the backend via a
14349
14349
  * SnapshotListener.
14350
- */ (await Hc(t), e, n))), n.promise;
14350
+ */ (await Ha(t), e, n))), n.promise;
14351
14351
  }
14352
14352
 
14353
- function na(t, e, n = {}) {
14353
+ function nc(t, e, n = {}) {
14354
14354
  const s = new Q;
14355
14355
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14356
- const r = new Lc({
14356
+ const r = new La({
14357
14357
  next: r => {
14358
14358
  // Remove query first before passing event to user to avoid
14359
14359
  // user actions affecting the now stale query.
14360
14360
  e.enqueueAndForget((() => Uo(t, o)));
14361
- const c = r.docs.has(n);
14362
- !c && r.fromCache ?
14361
+ const a = r.docs.has(n);
14362
+ !a && r.fromCache ?
14363
14363
  // TODO(dimond): If we're online and the document doesn't
14364
14364
  // exist then we resolve with a doc.exists set to false. If
14365
14365
  // we're offline however, we reject the Promise in this
@@ -14367,7 +14367,7 @@ function na(t, e, n = {}) {
14367
14367
  // the server so we can deliver that even when you're
14368
14368
  // offline 2) Actually reject the Promise in the online case
14369
14369
  // if the document doesn't exist.
14370
- i.reject(new j(K.UNAVAILABLE, "Failed to get document because the client is offline.")) : c && r.fromCache && s && "server" === s.source ? i.reject(new j(K.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
14370
+ i.reject(new j(K.UNAVAILABLE, "Failed to get document because the client is offline.")) : a && r.fromCache && s && "server" === s.source ? i.reject(new j(K.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
14371
14371
  },
14372
14372
  error: t => i.reject(t)
14373
14373
  }), o = new Qo(we(n.path), r, {
@@ -14375,10 +14375,10 @@ function na(t, e, n = {}) {
14375
14375
  fo: !0
14376
14376
  });
14377
14377
  return Bo(t, o);
14378
- }(await Xc(t), t.asyncQueue, e, n, s))), s.promise;
14378
+ }(await Xa(t), t.asyncQueue, e, n, s))), s.promise;
14379
14379
  }
14380
14380
 
14381
- function sa(t, e) {
14381
+ function sc(t, e) {
14382
14382
  const n = new Q;
14383
14383
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14384
14384
  try {
@@ -14394,13 +14394,13 @@ function sa(t, e) {
14394
14394
  /**
14395
14395
  * Retrieves a latency-compensated query snapshot from the backend via a
14396
14396
  * SnapshotListener.
14397
- */ (await Hc(t), e, n))), n.promise;
14397
+ */ (await Ha(t), e, n))), n.promise;
14398
14398
  }
14399
14399
 
14400
- function ia(t, e, n = {}) {
14400
+ function ic(t, e, n = {}) {
14401
14401
  const s = new Q;
14402
14402
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14403
- const r = new Lc({
14403
+ const r = new La({
14404
14404
  next: n => {
14405
14405
  // Remove query first before passing event to user to avoid
14406
14406
  // user actions affecting the now stale query.
@@ -14412,20 +14412,20 @@ function ia(t, e, n = {}) {
14412
14412
  fo: !0
14413
14413
  });
14414
14414
  return Bo(t, o);
14415
- }(await Xc(t), t.asyncQueue, e, n, s))), s.promise;
14415
+ }(await Xa(t), t.asyncQueue, e, n, s))), s.promise;
14416
14416
  }
14417
14417
 
14418
- function ra(t, e) {
14419
- const n = new Lc(e);
14418
+ function rc(t, e) {
14419
+ const n = new La(e);
14420
14420
  return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14421
14421
  q(t).so.add(e),
14422
14422
  // Immediately fire an initial event, indicating all existing listeners
14423
14423
  // are in-sync.
14424
14424
  e.next();
14425
- }(await Xc(t), n))), () => {
14426
- n.ec(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14425
+ }(await Xa(t), n))), () => {
14426
+ n.ea(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14427
14427
  q(t).so.delete(e);
14428
- }(await Xc(t), n)));
14428
+ }(await Xa(t), n)));
14429
14429
  };
14430
14430
  }
14431
14431
 
@@ -14443,25 +14443,25 @@ function ra(t, e) {
14443
14443
  * accessed with the transaction will not reflect local changes that have not
14444
14444
  * been committed. For this reason, it is required that all reads are
14445
14445
  * performed before any writes. Transactions must be performed while online.
14446
- */ function oa(t, e) {
14446
+ */ function oc(t, e) {
14447
14447
  const n = new Q;
14448
14448
  return t.asyncQueue.enqueueAndForget((async () => {
14449
14449
  const s = await function(t) {
14450
- return Gc(t).then((t => t.datastore));
14450
+ return Ga(t).then((t => t.datastore));
14451
14451
  }(t);
14452
- new qc(t.asyncQueue, s, e, n).run();
14452
+ new qa(t.asyncQueue, s, e, n).run();
14453
14453
  })), n.promise;
14454
14454
  }
14455
14455
 
14456
- function ca(t, e, n, s) {
14456
+ function ac(t, e, n, s) {
14457
14457
  const i = function(t, e) {
14458
14458
  let n;
14459
14459
  n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
14460
14460
  return function(t, e) {
14461
- return new Bc(t, e);
14461
+ return new Ba(t, e);
14462
14462
  }(function(t, e) {
14463
- if (t instanceof Uint8Array) return Mc(t, e);
14464
- if (t instanceof ArrayBuffer) return Mc(new Uint8Array(t), e);
14463
+ if (t instanceof Uint8Array) return Ma(t, e);
14464
+ if (t instanceof ArrayBuffer) return Ma(new Uint8Array(t), e);
14465
14465
  if (t instanceof ReadableStream) return t.getReader();
14466
14466
  throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
14467
14467
  }(n), e);
@@ -14483,18 +14483,18 @@ function ca(t, e, n, s) {
14483
14483
  * limitations under the License.
14484
14484
  */ (n, Yr(e));
14485
14485
  t.asyncQueue.enqueueAndForget((async () => {
14486
- xc(await Yc(t), i, s);
14486
+ xa(await Ya(t), i, s);
14487
14487
  }));
14488
14488
  }
14489
14489
 
14490
- function aa(t, e) {
14490
+ function cc(t, e) {
14491
14491
  return t.asyncQueue.enqueue((async () => function(t, e) {
14492
14492
  const n = q(t);
14493
14493
  return n.persistence.runTransaction("Get named query", "readonly", (t => n.Je.getNamedQuery(t, e)));
14494
- }(await Hc(t), e)));
14494
+ }(await Ha(t), e)));
14495
14495
  }
14496
14496
 
14497
- class ua {
14497
+ class uc {
14498
14498
  /**
14499
14499
  * Constructs a DatabaseInfo using the provided host, databaseId and
14500
14500
  * persistenceKey.
@@ -14512,9 +14512,9 @@ class ua {
14512
14512
  * @param useFetchStreams Whether to use the Fetch API instead of
14513
14513
  * XMLHTTPRequest
14514
14514
  */
14515
- constructor(t, e, n, s, i, r, o, c) {
14515
+ constructor(t, e, n, s, i, r, o, a) {
14516
14516
  this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i,
14517
- this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = c;
14517
+ this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = a;
14518
14518
  }
14519
14519
  }
14520
14520
 
@@ -14523,7 +14523,7 @@ class ua {
14523
14523
  * Represents the database ID a Firestore client is associated with.
14524
14524
  * @internal
14525
14525
  */
14526
- class ha {
14526
+ class hc {
14527
14527
  constructor(t, e) {
14528
14528
  this.projectId = t, this.database = e || "(default)";
14529
14529
  }
@@ -14531,7 +14531,7 @@ class ha {
14531
14531
  return "(default)" === this.database;
14532
14532
  }
14533
14533
  isEqual(t) {
14534
- return t instanceof ha && t.projectId === this.projectId && t.database === this.database;
14534
+ return t instanceof hc && t.projectId === this.projectId && t.database === this.database;
14535
14535
  }
14536
14536
  }
14537
14537
 
@@ -14550,7 +14550,7 @@ class ha {
14550
14550
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14551
14551
  * See the License for the specific language governing permissions and
14552
14552
  * limitations under the License.
14553
- */ const la = new Map;
14553
+ */ const lc = new Map;
14554
14554
 
14555
14555
  /**
14556
14556
  * An instance map that ensures only one Datastore exists per Firestore
@@ -14572,28 +14572,28 @@ class ha {
14572
14572
  * See the License for the specific language governing permissions and
14573
14573
  * limitations under the License.
14574
14574
  */
14575
- function fa(t, e, n) {
14575
+ function fc(t, e, n) {
14576
14576
  if (!n) throw new j(K.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
14577
14577
  }
14578
14578
 
14579
14579
  /**
14580
14580
  * Validates that two boolean options are not set at the same time.
14581
14581
  * @internal
14582
- */ function da(t, e, n, s) {
14582
+ */ function dc(t, e, n, s) {
14583
14583
  if (!0 === e && !0 === s) throw new j(K.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
14584
14584
  }
14585
14585
 
14586
14586
  /**
14587
14587
  * Validates that `path` refers to a document (indicated by the fact it contains
14588
14588
  * an even numbers of segments).
14589
- */ function wa(t) {
14589
+ */ function wc(t) {
14590
14590
  if (!Pt.isDocumentKey(t)) throw new j(K.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
14591
14591
  }
14592
14592
 
14593
14593
  /**
14594
14594
  * Validates that `path` refers to a collection (indicated by the fact it
14595
14595
  * contains an odd numbers of segments).
14596
- */ function _a(t) {
14596
+ */ function _c(t) {
14597
14597
  if (Pt.isDocumentKey(t)) throw new j(K.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
14598
14598
  }
14599
14599
 
@@ -14602,7 +14602,7 @@ function fa(t, e, n) {
14602
14602
  * (i.e. excludes Array, Date, etc.).
14603
14603
  */
14604
14604
  /** Returns a string describing the type / value of the provided input. */
14605
- function ma(t) {
14605
+ function mc(t) {
14606
14606
  if (void 0 === t) return "undefined";
14607
14607
  if (null === t) return "null";
14608
14608
  if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
@@ -14631,7 +14631,7 @@ function ma(t) {
14631
14631
  return "function" == typeof t ? "a function" : L();
14632
14632
  }
14633
14633
 
14634
- function ga(t,
14634
+ function gc(t,
14635
14635
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14636
14636
  e) {
14637
14637
  if ("_delegate" in t && (
@@ -14640,14 +14640,14 @@ e) {
14640
14640
  t = t._delegate), !(t instanceof e)) {
14641
14641
  if (e.name === t.constructor.name) throw new j(K.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
14642
14642
  {
14643
- const n = ma(t);
14643
+ const n = mc(t);
14644
14644
  throw new j(K.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
14645
14645
  }
14646
14646
  }
14647
14647
  return t;
14648
14648
  }
14649
14649
 
14650
- function ya(t, e) {
14650
+ function yc(t, e) {
14651
14651
  if (e <= 0) throw new j(K.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
14652
14652
  }
14653
14653
 
@@ -14673,7 +14673,7 @@ function ya(t, e) {
14673
14673
  * user-supplied `FirestoreSettings` object. This is a separate type so that
14674
14674
  * defaults can be supplied and the value can be checked for equality.
14675
14675
  */
14676
- class pa {
14676
+ class pc {
14677
14677
  constructor(t) {
14678
14678
  var e;
14679
14679
  if (void 0 === t.host) {
@@ -14686,7 +14686,7 @@ class pa {
14686
14686
  this.cacheSizeBytes = t.cacheSizeBytes;
14687
14687
  }
14688
14688
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
14689
- this.useFetchStreams = !!t.useFetchStreams, da("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14689
+ this.useFetchStreams = !!t.useFetchStreams, dc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14690
14690
  }
14691
14691
  isEqual(t) {
14692
14692
  return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
@@ -14713,18 +14713,18 @@ class pa {
14713
14713
  * The Cloud Firestore service interface.
14714
14714
  *
14715
14715
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
14716
- */ class Ta {
14716
+ */ class Tc {
14717
14717
  /** @hideconstructor */
14718
14718
  constructor(t, e) {
14719
14719
  this._credentials = e,
14720
14720
  /**
14721
14721
  * Whether it's a Firestore or Firestore Lite instance.
14722
14722
  */
14723
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pa({}),
14724
- this._settingsFrozen = !1, t instanceof ha ? this._databaseId = t : (this._app = t,
14723
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new pc({}),
14724
+ this._settingsFrozen = !1, t instanceof hc ? this._databaseId = t : (this._app = t,
14725
14725
  this._databaseId = function(t) {
14726
14726
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new j(K.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
14727
- return new ha(t.options.projectId);
14727
+ return new hc(t.options.projectId);
14728
14728
  }
14729
14729
  /**
14730
14730
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -14755,7 +14755,7 @@ class pa {
14755
14755
  }
14756
14756
  _setSettings(t) {
14757
14757
  if (this._settingsFrozen) throw new j(K.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
14758
- this._settings = new pa(t), void 0 !== t.credentials && (this._credentials = function(t) {
14758
+ this._settings = new pc(t), void 0 !== t.credentials && (this._credentials = function(t) {
14759
14759
  if (!t) return new G;
14760
14760
  switch (t.type) {
14761
14761
  case "gapi":
@@ -14800,15 +14800,15 @@ class pa {
14800
14800
  * when the `Firestore` instance is terminated.
14801
14801
  */
14802
14802
  return function(t) {
14803
- const e = la.get(t);
14804
- e && ($("ComponentProvider", "Removing Datastore"), la.delete(t), e.terminate());
14803
+ const e = lc.get(t);
14804
+ e && ($("ComponentProvider", "Removing Datastore"), lc.delete(t), e.terminate());
14805
14805
  }(this), Promise.resolve();
14806
14806
  }
14807
14807
  }
14808
14808
 
14809
- function Ea(t, e, n, s = {}) {
14809
+ function Ec(t, e, n, s = {}) {
14810
14810
  var i;
14811
- const r = (t = ga(t, Ta))._getSettings();
14811
+ const r = (t = gc(t, Tc))._getSettings();
14812
14812
  if ("firestore.googleapis.com" !== r.host && r.host !== e && F("Host has been set in both settings() and useEmulator(), emulator host will be used"),
14813
14813
  t._setSettings(Object.assign(Object.assign({}, r), {
14814
14814
  host: `${e}:${n}`,
@@ -14847,7 +14847,7 @@ function Ea(t, e, n, s = {}) {
14847
14847
  * A `DocumentReference` refers to a document location in a Firestore database
14848
14848
  * and can be used to write, read, or listen to the location. The document at
14849
14849
  * the referenced location may or may not exist.
14850
- */ class Ia {
14850
+ */ class Ic {
14851
14851
  /** @hideconstructor */
14852
14852
  constructor(t,
14853
14853
  /**
@@ -14875,17 +14875,17 @@ function Ea(t, e, n, s = {}) {
14875
14875
  /**
14876
14876
  * The collection this `DocumentReference` belongs to.
14877
14877
  */ get parent() {
14878
- return new Ra(this.firestore, this.converter, this._key.path.popLast());
14878
+ return new Rc(this.firestore, this.converter, this._key.path.popLast());
14879
14879
  }
14880
14880
  withConverter(t) {
14881
- return new Ia(this.firestore, t, this._key);
14881
+ return new Ic(this.firestore, t, this._key);
14882
14882
  }
14883
14883
  }
14884
14884
 
14885
14885
  /**
14886
14886
  * A `Query` refers to a query which you can read or listen to. You can also
14887
14887
  * construct refined `Query` objects by adding filters and ordering.
14888
- */ class Aa {
14888
+ */ class Ac {
14889
14889
  // This is the lite version of the Query class in the main SDK.
14890
14890
  /** @hideconstructor protected */
14891
14891
  constructor(t,
@@ -14898,14 +14898,14 @@ function Ea(t, e, n, s = {}) {
14898
14898
  this.type = "query", this.firestore = t;
14899
14899
  }
14900
14900
  withConverter(t) {
14901
- return new Aa(this.firestore, t, this._query);
14901
+ return new Ac(this.firestore, t, this._query);
14902
14902
  }
14903
14903
  }
14904
14904
 
14905
14905
  /**
14906
14906
  * A `CollectionReference` object can be used for adding documents, getting
14907
14907
  * document references, and querying for documents (using {@link query}).
14908
- */ class Ra extends Aa {
14908
+ */ class Rc extends Ac {
14909
14909
  /** @hideconstructor */
14910
14910
  constructor(t, e, n) {
14911
14911
  super(t, e, we(n)), this._path = n,
@@ -14926,23 +14926,23 @@ function Ea(t, e, n, s = {}) {
14926
14926
  * subcollection. If this isn't a subcollection, the reference is null.
14927
14927
  */ get parent() {
14928
14928
  const t = this._path.popLast();
14929
- return t.isEmpty() ? null : new Ia(this.firestore,
14929
+ return t.isEmpty() ? null : new Ic(this.firestore,
14930
14930
  /* converter= */ null, new Pt(t));
14931
14931
  }
14932
14932
  withConverter(t) {
14933
- return new Ra(this.firestore, t, this._path);
14933
+ return new Rc(this.firestore, t, this._path);
14934
14934
  }
14935
14935
  }
14936
14936
 
14937
- function ba(t, e, ...n) {
14938
- if (t = getModularInstance(t), fa("collection", "path", e), t instanceof Ta) {
14937
+ function bc(t, e, ...n) {
14938
+ if (t = getModularInstance(t), fc("collection", "path", e), t instanceof Tc) {
14939
14939
  const s = ht.fromString(e, ...n);
14940
- return _a(s), new Ra(t, /* converter= */ null, s);
14940
+ return _c(s), new Rc(t, /* converter= */ null, s);
14941
14941
  }
14942
14942
  {
14943
- if (!(t instanceof Ia || t instanceof Ra)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
14943
+ if (!(t instanceof Ic || t instanceof Rc)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
14944
14944
  const s = t._path.child(ht.fromString(e, ...n));
14945
- return _a(s), new Ra(t.firestore,
14945
+ return _c(s), new Rc(t.firestore,
14946
14946
  /* converter= */ null, s);
14947
14947
  }
14948
14948
  }
@@ -14959,9 +14959,9 @@ function ba(t, e, ...n) {
14959
14959
  * collection or subcollection with this ID as the last segment of its path
14960
14960
  * will be included. Cannot contain a slash.
14961
14961
  * @returns The created `Query`.
14962
- */ function Pa(t, e) {
14963
- if (t = ga(t, Ta), fa("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new j(K.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
14964
- return new Aa(t,
14962
+ */ function Pc(t, e) {
14963
+ if (t = gc(t, Tc), fc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new j(K.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
14964
+ return new Ac(t,
14965
14965
  /* converter= */ null,
14966
14966
  /**
14967
14967
  * Creates a new Query for a collection group query that matches all documents
@@ -14972,19 +14972,19 @@ function ba(t, e, ...n) {
14972
14972
  }(e));
14973
14973
  }
14974
14974
 
14975
- function va(t, e, ...n) {
14975
+ function vc(t, e, ...n) {
14976
14976
  if (t = getModularInstance(t),
14977
14977
  // We allow omission of 'pathString' but explicitly prohibit passing in both
14978
14978
  // 'undefined' and 'null'.
14979
- 1 === arguments.length && (e = tt.I()), fa("doc", "path", e), t instanceof Ta) {
14979
+ 1 === arguments.length && (e = tt.I()), fc("doc", "path", e), t instanceof Tc) {
14980
14980
  const s = ht.fromString(e, ...n);
14981
- return wa(s), new Ia(t,
14981
+ return wc(s), new Ic(t,
14982
14982
  /* converter= */ null, new Pt(s));
14983
14983
  }
14984
14984
  {
14985
- if (!(t instanceof Ia || t instanceof Ra)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
14985
+ if (!(t instanceof Ic || t instanceof Rc)) throw new j(K.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
14986
14986
  const s = t._path.child(ht.fromString(e, ...n));
14987
- return wa(s), new Ia(t.firestore, t instanceof Ra ? t.converter : null, new Pt(s));
14987
+ return wc(s), new Ic(t.firestore, t instanceof Rc ? t.converter : null, new Pt(s));
14988
14988
  }
14989
14989
  }
14990
14990
 
@@ -14995,8 +14995,8 @@ function va(t, e, ...n) {
14995
14995
  * @param right - A reference to compare.
14996
14996
  * @returns true if the references point to the same location in the same
14997
14997
  * Firestore database.
14998
- */ function Va(t, e) {
14999
- return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Ia || t instanceof Ra) && (e instanceof Ia || e instanceof Ra) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
14998
+ */ function Vc(t, e) {
14999
+ return t = getModularInstance(t), e = getModularInstance(e), (t instanceof Ic || t instanceof Rc) && (e instanceof Ic || e instanceof Rc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
15000
15000
  }
15001
15001
 
15002
15002
  /**
@@ -15007,8 +15007,8 @@ function va(t, e, ...n) {
15007
15007
  * @param right - A `Query` to compare.
15008
15008
  * @returns true if the references point to the same location in the same
15009
15009
  * Firestore database.
15010
- */ function Sa(t, e) {
15011
- return t = getModularInstance(t), e = getModularInstance(e), t instanceof Aa && e instanceof Aa && (t.firestore === e.firestore && Ae(t._query, e._query) && t.converter === e.converter);
15010
+ */ function Sc(t, e) {
15011
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof Ac && e instanceof Ac && (t.firestore === e.firestore && Ae(t._query, e._query) && t.converter === e.converter);
15012
15012
  }
15013
15013
 
15014
15014
  /**
@@ -15026,42 +15026,42 @@ function va(t, e, ...n) {
15026
15026
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15027
15027
  * See the License for the specific language governing permissions and
15028
15028
  * limitations under the License.
15029
- */ class Da {
15029
+ */ class Dc {
15030
15030
  constructor() {
15031
15031
  // The last promise in the queue.
15032
- this._c = Promise.resolve(),
15032
+ this._a = Promise.resolve(),
15033
15033
  // A list of retryable operations. Retryable operations are run in order and
15034
15034
  // retried with backoff.
15035
- this.mc = [],
15035
+ this.ma = [],
15036
15036
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
15037
15037
  // be changed again.
15038
- this.gc = !1,
15038
+ this.ga = !1,
15039
15039
  // Operations scheduled to be queued in the future. Operations are
15040
15040
  // automatically removed after they are run or canceled.
15041
- this.yc = [],
15041
+ this.ya = [],
15042
15042
  // visible for testing
15043
- this.Tc = null,
15043
+ this.pa = null,
15044
15044
  // Flag set while there's an outstanding AsyncQueue operation, used for
15045
15045
  // assertion sanity-checks.
15046
- this.Ec = !1,
15046
+ this.Ta = !1,
15047
15047
  // Enabled during shutdown on Safari to prevent future access to IndexedDB.
15048
- this.Ic = !1,
15048
+ this.Ea = !1,
15049
15049
  // List of TimerIds to fast-forward delays for.
15050
- this.Ac = [],
15050
+ this.Ia = [],
15051
15051
  // Backoff timer used to schedule retries for retryable operations
15052
- this.ar = new Xr(this, "async_queue_retry" /* AsyncQueueRetry */),
15052
+ this.cr = new Xr(this, "async_queue_retry" /* AsyncQueueRetry */),
15053
15053
  // Visibility handler that triggers an immediate retry of all retryable
15054
15054
  // operations. Meant to speed up recovery when we regain file system access
15055
15055
  // after page comes into foreground.
15056
- this.Rc = () => {
15056
+ this.Aa = () => {
15057
15057
  const t = Jr();
15058
- t && $("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ar.tr();
15058
+ t && $("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.cr.tr();
15059
15059
  };
15060
15060
  const t = Jr();
15061
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Rc);
15061
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Aa);
15062
15062
  }
15063
15063
  get isShuttingDown() {
15064
- return this.gc;
15064
+ return this.ga;
15065
15065
  }
15066
15066
  /**
15067
15067
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -15071,44 +15071,44 @@ function va(t, e, ...n) {
15071
15071
  this.enqueue(t);
15072
15072
  }
15073
15073
  enqueueAndForgetEvenWhileRestricted(t) {
15074
- this.bc(),
15074
+ this.Ra(),
15075
15075
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
15076
- this.Pc(t);
15076
+ this.ba(t);
15077
15077
  }
15078
15078
  enterRestrictedMode(t) {
15079
- if (!this.gc) {
15080
- this.gc = !0, this.Ic = t || !1;
15079
+ if (!this.ga) {
15080
+ this.ga = !0, this.Ea = t || !1;
15081
15081
  const e = Jr();
15082
- e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Rc);
15082
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Aa);
15083
15083
  }
15084
15084
  }
15085
15085
  enqueue(t) {
15086
- if (this.bc(), this.gc)
15086
+ if (this.Ra(), this.ga)
15087
15087
  // Return a Promise which never resolves.
15088
15088
  return new Promise((() => {}));
15089
15089
  // Create a deferred Promise that we can return to the callee. This
15090
15090
  // allows us to return a "hanging Promise" only to the callee and still
15091
15091
  // advance the queue even when the operation is not run.
15092
15092
  const e = new Q;
15093
- return this.Pc((() => this.gc && this.Ic ? Promise.resolve() : (t().then(e.resolve, e.reject),
15093
+ return this.ba((() => this.ga && this.Ea ? Promise.resolve() : (t().then(e.resolve, e.reject),
15094
15094
  e.promise))).then((() => e.promise));
15095
15095
  }
15096
15096
  enqueueRetryable(t) {
15097
- this.enqueueAndForget((() => (this.mc.push(t), this.vc())));
15097
+ this.enqueueAndForget((() => (this.ma.push(t), this.Pa())));
15098
15098
  }
15099
15099
  /**
15100
15100
  * Runs the next operation from the retryable queue. If the operation fails,
15101
15101
  * reschedules with backoff.
15102
- */ async vc() {
15103
- if (0 !== this.mc.length) {
15102
+ */ async Pa() {
15103
+ if (0 !== this.ma.length) {
15104
15104
  try {
15105
- await this.mc[0](), this.mc.shift(), this.ar.reset();
15105
+ await this.ma[0](), this.ma.shift(), this.cr.reset();
15106
15106
  } catch (t) {
15107
15107
  if (!Hs(t)) throw t;
15108
15108
  // Failure will be handled by AsyncQueue
15109
15109
  $("AsyncQueue", "Operation failed with retryable error: " + t);
15110
15110
  }
15111
- this.mc.length > 0 &&
15111
+ this.ma.length > 0 &&
15112
15112
  // If there are additional operations, we re-schedule `retryNextOp()`.
15113
15113
  // This is necessary to run retryable operations that failed during
15114
15114
  // their initial attempt since we don't know whether they are already
@@ -15119,12 +15119,12 @@ function va(t, e, ...n) {
15119
15119
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
15120
15120
  // new backoff on every call, there is only ever a single additional
15121
15121
  // operation in the queue.
15122
- this.ar.Xi((() => this.vc()));
15122
+ this.cr.Xi((() => this.Pa()));
15123
15123
  }
15124
15124
  }
15125
- Pc(t) {
15126
- const e = this._c.then((() => (this.Ec = !0, t().catch((t => {
15127
- this.Tc = t, this.Ec = !1;
15125
+ ba(t) {
15126
+ const e = this._a.then((() => (this.Ta = !0, t().catch((t => {
15127
+ this.pa = t, this.Ta = !1;
15128
15128
  const e =
15129
15129
  /**
15130
15130
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -15156,38 +15156,38 @@ function va(t, e, ...n) {
15156
15156
  // all further attempts to chain (via .then) will just short-circuit
15157
15157
  // and return the rejected Promise.
15158
15158
  throw O("INTERNAL UNHANDLED ERROR: ", e), t;
15159
- })).then((t => (this.Ec = !1, t))))));
15160
- return this._c = e, e;
15159
+ })).then((t => (this.Ta = !1, t))))));
15160
+ return this._a = e, e;
15161
15161
  }
15162
15162
  enqueueAfterDelay(t, e, n) {
15163
- this.bc(),
15163
+ this.Ra(),
15164
15164
  // Fast-forward delays for timerIds that have been overriden.
15165
- this.Ac.indexOf(t) > -1 && (e = 0);
15166
- const s = xo.createAndSchedule(this, t, e, n, (t => this.Vc(t)));
15167
- return this.yc.push(s), s;
15165
+ this.Ia.indexOf(t) > -1 && (e = 0);
15166
+ const s = xo.createAndSchedule(this, t, e, n, (t => this.va(t)));
15167
+ return this.ya.push(s), s;
15168
15168
  }
15169
- bc() {
15170
- this.Tc && L();
15169
+ Ra() {
15170
+ this.pa && L();
15171
15171
  }
15172
15172
  verifyOperationInProgress() {}
15173
15173
  /**
15174
15174
  * Waits until all currently queued tasks are finished executing. Delayed
15175
15175
  * operations are not run.
15176
- */ async Sc() {
15176
+ */ async Va() {
15177
15177
  // Operations in the queue prior to draining may have enqueued additional
15178
15178
  // operations. Keep draining the queue until the tail is no longer advanced,
15179
15179
  // which indicates that no more new operations were enqueued and that all
15180
15180
  // operations were executed.
15181
15181
  let t;
15182
15182
  do {
15183
- t = this._c, await t;
15184
- } while (t !== this._c);
15183
+ t = this._a, await t;
15184
+ } while (t !== this._a);
15185
15185
  }
15186
15186
  /**
15187
15187
  * For Tests: Determine if a delayed operation with a particular TimerId
15188
15188
  * exists.
15189
- */ Dc(t) {
15190
- for (const e of this.yc) if (e.timerId === t) return !0;
15189
+ */ Sa(t) {
15190
+ for (const e of this.ya) if (e.timerId === t) return !0;
15191
15191
  return !1;
15192
15192
  }
15193
15193
  /**
@@ -15196,28 +15196,28 @@ function va(t, e, ...n) {
15196
15196
  * @param lastTimerId - Delayed operations up to and including this TimerId
15197
15197
  * will be drained. Pass TimerId.All to run all delayed operations.
15198
15198
  * @returns a Promise that resolves once all operations have been run.
15199
- */ Cc(t) {
15199
+ */ Da(t) {
15200
15200
  // Note that draining may generate more delayed ops, so we do that first.
15201
- return this.Sc().then((() => {
15201
+ return this.Va().then((() => {
15202
15202
  // Run ops in the same order they'd run if they ran naturally.
15203
- this.yc.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
15204
- for (const e of this.yc) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
15205
- return this.Sc();
15203
+ this.ya.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
15204
+ for (const e of this.ya) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
15205
+ return this.Va();
15206
15206
  }));
15207
15207
  }
15208
15208
  /**
15209
15209
  * For Tests: Skip all subsequent delays for a timer id.
15210
- */ Nc(t) {
15211
- this.Ac.push(t);
15210
+ */ Ca(t) {
15211
+ this.Ia.push(t);
15212
15212
  }
15213
- /** Called once a DelayedOperation is run or canceled. */ Vc(t) {
15213
+ /** Called once a DelayedOperation is run or canceled. */ va(t) {
15214
15214
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
15215
- const e = this.yc.indexOf(t);
15216
- this.yc.splice(e, 1);
15215
+ const e = this.ya.indexOf(t);
15216
+ this.ya.splice(e, 1);
15217
15217
  }
15218
15218
  }
15219
15219
 
15220
- function Ca(t) {
15220
+ function Cc(t) {
15221
15221
  /**
15222
15222
  * Returns true if obj is an object and contains at least one of the specified
15223
15223
  * methods.
@@ -15252,7 +15252,7 @@ function Ca(t) {
15252
15252
  */ (t, [ "next", "error", "complete" ]);
15253
15253
  }
15254
15254
 
15255
- class Na {
15255
+ class Nc {
15256
15256
  constructor() {
15257
15257
  this._progressObserver = {}, this._taskCompletionResolver = new Q, this._lastProgress = {
15258
15258
  taskState: "Running",
@@ -15336,27 +15336,27 @@ class Na {
15336
15336
  * See the License for the specific language governing permissions and
15337
15337
  * limitations under the License.
15338
15338
  */
15339
- /** DOMException error code constants. */ const xa = -1;
15339
+ /** DOMException error code constants. */ const xc = -1;
15340
15340
 
15341
15341
  /**
15342
15342
  * The Cloud Firestore service interface.
15343
15343
  *
15344
15344
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
15345
15345
  */
15346
- class ka extends Ta {
15346
+ class kc extends Tc {
15347
15347
  /** @hideconstructor */
15348
15348
  constructor(t, e) {
15349
15349
  super(t, e),
15350
15350
  /**
15351
15351
  * Whether it's a {@link Firestore} or Firestore Lite instance.
15352
15352
  */
15353
- this.type = "firestore", this._queue = new Da, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15353
+ this.type = "firestore", this._queue = new Dc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15354
15354
  }
15355
15355
  _terminate() {
15356
15356
  return this._firestoreClient ||
15357
15357
  // The client must be initialized to ensure that all subsequent API
15358
15358
  // usage throws an exception.
15359
- Ma(this), this._firestoreClient.terminate();
15359
+ Mc(this), this._firestoreClient.terminate();
15360
15360
  }
15361
15361
  }
15362
15362
 
@@ -15370,7 +15370,7 @@ class ka extends Ta {
15370
15370
  * be associated.
15371
15371
  * @param settings - A settings object to configure the {@link Firestore} instance.
15372
15372
  * @returns A newly initialized {@link Firestore} instance.
15373
- */ function $a(t, e) {
15373
+ */ function $c(t, e) {
15374
15374
  const n = _getProvider(t, "firestore");
15375
15375
  if (n.isInitialized()) {
15376
15376
  const t = n.getImmediate(), s = n.getOptions();
@@ -15391,22 +15391,22 @@ class ka extends Ta {
15391
15391
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
15392
15392
  * instance is associated with.
15393
15393
  * @returns The {@link Firestore} instance of the provided app.
15394
- */ function Oa(e = getApp()) {
15394
+ */ function Oc(e = getApp()) {
15395
15395
  return _getProvider(e, "firestore").getImmediate();
15396
15396
  }
15397
15397
 
15398
15398
  /**
15399
15399
  * @internal
15400
- */ function Fa(t) {
15401
- return t._firestoreClient || Ma(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15400
+ */ function Fc(t) {
15401
+ return t._firestoreClient || Mc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15402
15402
  }
15403
15403
 
15404
- function Ma(t) {
15404
+ function Mc(t) {
15405
15405
  var e;
15406
15406
  const n = t._freezeSettings(), s = function(t, e, n, s) {
15407
- return new ua(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15407
+ return new uc(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15408
15408
  }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
15409
- t._firestoreClient = new Kc(t._credentials, t._queue, s);
15409
+ t._firestoreClient = new Ka(t._credentials, t._queue, s);
15410
15410
  }
15411
15411
 
15412
15412
  /**
@@ -15431,10 +15431,10 @@ function Ma(t) {
15431
15431
  * @param persistenceSettings - Optional settings object to configure
15432
15432
  * persistence.
15433
15433
  * @returns A `Promise` that represents successfully enabling persistent storage.
15434
- */ function La(t, e) {
15435
- Ha(t = ga(t, ka));
15436
- const n = Fa(t), s = t._freezeSettings(), i = new Fc;
15437
- return Ua(n, i, new $c(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15434
+ */ function Lc(t, e) {
15435
+ Hc(t = gc(t, kc));
15436
+ const n = Fc(t), s = t._freezeSettings(), i = new Fa;
15437
+ return Uc(n, i, new $a(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15438
15438
  }
15439
15439
 
15440
15440
  /**
@@ -15458,10 +15458,10 @@ function Ma(t) {
15458
15458
  * @param firestore - The {@link Firestore} instance to enable persistence for.
15459
15459
  * @returns A `Promise` that represents successfully enabling persistent
15460
15460
  * storage.
15461
- */ function Ba(t) {
15462
- Ha(t = ga(t, ka));
15463
- const e = Fa(t), n = t._freezeSettings(), s = new Fc;
15464
- return Ua(e, s, new Oc(s, n.cacheSizeBytes));
15461
+ */ function Bc(t) {
15462
+ Hc(t = gc(t, kc));
15463
+ const e = Fc(t), n = t._freezeSettings(), s = new Fa;
15464
+ return Uc(e, s, new Oa(s, n.cacheSizeBytes));
15465
15465
  }
15466
15466
 
15467
15467
  /**
@@ -15469,11 +15469,11 @@ function Ma(t) {
15469
15469
  * If the operation fails with a recoverable error (see
15470
15470
  * `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
15471
15471
  * but the client remains usable.
15472
- */ function Ua(t, e, n) {
15472
+ */ function Uc(t, e, n) {
15473
15473
  const s = new Q;
15474
15474
  return t.asyncQueue.enqueue((async () => {
15475
15475
  try {
15476
- await jc(t, n), await Qc(t, e), s.resolve();
15476
+ await ja(t, n), await Qa(t, e), s.resolve();
15477
15477
  } catch (t) {
15478
15478
  if (!
15479
15479
  /**
@@ -15527,7 +15527,7 @@ function Ma(t) {
15527
15527
  })).then((() => s.promise));
15528
15528
  }
15529
15529
 
15530
- function qa(t) {
15530
+ function qc(t) {
15531
15531
  if (t._initialized && !t._terminated) throw new j(K.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
15532
15532
  const e = new Q;
15533
15533
  return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
@@ -15558,11 +15558,11 @@ function qa(t) {
15558
15558
  *
15559
15559
  * @returns A `Promise` which resolves when all currently pending writes have been
15560
15560
  * acknowledged by the backend.
15561
- */ function Ka(t) {
15561
+ */ function Kc(t) {
15562
15562
  return function(t) {
15563
15563
  const e = new Q;
15564
- return t.asyncQueue.enqueueAndForget((async () => lc(await Yc(t), e))), e.promise;
15565
- }(Fa(t = ga(t, ka)));
15564
+ return t.asyncQueue.enqueueAndForget((async () => la(await Ya(t), e))), e.promise;
15565
+ }(Fc(t = gc(t, kc)));
15566
15566
  }
15567
15567
 
15568
15568
  /**
@@ -15570,8 +15570,8 @@ function qa(t) {
15570
15570
  * call to {@link disableNetwork}.
15571
15571
  *
15572
15572
  * @returns A `Promise` that is resolved once the network has been enabled.
15573
- */ function ja(t) {
15574
- return Zc(Fa(t = ga(t, ka)));
15573
+ */ function jc(t) {
15574
+ return Za(Fc(t = gc(t, kc)));
15575
15575
  }
15576
15576
 
15577
15577
  /**
@@ -15581,8 +15581,8 @@ function qa(t) {
15581
15581
  * operations will be queued until the network is restored.
15582
15582
  *
15583
15583
  * @returns A `Promise` that is resolved once the network has been disabled.
15584
- */ function Qa(t) {
15585
- return ta(Fa(t = ga(t, ka)));
15584
+ */ function Qc(t) {
15585
+ return tc(Fc(t = gc(t, kc)));
15586
15586
  }
15587
15587
 
15588
15588
  /**
@@ -15606,7 +15606,7 @@ function qa(t) {
15606
15606
  *
15607
15607
  * @returns A `Promise` that is resolved when the instance has been successfully
15608
15608
  * terminated.
15609
- */ function Wa(t) {
15609
+ */ function Wc(t) {
15610
15610
  return _removeServiceInstance(t.app, "firestore"), t._delete();
15611
15611
  }
15612
15612
 
@@ -15620,9 +15620,9 @@ function qa(t) {
15620
15620
  * @returns
15621
15621
  * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
15622
15622
  * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
15623
- */ function Ga(t, e) {
15624
- const n = Fa(t = ga(t, ka)), s = new Na;
15625
- return ca(n, t._databaseId, e, s), s;
15623
+ */ function Gc(t, e) {
15624
+ const n = Fc(t = gc(t, kc)), s = new Nc;
15625
+ return ac(n, t._databaseId, e, s), s;
15626
15626
  }
15627
15627
 
15628
15628
  /**
@@ -15631,11 +15631,11 @@ function qa(t) {
15631
15631
  * The named queries are packaged into bundles on the server side (along
15632
15632
  * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
15633
15633
  * cache, use this method to extract a {@link Query} by name.
15634
- */ function za(t, e) {
15635
- return aa(Fa(t = ga(t, ka)), e).then((e => e ? new Aa(t, null, e.query) : null));
15634
+ */ function zc(t, e) {
15635
+ return cc(Fc(t = gc(t, kc)), e).then((e => e ? new Ac(t, null, e.query) : null));
15636
15636
  }
15637
15637
 
15638
- function Ha(t) {
15638
+ function Hc(t) {
15639
15639
  if (t._initialized || t._terminated) throw new j(K.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
15640
15640
  }
15641
15641
 
@@ -15679,7 +15679,7 @@ function Ha(t) {
15679
15679
  * Create a `FieldPath` by providing field names. If more than one field
15680
15680
  * name is provided, the path will point to a nested field in a document.
15681
15681
  */
15682
- class Ja {
15682
+ class Jc {
15683
15683
  /**
15684
15684
  * Creates a `FieldPath` from the provided field names. If more than one field
15685
15685
  * name is provided, the path will point to a nested field in a document.
@@ -15703,8 +15703,8 @@ class Ja {
15703
15703
  /**
15704
15704
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
15705
15705
  * It can be used in queries to sort or filter by the document ID.
15706
- */ function Ya() {
15707
- return new Ja("__name__");
15706
+ */ function Yc() {
15707
+ return new Jc("__name__");
15708
15708
  }
15709
15709
 
15710
15710
  /**
@@ -15725,7 +15725,7 @@ class Ja {
15725
15725
  */
15726
15726
  /**
15727
15727
  * An immutable object representing an array of bytes.
15728
- */ class Xa {
15728
+ */ class Xc {
15729
15729
  /** @hideconstructor */
15730
15730
  constructor(t) {
15731
15731
  this._byteString = t;
@@ -15737,7 +15737,7 @@ class Ja {
15737
15737
  * @param base64 - The Base64 string used to create the `Bytes` object.
15738
15738
  */ static fromBase64String(t) {
15739
15739
  try {
15740
- return new Xa(_t.fromBase64String(t));
15740
+ return new Xc(_t.fromBase64String(t));
15741
15741
  } catch (t) {
15742
15742
  throw new j(K.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t);
15743
15743
  }
@@ -15747,7 +15747,7 @@ class Ja {
15747
15747
  *
15748
15748
  * @param array - The Uint8Array used to create the `Bytes` object.
15749
15749
  */ static fromUint8Array(t) {
15750
- return new Xa(_t.fromUint8Array(t));
15750
+ return new Xc(_t.fromUint8Array(t));
15751
15751
  }
15752
15752
  /**
15753
15753
  * Returns the underlying bytes as a Base64-encoded string.
@@ -15799,7 +15799,7 @@ class Ja {
15799
15799
  /**
15800
15800
  * Sentinel values that can be used when writing document fields with `set()`
15801
15801
  * or `update()`.
15802
- */ class Za {
15802
+ */ class Zc {
15803
15803
  /**
15804
15804
  * @param _methodName - The public API endpoint that returns this class.
15805
15805
  * @hideconstructor
@@ -15953,55 +15953,55 @@ function iu(t) {
15953
15953
  this.settings = t, this.databaseId = e, this.N = n, this.ignoreUndefinedProperties = s,
15954
15954
  // Minor hack: If fieldTransforms is undefined, we assume this is an
15955
15955
  // external call and we need to validate the entire path.
15956
- void 0 === i && this.xc(), this.fieldTransforms = i || [], this.fieldMask = r || [];
15956
+ void 0 === i && this.Na(), this.fieldTransforms = i || [], this.fieldMask = r || [];
15957
15957
  }
15958
15958
  get path() {
15959
15959
  return this.settings.path;
15960
15960
  }
15961
- get kc() {
15962
- return this.settings.kc;
15961
+ get xa() {
15962
+ return this.settings.xa;
15963
15963
  }
15964
- /** Returns a new context with the specified settings overwritten. */ $c(t) {
15964
+ /** Returns a new context with the specified settings overwritten. */ ka(t) {
15965
15965
  return new ru(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.N, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
15966
15966
  }
15967
- Oc(t) {
15967
+ $a(t) {
15968
15968
  var e;
15969
- const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$c({
15969
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.ka({
15970
15970
  path: n,
15971
- Fc: !1
15971
+ Oa: !1
15972
15972
  });
15973
- return s.Mc(t), s;
15973
+ return s.Fa(t), s;
15974
15974
  }
15975
- Lc(t) {
15975
+ Ma(t) {
15976
15976
  var e;
15977
- const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$c({
15977
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.ka({
15978
15978
  path: n,
15979
- Fc: !1
15979
+ Oa: !1
15980
15980
  });
15981
- return s.xc(), s;
15981
+ return s.Na(), s;
15982
15982
  }
15983
- Bc(t) {
15983
+ La(t) {
15984
15984
  // TODO(b/34871131): We don't support array paths right now; so make path
15985
15985
  // undefined.
15986
- return this.$c({
15986
+ return this.ka({
15987
15987
  path: void 0,
15988
- Fc: !0
15988
+ Oa: !0
15989
15989
  });
15990
15990
  }
15991
- Uc(t) {
15992
- return bu(t, this.settings.methodName, this.settings.qc || !1, this.path, this.settings.Kc);
15991
+ Ba(t) {
15992
+ return bu(t, this.settings.methodName, this.settings.Ua || !1, this.path, this.settings.qa);
15993
15993
  }
15994
15994
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
15995
15995
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
15996
15996
  }
15997
- xc() {
15997
+ Na() {
15998
15998
  // TODO(b/34871131): Remove null check once we have proper paths for fields
15999
15999
  // within arrays.
16000
- if (this.path) for (let t = 0; t < this.path.length; t++) this.Mc(this.path.get(t));
16000
+ if (this.path) for (let t = 0; t < this.path.length; t++) this.Fa(this.path.get(t));
16001
16001
  }
16002
- Mc(t) {
16003
- if (0 === t.length) throw this.Uc("Document fields must not be empty");
16004
- if (iu(this.kc) && eu.test(t)) throw this.Uc('Document fields cannot begin and end with "__"');
16002
+ Fa(t) {
16003
+ if (0 === t.length) throw this.Ba("Document fields must not be empty");
16004
+ if (iu(this.xa) && eu.test(t)) throw this.Ba('Document fields cannot begin and end with "__"');
16005
16005
  }
16006
16006
  }
16007
16007
 
@@ -16012,43 +16012,43 @@ function iu(t) {
16012
16012
  constructor(t, e, n) {
16013
16013
  this.databaseId = t, this.ignoreUndefinedProperties = e, this.N = n || Yr(t);
16014
16014
  }
16015
- /** Creates a new top-level parse context. */ jc(t, e, n, s = !1) {
16015
+ /** Creates a new top-level parse context. */ Ka(t, e, n, s = !1) {
16016
16016
  return new ru({
16017
- kc: t,
16017
+ xa: t,
16018
16018
  methodName: e,
16019
- Kc: n,
16019
+ qa: n,
16020
16020
  path: ft.emptyPath(),
16021
- Fc: !1,
16022
- qc: s
16021
+ Oa: !1,
16022
+ Ua: s
16023
16023
  }, this.databaseId, this.N, this.ignoreUndefinedProperties);
16024
16024
  }
16025
16025
  }
16026
16026
 
16027
- function cu(t) {
16027
+ function au(t) {
16028
16028
  const e = t._freezeSettings(), n = Yr(t._databaseId);
16029
16029
  return new ou(t._databaseId, !!e.ignoreUndefinedProperties, n);
16030
16030
  }
16031
16031
 
16032
- /** Parse document data from a set() call. */ function au(t, e, n, s, i, r = {}) {
16033
- const o = t.jc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
16032
+ /** Parse document data from a set() call. */ function cu(t, e, n, s, i, r = {}) {
16033
+ const o = t.Ka(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
16034
16034
  Eu("Data must be an object, but it was:", o, s);
16035
- const c = pu(s, o);
16036
- let a, u;
16037
- if (r.merge) a = new dt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
16035
+ const a = pu(s, o);
16036
+ let c, u;
16037
+ if (r.merge) c = new dt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
16038
16038
  const t = [];
16039
16039
  for (const s of r.mergeFields) {
16040
16040
  const i = Iu(e, s, n);
16041
16041
  if (!o.contains(i)) throw new j(K.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
16042
16042
  Pu(t, i) || t.push(i);
16043
16043
  }
16044
- a = new dt(t), u = o.fieldTransforms.filter((t => a.covers(t.field)));
16045
- } else a = null, u = o.fieldTransforms;
16046
- return new nu(new Ut(c), a, u);
16044
+ c = new dt(t), u = o.fieldTransforms.filter((t => c.covers(t.field)));
16045
+ } else c = null, u = o.fieldTransforms;
16046
+ return new nu(new Ut(a), c, u);
16047
16047
  }
16048
16048
 
16049
- class uu extends Za {
16049
+ class uu extends Zc {
16050
16050
  _toFieldTransform(t) {
16051
- if (2 /* MergeSet */ !== t.kc) throw 1 /* Update */ === t.kc ? t.Uc(`${this._methodName}() can only appear at the top level of your update data`) : t.Uc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
16051
+ if (2 /* MergeSet */ !== t.xa) throw 1 /* Update */ === t.xa ? t.Ba(`${this._methodName}() can only appear at the top level of your update data`) : t.Ba(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
16052
16052
  // No transform to add for a delete, but we need to add it to our
16053
16053
  // fieldMask so it gets deleted.
16054
16054
  return t.fieldMask.push(t.path), null;
@@ -16075,14 +16075,14 @@ class uu extends Za {
16075
16075
  * @param arrayElement - Whether or not the FieldValue has an array.
16076
16076
  */ function hu(t, e, n) {
16077
16077
  return new ru({
16078
- kc: 3 /* Argument */ ,
16079
- Kc: e.settings.Kc,
16078
+ xa: 3 /* Argument */ ,
16079
+ qa: e.settings.qa,
16080
16080
  methodName: t._methodName,
16081
- Fc: n
16081
+ Oa: n
16082
16082
  }, e.databaseId, e.N, e.ignoreUndefinedProperties);
16083
16083
  }
16084
16084
 
16085
- class lu extends Za {
16085
+ class lu extends Zc {
16086
16086
  _toFieldTransform(t) {
16087
16087
  return new je(t.path, new Oe);
16088
16088
  }
@@ -16091,13 +16091,13 @@ class lu extends Za {
16091
16091
  }
16092
16092
  }
16093
16093
 
16094
- class fu extends Za {
16094
+ class fu extends Zc {
16095
16095
  constructor(t, e) {
16096
- super(t), this.Qc = e;
16096
+ super(t), this.ja = e;
16097
16097
  }
16098
16098
  _toFieldTransform(t) {
16099
16099
  const e = hu(this, t,
16100
- /*array=*/ !0), n = this.Qc.map((t => yu(t, e))), s = new Fe(n);
16100
+ /*array=*/ !0), n = this.ja.map((t => yu(t, e))), s = new Fe(n);
16101
16101
  return new je(t.path, s);
16102
16102
  }
16103
16103
  isEqual(t) {
@@ -16106,13 +16106,13 @@ class fu extends Za {
16106
16106
  }
16107
16107
  }
16108
16108
 
16109
- class du extends Za {
16109
+ class du extends Zc {
16110
16110
  constructor(t, e) {
16111
- super(t), this.Qc = e;
16111
+ super(t), this.ja = e;
16112
16112
  }
16113
16113
  _toFieldTransform(t) {
16114
16114
  const e = hu(this, t,
16115
- /*array=*/ !0), n = this.Qc.map((t => yu(t, e))), s = new Le(n);
16115
+ /*array=*/ !0), n = this.ja.map((t => yu(t, e))), s = new Le(n);
16116
16116
  return new je(t.path, s);
16117
16117
  }
16118
16118
  isEqual(t) {
@@ -16121,12 +16121,12 @@ class du extends Za {
16121
16121
  }
16122
16122
  }
16123
16123
 
16124
- class wu extends Za {
16124
+ class wu extends Zc {
16125
16125
  constructor(t, e) {
16126
- super(t), this.Wc = e;
16126
+ super(t), this.Qa = e;
16127
16127
  }
16128
16128
  _toFieldTransform(t) {
16129
- const e = new Ue(t.N, Ce(t.N, this.Wc));
16129
+ const e = new Ue(t.N, Ce(t.N, this.Qa));
16130
16130
  return new je(t.path, e);
16131
16131
  }
16132
16132
  isEqual(t) {
@@ -16136,40 +16136,40 @@ class wu extends Za {
16136
16136
  }
16137
16137
 
16138
16138
  /** Parse update data from an update() call. */ function _u(t, e, n, s) {
16139
- const i = t.jc(1 /* Update */ , e, n);
16139
+ const i = t.Ka(1 /* Update */ , e, n);
16140
16140
  Eu("Data must be an object, but it was:", i, s);
16141
16141
  const r = [], o = Ut.empty();
16142
- ct(s, ((t, s) => {
16143
- const c = Ru(e, t, n);
16142
+ at(s, ((t, s) => {
16143
+ const a = Ru(e, t, n);
16144
16144
  // For Compat types, we have to "extract" the underlying types before
16145
16145
  // performing validation.
16146
16146
  s = getModularInstance(s);
16147
- const a = i.Lc(c);
16147
+ const c = i.Ma(a);
16148
16148
  if (s instanceof uu)
16149
16149
  // Add it to the field mask, but don't add anything to updateData.
16150
- r.push(c); else {
16151
- const t = yu(s, a);
16152
- null != t && (r.push(c), o.set(c, t));
16150
+ r.push(a); else {
16151
+ const t = yu(s, c);
16152
+ null != t && (r.push(a), o.set(a, t));
16153
16153
  }
16154
16154
  }));
16155
- const c = new dt(r);
16156
- return new su(o, c, i.fieldTransforms);
16155
+ const a = new dt(r);
16156
+ return new su(o, a, i.fieldTransforms);
16157
16157
  }
16158
16158
 
16159
16159
  /** Parse update data from a list of field/value arguments. */ function mu(t, e, n, s, i, r) {
16160
- const o = t.jc(1 /* Update */ , e, n), c = [ Iu(e, s, n) ], a = [ i ];
16160
+ const o = t.Ka(1 /* Update */ , e, n), a = [ Iu(e, s, n) ], c = [ i ];
16161
16161
  if (r.length % 2 != 0) throw new j(K.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
16162
- for (let t = 0; t < r.length; t += 2) c.push(Iu(e, r[t])), a.push(r[t + 1]);
16162
+ for (let t = 0; t < r.length; t += 2) a.push(Iu(e, r[t])), c.push(r[t + 1]);
16163
16163
  const u = [], h = Ut.empty();
16164
16164
  // We iterate in reverse order to pick the last value for a field if the
16165
16165
  // user specified the field multiple times.
16166
- for (let t = c.length - 1; t >= 0; --t) if (!Pu(u, c[t])) {
16167
- const e = c[t];
16168
- let n = a[t];
16166
+ for (let t = a.length - 1; t >= 0; --t) if (!Pu(u, a[t])) {
16167
+ const e = a[t];
16168
+ let n = c[t];
16169
16169
  // For Compat types, we have to "extract" the underlying types before
16170
16170
  // performing validation.
16171
16171
  n = getModularInstance(n);
16172
- const s = o.Lc(e);
16172
+ const s = o.Ma(e);
16173
16173
  if (n instanceof uu)
16174
16174
  // Add it to the field mask, but don't add anything to updateData.
16175
16175
  u.push(e); else {
@@ -16188,7 +16188,7 @@ class wu extends Za {
16188
16188
  * @param allowArrays - Whether the query value is an array that may directly
16189
16189
  * contain additional arrays (e.g. the operand of an `in` query).
16190
16190
  */ function gu(t, e, n, s = !1) {
16191
- return yu(n, t.jc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16191
+ return yu(n, t.Ka(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16192
16192
  }
16193
16193
 
16194
16194
  /**
@@ -16204,7 +16204,7 @@ class wu extends Za {
16204
16204
  // Unwrap the API type from the Compat SDK. This will return the API type
16205
16205
  // from firestore-exp.
16206
16206
  t = getModularInstance(t))) return Eu("Unsupported field value:", e, t), pu(t, e);
16207
- if (t instanceof Za)
16207
+ if (t instanceof Zc)
16208
16208
  // FieldValues usually parse into transforms (except FieldValue.delete())
16209
16209
  // in which case we do not want to include this field in our parsed data
16210
16210
  // (as doing so will overwrite the field directly prior to the transform
@@ -16216,8 +16216,8 @@ class wu extends Za {
16216
16216
  */
16217
16217
  return function(t, e) {
16218
16218
  // Sentinels are only supported with writes, and not within arrays.
16219
- if (!iu(e.kc)) throw e.Uc(`${t._methodName}() can only be used with update() and set()`);
16220
- if (!e.path) throw e.Uc(`${t._methodName}() is not currently supported inside arrays`);
16219
+ if (!iu(e.xa)) throw e.Ba(`${t._methodName}() can only be used with update() and set()`);
16220
+ if (!e.path) throw e.Ba(`${t._methodName}() is not currently supported inside arrays`);
16221
16221
  const n = t._toFieldTransform(e);
16222
16222
  n && e.fieldTransforms.push(n);
16223
16223
  }
@@ -16241,12 +16241,12 @@ class wu extends Za {
16241
16241
  // the set of values to be included for the IN query) that may directly
16242
16242
  // contain additional arrays (each representing an individual field
16243
16243
  // value), so we disable this validation.
16244
- if (e.settings.Fc && 4 /* ArrayArgument */ !== e.kc) throw e.Uc("Nested arrays are not supported");
16244
+ if (e.settings.Oa && 4 /* ArrayArgument */ !== e.xa) throw e.Ba("Nested arrays are not supported");
16245
16245
  return function(t, e) {
16246
16246
  const n = [];
16247
16247
  let s = 0;
16248
16248
  for (const i of t) {
16249
- let t = yu(i, e.Bc(s));
16249
+ let t = yu(i, e.La(s));
16250
16250
  null == t && (
16251
16251
  // Just include nulls in the array for fields being replaced with a
16252
16252
  // sentinel.
@@ -16293,17 +16293,17 @@ class wu extends Za {
16293
16293
  longitude: t.longitude
16294
16294
  }
16295
16295
  };
16296
- if (t instanceof Xa) return {
16296
+ if (t instanceof Xc) return {
16297
16297
  bytesValue: qn(e.N, t._byteString)
16298
16298
  };
16299
- if (t instanceof Ia) {
16299
+ if (t instanceof Ic) {
16300
16300
  const n = e.databaseId, s = t.firestore._databaseId;
16301
- if (!s.isEqual(n)) throw e.Uc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
16301
+ if (!s.isEqual(n)) throw e.Ba(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
16302
16302
  return {
16303
16303
  referenceValue: Qn(t.firestore._databaseId || e.databaseId, t._key.path)
16304
16304
  };
16305
16305
  }
16306
- throw e.Uc(`Unsupported field value: ${ma(t)}`);
16306
+ throw e.Ba(`Unsupported field value: ${mc(t)}`);
16307
16307
  }
16308
16308
  /**
16309
16309
  * Checks whether an object looks like a JSON object that should be converted
@@ -16316,11 +16316,11 @@ class wu extends Za {
16316
16316
 
16317
16317
  function pu(t, e) {
16318
16318
  const n = {};
16319
- return at(t) ?
16319
+ return ct(t) ?
16320
16320
  // If we encounter an empty object, we explicitly add it to the update
16321
16321
  // mask to ensure that the server creates a map entry.
16322
- e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ct(t, ((t, s) => {
16323
- const i = yu(s, e.Oc(t));
16322
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path) : at(t, ((t, s) => {
16323
+ const i = yu(s, e.$a(t));
16324
16324
  null != i && (n[t] = i);
16325
16325
  })), {
16326
16326
  mapValue: {
@@ -16330,15 +16330,15 @@ function pu(t, e) {
16330
16330
  }
16331
16331
 
16332
16332
  function Tu(t) {
16333
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof it || t instanceof tu || t instanceof Xa || t instanceof Ia || t instanceof Za);
16333
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof it || t instanceof tu || t instanceof Xc || t instanceof Ic || t instanceof Zc);
16334
16334
  }
16335
16335
 
16336
16336
  function Eu(t, e, n) {
16337
16337
  if (!Tu(n) || !function(t) {
16338
16338
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
16339
16339
  }(n)) {
16340
- const s = ma(n);
16341
- throw "an object" === s ? e.Uc(t + " a custom object") : e.Uc(t + " " + s);
16340
+ const s = mc(n);
16341
+ throw "an object" === s ? e.Ba(t + " a custom object") : e.Ba(t + " " + s);
16342
16342
  }
16343
16343
  }
16344
16344
 
@@ -16348,7 +16348,7 @@ function Eu(t, e, n) {
16348
16348
  if ((
16349
16349
  // If required, replace the FieldPath Compat class with with the firestore-exp
16350
16350
  // FieldPath.
16351
- e = getModularInstance(e)) instanceof Ja) return e._internalPath;
16351
+ e = getModularInstance(e)) instanceof Jc) return e._internalPath;
16352
16352
  if ("string" == typeof e) return Ru(t, e);
16353
16353
  throw bu("Field path arguments must be of type string or FieldPath.", t,
16354
16354
  /* hasConverter= */ !1,
@@ -16372,7 +16372,7 @@ function Eu(t, e, n) {
16372
16372
  /* hasConverter= */ !1,
16373
16373
  /* path= */ void 0, n);
16374
16374
  try {
16375
- return new Ja(...e.split("."))._internalPath;
16375
+ return new Jc(...e.split("."))._internalPath;
16376
16376
  } catch (s) {
16377
16377
  throw bu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
16378
16378
  /* hasConverter= */ !1,
@@ -16382,11 +16382,11 @@ function Eu(t, e, n) {
16382
16382
 
16383
16383
  function bu(t, e, n, s, i) {
16384
16384
  const r = s && !s.isEmpty(), o = void 0 !== i;
16385
- let c = `Function ${e}() called with invalid data`;
16386
- n && (c += " (via `toFirestore()`)"), c += ". ";
16387
- let a = "";
16388
- return (r || o) && (a += " (found", r && (a += ` in field ${s}`), o && (a += ` in document ${i}`),
16389
- a += ")"), new j(K.INVALID_ARGUMENT, c + t + a);
16385
+ let a = `Function ${e}() called with invalid data`;
16386
+ n && (a += " (via `toFirestore()`)"), a += ". ";
16387
+ let c = "";
16388
+ return (r || o) && (c += " (found", r && (c += ` in field ${s}`), o && (c += ` in document ${i}`),
16389
+ c += ")"), new j(K.INVALID_ARGUMENT, a + t + c);
16390
16390
  }
16391
16391
 
16392
16392
  /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Pu(t, e) {
@@ -16433,7 +16433,7 @@ function bu(t, e, n, s, i) {
16433
16433
  /**
16434
16434
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
16435
16435
  */ get ref() {
16436
- return new Ia(this._firestore, this._converter, this._key);
16436
+ return new Ic(this._firestore, this._converter, this._key);
16437
16437
  }
16438
16438
  /**
16439
16439
  * Signals whether or not the document at the snapshot's location exists.
@@ -16504,7 +16504,7 @@ function bu(t, e, n, s, i) {
16504
16504
  /**
16505
16505
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
16506
16506
  */ function Su(t, e) {
16507
- return "string" == typeof e ? Ru(t, e) : e instanceof Ja ? e._internalPath : e._delegate._internalPath;
16507
+ return "string" == typeof e ? Ru(t, e) : e instanceof Jc ? e._internalPath : e._delegate._internalPath;
16508
16508
  }
16509
16509
 
16510
16510
  /**
@@ -16741,7 +16741,7 @@ function ku(t) {
16741
16741
  * @param right - A snapshot to compare.
16742
16742
  * @returns true if the snapshots are equal.
16743
16743
  */ function $u(t, e) {
16744
- return t instanceof Cu && e instanceof Cu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof xu && e instanceof xu && (t._firestore === e._firestore && Sa(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16744
+ return t instanceof Cu && e instanceof Cu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof xu && e instanceof xu && (t._firestore === e._firestore && Sc(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16745
16745
  }
16746
16746
 
16747
16747
  /**
@@ -16787,27 +16787,27 @@ function ku(t) {
16787
16787
 
16788
16788
  class Lu extends Fu {
16789
16789
  constructor(t, e, n) {
16790
- super(), this.Gc = t, this.zc = e, this.Hc = n, this.type = "where";
16790
+ super(), this.Wa = t, this.Ga = e, this.za = n, this.type = "where";
16791
16791
  }
16792
16792
  _apply(t) {
16793
- const e = cu(t.firestore), n = function(t, e, n, s, i, r, o) {
16794
- let c;
16793
+ const e = au(t.firestore), n = function(t, e, n, s, i, r, o) {
16794
+ let a;
16795
16795
  if (i.isKeyField()) {
16796
16796
  if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new j(K.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on FieldPath.documentId().`);
16797
16797
  if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
16798
16798
  th(o, r);
16799
16799
  const e = [];
16800
16800
  for (const n of o) e.push(Zu(s, t, n));
16801
- c = {
16801
+ a = {
16802
16802
  arrayValue: {
16803
16803
  values: e
16804
16804
  }
16805
16805
  };
16806
- } else c = Zu(s, t, o);
16806
+ } else a = Zu(s, t, o);
16807
16807
  } else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || th(o, r),
16808
- c = gu(n, e, o,
16808
+ a = gu(n, e, o,
16809
16809
  /* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
16810
- const a = Jt.create(i, r, c);
16810
+ const c = Jt.create(i, r, a);
16811
16811
  return function(t, e) {
16812
16812
  if (e.v()) {
16813
16813
  const n = ye(t);
@@ -16855,9 +16855,9 @@ class Lu extends Fu {
16855
16855
  if (null !== n)
16856
16856
  // Special case when it's a duplicate op to give a slightly clearer error message.
16857
16857
  throw n === e.op ? new j(K.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new j(K.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
16858
- }(t, a), a;
16859
- }(t._query, "where", e, t.firestore._databaseId, this.Gc, this.zc, this.Hc);
16860
- return new Aa(t.firestore, t.converter, function(t, e) {
16858
+ }(t, c), c;
16859
+ }(t._query, "where", e, t.firestore._databaseId, this.Wa, this.Ga, this.za);
16860
+ return new Ac(t.firestore, t.converter, function(t, e) {
16861
16861
  const n = t.filters.concat([ e ]);
16862
16862
  return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
16863
16863
  }(t._query, n));
@@ -16881,13 +16881,13 @@ class Lu extends Fu {
16881
16881
 
16882
16882
  class Uu extends Fu {
16883
16883
  constructor(t, e) {
16884
- super(), this.Gc = t, this.Jc = e, this.type = "orderBy";
16884
+ super(), this.Wa = t, this.Ha = e, this.type = "orderBy";
16885
16885
  }
16886
16886
  _apply(t) {
16887
16887
  const e = function(t, e, n) {
16888
16888
  if (null !== t.startAt) throw new j(K.INVALID_ARGUMENT, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
16889
16889
  if (null !== t.endAt) throw new j(K.INVALID_ARGUMENT, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
16890
- const s = new ae(e, n);
16890
+ const s = new ce(e, n);
16891
16891
  return function(t, e) {
16892
16892
  if (null === ge(t)) {
16893
16893
  // This is the first order by. It must match any inequality.
@@ -16906,8 +16906,8 @@ class Uu extends Fu {
16906
16906
  * Will throw if the document does not contain all fields of the order by
16907
16907
  * of the query or if any of the fields in the order by are an uncommitted
16908
16908
  * server timestamp.
16909
- */ (t._query, this.Gc, this.Jc);
16910
- return new Aa(t.firestore, t.converter, function(t, e) {
16909
+ */ (t._query, this.Wa, this.Ha);
16910
+ return new Ac(t.firestore, t.converter, function(t, e) {
16911
16911
  // TODO(dimond): validate that orderBy does not list the same key twice.
16912
16912
  const n = t.explicitOrderBy.concat([ e ]);
16913
16913
  return new fe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
@@ -16930,10 +16930,10 @@ class Uu extends Fu {
16930
16930
 
16931
16931
  class Ku extends Fu {
16932
16932
  constructor(t, e, n) {
16933
- super(), this.type = t, this.Yc = e, this.Xc = n;
16933
+ super(), this.type = t, this.Ja = e, this.Ya = n;
16934
16934
  }
16935
16935
  _apply(t) {
16936
- return new Aa(t.firestore, t.converter, Ie(t._query, this.Yc, this.Xc));
16936
+ return new Ac(t.firestore, t.converter, Ie(t._query, this.Ja, this.Ya));
16937
16937
  }
16938
16938
  }
16939
16939
 
@@ -16943,7 +16943,7 @@ class Ku extends Fu {
16943
16943
  * @param limit - The maximum number of items to return.
16944
16944
  * @returns The created {@link Query}.
16945
16945
  */ function ju(t) {
16946
- return ya("limit", t), new Ku("limit", t, "F" /* First */);
16946
+ return yc("limit", t), new Ku("limit", t, "F" /* First */);
16947
16947
  }
16948
16948
 
16949
16949
  /**
@@ -16955,16 +16955,16 @@ class Ku extends Fu {
16955
16955
  * @param limit - The maximum number of items to return.
16956
16956
  * @returns The created {@link Query}.
16957
16957
  */ function Qu(t) {
16958
- return ya("limitToLast", t), new Ku("limitToLast", t, "L" /* Last */);
16958
+ return yc("limitToLast", t), new Ku("limitToLast", t, "L" /* Last */);
16959
16959
  }
16960
16960
 
16961
16961
  class Wu extends Fu {
16962
16962
  constructor(t, e, n) {
16963
- super(), this.type = t, this.Zc = e, this.ta = n;
16963
+ super(), this.type = t, this.Xa = e, this.Za = n;
16964
16964
  }
16965
16965
  _apply(t) {
16966
- const e = Xu(t, this.type, this.Zc, this.ta);
16967
- return new Aa(t.firestore, t.converter, function(t, e) {
16966
+ const e = Xu(t, this.type, this.Xa, this.Za);
16967
+ return new Ac(t.firestore, t.converter, function(t, e) {
16968
16968
  return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
16969
16969
  }(t._query, e));
16970
16970
  }
@@ -16981,11 +16981,11 @@ function zu(...t) {
16981
16981
 
16982
16982
  class Hu extends Fu {
16983
16983
  constructor(t, e, n) {
16984
- super(), this.type = t, this.Zc = e, this.ta = n;
16984
+ super(), this.type = t, this.Xa = e, this.Za = n;
16985
16985
  }
16986
16986
  _apply(t) {
16987
- const e = Xu(t, this.type, this.Zc, this.ta);
16988
- return new Aa(t.firestore, t.converter, function(t, e) {
16987
+ const e = Xu(t, this.type, this.Xa, this.Za);
16988
+ return new Ac(t.firestore, t.converter, function(t, e) {
16989
16989
  return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
16990
16990
  }(t._query, e));
16991
16991
  }
@@ -17025,27 +17025,27 @@ function Yu(...t) {
17025
17025
  * Converts a list of field values to a `Bound` for the given query.
17026
17026
  */ (t._query, t.firestore._databaseId, e, n[0]._document, s);
17027
17027
  {
17028
- const i = cu(t.firestore);
17028
+ const i = au(t.firestore);
17029
17029
  return function(t, e, n, s, i, r) {
17030
17030
  // Use explicit order by's because it has to match the query the user made
17031
17031
  const o = t.explicitOrderBy;
17032
17032
  if (i.length > o.length) throw new j(K.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
17033
- const c = [];
17033
+ const a = [];
17034
17034
  for (let r = 0; r < i.length; r++) {
17035
- const a = i[r];
17035
+ const c = i[r];
17036
17036
  if (o[r].field.isKeyField()) {
17037
- if ("string" != typeof a) throw new j(K.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof a}`);
17038
- if (!pe(t) && -1 !== a.indexOf("/")) throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to ${s}() must be a plain document ID, but '${a}' contains a slash.`);
17039
- const n = t.path.child(ht.fromString(a));
17037
+ if ("string" != typeof c) throw new j(K.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof c}`);
17038
+ if (!pe(t) && -1 !== c.indexOf("/")) throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to ${s}() must be a plain document ID, but '${c}' contains a slash.`);
17039
+ const n = t.path.child(ht.fromString(c));
17040
17040
  if (!Pt.isDocumentKey(n)) throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to ${s}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
17041
17041
  const i = new Pt(n);
17042
- c.push(kt(e, i));
17042
+ a.push(kt(e, i));
17043
17043
  } else {
17044
- const t = gu(n, s, a);
17045
- c.push(t);
17044
+ const t = gu(n, s, c);
17045
+ a.push(t);
17046
17046
  }
17047
17047
  }
17048
- return new oe(c, r);
17048
+ return new oe(a, r);
17049
17049
  }
17050
17050
  /**
17051
17051
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -17063,8 +17063,8 @@ function Zu(t, e, n) {
17063
17063
  if (!Pt.isDocumentKey(s)) throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
17064
17064
  return kt(t, new Pt(s));
17065
17065
  }
17066
- if (n instanceof Ia) return kt(t, n._key);
17067
- throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${ma(n)}.`);
17066
+ if (n instanceof Ic) return kt(t, n._key);
17067
+ throw new j(K.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${mc(n)}.`);
17068
17068
  }
17069
17069
 
17070
17070
  /**
@@ -17142,7 +17142,7 @@ function eh(t, e, n) {
17142
17142
  }
17143
17143
  convertObject(t, e) {
17144
17144
  const n = {};
17145
- return ct(t.fields, ((t, s) => {
17145
+ return at(t.fields, ((t, s) => {
17146
17146
  n[t] = this.convertValue(s, e);
17147
17147
  })), n;
17148
17148
  }
@@ -17172,7 +17172,7 @@ function eh(t, e, n) {
17172
17172
  convertDocumentKey(t, e) {
17173
17173
  const n = ht.fromString(t);
17174
17174
  B(Ts(n));
17175
- const s = new ha(n.get(1), n.get(3)), i = new Pt(n.popFirst(5));
17175
+ const s = new hc(n.get(1), n.get(3)), i = new Pt(n.popFirst(5));
17176
17176
  return s.isEqual(e) ||
17177
17177
  // TODO(b/64130202): Somehow support foreign references.
17178
17178
  O(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
@@ -17218,11 +17218,11 @@ class ih extends nh {
17218
17218
  super(), this.firestore = t;
17219
17219
  }
17220
17220
  convertBytes(t) {
17221
- return new Xa(t);
17221
+ return new Xc(t);
17222
17222
  }
17223
17223
  convertReference(t) {
17224
17224
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17225
- return new Ia(this.firestore, /* converter= */ null, e);
17225
+ return new Ic(this.firestore, /* converter= */ null, e);
17226
17226
  }
17227
17227
  }
17228
17228
 
@@ -17253,11 +17253,11 @@ class ih extends nh {
17253
17253
  /** @hideconstructor */
17254
17254
  constructor(t, e) {
17255
17255
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
17256
- this._dataReader = cu(t);
17256
+ this._dataReader = au(t);
17257
17257
  }
17258
17258
  set(t, e, n) {
17259
17259
  this._verifyNotCommitted();
17260
- const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = au(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
17260
+ const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = cu(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
17261
17261
  return this._mutations.push(r.toMutation(s._key, Ge.none())), this;
17262
17262
  }
17263
17263
  update(t, e, n, ...s) {
@@ -17266,7 +17266,7 @@ class ih extends nh {
17266
17266
  // For Compat types, we have to "extract" the underlying types before
17267
17267
  // performing validation.
17268
17268
  let r;
17269
- return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Ja ? mu(this._dataReader, "WriteBatch.update", i._key, e, n, s) : _u(this._dataReader, "WriteBatch.update", i._key, e),
17269
+ return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Jc ? mu(this._dataReader, "WriteBatch.update", i._key, e, n, s) : _u(this._dataReader, "WriteBatch.update", i._key, e),
17270
17270
  this._mutations.push(r.toMutation(i._key, Ge.exists(!0))), this;
17271
17271
  }
17272
17272
  /**
@@ -17277,7 +17277,7 @@ class ih extends nh {
17277
17277
  */ delete(t) {
17278
17278
  this._verifyNotCommitted();
17279
17279
  const e = oh(t, this._firestore);
17280
- return this._mutations = this._mutations.concat(new cn(e._key, Ge.none())), this;
17280
+ return this._mutations = this._mutations.concat(new an(e._key, Ge.none())), this;
17281
17281
  }
17282
17282
  /**
17283
17283
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -17356,22 +17356,22 @@ function oh(t, e) {
17356
17356
  * @returns A Promise resolved with a `DocumentSnapshot` containing the
17357
17357
  * current document contents.
17358
17358
  */
17359
- function ch(t) {
17360
- t = ga(t, Ia);
17361
- const e = ga(t.firestore, ka);
17362
- return na(Fa(e), t._key).then((n => Eh(e, t, n)));
17359
+ function ah(t) {
17360
+ t = gc(t, Ic);
17361
+ const e = gc(t.firestore, kc);
17362
+ return nc(Fc(e), t._key).then((n => Eh(e, t, n)));
17363
17363
  }
17364
17364
 
17365
- class ah extends nh {
17365
+ class ch extends nh {
17366
17366
  constructor(t) {
17367
17367
  super(), this.firestore = t;
17368
17368
  }
17369
17369
  convertBytes(t) {
17370
- return new Xa(t);
17370
+ return new Xc(t);
17371
17371
  }
17372
17372
  convertReference(t) {
17373
17373
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17374
- return new Ia(this.firestore, /* converter= */ null, e);
17374
+ return new Ic(this.firestore, /* converter= */ null, e);
17375
17375
  }
17376
17376
  }
17377
17377
 
@@ -17382,9 +17382,9 @@ class ah extends nh {
17382
17382
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17383
17383
  * current document contents.
17384
17384
  */ function uh(t) {
17385
- t = ga(t, Ia);
17386
- const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
17387
- return ea(n, t._key).then((n => new Cu(e, s, t._key, n, new Du(null !== n && n.hasLocalMutations,
17385
+ t = gc(t, Ic);
17386
+ const e = gc(t.firestore, kc), n = Fc(e), s = new ch(e);
17387
+ return ec(n, t._key).then((n => new Cu(e, s, t._key, n, new Du(null !== n && n.hasLocalMutations,
17388
17388
  /* fromCache= */ !0), t.converter)));
17389
17389
  }
17390
17390
 
@@ -17395,9 +17395,9 @@ class ah extends nh {
17395
17395
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17396
17396
  * current document contents.
17397
17397
  */ function hh(t) {
17398
- t = ga(t, Ia);
17399
- const e = ga(t.firestore, ka);
17400
- return na(Fa(e), t._key, {
17398
+ t = gc(t, Ic);
17399
+ const e = gc(t.firestore, kc);
17400
+ return nc(Fc(e), t._key, {
17401
17401
  source: "server"
17402
17402
  }).then((n => Eh(e, t, n)));
17403
17403
  }
@@ -17412,9 +17412,9 @@ class ah extends nh {
17412
17412
  *
17413
17413
  * @returns A `Promise` that will be resolved with the results of the query.
17414
17414
  */ function lh(t) {
17415
- t = ga(t, Aa);
17416
- const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
17417
- return Ou(t._query), ia(n, t._query).then((n => new xu(e, s, t, n)));
17415
+ t = gc(t, Ac);
17416
+ const e = gc(t.firestore, kc), n = Fc(e), s = new ch(e);
17417
+ return Ou(t._query), ic(n, t._query).then((n => new xu(e, s, t, n)));
17418
17418
  }
17419
17419
 
17420
17420
  /**
@@ -17423,9 +17423,9 @@ class ah extends nh {
17423
17423
  *
17424
17424
  * @returns A `Promise` that will be resolved with the results of the query.
17425
17425
  */ function fh(t) {
17426
- t = ga(t, Aa);
17427
- const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
17428
- return sa(n, t._query).then((n => new xu(e, s, t, n)));
17426
+ t = gc(t, Ac);
17427
+ const e = gc(t.firestore, kc), n = Fc(e), s = new ch(e);
17428
+ return sc(n, t._query).then((n => new xu(e, s, t, n)));
17429
17429
  }
17430
17430
 
17431
17431
  /**
@@ -17434,27 +17434,27 @@ class ah extends nh {
17434
17434
  *
17435
17435
  * @returns A `Promise` that will be resolved with the results of the query.
17436
17436
  */ function dh(t) {
17437
- t = ga(t, Aa);
17438
- const e = ga(t.firestore, ka), n = Fa(e), s = new ah(e);
17439
- return ia(n, t._query, {
17437
+ t = gc(t, Ac);
17438
+ const e = gc(t.firestore, kc), n = Fc(e), s = new ch(e);
17439
+ return ic(n, t._query, {
17440
17440
  source: "server"
17441
17441
  }).then((n => new xu(e, s, t, n)));
17442
17442
  }
17443
17443
 
17444
17444
  function wh(t, e, n) {
17445
- t = ga(t, Ia);
17446
- const s = ga(t.firestore, ka), i = sh(t.converter, e, n);
17447
- return Th(s, [ au(cu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ge.none()) ]);
17445
+ t = gc(t, Ic);
17446
+ const s = gc(t.firestore, kc), i = sh(t.converter, e, n);
17447
+ return Th(s, [ cu(au(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ge.none()) ]);
17448
17448
  }
17449
17449
 
17450
17450
  function _h(t, e, n, ...s) {
17451
- t = ga(t, Ia);
17452
- const i = ga(t.firestore, ka), r = cu(i);
17451
+ t = gc(t, Ic);
17452
+ const i = gc(t.firestore, kc), r = au(i);
17453
17453
  let o;
17454
17454
  o = "string" == typeof (
17455
17455
  // For Compat types, we have to "extract" the underlying types before
17456
17456
  // performing validation.
17457
- e = getModularInstance(e)) || e instanceof Ja ? mu(r, "updateDoc", t._key, e, n, s) : _u(r, "updateDoc", t._key, e);
17457
+ e = getModularInstance(e)) || e instanceof Jc ? mu(r, "updateDoc", t._key, e, n, s) : _u(r, "updateDoc", t._key, e);
17458
17458
  return Th(i, [ o.toMutation(t._key, Ge.exists(!0)) ]);
17459
17459
  }
17460
17460
 
@@ -17465,7 +17465,7 @@ function _h(t, e, n, ...s) {
17465
17465
  * @returns A Promise resolved once the document has been successfully
17466
17466
  * deleted from the backend (note that it won't resolve while you're offline).
17467
17467
  */ function mh(t) {
17468
- return Th(ga(t.firestore, ka), [ new cn(t._key, Ge.none()) ]);
17468
+ return Th(gc(t.firestore, kc), [ new an(t._key, Ge.none()) ]);
17469
17469
  }
17470
17470
 
17471
17471
  /**
@@ -17478,8 +17478,8 @@ function _h(t, e, n, ...s) {
17478
17478
  * newly created document after it has been written to the backend (Note that it
17479
17479
  * won't resolve while you're offline).
17480
17480
  */ function gh(t, e) {
17481
- const n = ga(t.firestore, ka), s = va(t), i = sh(t.converter, e);
17482
- return Th(n, [ au(cu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ge.exists(!1)) ]).then((() => s));
17481
+ const n = gc(t.firestore, kc), s = vc(t), i = sh(t.converter, e);
17482
+ return Th(n, [ cu(au(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ge.exists(!1)) ]).then((() => s));
17483
17483
  }
17484
17484
 
17485
17485
  function yh(t, ...e) {
@@ -17488,27 +17488,27 @@ function yh(t, ...e) {
17488
17488
  let r = {
17489
17489
  includeMetadataChanges: !1
17490
17490
  }, o = 0;
17491
- "object" != typeof e[o] || Ca(e[o]) || (r = e[o], o++);
17492
- const c = {
17491
+ "object" != typeof e[o] || Cc(e[o]) || (r = e[o], o++);
17492
+ const a = {
17493
17493
  includeMetadataChanges: r.includeMetadataChanges
17494
17494
  };
17495
- if (Ca(e[o])) {
17495
+ if (Cc(e[o])) {
17496
17496
  const t = e[o];
17497
17497
  e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
17498
17498
  e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
17499
17499
  }
17500
- let a, u, h;
17501
- if (t instanceof Ia) u = ga(t.firestore, ka), h = we(t._key.path), a = {
17500
+ let c, u, h;
17501
+ if (t instanceof Ic) u = gc(t.firestore, kc), h = we(t._key.path), c = {
17502
17502
  next: n => {
17503
17503
  e[o] && e[o](Eh(u, t, n));
17504
17504
  },
17505
17505
  error: e[o + 1],
17506
17506
  complete: e[o + 2]
17507
17507
  }; else {
17508
- const n = ga(t, Aa);
17509
- u = ga(n.firestore, ka), h = n._query;
17510
- const s = new ah(u);
17511
- a = {
17508
+ const n = gc(t, Ac);
17509
+ u = gc(n.firestore, kc), h = n._query;
17510
+ const s = new ch(u);
17511
+ c = {
17512
17512
  next: t => {
17513
17513
  e[o] && e[o](new xu(u, s, n, t));
17514
17514
  },
@@ -17517,15 +17517,15 @@ function yh(t, ...e) {
17517
17517
  }, Ou(t._query);
17518
17518
  }
17519
17519
  return function(t, e, n, s) {
17520
- const i = new Lc(s), r = new Qo(e, i, n);
17521
- return t.asyncQueue.enqueueAndForget((async () => Bo(await Xc(t), r))), () => {
17522
- i.ec(), t.asyncQueue.enqueueAndForget((async () => Uo(await Xc(t), r)));
17520
+ const i = new La(s), r = new Qo(e, i, n);
17521
+ return t.asyncQueue.enqueueAndForget((async () => Bo(await Xa(t), r))), () => {
17522
+ i.ea(), t.asyncQueue.enqueueAndForget((async () => Uo(await Xa(t), r)));
17523
17523
  };
17524
- }(Fa(u), h, c, a);
17524
+ }(Fc(u), h, a, c);
17525
17525
  }
17526
17526
 
17527
17527
  function ph(t, e) {
17528
- return ra(Fa(t = ga(t, ka)), Ca(e) ? e : {
17528
+ return rc(Fc(t = gc(t, kc)), Cc(e) ? e : {
17529
17529
  next: e
17530
17530
  });
17531
17531
  }
@@ -17536,15 +17536,15 @@ function ph(t, e) {
17536
17536
  */ function Th(t, e) {
17537
17537
  return function(t, e) {
17538
17538
  const n = new Q;
17539
- return t.asyncQueue.enqueueAndForget((async () => rc(await Yc(t), e, n))), n.promise;
17540
- }(Fa(t), e);
17539
+ return t.asyncQueue.enqueueAndForget((async () => ra(await Ya(t), e, n))), n.promise;
17540
+ }(Fc(t), e);
17541
17541
  }
17542
17542
 
17543
17543
  /**
17544
17544
  * Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
17545
17545
  * to a {@link DocumentSnapshot}.
17546
17546
  */ function Eh(t, e, n) {
17547
- const s = n.docs.get(e._key), i = new ah(t);
17547
+ const s = n.docs.get(e._key), i = new ch(t);
17548
17548
  return new Cu(t, i, e._key, s, new Du(n.hasPendingWrites, n.fromCache), e.converter);
17549
17549
  }
17550
17550
 
@@ -17573,7 +17573,7 @@ function ph(t, e) {
17573
17573
  */ class Ih extends class {
17574
17574
  /** @hideconstructor */
17575
17575
  constructor(t, e) {
17576
- this._firestore = t, this._transaction = e, this._dataReader = cu(t);
17576
+ this._firestore = t, this._transaction = e, this._dataReader = au(t);
17577
17577
  }
17578
17578
  /**
17579
17579
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -17591,7 +17591,7 @@ function ph(t, e) {
17591
17591
  }));
17592
17592
  }
17593
17593
  set(t, e, n) {
17594
- const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = au(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
17594
+ const s = oh(t, this._firestore), i = sh(s.converter, e, n), r = cu(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
17595
17595
  return this._transaction.set(s._key, r), this;
17596
17596
  }
17597
17597
  update(t, e, n, ...s) {
@@ -17599,7 +17599,7 @@ function ph(t, e) {
17599
17599
  // For Compat types, we have to "extract" the underlying types before
17600
17600
  // performing validation.
17601
17601
  let r;
17602
- return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Ja ? mu(this._dataReader, "Transaction.update", i._key, e, n, s) : _u(this._dataReader, "Transaction.update", i._key, e),
17602
+ return r = "string" == typeof (e = getModularInstance(e)) || e instanceof Jc ? mu(this._dataReader, "Transaction.update", i._key, e, n, s) : _u(this._dataReader, "Transaction.update", i._key, e),
17603
17603
  this._transaction.update(i._key, r), this;
17604
17604
  }
17605
17605
  /**
@@ -17624,7 +17624,7 @@ function ph(t, e) {
17624
17624
  * @param documentRef - A reference to the document to be read.
17625
17625
  * @returns A `DocumentSnapshot` with the read data.
17626
17626
  */ get(t) {
17627
- const e = oh(t, this._firestore), n = new ah(this._firestore);
17627
+ const e = oh(t, this._firestore), n = new ch(this._firestore);
17628
17628
  return super.get(t).then((t => new Cu(this._firestore, n, e._key, t._document, new Du(
17629
17629
  /* hasPendingWrites= */ !1,
17630
17630
  /* fromCache= */ !1), e.converter)));
@@ -17648,7 +17648,7 @@ function ph(t, e) {
17648
17648
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
17649
17649
  * rejected promise with the corresponding failure error is returned.
17650
17650
  */ function Ah(t, e) {
17651
- return oa(Fa(t = ga(t, ka)), (n => e(new Ih(t, n))));
17651
+ return oc(Fc(t = gc(t, kc)), (n => e(new Ih(t, n))));
17652
17652
  }
17653
17653
 
17654
17654
  /**
@@ -17763,7 +17763,7 @@ function ph(t, e) {
17763
17763
  * @returns A {@link WriteBatch} that can be used to atomically execute multiple
17764
17764
  * writes.
17765
17765
  */ function Sh(t) {
17766
- return Fa(t = ga(t, ka)), new rh(t, (e => Th(t, e)));
17766
+ return Fc(t = gc(t, kc)), new rh(t, (e => Th(t, e)));
17767
17767
  }
17768
17768
 
17769
17769
  /**
@@ -17774,14 +17774,14 @@ function ph(t, e) {
17774
17774
  !function(t) {
17775
17775
  C = t;
17776
17776
  }(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {options: n}) => {
17777
- const s = t.getProvider("app").getImmediate(), i = new ka(s, new H(t.getProvider("auth-internal")));
17777
+ const s = t.getProvider("app").getImmediate(), i = new kc(s, new H(t.getProvider("auth-internal")));
17778
17778
  return n = Object.assign({
17779
17779
  useFetchStreams: e
17780
17780
  }, n), i._setSettings(n), i;
17781
- }), "PUBLIC" /* PUBLIC */)), registerVersion(S, "3.2.1", t),
17781
+ }), "PUBLIC" /* PUBLIC */)), registerVersion(S, "3.3.0-canary.3a9435447", t),
17782
17782
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
17783
- registerVersion(S, "3.2.1", "esm2017");
17783
+ registerVersion(S, "3.3.0-canary.3a9435447", "esm2017");
17784
17784
  }();
17785
17785
 
17786
- export { nh as AbstractUserDataWriter, Xa as Bytes, xa as CACHE_SIZE_UNLIMITED, Ra as CollectionReference, Ia as DocumentReference, Cu as DocumentSnapshot, Ja as FieldPath, Za as FieldValue, ka as Firestore, j as FirestoreError, tu as GeoPoint, Na as LoadBundleTask, Aa as Query, Fu as QueryConstraint, Nu as QueryDocumentSnapshot, xu as QuerySnapshot, Du as SnapshotMetadata, it as Timestamp, Ih as Transaction, rh as WriteBatch, ha as _DatabaseId, Pt as _DocumentKey, G as _EmptyCredentialsProvider, ft as _FieldPath, ga as _cast, U as _debugAssert, wt as _isBase64Available, F as _logWarn, da as _validateIsNotUsedTogether, gh as addDoc, vh as arrayRemove, Ph as arrayUnion, qa as clearIndexedDbPersistence, ba as collection, Pa as collectionGroup, Ea as connectFirestoreEmulator, mh as deleteDoc, Rh as deleteField, Qa as disableNetwork, va as doc, Ya as documentId, La as enableIndexedDbPersistence, Ba as enableMultiTabIndexedDbPersistence, ja as enableNetwork, Yu as endAt, Ju as endBefore, Fa as ensureFirestoreConfigured, Th as executeWrite, ch as getDoc, uh as getDocFromCache, hh as getDocFromServer, lh as getDocs, fh as getDocsFromCache, dh as getDocsFromServer, Oa as getFirestore, Vh as increment, $a as initializeFirestore, ju as limit, Qu as limitToLast, Ga as loadBundle, za as namedQuery, yh as onSnapshot, ph as onSnapshotsInSync, qu as orderBy, Mu as query, Sa as queryEqual, Va as refEqual, Ah as runTransaction, bh as serverTimestamp, wh as setDoc, k as setLogLevel, $u as snapshotEqual, zu as startAfter, Gu as startAt, Wa as terminate, _h as updateDoc, Ka as waitForPendingWrites, Bu as where, Sh as writeBatch };
17786
+ export { nh as AbstractUserDataWriter, Xc as Bytes, xc as CACHE_SIZE_UNLIMITED, Rc as CollectionReference, Ic as DocumentReference, Cu as DocumentSnapshot, Jc as FieldPath, Zc as FieldValue, kc as Firestore, j as FirestoreError, tu as GeoPoint, Nc as LoadBundleTask, Ac as Query, Fu as QueryConstraint, Nu as QueryDocumentSnapshot, xu as QuerySnapshot, Du as SnapshotMetadata, it as Timestamp, Ih as Transaction, rh as WriteBatch, hc as _DatabaseId, Pt as _DocumentKey, G as _EmptyCredentialsProvider, ft as _FieldPath, gc as _cast, U as _debugAssert, wt as _isBase64Available, F as _logWarn, dc as _validateIsNotUsedTogether, gh as addDoc, vh as arrayRemove, Ph as arrayUnion, qc as clearIndexedDbPersistence, bc as collection, Pc as collectionGroup, Ec as connectFirestoreEmulator, mh as deleteDoc, Rh as deleteField, Qc as disableNetwork, vc as doc, Yc as documentId, Lc as enableIndexedDbPersistence, Bc as enableMultiTabIndexedDbPersistence, jc as enableNetwork, Yu as endAt, Ju as endBefore, Fc as ensureFirestoreConfigured, Th as executeWrite, ah as getDoc, uh as getDocFromCache, hh as getDocFromServer, lh as getDocs, fh as getDocsFromCache, dh as getDocsFromServer, Oc as getFirestore, Vh as increment, $c as initializeFirestore, ju as limit, Qu as limitToLast, Gc as loadBundle, zc as namedQuery, yh as onSnapshot, ph as onSnapshotsInSync, qu as orderBy, Mu as query, Sc as queryEqual, Vc as refEqual, Ah as runTransaction, bh as serverTimestamp, wh as setDoc, k as setLogLevel, $u as snapshotEqual, zu as startAfter, Gu as startAt, Wc as terminate, _h as updateDoc, Kc as waitForPendingWrites, Bu as where, Sh as writeBatch };
17787
17787
  //# sourceMappingURL=index.esm2017.js.map