@firebase/firestore 4.7.7 → 4.7.8

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.
@@ -5,7 +5,7 @@ import { FirebaseError, createMockUserToken, getModularInstance, deepEqual, getD
5
5
  import { Integer, Md5 } from '@firebase/webchannel-wrapper/bloom-blob';
6
6
  import { XhrIo, EventType, ErrorCode, createWebChannelTransport, getStatEventTarget, WebChannel, Event, Stat } from '@firebase/webchannel-wrapper/webchannel-blob';
7
7
 
8
- const S = "@firebase/firestore", b = "4.7.7";
8
+ const S = "@firebase/firestore", b = "4.7.8";
9
9
 
10
10
  /**
11
11
  * @license
@@ -67,7 +67,7 @@ User.MOCK_USER = new User("mock-user");
67
67
  * See the License for the specific language governing permissions and
68
68
  * limitations under the License.
69
69
  */
70
- let D = "11.3.0";
70
+ let D = "11.3.1";
71
71
 
72
72
  /**
73
73
  * @license
@@ -684,31 +684,6 @@ function __PRIVATE_randomBytes(e) {
684
684
  return n;
685
685
  }
686
686
 
687
- /**
688
- * @license
689
- * Copyright 2023 Google LLC
690
- *
691
- * Licensed under the Apache License, Version 2.0 (the "License");
692
- * you may not use this file except in compliance with the License.
693
- * You may obtain a copy of the License at
694
- *
695
- * http://www.apache.org/licenses/LICENSE-2.0
696
- *
697
- * Unless required by applicable law or agreed to in writing, software
698
- * distributed under the License is distributed on an "AS IS" BASIS,
699
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
700
- * See the License for the specific language governing permissions and
701
- * limitations under the License.
702
- */
703
- /**
704
- * An instance of the Platform's 'TextEncoder' implementation.
705
- */ function __PRIVATE_newTextEncoder() {
706
- return new TextEncoder;
707
- }
708
-
709
- /**
710
- * An instance of the Platform's 'TextDecoder' implementation.
711
- */
712
687
  /**
713
688
  * @license
714
689
  * Copyright 2017 Google LLC
@@ -730,8 +705,7 @@ function __PRIVATE_randomBytes(e) {
730
705
  *
731
706
  * @internal
732
707
  * Exported internally for testing purposes.
733
- */
734
- class __PRIVATE_AutoId {
708
+ */ class __PRIVATE_AutoId {
735
709
  static newId() {
736
710
  // Alphanumeric characters
737
711
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -752,16 +726,6 @@ function __PRIVATE_primitiveComparator(e, t) {
752
726
  return e < t ? -1 : e > t ? 1 : 0;
753
727
  }
754
728
 
755
- /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
756
- // Convert the string to UTF-8 encoded bytes
757
- const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
758
- for (let e = 0; e < Math.min(n.length, r.length); e++) {
759
- const t = __PRIVATE_primitiveComparator(n[e], r[e]);
760
- if (0 !== t) return t;
761
- }
762
- return __PRIVATE_primitiveComparator(n.length, r.length);
763
- }
764
-
765
729
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
766
730
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
767
731
  }
@@ -1052,11 +1016,13 @@ class Timestamp {
1052
1016
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1053
1017
  if (0 !== n) return n;
1054
1018
  }
1055
- return __PRIVATE_primitiveComparator(e.length, t.length);
1019
+ return Math.sign(e.length - t.length);
1056
1020
  }
1057
1021
  static compareSegments(e, t) {
1058
1022
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1059
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1023
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1024
+ // both non-numeric
1025
+ e < t ? -1 : e > t ? 1 : 0;
1060
1026
  }
1061
1027
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1062
1028
  static isNumericId(e) {
@@ -1844,13 +1810,13 @@ class __PRIVATE_SimpleDbTransaction {
1844
1810
  * within the key range or index.
1845
1811
  */ class __PRIVATE_IterationController {
1846
1812
  constructor(e) {
1847
- this.q = e, this.$ = !1, this.U = null;
1813
+ this.q = e, this.$ = !1, this.K = null;
1848
1814
  }
1849
1815
  get isDone() {
1850
1816
  return this.$;
1851
1817
  }
1852
- get K() {
1853
- return this.U;
1818
+ get U() {
1819
+ return this.K;
1854
1820
  }
1855
1821
  set cursor(e) {
1856
1822
  this.q = e;
@@ -1864,7 +1830,7 @@ class __PRIVATE_SimpleDbTransaction {
1864
1830
  * This function can be called to skip to that next key, which could be
1865
1831
  * an index or a primary key.
1866
1832
  */ W(e) {
1867
- this.U = e;
1833
+ this.K = e;
1868
1834
  }
1869
1835
  /**
1870
1836
  * Delete the current cursor value from the object store.
@@ -2023,7 +1989,7 @@ class __PRIVATE_SimpleDbTransaction {
2023
1989
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
2024
1990
  n.push(e);
2025
1991
  }
2026
- s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1992
+ s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2027
1993
  };
2028
1994
  })).next((() => PersistencePromise.waitFor(n)));
2029
1995
  }
@@ -2344,7 +2310,7 @@ function __PRIVATE_encodeResourcePath(e) {
2344
2310
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2345
2311
  * See the License for the specific language governing permissions and
2346
2312
  * limitations under the License.
2347
- */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2313
+ */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2348
2314
 
2349
2315
  /**
2350
2316
  * @license
@@ -2389,7 +2355,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2389
2355
  * there is no useful information to store as the value. The raw (unencoded)
2390
2356
  * path cannot be stored because IndexedDb doesn't store prototype
2391
2357
  * information.
2392
- */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ue = "globals", Ke = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, U, ae, K, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, K, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ue ];
2358
+ */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ke = "globals", Ue = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, K, ae, U, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, U, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ke ];
2393
2359
 
2394
2360
  /**
2395
2361
  * @license
@@ -3451,7 +3417,7 @@ function __PRIVATE_valueCompare(e, t) {
3451
3417
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3452
3418
 
3453
3419
  case 5 /* TypeOrder.StringValue */ :
3454
- return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3420
+ return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3455
3421
 
3456
3422
  case 6 /* TypeOrder.BlobValue */ :
3457
3423
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3499,7 +3465,7 @@ function __PRIVATE_valueCompare(e, t) {
3499
3465
  // canonical IDs are independent of insertion order.
3500
3466
  r.sort(), s.sort();
3501
3467
  for (let e = 0; e < r.length && e < s.length; ++e) {
3502
- const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3468
+ const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3503
3469
  if (0 !== t) return t;
3504
3470
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3505
3471
  if (0 !== o) return o;
@@ -5911,6 +5877,32 @@ let At = null;
5911
5877
  * Sets the value of the `testingHooksSpi` object.
5912
5878
  * @param instance the instance to set.
5913
5879
  */
5880
+ /**
5881
+ * @license
5882
+ * Copyright 2023 Google LLC
5883
+ *
5884
+ * Licensed under the Apache License, Version 2.0 (the "License");
5885
+ * you may not use this file except in compliance with the License.
5886
+ * You may obtain a copy of the License at
5887
+ *
5888
+ * http://www.apache.org/licenses/LICENSE-2.0
5889
+ *
5890
+ * Unless required by applicable law or agreed to in writing, software
5891
+ * distributed under the License is distributed on an "AS IS" BASIS,
5892
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5893
+ * See the License for the specific language governing permissions and
5894
+ * limitations under the License.
5895
+ */
5896
+ /**
5897
+ * An instance of the Platform's 'TextEncoder' implementation.
5898
+ */
5899
+ function __PRIVATE_newTextEncoder() {
5900
+ return new TextEncoder;
5901
+ }
5902
+
5903
+ /**
5904
+ * An instance of the Platform's 'TextDecoder' implementation.
5905
+ */
5914
5906
  /**
5915
5907
  * @license
5916
5908
  * Copyright 2022 Google LLC
@@ -6283,13 +6275,13 @@ class __PRIVATE_WatchChangeAggregator {
6283
6275
  /** Keeps track of the documents to update since the last raised snapshot. */
6284
6276
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6285
6277
  /** A mapping of document keys to their set of target IDs. */
6286
- this.Ue = __PRIVATE_documentTargetMap(),
6278
+ this.Ke = __PRIVATE_documentTargetMap(),
6287
6279
  /**
6288
6280
  * A map of targets with existence filter mismatches. These targets are
6289
6281
  * known to be inconsistent and their listens needs to be re-established by
6290
6282
  * RemoteStore.
6291
6283
  */
6292
- this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6284
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6293
6285
  }
6294
6286
  /**
6295
6287
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6378,7 +6370,7 @@ class __PRIVATE_WatchChangeAggregator {
6378
6370
  // trigger re-run of the query.
6379
6371
  this.Ye(t);
6380
6372
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6381
- this.Ke = this.Ke.insert(t, e);
6373
+ this.Ue = this.Ue.insert(t, e);
6382
6374
  }
6383
6375
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6384
6376
  var s, o, _, a, u, c;
@@ -6490,7 +6482,7 @@ class __PRIVATE_WatchChangeAggregator {
6490
6482
 
6491
6483
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6492
6484
  // client.
6493
- this.Ue.forEach(((e, t) => {
6485
+ this.Ke.forEach(((e, t) => {
6494
6486
  let r = !0;
6495
6487
  t.forEachWhile((e => {
6496
6488
  const t = this.Xe(e);
@@ -6498,9 +6490,9 @@ class __PRIVATE_WatchChangeAggregator {
6498
6490
  !1);
6499
6491
  })), r && (n = n.add(e));
6500
6492
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6501
- const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6493
+ const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6502
6494
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6503
- this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6495
+ this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6504
6496
  r;
6505
6497
  }
6506
6498
  /**
@@ -6512,7 +6504,7 @@ class __PRIVATE_WatchChangeAggregator {
6512
6504
  if (!this.Je(e)) return;
6513
6505
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6514
6506
  this.He(e).xe(t.key, n), this.Qe = this.Qe.insert(t.key, t), this.$e = this.$e.insert(t.key, this._t(t.key).add(e)),
6515
- this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6507
+ this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6516
6508
  }
6517
6509
  /**
6518
6510
  * Removes the provided document from the target mapping. If the
@@ -6528,7 +6520,7 @@ class __PRIVATE_WatchChangeAggregator {
6528
6520
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6529
6521
  // The document may have entered and left the target before we raised a
6530
6522
  // snapshot, so we can just ignore the change.
6531
- r.Oe(t), this.Ue = this.Ue.insert(t, this.ct(t).delete(e)), this.Ue = this.Ue.insert(t, this.ct(t).add(e)),
6523
+ r.Oe(t), this.Ke = this.Ke.insert(t, this.ct(t).delete(e)), this.Ke = this.Ke.insert(t, this.ct(t).add(e)),
6532
6524
  n && (this.Qe = this.Qe.insert(t, n));
6533
6525
  }
6534
6526
  removeTarget(e) {
@@ -6553,8 +6545,8 @@ class __PRIVATE_WatchChangeAggregator {
6553
6545
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6554
6546
  }
6555
6547
  ct(e) {
6556
- let t = this.Ue.get(e);
6557
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6548
+ let t = this.Ke.get(e);
6549
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6558
6550
  t;
6559
6551
  }
6560
6552
  _t(e) {
@@ -7737,7 +7729,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7737
7729
  * limitations under the License.
7738
7730
  */ class __PRIVATE_IndexedDbGlobalsCache {
7739
7731
  dt(e) {
7740
- return __PRIVATE_getStore(e, Ue);
7732
+ return __PRIVATE_getStore(e, Ke);
7741
7733
  }
7742
7734
  getSessionToken(e) {
7743
7735
  return this.dt(e).get("sessionToken").next((e => {
@@ -7949,10 +7941,10 @@ function __PRIVATE_unsignedNumLength(e) {
7949
7941
  }
7950
7942
  this.qt();
7951
7943
  }
7952
- Ut(e) {
7944
+ Kt(e) {
7953
7945
  // Values are encoded with a single byte length prefix, followed by the
7954
7946
  // actual value in big-endian format with leading 0 bytes dropped.
7955
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7947
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7956
7948
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7957
7949
  // Write the length
7958
7950
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7960,7 +7952,7 @@ function __PRIVATE_unsignedNumLength(e) {
7960
7952
  Gt(e) {
7961
7953
  // Values are encoded with a single byte length prefix, followed by the
7962
7954
  // inverted value in big-endian format with leading 0 bytes dropped.
7963
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7955
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7964
7956
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7965
7957
  // Write the length
7966
7958
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7995,7 +7987,7 @@ function __PRIVATE_unsignedNumLength(e) {
7995
7987
  * -0.0 < 0.0
7996
7988
  * all non-NaN < NaN
7997
7989
  * NaN = NaN
7998
- */ Kt(e) {
7990
+ */ Ut(e) {
7999
7991
  const t =
8000
7992
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
8001
7993
  function __PRIVATE_doubleToLongBits(e) {
@@ -8054,7 +8046,7 @@ class __PRIVATE_AscendingIndexByteEncoder {
8054
8046
  this.Zt.Qt(e);
8055
8047
  }
8056
8048
  gt(e) {
8057
- this.Zt.Ut(e);
8049
+ this.Zt.Kt(e);
8058
8050
  }
8059
8051
  Vt() {
8060
8052
  this.Zt.zt();
@@ -9563,14 +9555,14 @@ class __PRIVATE_TargetIdGenerator {
9563
9555
  next() {
9564
9556
  return this.$n += 2, this.$n;
9565
9557
  }
9566
- static Un() {
9558
+ static Kn() {
9567
9559
  // The target cache generator must return '2' in its first call to `next()`
9568
9560
  // as there is no differentiation in the protocol layer between an unset
9569
9561
  // number and the number '0'. If we were to sent a target with target ID
9570
9562
  // '0', the backend would consider it unset and replace it with its own ID.
9571
9563
  return new __PRIVATE_TargetIdGenerator(0);
9572
9564
  }
9573
- static Kn() {
9565
+ static Un() {
9574
9566
  // Sync engine assigns target IDs for limbo document detection.
9575
9567
  return new __PRIVATE_TargetIdGenerator(-1);
9576
9568
  }
@@ -11338,7 +11330,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11338
11330
  * A ordered bidirectional mapping between documents and the remote target
11339
11331
  * IDs.
11340
11332
  */
11341
- this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11333
+ this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11342
11334
  }
11343
11335
  forEachTarget(e, t) {
11344
11336
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11350,7 +11342,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11350
11342
  return PersistencePromise.resolve(this.$r);
11351
11343
  }
11352
11344
  allocateTargetId(e) {
11353
- return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11345
+ return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11354
11346
  }
11355
11347
  setTargetsMetadata(e, t, n) {
11356
11348
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11359,7 +11351,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11359
11351
  zn(e) {
11360
11352
  this.Qr.set(e.target, e);
11361
11353
  const t = e.targetId;
11362
- t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11354
+ t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11363
11355
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11364
11356
  }
11365
11357
  addTargetData(e, t) {
@@ -11369,7 +11361,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11369
11361
  return this.zn(t), PersistencePromise.resolve();
11370
11362
  }
11371
11363
  removeTargetData(e, t) {
11372
- return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11364
+ return this.Qr.delete(t.target), this.Kr.br(t.targetId), this.targetCount -= 1,
11373
11365
  PersistencePromise.resolve();
11374
11366
  }
11375
11367
  removeTargets(e, t, n) {
@@ -11388,24 +11380,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11388
11380
  return PersistencePromise.resolve(n);
11389
11381
  }
11390
11382
  addMatchingKeys(e, t, n) {
11391
- return this.Ur.yr(t, n), PersistencePromise.resolve();
11383
+ return this.Kr.yr(t, n), PersistencePromise.resolve();
11392
11384
  }
11393
11385
  removeMatchingKeys(e, t, n) {
11394
- this.Ur.Sr(t, n);
11386
+ this.Kr.Sr(t, n);
11395
11387
  const r = this.persistence.referenceDelegate, i = [];
11396
11388
  return r && t.forEach((t => {
11397
11389
  i.push(r.markPotentiallyOrphaned(e, t));
11398
11390
  })), PersistencePromise.waitFor(i);
11399
11391
  }
11400
11392
  removeMatchingKeysForTargetId(e, t) {
11401
- return this.Ur.br(t), PersistencePromise.resolve();
11393
+ return this.Kr.br(t), PersistencePromise.resolve();
11402
11394
  }
11403
11395
  getMatchingKeysForTargetId(e, t) {
11404
- const n = this.Ur.vr(t);
11396
+ const n = this.Kr.vr(t);
11405
11397
  return PersistencePromise.resolve(n);
11406
11398
  }
11407
11399
  containsKey(e, t) {
11408
- return PersistencePromise.resolve(this.Ur.containsKey(t));
11400
+ return PersistencePromise.resolve(this.Kr.containsKey(t));
11409
11401
  }
11410
11402
  }
11411
11403
 
@@ -11666,7 +11658,7 @@ class __PRIVATE_MemoryLruDelegate {
11666
11658
  */ B(e, t, n, r) {
11667
11659
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11668
11660
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11669
- e.createObjectStore(K);
11661
+ e.createObjectStore(U);
11670
11662
  }(e), function __PRIVATE_createMutationQueue(e) {
11671
11663
  e.createObjectStore(G, {
11672
11664
  keyPath: z
@@ -11683,7 +11675,7 @@ class __PRIVATE_MemoryLruDelegate {
11683
11675
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11684
11676
  * and rewrites all data.
11685
11677
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11686
- e.createObjectStore(U);
11678
+ e.createObjectStore(K);
11687
11679
  }(e));
11688
11680
  // Migration 2 to populate the targetGlobal object no longer needed since
11689
11681
  // migration 3 unconditionally clears it.
@@ -11771,7 +11763,7 @@ class __PRIVATE_MemoryLruDelegate {
11771
11763
  keyPath: te
11772
11764
  });
11773
11765
  t.createIndex(ne, re), t.createIndex(ie, se);
11774
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11766
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11775
11767
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11776
11768
  const t = e.createObjectStore(ye, {
11777
11769
  keyPath: we,
@@ -11800,15 +11792,15 @@ class __PRIVATE_MemoryLruDelegate {
11800
11792
  t.objectStore(Me).clear();
11801
11793
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11802
11794
  !function __PRIVATE_createGlobalsStore(e) {
11803
- e.createObjectStore(Ue, {
11804
- keyPath: Ke
11795
+ e.createObjectStore(Ke, {
11796
+ keyPath: Ue
11805
11797
  });
11806
11798
  }(e);
11807
11799
  }))), s;
11808
11800
  }
11809
11801
  ai(e) {
11810
11802
  let t = 0;
11811
- return e.store(U).Z(((e, n) => {
11803
+ return e.store(K).Z(((e, n) => {
11812
11804
  t += __PRIVATE_dbDocumentSize(n);
11813
11805
  })).next((() => {
11814
11806
  const n = {
@@ -11832,7 +11824,7 @@ class __PRIVATE_MemoryLruDelegate {
11832
11824
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11833
11825
  * with a sequence number. Missing rows are given the most recently used sequence number.
11834
11826
  */ ui(e) {
11835
- const t = e.store(le), n = e.store(U);
11827
+ const t = e.store(le), n = e.store(K);
11836
11828
  return e.store(Ee).get(Ie).next((e => {
11837
11829
  const r = [];
11838
11830
  return n.Z(((n, i) => {
@@ -11863,7 +11855,7 @@ class __PRIVATE_MemoryLruDelegate {
11863
11855
  };
11864
11856
  // Helper to add an index entry iff we haven't already written it.
11865
11857
  // Index existing remote documents.
11866
- return t.store(U).Z({
11858
+ return t.store(K).Z({
11867
11859
  Y: !0
11868
11860
  }, ((e, t) => {
11869
11861
  const n = new ResourcePath(e);
@@ -11883,7 +11875,7 @@ class __PRIVATE_MemoryLruDelegate {
11883
11875
  }));
11884
11876
  }
11885
11877
  hi(e, t) {
11886
- const n = t.store(U), r = [];
11878
+ const n = t.store(K), r = [];
11887
11879
  return n.Z(((e, n) => {
11888
11880
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11889
11881
  return e.document ? new DocumentKey(ResourcePath.fromString(e.document.name).popFirst(5)) : e.noDocument ? DocumentKey.fromSegments(e.noDocument.path) : e.unknownDocument ? DocumentKey.fromSegments(e.unknownDocument.path) : fail();
@@ -12201,11 +12193,11 @@ class __PRIVATE_IndexedDbPersistence {
12201
12193
  async shutdown() {
12202
12194
  // The shutdown() operations are idempotent and can be called even when
12203
12195
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12204
- this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12196
+ this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12205
12197
  this.Wi(),
12206
12198
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12207
12199
  // has obtained the primary lease.
12208
- await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12200
+ await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12209
12201
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12210
12202
  return this.xi(t).next((() => this.Bi(t)));
12211
12203
  })), this.pi.close(),
@@ -12311,7 +12303,7 @@ class __PRIVATE_IndexedDbPersistence {
12311
12303
  this.wi())));
12312
12304
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12313
12305
  }
12314
- Ki() {
12306
+ Ui() {
12315
12307
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12316
12308
  }
12317
12309
  /**
@@ -12329,7 +12321,7 @@ class __PRIVATE_IndexedDbPersistence {
12329
12321
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12330
12322
  // accesses internal state. We execute this code directly during shutdown
12331
12323
  // to make sure it gets a chance to run.
12332
- this.Ui();
12324
+ this.Ki();
12333
12325
  const e = /(?:Version|Mobile)\/1[456]/;
12334
12326
  isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12335
12327
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12360,7 +12352,7 @@ class __PRIVATE_IndexedDbPersistence {
12360
12352
  /**
12361
12353
  * Record client as zombied (a client that had its tab closed). Zombied
12362
12354
  * clients are ignored during primary tab selection.
12363
- */ Ui() {
12355
+ */ Ki() {
12364
12356
  if (this.yi) try {
12365
12357
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12366
12358
  } catch (e) {
@@ -12383,7 +12375,7 @@ class __PRIVATE_IndexedDbPersistence {
12383
12375
  /**
12384
12376
  * Helper to get a typed SimpleDbStore for the primary client object store.
12385
12377
  */ function __PRIVATE_primaryClientStore(e) {
12386
- return __PRIVATE_getStore(e, K);
12378
+ return __PRIVATE_getStore(e, U);
12387
12379
  }
12388
12380
 
12389
12381
  /**
@@ -13422,12 +13414,12 @@ class __PRIVATE_LocalClientState {
13422
13414
  n && (this.xs = this.xs.insert(n.clientId, n));
13423
13415
  }
13424
13416
  }
13425
- this.Us();
13417
+ this.Ks();
13426
13418
  // Check if there is an existing online state and call the callback handler
13427
13419
  // if applicable.
13428
13420
  const t = this.storage.getItem(this.Qs);
13429
13421
  if (t) {
13430
- const e = this.Ks(t);
13422
+ const e = this.Us(t);
13431
13423
  e && this.Ws(e);
13432
13424
  }
13433
13425
  for (const e of this.Os) this.Ms(e);
@@ -13471,10 +13463,10 @@ class __PRIVATE_LocalClientState {
13471
13463
  }
13472
13464
  // If the query is listening to cache only, the target ID should not be registered with the
13473
13465
  // local Firestore client as an active watch target.
13474
- return t && this.Hs.Ds(e), this.Us(), n;
13466
+ return t && this.Hs.Ds(e), this.Ks(), n;
13475
13467
  }
13476
13468
  removeLocalQueryTarget(e) {
13477
- this.Hs.vs(e), this.Us();
13469
+ this.Hs.vs(e), this.Ks();
13478
13470
  }
13479
13471
  isLocalQueryTarget(e) {
13480
13472
  return this.Hs.activeTargetIds.has(e);
@@ -13541,7 +13533,7 @@ class __PRIVATE_LocalClientState {
13541
13533
  }
13542
13534
  } else if (t.key === this.Qs) {
13543
13535
  if (null !== t.newValue) {
13544
- const e = this.Ks(t.newValue);
13536
+ const e = this.Us(t.newValue);
13545
13537
  if (e) return this.Ws(e);
13546
13538
  }
13547
13539
  } else if (t.key === this.Bs) {
@@ -13572,7 +13564,7 @@ class __PRIVATE_LocalClientState {
13572
13564
  get Hs() {
13573
13565
  return this.xs.get(this.Cs);
13574
13566
  }
13575
- Us() {
13567
+ Ks() {
13576
13568
  this.setItem(this.Ns, this.Hs.bs());
13577
13569
  }
13578
13570
  zs(e, t, n) {
@@ -13629,7 +13621,7 @@ class __PRIVATE_LocalClientState {
13629
13621
  /**
13630
13622
  * Parses an online state from WebStorage. Returns 'null' if the value
13631
13623
  * could not be parsed.
13632
- */ Ks(e) {
13624
+ */ Us(e) {
13633
13625
  return __PRIVATE_SharedOnlineState.Ss(e);
13634
13626
  }
13635
13627
  _o(e) {
@@ -13854,7 +13846,7 @@ function __PRIVATE_generateUniqueDebugId() {
13854
13846
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13855
13847
  * See the License for the specific language governing permissions and
13856
13848
  * limitations under the License.
13857
- */ const Ut = "RestConnection", Kt = {
13849
+ */ const Kt = "RestConnection", Ut = {
13858
13850
  BatchGetDocuments: "batchGet",
13859
13851
  Commit: "commit",
13860
13852
  RunQuery: "runQuery",
@@ -13883,14 +13875,14 @@ class __PRIVATE_RestConnection {
13883
13875
  }
13884
13876
  So(e, t, n, r, i) {
13885
13877
  const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13886
- __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13878
+ __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13887
13879
  const _ = {
13888
13880
  "google-cloud-resource-prefix": this.yo,
13889
13881
  "x-goog-request-params": this.wo
13890
13882
  };
13891
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13883
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13892
13884
  t)), (t => {
13893
- throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13885
+ throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13894
13886
  t;
13895
13887
  }));
13896
13888
  }
@@ -13917,7 +13909,7 @@ class __PRIVATE_RestConnection {
13917
13909
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13918
13910
  }
13919
13911
  bo(e, t) {
13920
- const n = Kt[e];
13912
+ const n = Ut[e];
13921
13913
  return `${this.po}/v1/${t}:${n}`;
13922
13914
  }
13923
13915
  /**
@@ -13977,10 +13969,10 @@ class __PRIVATE_RestConnection {
13977
13969
  $o() {
13978
13970
  this.Bo();
13979
13971
  }
13980
- Uo(e) {
13972
+ Ko(e) {
13981
13973
  this.ko(e);
13982
13974
  }
13983
- Ko(e) {
13975
+ Uo(e) {
13984
13976
  this.qo(e);
13985
13977
  }
13986
13978
  }
@@ -14132,10 +14124,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14132
14124
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14133
14125
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
14134
14126
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14135
- P.Uo());
14127
+ P.Ko());
14136
14128
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {
14137
14129
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14138
- P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14130
+ P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14139
14131
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {
14140
14132
  var n;
14141
14133
  if (!h) {
@@ -14166,8 +14158,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14166
14158
  }(t), i = o.message;
14167
14159
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14168
14160
  // Mark closed so no further events are propagated
14169
- h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14170
- } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14161
+ h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14162
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14171
14163
  }
14172
14164
  })), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {
14173
14165
  t.stat === Stat.PROXY ? __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === Stat.NOPROXY && __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14902,7 +14894,7 @@ class __PRIVATE_RemoteStoreImpl {
14902
14894
  * purely based on order, and so we can just shift() writes from the front of
14903
14895
  * the writePipeline as we receive responses.
14904
14896
  */
14905
- this.U_ = [],
14897
+ this.K_ = [],
14906
14898
  /**
14907
14899
  * A mapping of watched targets that the client cares about tracking and the
14908
14900
  * user has explicitly called a 'listen' for this target.
@@ -14912,7 +14904,7 @@ class __PRIVATE_RemoteStoreImpl {
14912
14904
  * to the server. The targets removed with unlistens are removed eagerly
14913
14905
  * without waiting for confirmation from the listen stream.
14914
14906
  */
14915
- this.K_ = new Map,
14907
+ this.U_ = new Map,
14916
14908
  /**
14917
14909
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14918
14910
  * RemoteStore may start its network connections.
@@ -14959,9 +14951,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14959
14951
  */
14960
14952
  function __PRIVATE_remoteStoreListen(e, t) {
14961
14953
  const n = __PRIVATE_debugCast(e);
14962
- n.K_.has(t.targetId) || (
14954
+ n.U_.has(t.targetId) || (
14963
14955
  // Mark this as something the client is currently listening for.
14964
- n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14956
+ n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14965
14957
  // The listen will be sent in onWatchStreamOpen
14966
14958
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14967
14959
  }
@@ -14971,7 +14963,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14971
14963
  * not being listened to.
14972
14964
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14973
14965
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14974
- n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14966
+ n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14975
14967
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14976
14968
  // have no listeners, since without any listens to send we cannot
14977
14969
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -15000,7 +14992,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
15000
14992
  function __PRIVATE_startWatchStream(e) {
15001
14993
  e.H_ = new __PRIVATE_WatchChangeAggregator({
15002
14994
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
15003
- lt: t => e.K_.get(t) || null,
14995
+ lt: t => e.U_.get(t) || null,
15004
14996
  it: () => e.datastore.serializer.databaseId
15005
14997
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
15006
14998
  }
@@ -15009,7 +15001,7 @@ function __PRIVATE_startWatchStream(e) {
15009
15001
  * Returns whether the watch stream should be started because it's necessary
15010
15002
  * and has not yet been started.
15011
15003
  */ function __PRIVATE_shouldStartWatchStream(e) {
15012
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15004
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15013
15005
  }
15014
15006
 
15015
15007
  function __PRIVATE_canUseNetwork(e) {
@@ -15026,7 +15018,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15026
15018
  }
15027
15019
 
15028
15020
  async function __PRIVATE_onWatchStreamOpen(e) {
15029
- e.K_.forEach(((t, n) => {
15021
+ e.U_.forEach(((t, n) => {
15030
15022
  __PRIVATE_sendWatchRequest(e, t);
15031
15023
  }));
15032
15024
  }
@@ -15053,7 +15045,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15053
15045
  const n = t.cause;
15054
15046
  for (const r of t.targetIds)
15055
15047
  // A watched target might have been removed already.
15056
- e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15048
+ e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15057
15049
  }
15058
15050
  /**
15059
15051
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15083,21 +15075,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15083
15075
  // persistent view of these when applying the completed RemoteEvent.
15084
15076
  return n.targetChanges.forEach(((n, r) => {
15085
15077
  if (n.resumeToken.approximateByteSize() > 0) {
15086
- const i = e.K_.get(r);
15078
+ const i = e.U_.get(r);
15087
15079
  // A watched target might have been removed already.
15088
- i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15080
+ i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15089
15081
  }
15090
15082
  })),
15091
15083
  // Re-establish listens for the targets that have been invalidated by
15092
15084
  // existence filter mismatches.
15093
15085
  n.targetMismatches.forEach(((t, n) => {
15094
- const r = e.K_.get(t);
15086
+ const r = e.U_.get(t);
15095
15087
  if (!r)
15096
15088
  // A watched target might have been removed already.
15097
15089
  return;
15098
15090
  // Clear the resume token for the target, since we're in a known mismatch
15099
15091
  // state.
15100
- e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15092
+ e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15101
15093
  // Cause a hard reset by unwatching and rewatching immediately, but
15102
15094
  // deliberately don't send a resume token so that we get a full update.
15103
15095
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15148,11 +15140,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15148
15140
 
15149
15141
  async function __PRIVATE_fillWritePipeline(e) {
15150
15142
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15151
- let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15143
+ let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15152
15144
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15153
15145
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15154
15146
  if (null === e) {
15155
- 0 === t.U_.length && n.P_();
15147
+ 0 === t.K_.length && n.P_();
15156
15148
  break;
15157
15149
  }
15158
15150
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15166,20 +15158,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15166
15158
  * Returns true if we can add to the write pipeline (i.e. the network is
15167
15159
  * enabled and the write pipeline is not full).
15168
15160
  */ function __PRIVATE_canAddToWritePipeline(e) {
15169
- return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15161
+ return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15170
15162
  }
15171
15163
 
15172
15164
  /**
15173
15165
  * Queues additional writes to be sent to the write stream, sending them
15174
15166
  * immediately if the write stream is established.
15175
15167
  */ function __PRIVATE_addToWritePipeline(e, t) {
15176
- e.U_.push(t);
15168
+ e.K_.push(t);
15177
15169
  const n = __PRIVATE_ensureWriteStream(e);
15178
15170
  n.c_() && n.S_ && n.b_(t.mutations);
15179
15171
  }
15180
15172
 
15181
15173
  function __PRIVATE_shouldStartWriteStream(e) {
15182
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15174
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15183
15175
  }
15184
15176
 
15185
15177
  function __PRIVATE_startWriteStream(e) {
@@ -15193,11 +15185,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15193
15185
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15194
15186
  const t = __PRIVATE_ensureWriteStream(e);
15195
15187
  // Send the write pipeline now that the stream is established.
15196
- for (const n of e.U_) t.b_(n.mutations);
15188
+ for (const n of e.K_) t.b_(n.mutations);
15197
15189
  }
15198
15190
 
15199
15191
  async function __PRIVATE_onMutationResult(e, t, n) {
15200
- const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15192
+ const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15201
15193
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15202
15194
  // It's possible that with the completion of this mutation another
15203
15195
  // slot has freed up.
@@ -15217,7 +15209,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15217
15209
  }(t.code)) {
15218
15210
  // This was a permanent error, the request itself was the problem
15219
15211
  // so it's not going to succeed if we resend it.
15220
- const n = e.U_.shift();
15212
+ const n = e.K_.shift();
15221
15213
  // In this case it's also unlikely that the server itself is melting
15222
15214
  // down -- this was just a bad request so inhibit backoff on the next
15223
15215
  // restart.
@@ -15316,8 +15308,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15316
15308
  }), e.G_.push((async t => {
15317
15309
  t ? (e.Y_.h_(),
15318
15310
  // This will start the write stream if necessary.
15319
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15320
- e.U_ = []));
15311
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.K_.length} pending writes`),
15312
+ e.K_ = []));
15321
15313
  }))), e.Y_;
15322
15314
  }
15323
15315
 
@@ -16331,11 +16323,11 @@ const Jt = "SyncEngine";
16331
16323
  * Keeps track of the information about an active limbo resolution for each
16332
16324
  * active target ID that was started for the purpose of limbo resolution.
16333
16325
  */
16334
- this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16326
+ this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16335
16327
  /** Stores user completion handlers, indexed by User and BatchId. */
16336
16328
  this.Wa = {},
16337
16329
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16338
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16330
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16339
16331
  // The primary state is set to `true` or `false` immediately after Firestore
16340
16332
  // startup. In the interim, a client should only be considered primary if
16341
16333
  // `isPrimary` is true.
@@ -16515,7 +16507,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16515
16507
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16516
16508
  // Update `receivedDocument` as appropriate for any limbo targets.
16517
16509
  t.targetChanges.forEach(((e, t) => {
16518
- const r = n.Ua.get(t);
16510
+ const r = n.Ka.get(t);
16519
16511
  r && (
16520
16512
  // Since this is a limbo resolution lookup, it's for a single document
16521
16513
  // and it could be added, modified, or removed, but not a combination.
@@ -16569,7 +16561,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16569
16561
  const r = __PRIVATE_debugCast(e);
16570
16562
  // PORTING NOTE: Multi-tab only.
16571
16563
  r.sharedClientState.updateQueryState(t, "rejected", n);
16572
- const i = r.Ua.get(t), s = i && i.key;
16564
+ const i = r.Ka.get(t), s = i && i.key;
16573
16565
  if (s) {
16574
16566
  // TODO(klimt): We really only should do the following on permission
16575
16567
  // denied errors, but we don't have the cause code here.
@@ -16591,7 +16583,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16591
16583
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16592
16584
  // this query when the RemoteStore restarts the Watch stream, which should
16593
16585
  // re-trigger the target failure.
16594
- r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16586
+ r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16595
16587
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16596
16588
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16597
16589
  }
@@ -16685,8 +16677,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16685
16677
  e.sharedClientState.removeLocalQueryTarget(t);
16686
16678
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16687
16679
  if (e.qa.delete(t), e.isPrimaryClient) {
16688
- e.Ka.br(t).forEach((t => {
16689
- e.Ka.containsKey(t) ||
16680
+ e.Ua.br(t).forEach((t => {
16681
+ e.Ua.containsKey(t) ||
16690
16682
  // We removed the last reference for this key
16691
16683
  __PRIVATE_removeLimboTarget(e, t);
16692
16684
  }));
@@ -16699,14 +16691,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16699
16691
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16700
16692
  const n = e.$a.get(t);
16701
16693
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16702
- e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16694
+ e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16703
16695
  }
16704
16696
 
16705
16697
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16706
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16698
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16707
16699
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16708
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16709
- e.Ka.containsKey(r.key) ||
16700
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16701
+ e.Ua.containsKey(r.key) ||
16710
16702
  // We removed the last reference for this key
16711
16703
  __PRIVATE_removeLimboTarget(e, r.key);
16712
16704
  } else fail();
@@ -16730,7 +16722,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16730
16722
  const t = e.Qa.values().next().value;
16731
16723
  e.Qa.delete(t);
16732
16724
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16733
- e.Ua.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16725
+ e.Ka.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16734
16726
  }
16735
16727
  }
16736
16728
 
@@ -16798,7 +16790,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16798
16790
  }
16799
16791
 
16800
16792
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16801
- const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16793
+ const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16802
16794
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16803
16795
  {
16804
16796
  let e = __PRIVATE_documentKeySet();
@@ -16890,9 +16882,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16890
16882
  // PORTING NOTE: Multi-Tab only.
16891
16883
  function __PRIVATE_resetLimboDocuments(e) {
16892
16884
  const t = __PRIVATE_debugCast(e);
16893
- t.Ua.forEach(((e, n) => {
16885
+ t.Ka.forEach(((e, n) => {
16894
16886
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16895
- })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16887
+ })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16896
16888
  }
16897
16889
  /**
16898
16890
  * Reconcile the query views of the provided query targets with the state from
@@ -19751,7 +19743,7 @@ function __PRIVATE_isWrite(e) {
19751
19743
  });
19752
19744
  return r.$u(e), r;
19753
19745
  }
19754
- Uu(e) {
19746
+ Ku(e) {
19755
19747
  var t;
19756
19748
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19757
19749
  path: n,
@@ -19759,7 +19751,7 @@ function __PRIVATE_isWrite(e) {
19759
19751
  });
19760
19752
  return r.Bu(), r;
19761
19753
  }
19762
- Ku(e) {
19754
+ Uu(e) {
19763
19755
  // TODO(b/34871131): We don't support array paths right now; so make path
19764
19756
  // undefined.
19765
19757
  return this.ku({
@@ -19920,7 +19912,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19920
19912
  // For Compat types, we have to "extract" the underlying types before
19921
19913
  // performing validation.
19922
19914
  r = getModularInstance(r);
19923
- const a = i.Uu(_);
19915
+ const a = i.Ku(_);
19924
19916
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19925
19917
  // Add it to the field mask, but don't add anything to updateData.
19926
19918
  s.push(_); else {
@@ -19946,7 +19938,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19946
19938
  // For Compat types, we have to "extract" the underlying types before
19947
19939
  // performing validation.
19948
19940
  n = getModularInstance(n);
19949
- const r = o.Uu(t);
19941
+ const r = o.Ku(t);
19950
19942
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19951
19943
  // Add it to the field mask, but don't add anything to updateData.
19952
19944
  u.push(t); else {
@@ -20024,7 +20016,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20024
20016
  const n = [];
20025
20017
  let r = 0;
20026
20018
  for (const i of e) {
20027
- let e = __PRIVATE_parseData(i, t.Ku(r));
20019
+ let e = __PRIVATE_parseData(i, t.Uu(r));
20028
20020
  null == e && (
20029
20021
  // Just include nulls in the array for fields being replaced with a
20030
20022
  // sentinel.