@firebase/firestore 4.7.7-canary.3418ef807 → 4.7.7-canary.4d2fc6e82

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.
package/dist/index.cjs.js CHANGED
@@ -9,7 +9,7 @@ var util = require('@firebase/util');
9
9
  var bloomBlob = require('@firebase/webchannel-wrapper/bloom-blob');
10
10
  var webchannelBlob = require('@firebase/webchannel-wrapper/webchannel-blob');
11
11
 
12
- const S = "@firebase/firestore", b = "4.7.7-canary.3418ef807";
12
+ const S = "@firebase/firestore", b = "4.7.7-canary.4d2fc6e82";
13
13
 
14
14
  /**
15
15
  * @license
@@ -71,7 +71,7 @@ User.MOCK_USER = new User("mock-user");
71
71
  * See the License for the specific language governing permissions and
72
72
  * limitations under the License.
73
73
  */
74
- let D = "11.3.0-canary.3418ef807";
74
+ let D = "11.3.0-canary.4d2fc6e82";
75
75
 
76
76
  /**
77
77
  * @license
@@ -688,6 +688,31 @@ function __PRIVATE_randomBytes(e) {
688
688
  return n;
689
689
  }
690
690
 
691
+ /**
692
+ * @license
693
+ * Copyright 2023 Google LLC
694
+ *
695
+ * Licensed under the Apache License, Version 2.0 (the "License");
696
+ * you may not use this file except in compliance with the License.
697
+ * You may obtain a copy of the License at
698
+ *
699
+ * http://www.apache.org/licenses/LICENSE-2.0
700
+ *
701
+ * Unless required by applicable law or agreed to in writing, software
702
+ * distributed under the License is distributed on an "AS IS" BASIS,
703
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704
+ * See the License for the specific language governing permissions and
705
+ * limitations under the License.
706
+ */
707
+ /**
708
+ * An instance of the Platform's 'TextEncoder' implementation.
709
+ */ function __PRIVATE_newTextEncoder() {
710
+ return new TextEncoder;
711
+ }
712
+
713
+ /**
714
+ * An instance of the Platform's 'TextDecoder' implementation.
715
+ */
691
716
  /**
692
717
  * @license
693
718
  * Copyright 2017 Google LLC
@@ -709,7 +734,8 @@ function __PRIVATE_randomBytes(e) {
709
734
  *
710
735
  * @internal
711
736
  * Exported internally for testing purposes.
712
- */ class __PRIVATE_AutoId {
737
+ */
738
+ class __PRIVATE_AutoId {
713
739
  static newId() {
714
740
  // Alphanumeric characters
715
741
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -730,6 +756,16 @@ function __PRIVATE_primitiveComparator(e, t) {
730
756
  return e < t ? -1 : e > t ? 1 : 0;
731
757
  }
732
758
 
759
+ /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
760
+ // Convert the string to UTF-8 encoded bytes
761
+ const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
762
+ for (let e = 0; e < Math.min(n.length, r.length); e++) {
763
+ const t = __PRIVATE_primitiveComparator(n[e], r[e]);
764
+ if (0 !== t) return t;
765
+ }
766
+ return __PRIVATE_primitiveComparator(n.length, r.length);
767
+ }
768
+
733
769
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
734
770
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
735
771
  }
@@ -1020,13 +1056,11 @@ class Timestamp {
1020
1056
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1021
1057
  if (0 !== n) return n;
1022
1058
  }
1023
- return Math.sign(e.length - t.length);
1059
+ return __PRIVATE_primitiveComparator(e.length, t.length);
1024
1060
  }
1025
1061
  static compareSegments(e, t) {
1026
1062
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1027
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1028
- // both non-numeric
1029
- e < t ? -1 : e > t ? 1 : 0;
1063
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1030
1064
  }
1031
1065
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1032
1066
  static isNumericId(e) {
@@ -1814,13 +1848,13 @@ class __PRIVATE_SimpleDbTransaction {
1814
1848
  * within the key range or index.
1815
1849
  */ class __PRIVATE_IterationController {
1816
1850
  constructor(e) {
1817
- this.q = e, this.$ = !1, this.K = null;
1851
+ this.q = e, this.$ = !1, this.U = null;
1818
1852
  }
1819
1853
  get isDone() {
1820
1854
  return this.$;
1821
1855
  }
1822
- get U() {
1823
- return this.K;
1856
+ get K() {
1857
+ return this.U;
1824
1858
  }
1825
1859
  set cursor(e) {
1826
1860
  this.q = e;
@@ -1834,7 +1868,7 @@ class __PRIVATE_SimpleDbTransaction {
1834
1868
  * This function can be called to skip to that next key, which could be
1835
1869
  * an index or a primary key.
1836
1870
  */ W(e) {
1837
- this.K = e;
1871
+ this.U = e;
1838
1872
  }
1839
1873
  /**
1840
1874
  * Delete the current cursor value from the object store.
@@ -1993,7 +2027,7 @@ class __PRIVATE_SimpleDbTransaction {
1993
2027
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
1994
2028
  n.push(e);
1995
2029
  }
1996
- s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2030
+ s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1997
2031
  };
1998
2032
  })).next((() => PersistencePromise.waitFor(n)));
1999
2033
  }
@@ -2314,7 +2348,7 @@ function __PRIVATE_encodeResourcePath(e) {
2314
2348
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2315
2349
  * See the License for the specific language governing permissions and
2316
2350
  * limitations under the License.
2317
- */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2351
+ */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2318
2352
 
2319
2353
  /**
2320
2354
  * @license
@@ -2359,7 +2393,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2359
2393
  * there is no useful information to store as the value. The raw (unencoded)
2360
2394
  * path cannot be stored because IndexedDb doesn't store prototype
2361
2395
  * information.
2362
- */ 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 ];
2396
+ */ 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 ];
2363
2397
 
2364
2398
  /**
2365
2399
  * @license
@@ -3421,7 +3455,7 @@ function __PRIVATE_valueCompare(e, t) {
3421
3455
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3422
3456
 
3423
3457
  case 5 /* TypeOrder.StringValue */ :
3424
- return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3458
+ return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3425
3459
 
3426
3460
  case 6 /* TypeOrder.BlobValue */ :
3427
3461
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3469,7 +3503,7 @@ function __PRIVATE_valueCompare(e, t) {
3469
3503
  // canonical IDs are independent of insertion order.
3470
3504
  r.sort(), s.sort();
3471
3505
  for (let e = 0; e < r.length && e < s.length; ++e) {
3472
- const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3506
+ const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3473
3507
  if (0 !== t) return t;
3474
3508
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3475
3509
  if (0 !== o) return o;
@@ -5881,32 +5915,6 @@ let At = null;
5881
5915
  * Sets the value of the `testingHooksSpi` object.
5882
5916
  * @param instance the instance to set.
5883
5917
  */
5884
- /**
5885
- * @license
5886
- * Copyright 2023 Google LLC
5887
- *
5888
- * Licensed under the Apache License, Version 2.0 (the "License");
5889
- * you may not use this file except in compliance with the License.
5890
- * You may obtain a copy of the License at
5891
- *
5892
- * http://www.apache.org/licenses/LICENSE-2.0
5893
- *
5894
- * Unless required by applicable law or agreed to in writing, software
5895
- * distributed under the License is distributed on an "AS IS" BASIS,
5896
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5897
- * See the License for the specific language governing permissions and
5898
- * limitations under the License.
5899
- */
5900
- /**
5901
- * An instance of the Platform's 'TextEncoder' implementation.
5902
- */
5903
- function __PRIVATE_newTextEncoder() {
5904
- return new TextEncoder;
5905
- }
5906
-
5907
- /**
5908
- * An instance of the Platform's 'TextDecoder' implementation.
5909
- */
5910
5918
  /**
5911
5919
  * @license
5912
5920
  * Copyright 2022 Google LLC
@@ -6279,13 +6287,13 @@ class __PRIVATE_WatchChangeAggregator {
6279
6287
  /** Keeps track of the documents to update since the last raised snapshot. */
6280
6288
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6281
6289
  /** A mapping of document keys to their set of target IDs. */
6282
- this.Ke = __PRIVATE_documentTargetMap(),
6290
+ this.Ue = __PRIVATE_documentTargetMap(),
6283
6291
  /**
6284
6292
  * A map of targets with existence filter mismatches. These targets are
6285
6293
  * known to be inconsistent and their listens needs to be re-established by
6286
6294
  * RemoteStore.
6287
6295
  */
6288
- this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6296
+ this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6289
6297
  }
6290
6298
  /**
6291
6299
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6374,7 +6382,7 @@ class __PRIVATE_WatchChangeAggregator {
6374
6382
  // trigger re-run of the query.
6375
6383
  this.Ye(t);
6376
6384
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6377
- this.Ue = this.Ue.insert(t, e);
6385
+ this.Ke = this.Ke.insert(t, e);
6378
6386
  }
6379
6387
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6380
6388
  var s, o, _, a, u, c;
@@ -6486,7 +6494,7 @@ class __PRIVATE_WatchChangeAggregator {
6486
6494
 
6487
6495
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6488
6496
  // client.
6489
- this.Ke.forEach(((e, t) => {
6497
+ this.Ue.forEach(((e, t) => {
6490
6498
  let r = !0;
6491
6499
  t.forEachWhile((e => {
6492
6500
  const t = this.Xe(e);
@@ -6494,9 +6502,9 @@ class __PRIVATE_WatchChangeAggregator {
6494
6502
  !1);
6495
6503
  })), r && (n = n.add(e));
6496
6504
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6497
- const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6505
+ const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6498
6506
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6499
- this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6507
+ this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6500
6508
  r;
6501
6509
  }
6502
6510
  /**
@@ -6508,7 +6516,7 @@ class __PRIVATE_WatchChangeAggregator {
6508
6516
  if (!this.Je(e)) return;
6509
6517
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6510
6518
  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)),
6511
- this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6519
+ this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6512
6520
  }
6513
6521
  /**
6514
6522
  * Removes the provided document from the target mapping. If the
@@ -6524,7 +6532,7 @@ class __PRIVATE_WatchChangeAggregator {
6524
6532
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6525
6533
  // The document may have entered and left the target before we raised a
6526
6534
  // snapshot, so we can just ignore the change.
6527
- 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)),
6535
+ 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)),
6528
6536
  n && (this.Qe = this.Qe.insert(t, n));
6529
6537
  }
6530
6538
  removeTarget(e) {
@@ -6549,8 +6557,8 @@ class __PRIVATE_WatchChangeAggregator {
6549
6557
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6550
6558
  }
6551
6559
  ct(e) {
6552
- let t = this.Ke.get(e);
6553
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6560
+ let t = this.Ue.get(e);
6561
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6554
6562
  t;
6555
6563
  }
6556
6564
  _t(e) {
@@ -7733,7 +7741,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7733
7741
  * limitations under the License.
7734
7742
  */ class __PRIVATE_IndexedDbGlobalsCache {
7735
7743
  dt(e) {
7736
- return __PRIVATE_getStore(e, Ke);
7744
+ return __PRIVATE_getStore(e, Ue);
7737
7745
  }
7738
7746
  getSessionToken(e) {
7739
7747
  return this.dt(e).get("sessionToken").next((e => {
@@ -7945,10 +7953,10 @@ function __PRIVATE_unsignedNumLength(e) {
7945
7953
  }
7946
7954
  this.qt();
7947
7955
  }
7948
- Kt(e) {
7956
+ Ut(e) {
7949
7957
  // Values are encoded with a single byte length prefix, followed by the
7950
7958
  // actual value in big-endian format with leading 0 bytes dropped.
7951
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7959
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7952
7960
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7953
7961
  // Write the length
7954
7962
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7956,7 +7964,7 @@ function __PRIVATE_unsignedNumLength(e) {
7956
7964
  Gt(e) {
7957
7965
  // Values are encoded with a single byte length prefix, followed by the
7958
7966
  // inverted value in big-endian format with leading 0 bytes dropped.
7959
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7967
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7960
7968
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7961
7969
  // Write the length
7962
7970
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7991,7 +7999,7 @@ function __PRIVATE_unsignedNumLength(e) {
7991
7999
  * -0.0 < 0.0
7992
8000
  * all non-NaN < NaN
7993
8001
  * NaN = NaN
7994
- */ Ut(e) {
8002
+ */ Kt(e) {
7995
8003
  const t =
7996
8004
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
7997
8005
  function __PRIVATE_doubleToLongBits(e) {
@@ -8050,7 +8058,7 @@ class __PRIVATE_AscendingIndexByteEncoder {
8050
8058
  this.Zt.Qt(e);
8051
8059
  }
8052
8060
  gt(e) {
8053
- this.Zt.Kt(e);
8061
+ this.Zt.Ut(e);
8054
8062
  }
8055
8063
  Vt() {
8056
8064
  this.Zt.zt();
@@ -9559,14 +9567,14 @@ class __PRIVATE_TargetIdGenerator {
9559
9567
  next() {
9560
9568
  return this.$n += 2, this.$n;
9561
9569
  }
9562
- static Kn() {
9570
+ static Un() {
9563
9571
  // The target cache generator must return '2' in its first call to `next()`
9564
9572
  // as there is no differentiation in the protocol layer between an unset
9565
9573
  // number and the number '0'. If we were to sent a target with target ID
9566
9574
  // '0', the backend would consider it unset and replace it with its own ID.
9567
9575
  return new __PRIVATE_TargetIdGenerator(0);
9568
9576
  }
9569
- static Un() {
9577
+ static Kn() {
9570
9578
  // Sync engine assigns target IDs for limbo document detection.
9571
9579
  return new __PRIVATE_TargetIdGenerator(-1);
9572
9580
  }
@@ -11334,7 +11342,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11334
11342
  * A ordered bidirectional mapping between documents and the remote target
11335
11343
  * IDs.
11336
11344
  */
11337
- this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11345
+ this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11338
11346
  }
11339
11347
  forEachTarget(e, t) {
11340
11348
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11346,7 +11354,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11346
11354
  return PersistencePromise.resolve(this.$r);
11347
11355
  }
11348
11356
  allocateTargetId(e) {
11349
- return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11357
+ return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11350
11358
  }
11351
11359
  setTargetsMetadata(e, t, n) {
11352
11360
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11355,7 +11363,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11355
11363
  zn(e) {
11356
11364
  this.Qr.set(e.target, e);
11357
11365
  const t = e.targetId;
11358
- t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11366
+ t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11359
11367
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11360
11368
  }
11361
11369
  addTargetData(e, t) {
@@ -11365,7 +11373,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11365
11373
  return this.zn(t), PersistencePromise.resolve();
11366
11374
  }
11367
11375
  removeTargetData(e, t) {
11368
- return this.Qr.delete(t.target), this.Kr.br(t.targetId), this.targetCount -= 1,
11376
+ return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11369
11377
  PersistencePromise.resolve();
11370
11378
  }
11371
11379
  removeTargets(e, t, n) {
@@ -11384,24 +11392,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11384
11392
  return PersistencePromise.resolve(n);
11385
11393
  }
11386
11394
  addMatchingKeys(e, t, n) {
11387
- return this.Kr.yr(t, n), PersistencePromise.resolve();
11395
+ return this.Ur.yr(t, n), PersistencePromise.resolve();
11388
11396
  }
11389
11397
  removeMatchingKeys(e, t, n) {
11390
- this.Kr.Sr(t, n);
11398
+ this.Ur.Sr(t, n);
11391
11399
  const r = this.persistence.referenceDelegate, i = [];
11392
11400
  return r && t.forEach((t => {
11393
11401
  i.push(r.markPotentiallyOrphaned(e, t));
11394
11402
  })), PersistencePromise.waitFor(i);
11395
11403
  }
11396
11404
  removeMatchingKeysForTargetId(e, t) {
11397
- return this.Kr.br(t), PersistencePromise.resolve();
11405
+ return this.Ur.br(t), PersistencePromise.resolve();
11398
11406
  }
11399
11407
  getMatchingKeysForTargetId(e, t) {
11400
- const n = this.Kr.vr(t);
11408
+ const n = this.Ur.vr(t);
11401
11409
  return PersistencePromise.resolve(n);
11402
11410
  }
11403
11411
  containsKey(e, t) {
11404
- return PersistencePromise.resolve(this.Kr.containsKey(t));
11412
+ return PersistencePromise.resolve(this.Ur.containsKey(t));
11405
11413
  }
11406
11414
  }
11407
11415
 
@@ -11662,7 +11670,7 @@ class __PRIVATE_MemoryLruDelegate {
11662
11670
  */ B(e, t, n, r) {
11663
11671
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11664
11672
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11665
- e.createObjectStore(U);
11673
+ e.createObjectStore(K);
11666
11674
  }(e), function __PRIVATE_createMutationQueue(e) {
11667
11675
  e.createObjectStore(G, {
11668
11676
  keyPath: z
@@ -11679,7 +11687,7 @@ class __PRIVATE_MemoryLruDelegate {
11679
11687
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11680
11688
  * and rewrites all data.
11681
11689
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11682
- e.createObjectStore(K);
11690
+ e.createObjectStore(U);
11683
11691
  }(e));
11684
11692
  // Migration 2 to populate the targetGlobal object no longer needed since
11685
11693
  // migration 3 unconditionally clears it.
@@ -11767,7 +11775,7 @@ class __PRIVATE_MemoryLruDelegate {
11767
11775
  keyPath: te
11768
11776
  });
11769
11777
  t.createIndex(ne, re), t.createIndex(ie, se);
11770
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11778
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11771
11779
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11772
11780
  const t = e.createObjectStore(ye, {
11773
11781
  keyPath: we,
@@ -11796,15 +11804,15 @@ class __PRIVATE_MemoryLruDelegate {
11796
11804
  t.objectStore(Me).clear();
11797
11805
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11798
11806
  !function __PRIVATE_createGlobalsStore(e) {
11799
- e.createObjectStore(Ke, {
11800
- keyPath: Ue
11807
+ e.createObjectStore(Ue, {
11808
+ keyPath: Ke
11801
11809
  });
11802
11810
  }(e);
11803
11811
  }))), s;
11804
11812
  }
11805
11813
  ai(e) {
11806
11814
  let t = 0;
11807
- return e.store(K).Z(((e, n) => {
11815
+ return e.store(U).Z(((e, n) => {
11808
11816
  t += __PRIVATE_dbDocumentSize(n);
11809
11817
  })).next((() => {
11810
11818
  const n = {
@@ -11828,7 +11836,7 @@ class __PRIVATE_MemoryLruDelegate {
11828
11836
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11829
11837
  * with a sequence number. Missing rows are given the most recently used sequence number.
11830
11838
  */ ui(e) {
11831
- const t = e.store(le), n = e.store(K);
11839
+ const t = e.store(le), n = e.store(U);
11832
11840
  return e.store(Ee).get(Ie).next((e => {
11833
11841
  const r = [];
11834
11842
  return n.Z(((n, i) => {
@@ -11859,7 +11867,7 @@ class __PRIVATE_MemoryLruDelegate {
11859
11867
  };
11860
11868
  // Helper to add an index entry iff we haven't already written it.
11861
11869
  // Index existing remote documents.
11862
- return t.store(K).Z({
11870
+ return t.store(U).Z({
11863
11871
  Y: !0
11864
11872
  }, ((e, t) => {
11865
11873
  const n = new ResourcePath(e);
@@ -11879,7 +11887,7 @@ class __PRIVATE_MemoryLruDelegate {
11879
11887
  }));
11880
11888
  }
11881
11889
  hi(e, t) {
11882
- const n = t.store(K), r = [];
11890
+ const n = t.store(U), r = [];
11883
11891
  return n.Z(((e, n) => {
11884
11892
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11885
11893
  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();
@@ -12197,11 +12205,11 @@ class __PRIVATE_IndexedDbPersistence {
12197
12205
  async shutdown() {
12198
12206
  // The shutdown() operations are idempotent and can be called even when
12199
12207
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12200
- this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12208
+ this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12201
12209
  this.Wi(),
12202
12210
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12203
12211
  // has obtained the primary lease.
12204
- await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12212
+ await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12205
12213
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12206
12214
  return this.xi(t).next((() => this.Bi(t)));
12207
12215
  })), this.pi.close(),
@@ -12307,7 +12315,7 @@ class __PRIVATE_IndexedDbPersistence {
12307
12315
  this.wi())));
12308
12316
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12309
12317
  }
12310
- Ui() {
12318
+ Ki() {
12311
12319
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12312
12320
  }
12313
12321
  /**
@@ -12325,7 +12333,7 @@ class __PRIVATE_IndexedDbPersistence {
12325
12333
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12326
12334
  // accesses internal state. We execute this code directly during shutdown
12327
12335
  // to make sure it gets a chance to run.
12328
- this.Ki();
12336
+ this.Ui();
12329
12337
  const e = /(?:Version|Mobile)\/1[456]/;
12330
12338
  util.isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12331
12339
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12356,7 +12364,7 @@ class __PRIVATE_IndexedDbPersistence {
12356
12364
  /**
12357
12365
  * Record client as zombied (a client that had its tab closed). Zombied
12358
12366
  * clients are ignored during primary tab selection.
12359
- */ Ki() {
12367
+ */ Ui() {
12360
12368
  if (this.yi) try {
12361
12369
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12362
12370
  } catch (e) {
@@ -12379,7 +12387,7 @@ class __PRIVATE_IndexedDbPersistence {
12379
12387
  /**
12380
12388
  * Helper to get a typed SimpleDbStore for the primary client object store.
12381
12389
  */ function __PRIVATE_primaryClientStore(e) {
12382
- return __PRIVATE_getStore(e, U);
12390
+ return __PRIVATE_getStore(e, K);
12383
12391
  }
12384
12392
 
12385
12393
  /**
@@ -13418,12 +13426,12 @@ class __PRIVATE_LocalClientState {
13418
13426
  n && (this.xs = this.xs.insert(n.clientId, n));
13419
13427
  }
13420
13428
  }
13421
- this.Ks();
13429
+ this.Us();
13422
13430
  // Check if there is an existing online state and call the callback handler
13423
13431
  // if applicable.
13424
13432
  const t = this.storage.getItem(this.Qs);
13425
13433
  if (t) {
13426
- const e = this.Us(t);
13434
+ const e = this.Ks(t);
13427
13435
  e && this.Ws(e);
13428
13436
  }
13429
13437
  for (const e of this.Os) this.Ms(e);
@@ -13467,10 +13475,10 @@ class __PRIVATE_LocalClientState {
13467
13475
  }
13468
13476
  // If the query is listening to cache only, the target ID should not be registered with the
13469
13477
  // local Firestore client as an active watch target.
13470
- return t && this.Hs.Ds(e), this.Ks(), n;
13478
+ return t && this.Hs.Ds(e), this.Us(), n;
13471
13479
  }
13472
13480
  removeLocalQueryTarget(e) {
13473
- this.Hs.vs(e), this.Ks();
13481
+ this.Hs.vs(e), this.Us();
13474
13482
  }
13475
13483
  isLocalQueryTarget(e) {
13476
13484
  return this.Hs.activeTargetIds.has(e);
@@ -13537,7 +13545,7 @@ class __PRIVATE_LocalClientState {
13537
13545
  }
13538
13546
  } else if (t.key === this.Qs) {
13539
13547
  if (null !== t.newValue) {
13540
- const e = this.Us(t.newValue);
13548
+ const e = this.Ks(t.newValue);
13541
13549
  if (e) return this.Ws(e);
13542
13550
  }
13543
13551
  } else if (t.key === this.Bs) {
@@ -13568,7 +13576,7 @@ class __PRIVATE_LocalClientState {
13568
13576
  get Hs() {
13569
13577
  return this.xs.get(this.Cs);
13570
13578
  }
13571
- Ks() {
13579
+ Us() {
13572
13580
  this.setItem(this.Ns, this.Hs.bs());
13573
13581
  }
13574
13582
  zs(e, t, n) {
@@ -13625,7 +13633,7 @@ class __PRIVATE_LocalClientState {
13625
13633
  /**
13626
13634
  * Parses an online state from WebStorage. Returns 'null' if the value
13627
13635
  * could not be parsed.
13628
- */ Us(e) {
13636
+ */ Ks(e) {
13629
13637
  return __PRIVATE_SharedOnlineState.Ss(e);
13630
13638
  }
13631
13639
  _o(e) {
@@ -13850,7 +13858,7 @@ function __PRIVATE_generateUniqueDebugId() {
13850
13858
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13851
13859
  * See the License for the specific language governing permissions and
13852
13860
  * limitations under the License.
13853
- */ const Kt = "RestConnection", Ut = {
13861
+ */ const Ut = "RestConnection", Kt = {
13854
13862
  BatchGetDocuments: "batchGet",
13855
13863
  Commit: "commit",
13856
13864
  RunQuery: "runQuery",
@@ -13879,14 +13887,14 @@ class __PRIVATE_RestConnection {
13879
13887
  }
13880
13888
  So(e, t, n, r, i) {
13881
13889
  const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13882
- __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13890
+ __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13883
13891
  const _ = {
13884
13892
  "google-cloud-resource-prefix": this.yo,
13885
13893
  "x-goog-request-params": this.wo
13886
13894
  };
13887
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13895
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13888
13896
  t)), (t => {
13889
- throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13897
+ throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13890
13898
  t;
13891
13899
  }));
13892
13900
  }
@@ -13913,7 +13921,7 @@ class __PRIVATE_RestConnection {
13913
13921
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13914
13922
  }
13915
13923
  bo(e, t) {
13916
- const n = Ut[e];
13924
+ const n = Kt[e];
13917
13925
  return `${this.po}/v1/${t}:${n}`;
13918
13926
  }
13919
13927
  /**
@@ -13973,10 +13981,10 @@ class __PRIVATE_RestConnection {
13973
13981
  $o() {
13974
13982
  this.Bo();
13975
13983
  }
13976
- Ko(e) {
13984
+ Uo(e) {
13977
13985
  this.ko(e);
13978
13986
  }
13979
- Uo(e) {
13987
+ Ko(e) {
13980
13988
  this.qo(e);
13981
13989
  }
13982
13990
  }
@@ -14128,10 +14136,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14128
14136
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14129
14137
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.CLOSE, (() => {
14130
14138
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14131
- P.Ko());
14139
+ P.Uo());
14132
14140
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.ERROR, (t => {
14133
14141
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14134
- P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14142
+ P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14135
14143
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.MESSAGE, (t => {
14136
14144
  var n;
14137
14145
  if (!h) {
@@ -14162,8 +14170,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14162
14170
  }(t), i = o.message;
14163
14171
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14164
14172
  // Mark closed so no further events are propagated
14165
- h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14166
- } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14173
+ h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14174
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14167
14175
  }
14168
14176
  })), __PRIVATE_unguardedEventListen(o, webchannelBlob.Event.STAT_EVENT, (t => {
14169
14177
  t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelBlob.Stat.NOPROXY && __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14898,7 +14906,7 @@ class __PRIVATE_RemoteStoreImpl {
14898
14906
  * purely based on order, and so we can just shift() writes from the front of
14899
14907
  * the writePipeline as we receive responses.
14900
14908
  */
14901
- this.K_ = [],
14909
+ this.U_ = [],
14902
14910
  /**
14903
14911
  * A mapping of watched targets that the client cares about tracking and the
14904
14912
  * user has explicitly called a 'listen' for this target.
@@ -14908,7 +14916,7 @@ class __PRIVATE_RemoteStoreImpl {
14908
14916
  * to the server. The targets removed with unlistens are removed eagerly
14909
14917
  * without waiting for confirmation from the listen stream.
14910
14918
  */
14911
- this.U_ = new Map,
14919
+ this.K_ = new Map,
14912
14920
  /**
14913
14921
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14914
14922
  * RemoteStore may start its network connections.
@@ -14955,9 +14963,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14955
14963
  */
14956
14964
  function __PRIVATE_remoteStoreListen(e, t) {
14957
14965
  const n = __PRIVATE_debugCast(e);
14958
- n.U_.has(t.targetId) || (
14966
+ n.K_.has(t.targetId) || (
14959
14967
  // Mark this as something the client is currently listening for.
14960
- n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14968
+ n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14961
14969
  // The listen will be sent in onWatchStreamOpen
14962
14970
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14963
14971
  }
@@ -14967,7 +14975,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14967
14975
  * not being listened to.
14968
14976
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14969
14977
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14970
- n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14978
+ n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14971
14979
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14972
14980
  // have no listeners, since without any listens to send we cannot
14973
14981
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14996,7 +15004,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14996
15004
  function __PRIVATE_startWatchStream(e) {
14997
15005
  e.H_ = new __PRIVATE_WatchChangeAggregator({
14998
15006
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14999
- lt: t => e.U_.get(t) || null,
15007
+ lt: t => e.K_.get(t) || null,
15000
15008
  it: () => e.datastore.serializer.databaseId
15001
15009
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
15002
15010
  }
@@ -15005,7 +15013,7 @@ function __PRIVATE_startWatchStream(e) {
15005
15013
  * Returns whether the watch stream should be started because it's necessary
15006
15014
  * and has not yet been started.
15007
15015
  */ function __PRIVATE_shouldStartWatchStream(e) {
15008
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15016
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15009
15017
  }
15010
15018
 
15011
15019
  function __PRIVATE_canUseNetwork(e) {
@@ -15022,7 +15030,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15022
15030
  }
15023
15031
 
15024
15032
  async function __PRIVATE_onWatchStreamOpen(e) {
15025
- e.U_.forEach(((t, n) => {
15033
+ e.K_.forEach(((t, n) => {
15026
15034
  __PRIVATE_sendWatchRequest(e, t);
15027
15035
  }));
15028
15036
  }
@@ -15049,7 +15057,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15049
15057
  const n = t.cause;
15050
15058
  for (const r of t.targetIds)
15051
15059
  // A watched target might have been removed already.
15052
- e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15060
+ e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15053
15061
  }
15054
15062
  /**
15055
15063
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15079,21 +15087,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15079
15087
  // persistent view of these when applying the completed RemoteEvent.
15080
15088
  return n.targetChanges.forEach(((n, r) => {
15081
15089
  if (n.resumeToken.approximateByteSize() > 0) {
15082
- const i = e.U_.get(r);
15090
+ const i = e.K_.get(r);
15083
15091
  // A watched target might have been removed already.
15084
- i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15092
+ i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15085
15093
  }
15086
15094
  })),
15087
15095
  // Re-establish listens for the targets that have been invalidated by
15088
15096
  // existence filter mismatches.
15089
15097
  n.targetMismatches.forEach(((t, n) => {
15090
- const r = e.U_.get(t);
15098
+ const r = e.K_.get(t);
15091
15099
  if (!r)
15092
15100
  // A watched target might have been removed already.
15093
15101
  return;
15094
15102
  // Clear the resume token for the target, since we're in a known mismatch
15095
15103
  // state.
15096
- e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15104
+ e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15097
15105
  // Cause a hard reset by unwatching and rewatching immediately, but
15098
15106
  // deliberately don't send a resume token so that we get a full update.
15099
15107
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15144,11 +15152,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15144
15152
 
15145
15153
  async function __PRIVATE_fillWritePipeline(e) {
15146
15154
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15147
- let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15155
+ let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15148
15156
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15149
15157
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15150
15158
  if (null === e) {
15151
- 0 === t.K_.length && n.P_();
15159
+ 0 === t.U_.length && n.P_();
15152
15160
  break;
15153
15161
  }
15154
15162
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15162,20 +15170,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15162
15170
  * Returns true if we can add to the write pipeline (i.e. the network is
15163
15171
  * enabled and the write pipeline is not full).
15164
15172
  */ function __PRIVATE_canAddToWritePipeline(e) {
15165
- return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15173
+ return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15166
15174
  }
15167
15175
 
15168
15176
  /**
15169
15177
  * Queues additional writes to be sent to the write stream, sending them
15170
15178
  * immediately if the write stream is established.
15171
15179
  */ function __PRIVATE_addToWritePipeline(e, t) {
15172
- e.K_.push(t);
15180
+ e.U_.push(t);
15173
15181
  const n = __PRIVATE_ensureWriteStream(e);
15174
15182
  n.c_() && n.S_ && n.b_(t.mutations);
15175
15183
  }
15176
15184
 
15177
15185
  function __PRIVATE_shouldStartWriteStream(e) {
15178
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15186
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15179
15187
  }
15180
15188
 
15181
15189
  function __PRIVATE_startWriteStream(e) {
@@ -15189,11 +15197,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15189
15197
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15190
15198
  const t = __PRIVATE_ensureWriteStream(e);
15191
15199
  // Send the write pipeline now that the stream is established.
15192
- for (const n of e.K_) t.b_(n.mutations);
15200
+ for (const n of e.U_) t.b_(n.mutations);
15193
15201
  }
15194
15202
 
15195
15203
  async function __PRIVATE_onMutationResult(e, t, n) {
15196
- const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15204
+ const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15197
15205
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15198
15206
  // It's possible that with the completion of this mutation another
15199
15207
  // slot has freed up.
@@ -15213,7 +15221,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15213
15221
  }(t.code)) {
15214
15222
  // This was a permanent error, the request itself was the problem
15215
15223
  // so it's not going to succeed if we resend it.
15216
- const n = e.K_.shift();
15224
+ const n = e.U_.shift();
15217
15225
  // In this case it's also unlikely that the server itself is melting
15218
15226
  // down -- this was just a bad request so inhibit backoff on the next
15219
15227
  // restart.
@@ -15312,8 +15320,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15312
15320
  }), e.G_.push((async t => {
15313
15321
  t ? (e.Y_.h_(),
15314
15322
  // This will start the write stream if necessary.
15315
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.K_.length} pending writes`),
15316
- e.K_ = []));
15323
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15324
+ e.U_ = []));
15317
15325
  }))), e.Y_;
15318
15326
  }
15319
15327
 
@@ -16327,11 +16335,11 @@ const Jt = "SyncEngine";
16327
16335
  * Keeps track of the information about an active limbo resolution for each
16328
16336
  * active target ID that was started for the purpose of limbo resolution.
16329
16337
  */
16330
- this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16338
+ this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16331
16339
  /** Stores user completion handlers, indexed by User and BatchId. */
16332
16340
  this.Wa = {},
16333
16341
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16334
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16342
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16335
16343
  // The primary state is set to `true` or `false` immediately after Firestore
16336
16344
  // startup. In the interim, a client should only be considered primary if
16337
16345
  // `isPrimary` is true.
@@ -16511,7 +16519,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16511
16519
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16512
16520
  // Update `receivedDocument` as appropriate for any limbo targets.
16513
16521
  t.targetChanges.forEach(((e, t) => {
16514
- const r = n.Ka.get(t);
16522
+ const r = n.Ua.get(t);
16515
16523
  r && (
16516
16524
  // Since this is a limbo resolution lookup, it's for a single document
16517
16525
  // and it could be added, modified, or removed, but not a combination.
@@ -16565,7 +16573,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16565
16573
  const r = __PRIVATE_debugCast(e);
16566
16574
  // PORTING NOTE: Multi-tab only.
16567
16575
  r.sharedClientState.updateQueryState(t, "rejected", n);
16568
- const i = r.Ka.get(t), s = i && i.key;
16576
+ const i = r.Ua.get(t), s = i && i.key;
16569
16577
  if (s) {
16570
16578
  // TODO(klimt): We really only should do the following on permission
16571
16579
  // denied errors, but we don't have the cause code here.
@@ -16587,7 +16595,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16587
16595
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16588
16596
  // this query when the RemoteStore restarts the Watch stream, which should
16589
16597
  // re-trigger the target failure.
16590
- r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16598
+ r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16591
16599
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16592
16600
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16593
16601
  }
@@ -16681,8 +16689,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16681
16689
  e.sharedClientState.removeLocalQueryTarget(t);
16682
16690
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16683
16691
  if (e.qa.delete(t), e.isPrimaryClient) {
16684
- e.Ua.br(t).forEach((t => {
16685
- e.Ua.containsKey(t) ||
16692
+ e.Ka.br(t).forEach((t => {
16693
+ e.Ka.containsKey(t) ||
16686
16694
  // We removed the last reference for this key
16687
16695
  __PRIVATE_removeLimboTarget(e, t);
16688
16696
  }));
@@ -16695,14 +16703,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16695
16703
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16696
16704
  const n = e.$a.get(t);
16697
16705
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16698
- e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16706
+ e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16699
16707
  }
16700
16708
 
16701
16709
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16702
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16710
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16703
16711
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16704
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16705
- e.Ua.containsKey(r.key) ||
16712
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16713
+ e.Ka.containsKey(r.key) ||
16706
16714
  // We removed the last reference for this key
16707
16715
  __PRIVATE_removeLimboTarget(e, r.key);
16708
16716
  } else fail();
@@ -16726,7 +16734,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16726
16734
  const t = e.Qa.values().next().value;
16727
16735
  e.Qa.delete(t);
16728
16736
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16729
- 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));
16737
+ 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));
16730
16738
  }
16731
16739
  }
16732
16740
 
@@ -16794,7 +16802,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16794
16802
  }
16795
16803
 
16796
16804
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16797
- const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16805
+ const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16798
16806
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16799
16807
  {
16800
16808
  let e = __PRIVATE_documentKeySet();
@@ -16886,9 +16894,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16886
16894
  // PORTING NOTE: Multi-Tab only.
16887
16895
  function __PRIVATE_resetLimboDocuments(e) {
16888
16896
  const t = __PRIVATE_debugCast(e);
16889
- t.Ka.forEach(((e, n) => {
16897
+ t.Ua.forEach(((e, n) => {
16890
16898
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16891
- })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16899
+ })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16892
16900
  }
16893
16901
  /**
16894
16902
  * Reconcile the query views of the provided query targets with the state from
@@ -19747,7 +19755,7 @@ function __PRIVATE_isWrite(e) {
19747
19755
  });
19748
19756
  return r.$u(e), r;
19749
19757
  }
19750
- Ku(e) {
19758
+ Uu(e) {
19751
19759
  var t;
19752
19760
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19753
19761
  path: n,
@@ -19755,7 +19763,7 @@ function __PRIVATE_isWrite(e) {
19755
19763
  });
19756
19764
  return r.Bu(), r;
19757
19765
  }
19758
- Uu(e) {
19766
+ Ku(e) {
19759
19767
  // TODO(b/34871131): We don't support array paths right now; so make path
19760
19768
  // undefined.
19761
19769
  return this.ku({
@@ -19916,7 +19924,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19916
19924
  // For Compat types, we have to "extract" the underlying types before
19917
19925
  // performing validation.
19918
19926
  r = util.getModularInstance(r);
19919
- const a = i.Ku(_);
19927
+ const a = i.Uu(_);
19920
19928
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19921
19929
  // Add it to the field mask, but don't add anything to updateData.
19922
19930
  s.push(_); else {
@@ -19942,7 +19950,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19942
19950
  // For Compat types, we have to "extract" the underlying types before
19943
19951
  // performing validation.
19944
19952
  n = util.getModularInstance(n);
19945
- const r = o.Ku(t);
19953
+ const r = o.Uu(t);
19946
19954
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19947
19955
  // Add it to the field mask, but don't add anything to updateData.
19948
19956
  u.push(t); else {
@@ -20020,7 +20028,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20020
20028
  const n = [];
20021
20029
  let r = 0;
20022
20030
  for (const i of e) {
20023
- let e = __PRIVATE_parseData(i, t.Uu(r));
20031
+ let e = __PRIVATE_parseData(i, t.Ku(r));
20024
20032
  null == e && (
20025
20033
  // Just include nulls in the array for fields being replaced with a
20026
20034
  // sentinel.