@firebase/firestore 4.7.9-canary.a24a76aa2 → 4.7.9-canary.cf3c8fb2a

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, deepEqual, createMockUserToken, getModularInstance, 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 b = "@firebase/firestore", S = "4.7.9-canary.a24a76aa2";
8
+ const S = "@firebase/firestore", b = "4.7.9-canary.cf3c8fb2a";
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.4.0-canary.a24a76aa2";
70
+ let D = "11.4.0-canary.cf3c8fb2a";
71
71
 
72
72
  /**
73
73
  * @license
@@ -684,6 +684,31 @@ 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
+ */
687
712
  /**
688
713
  * @license
689
714
  * Copyright 2017 Google LLC
@@ -705,7 +730,8 @@ function __PRIVATE_randomBytes(e) {
705
730
  *
706
731
  * @internal
707
732
  * Exported internally for testing purposes.
708
- */ class __PRIVATE_AutoId {
733
+ */
734
+ class __PRIVATE_AutoId {
709
735
  static newId() {
710
736
  // Alphanumeric characters
711
737
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -726,6 +752,37 @@ function __PRIVATE_primitiveComparator(e, t) {
726
752
  return e < t ? -1 : e > t ? 1 : 0;
727
753
  }
728
754
 
755
+ /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
756
+ let n = 0;
757
+ for (;n < e.length && n < t.length; ) {
758
+ const r = e.codePointAt(n), i = t.codePointAt(n);
759
+ if (r !== i) {
760
+ if (r < 128 && i < 128)
761
+ // ASCII comparison
762
+ return __PRIVATE_primitiveComparator(r, i);
763
+ {
764
+ // Lazy instantiate TextEncoder
765
+ const s = __PRIVATE_newTextEncoder(), o = __PRIVATE_compareByteArrays$1(s.encode(__PRIVATE_getUtf8SafeSubstring(e, n)), s.encode(__PRIVATE_getUtf8SafeSubstring(t, n)));
766
+ // UTF-8 encode the character at index i for byte comparison.
767
+ return 0 !== o ? o : __PRIVATE_primitiveComparator(r, i);
768
+ }
769
+ }
770
+ // Increment by 2 for surrogate pairs, 1 otherwise
771
+ n += r > 65535 ? 2 : 1;
772
+ }
773
+ // Compare lengths if all characters are equal
774
+ return __PRIVATE_primitiveComparator(e.length, t.length);
775
+ }
776
+
777
+ function __PRIVATE_getUtf8SafeSubstring(e, t) {
778
+ return e.codePointAt(t) > 65535 ? e.substring(t, t + 2) : e.substring(t, t + 1);
779
+ }
780
+
781
+ function __PRIVATE_compareByteArrays$1(e, t) {
782
+ for (let n = 0; n < e.length && n < t.length; ++n) if (e[n] !== t[n]) return __PRIVATE_primitiveComparator(e[n], t[n]);
783
+ return __PRIVATE_primitiveComparator(e.length, t.length);
784
+ }
785
+
729
786
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
730
787
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
731
788
  }
@@ -1016,13 +1073,11 @@ class Timestamp {
1016
1073
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1017
1074
  if (0 !== n) return n;
1018
1075
  }
1019
- return Math.sign(e.length - t.length);
1076
+ return __PRIVATE_primitiveComparator(e.length, t.length);
1020
1077
  }
1021
1078
  static compareSegments(e, t) {
1022
1079
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(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;
1080
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1026
1081
  }
1027
1082
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1028
1083
  static isNumericId(e) {
@@ -1810,13 +1865,13 @@ class __PRIVATE_SimpleDbTransaction {
1810
1865
  * within the key range or index.
1811
1866
  */ class __PRIVATE_IterationController {
1812
1867
  constructor(e) {
1813
- this.q = e, this.$ = !1, this.K = null;
1868
+ this.q = e, this.$ = !1, this.U = null;
1814
1869
  }
1815
1870
  get isDone() {
1816
1871
  return this.$;
1817
1872
  }
1818
- get U() {
1819
- return this.K;
1873
+ get K() {
1874
+ return this.U;
1820
1875
  }
1821
1876
  set cursor(e) {
1822
1877
  this.q = e;
@@ -1830,7 +1885,7 @@ class __PRIVATE_SimpleDbTransaction {
1830
1885
  * This function can be called to skip to that next key, which could be
1831
1886
  * an index or a primary key.
1832
1887
  */ W(e) {
1833
- this.K = e;
1888
+ this.U = e;
1834
1889
  }
1835
1890
  /**
1836
1891
  * Delete the current cursor value from the object store.
@@ -1989,7 +2044,7 @@ class __PRIVATE_SimpleDbTransaction {
1989
2044
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
1990
2045
  n.push(e);
1991
2046
  }
1992
- s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2047
+ s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1993
2048
  };
1994
2049
  })).next((() => PersistencePromise.waitFor(n)));
1995
2050
  }
@@ -2310,7 +2365,7 @@ function __PRIVATE_encodeResourcePath(e) {
2310
2365
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311
2366
  * See the License for the specific language governing permissions and
2312
2367
  * limitations under the License.
2313
- */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2368
+ */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2314
2369
 
2315
2370
  /**
2316
2371
  * @license
@@ -2355,7 +2410,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2355
2410
  * there is no useful information to store as the value. The raw (unencoded)
2356
2411
  * path cannot be stored because IndexedDb doesn't store prototype
2357
2412
  * information.
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", be = "collectionGroupIndex", Se = "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 ];
2413
+ */ 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 ];
2359
2414
 
2360
2415
  /**
2361
2416
  * @license
@@ -3417,7 +3472,7 @@ function __PRIVATE_valueCompare(e, t) {
3417
3472
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3418
3473
 
3419
3474
  case 5 /* TypeOrder.StringValue */ :
3420
- return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3475
+ return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3421
3476
 
3422
3477
  case 6 /* TypeOrder.BlobValue */ :
3423
3478
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3465,7 +3520,7 @@ function __PRIVATE_valueCompare(e, t) {
3465
3520
  // canonical IDs are independent of insertion order.
3466
3521
  r.sort(), s.sort();
3467
3522
  for (let e = 0; e < r.length && e < s.length; ++e) {
3468
- const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3523
+ const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3469
3524
  if (0 !== t) return t;
3470
3525
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3471
3526
  if (0 !== o) return o;
@@ -5877,32 +5932,6 @@ let At = null;
5877
5932
  * Sets the value of the `testingHooksSpi` object.
5878
5933
  * @param instance the instance to set.
5879
5934
  */
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
- */
5906
5935
  /**
5907
5936
  * @license
5908
5937
  * Copyright 2022 Google LLC
@@ -6183,13 +6212,13 @@ class __PRIVATE_WatchTargetChange {
6183
6212
  */
6184
6213
  this.ye = __PRIVATE_snapshotChangesMap(),
6185
6214
  /** See public getters for explanations of these fields. */
6186
- this.we = ByteString.EMPTY_BYTE_STRING, this.be = !1,
6215
+ this.we = ByteString.EMPTY_BYTE_STRING, this.Se = !1,
6187
6216
  /**
6188
6217
  * Whether this target state should be included in the next snapshot. We
6189
6218
  * initialize to true so that newly-added targets are included in the next
6190
6219
  * RemoteEvent.
6191
6220
  */
6192
- this.Se = !0;
6221
+ this.be = !0;
6193
6222
  }
6194
6223
  /**
6195
6224
  * Whether this target has been marked 'current'.
@@ -6199,7 +6228,7 @@ class __PRIVATE_WatchTargetChange {
6199
6228
  * was added and that the target is consistent with the rest of the watch
6200
6229
  * stream.
6201
6230
  */ get current() {
6202
- return this.be;
6231
+ return this.Se;
6203
6232
  }
6204
6233
  /** The last resume token sent to us for this target. */ get resumeToken() {
6205
6234
  return this.we;
@@ -6208,13 +6237,13 @@ class __PRIVATE_WatchTargetChange {
6208
6237
  return 0 !== this.pe;
6209
6238
  }
6210
6239
  /** Whether we have modified any state that should trigger a snapshot. */ get ve() {
6211
- return this.Se;
6240
+ return this.be;
6212
6241
  }
6213
6242
  /**
6214
6243
  * Applies the resume token to the TargetChange, but only when it has a new
6215
6244
  * value. Empty resumeTokens are discarded.
6216
6245
  */ Ce(e) {
6217
- e.approximateByteSize() > 0 && (this.Se = !0, this.we = e);
6246
+ e.approximateByteSize() > 0 && (this.be = !0, this.we = e);
6218
6247
  }
6219
6248
  /**
6220
6249
  * Creates a target change from the current set of changes.
@@ -6240,18 +6269,18 @@ class __PRIVATE_WatchTargetChange {
6240
6269
  default:
6241
6270
  fail();
6242
6271
  }
6243
- })), new TargetChange(this.we, this.be, e, t, n);
6272
+ })), new TargetChange(this.we, this.Se, e, t, n);
6244
6273
  }
6245
6274
  /**
6246
6275
  * Resets the document changes and sets `hasPendingChanges` to false.
6247
6276
  */ Me() {
6248
- this.Se = !1, this.ye = __PRIVATE_snapshotChangesMap();
6277
+ this.be = !1, this.ye = __PRIVATE_snapshotChangesMap();
6249
6278
  }
6250
6279
  xe(e, t) {
6251
- this.Se = !0, this.ye = this.ye.insert(e, t);
6280
+ this.be = !0, this.ye = this.ye.insert(e, t);
6252
6281
  }
6253
6282
  Oe(e) {
6254
- this.Se = !0, this.ye = this.ye.remove(e);
6283
+ this.be = !0, this.ye = this.ye.remove(e);
6255
6284
  }
6256
6285
  Ne() {
6257
6286
  this.pe += 1;
@@ -6260,7 +6289,7 @@ class __PRIVATE_WatchTargetChange {
6260
6289
  this.pe -= 1, __PRIVATE_hardAssert(this.pe >= 0);
6261
6290
  }
6262
6291
  Le() {
6263
- this.Se = !0, this.be = !0;
6292
+ this.be = !0, this.Se = !0;
6264
6293
  }
6265
6294
  }
6266
6295
 
@@ -6275,13 +6304,13 @@ class __PRIVATE_WatchChangeAggregator {
6275
6304
  /** Keeps track of the documents to update since the last raised snapshot. */
6276
6305
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6277
6306
  /** A mapping of document keys to their set of target IDs. */
6278
- this.Ke = __PRIVATE_documentTargetMap(),
6307
+ this.Ue = __PRIVATE_documentTargetMap(),
6279
6308
  /**
6280
6309
  * A map of targets with existence filter mismatches. These targets are
6281
6310
  * known to be inconsistent and their listens needs to be re-established by
6282
6311
  * RemoteStore.
6283
6312
  */
6284
- this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6313
+ this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6285
6314
  }
6286
6315
  /**
6287
6316
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6370,7 +6399,7 @@ class __PRIVATE_WatchChangeAggregator {
6370
6399
  // trigger re-run of the query.
6371
6400
  this.Ye(t);
6372
6401
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6373
- this.Ue = this.Ue.insert(t, e);
6402
+ this.Ke = this.Ke.insert(t, e);
6374
6403
  }
6375
6404
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6376
6405
  var s, o, _, a, u, c;
@@ -6482,7 +6511,7 @@ class __PRIVATE_WatchChangeAggregator {
6482
6511
 
6483
6512
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6484
6513
  // client.
6485
- this.Ke.forEach(((e, t) => {
6514
+ this.Ue.forEach(((e, t) => {
6486
6515
  let r = !0;
6487
6516
  t.forEachWhile((e => {
6488
6517
  const t = this.Xe(e);
@@ -6490,9 +6519,9 @@ class __PRIVATE_WatchChangeAggregator {
6490
6519
  !1);
6491
6520
  })), r && (n = n.add(e));
6492
6521
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6493
- const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6522
+ const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6494
6523
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6495
- this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6524
+ this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6496
6525
  r;
6497
6526
  }
6498
6527
  /**
@@ -6504,7 +6533,7 @@ class __PRIVATE_WatchChangeAggregator {
6504
6533
  if (!this.Je(e)) return;
6505
6534
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6506
6535
  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)),
6507
- this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6536
+ this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6508
6537
  }
6509
6538
  /**
6510
6539
  * Removes the provided document from the target mapping. If the
@@ -6520,7 +6549,7 @@ class __PRIVATE_WatchChangeAggregator {
6520
6549
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6521
6550
  // The document may have entered and left the target before we raised a
6522
6551
  // snapshot, so we can just ignore the change.
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)),
6552
+ 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)),
6524
6553
  n && (this.Qe = this.Qe.insert(t, n));
6525
6554
  }
6526
6555
  removeTarget(e) {
@@ -6545,8 +6574,8 @@ class __PRIVATE_WatchChangeAggregator {
6545
6574
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6546
6575
  }
6547
6576
  ct(e) {
6548
- let t = this.Ke.get(e);
6549
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6577
+ let t = this.Ue.get(e);
6578
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6550
6579
  t;
6551
6580
  }
6552
6581
  _t(e) {
@@ -7729,7 +7758,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7729
7758
  * limitations under the License.
7730
7759
  */ class __PRIVATE_IndexedDbGlobalsCache {
7731
7760
  dt(e) {
7732
- return __PRIVATE_getStore(e, Ke);
7761
+ return __PRIVATE_getStore(e, Ue);
7733
7762
  }
7734
7763
  getSessionToken(e) {
7735
7764
  return this.dt(e).get("sessionToken").next((e => {
@@ -7790,12 +7819,12 @@ class __PRIVATE_FirestoreIndexValueWriter {
7790
7819
  let n = e.timestampValue;
7791
7820
  this.ft(t, 20), "string" == typeof n && (n = __PRIVATE_normalizeTimestamp(n)), t.yt(`${n.seconds || ""}`),
7792
7821
  t.gt(n.nanos || 0);
7793
- } else if ("stringValue" in e) this.wt(e.stringValue, t), this.bt(t); else if ("bytesValue" in e) this.ft(t, 30),
7794
- t.St(__PRIVATE_normalizeByteString(e.bytesValue)), this.bt(t); else if ("referenceValue" in e) this.Dt(e.referenceValue, t); else if ("geoPointValue" in e) {
7822
+ } else if ("stringValue" in e) this.wt(e.stringValue, t), this.St(t); else if ("bytesValue" in e) this.ft(t, 30),
7823
+ t.bt(__PRIVATE_normalizeByteString(e.bytesValue)), this.St(t); else if ("referenceValue" in e) this.Dt(e.referenceValue, t); else if ("geoPointValue" in e) {
7795
7824
  const n = e.geoPointValue;
7796
7825
  this.ft(t, 45), t.gt(n.latitude || 0), t.gt(n.longitude || 0);
7797
7826
  } else "mapValue" in e ? __PRIVATE_isMaxValue(e) ? this.ft(t, Number.MAX_SAFE_INTEGER) : __PRIVATE_isVectorValue(e) ? this.vt(e.mapValue, t) : (this.Ct(e.mapValue, t),
7798
- this.bt(t)) : "arrayValue" in e ? (this.Ft(e.arrayValue, t), this.bt(t)) : fail();
7827
+ this.St(t)) : "arrayValue" in e ? (this.Ft(e.arrayValue, t), this.St(t)) : fail();
7799
7828
  }
7800
7829
  wt(e, t) {
7801
7830
  this.ft(t, 25), this.Mt(e, t);
@@ -7832,7 +7861,7 @@ class __PRIVATE_FirestoreIndexValueWriter {
7832
7861
  ft(e, t) {
7833
7862
  e.gt(t);
7834
7863
  }
7835
- bt(e) {
7864
+ St(e) {
7836
7865
  // While the SDK does not implement truncation, the truncation marker is
7837
7866
  // used to terminate all variable length values (which are strings, bytes,
7838
7867
  // references, arrays and maps).
@@ -7941,10 +7970,10 @@ function __PRIVATE_unsignedNumLength(e) {
7941
7970
  }
7942
7971
  this.qt();
7943
7972
  }
7944
- Kt(e) {
7973
+ Ut(e) {
7945
7974
  // Values are encoded with a single byte length prefix, followed by the
7946
7975
  // actual value in big-endian format with leading 0 bytes dropped.
7947
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7976
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7948
7977
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7949
7978
  // Write the length
7950
7979
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7952,7 +7981,7 @@ function __PRIVATE_unsignedNumLength(e) {
7952
7981
  Gt(e) {
7953
7982
  // Values are encoded with a single byte length prefix, followed by the
7954
7983
  // inverted value in big-endian format with leading 0 bytes dropped.
7955
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7984
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7956
7985
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7957
7986
  // Write the length
7958
7987
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7987,7 +8016,7 @@ function __PRIVATE_unsignedNumLength(e) {
7987
8016
  * -0.0 < 0.0
7988
8017
  * all non-NaN < NaN
7989
8018
  * NaN = NaN
7990
- */ Ut(e) {
8019
+ */ Kt(e) {
7991
8020
  const t =
7992
8021
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
7993
8022
  function __PRIVATE_doubleToLongBits(e) {
@@ -8039,14 +8068,14 @@ class __PRIVATE_AscendingIndexByteEncoder {
8039
8068
  constructor(e) {
8040
8069
  this.Zt = e;
8041
8070
  }
8042
- St(e) {
8071
+ bt(e) {
8043
8072
  this.Zt.Ot(e);
8044
8073
  }
8045
8074
  yt(e) {
8046
8075
  this.Zt.Qt(e);
8047
8076
  }
8048
8077
  gt(e) {
8049
- this.Zt.Kt(e);
8078
+ this.Zt.Ut(e);
8050
8079
  }
8051
8080
  Vt() {
8052
8081
  this.Zt.zt();
@@ -8057,7 +8086,7 @@ class __PRIVATE_DescendingIndexByteEncoder {
8057
8086
  constructor(e) {
8058
8087
  this.Zt = e;
8059
8088
  }
8060
- St(e) {
8089
+ bt(e) {
8061
8090
  this.Zt.Lt(e);
8062
8091
  }
8063
8092
  yt(e) {
@@ -8887,7 +8916,7 @@ class __PRIVATE_IndexedDbIndexManager {
8887
8916
  let i = 0;
8888
8917
  for (const s of __PRIVATE_fieldIndexGetDirectionalSegments(e)) {
8889
8918
  const e = n[i++];
8890
- for (const n of r) if (this.bn(t, s.fieldPath) && isArray(e)) r = this.Sn(r, s, e); else {
8919
+ for (const n of r) if (this.Sn(t, s.fieldPath) && isArray(e)) r = this.bn(r, s, e); else {
8891
8920
  const t = n.tn(s.kind);
8892
8921
  __PRIVATE_FirestoreIndexValueWriter.xt.At(e, t);
8893
8922
  }
@@ -8911,7 +8940,7 @@ class __PRIVATE_IndexedDbIndexManager {
8911
8940
  * The method appends each value to all existing encoders (e.g. filter("a",
8912
8941
  * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A
8913
8942
  * list of new encoders is returned.
8914
- */ Sn(e, t, n) {
8943
+ */ bn(e, t, n) {
8915
8944
  const r = [ ...e ], i = [];
8916
8945
  for (const e of n.arrayValue.values || []) for (const n of r) {
8917
8946
  const r = new __PRIVATE_IndexByteEncoder;
@@ -8919,12 +8948,12 @@ class __PRIVATE_IndexedDbIndexManager {
8919
8948
  }
8920
8949
  return i;
8921
8950
  }
8922
- bn(e, t) {
8951
+ Sn(e, t) {
8923
8952
  return !!e.filters.find((e => e instanceof FieldFilter && e.field.isEqual(t) && ("in" /* Operator.IN */ === e.op || "not-in" /* Operator.NOT_IN */ === e.op)));
8924
8953
  }
8925
8954
  getFieldIndexes(e, t) {
8926
8955
  const n = __PRIVATE_indexConfigurationStore(e), r = __PRIVATE_indexStateStore(e);
8927
- return (t ? n.G(be, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8956
+ return (t ? n.G(Se, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8928
8957
  const t = [];
8929
8958
  return PersistencePromise.forEach(e, (e => r.get([ e.indexId, this.uid ]).next((n => {
8930
8959
  t.push(function __PRIVATE_fromDbIndexConfiguration(e, t) {
@@ -8942,7 +8971,7 @@ class __PRIVATE_IndexedDbIndexManager {
8942
8971
  }
8943
8972
  updateCollectionGroup(e, t, n) {
8944
8973
  const r = __PRIVATE_indexConfigurationStore(e), i = __PRIVATE_indexStateStore(e);
8945
- return this.vn(e).next((e => r.G(be, IDBKeyRange.bound(t, t)).next((t => PersistencePromise.forEach(t, (t => i.put(__PRIVATE_toDbIndexState(t.indexId, this.uid, e, n))))))));
8974
+ return this.vn(e).next((e => r.G(Se, IDBKeyRange.bound(t, t)).next((t => PersistencePromise.forEach(t, (t => i.put(__PRIVATE_toDbIndexState(t.indexId, this.uid, e, n))))))));
8946
8975
  }
8947
8976
  updateIndexEntries(e, t) {
8948
8977
  // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as
@@ -9139,7 +9168,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
9139
9168
  sequenceNumbersCollected: 0,
9140
9169
  targetsRemoved: 0,
9141
9170
  documentsRemoved: 0
9142
- }, bt = 41943040;
9171
+ }, St = 41943040;
9143
9172
 
9144
9173
  class LruParams {
9145
9174
  static withCacheSize(e) {
@@ -9224,7 +9253,7 @@ function removeMutationBatch(e, t, n) {
9224
9253
  * limitations under the License.
9225
9254
  */
9226
9255
  /** A mutation queue for a specific user, backed by IndexedDB. */ LruParams.DEFAULT_COLLECTION_PERCENTILE = 10,
9227
- LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, LruParams.DEFAULT = new LruParams(bt, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),
9256
+ LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, LruParams.DEFAULT = new LruParams(St, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),
9228
9257
  LruParams.DISABLED = new LruParams(-1, 0, 0);
9229
9258
 
9230
9259
  class __PRIVATE_IndexedDbMutationQueue {
@@ -9555,14 +9584,14 @@ class __PRIVATE_TargetIdGenerator {
9555
9584
  next() {
9556
9585
  return this.$n += 2, this.$n;
9557
9586
  }
9558
- static Kn() {
9587
+ static Un() {
9559
9588
  // The target cache generator must return '2' in its first call to `next()`
9560
9589
  // as there is no differentiation in the protocol layer between an unset
9561
9590
  // number and the number '0'. If we were to sent a target with target ID
9562
9591
  // '0', the backend would consider it unset and replace it with its own ID.
9563
9592
  return new __PRIVATE_TargetIdGenerator(0);
9564
9593
  }
9565
- static Un() {
9594
+ static Kn() {
9566
9595
  // Sync engine assigns target IDs for limbo document detection.
9567
9596
  return new __PRIVATE_TargetIdGenerator(-1);
9568
9597
  }
@@ -9781,7 +9810,7 @@ class __PRIVATE_TargetIdGenerator {
9781
9810
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9782
9811
  * See the License for the specific language governing permissions and
9783
9812
  * limitations under the License.
9784
- */ const St = "LruGarbageCollector", Dt = 1048576;
9813
+ */ const bt = "LruGarbageCollector", Dt = 1048576;
9785
9814
 
9786
9815
  function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9787
9816
  const i = __PRIVATE_primitiveComparator(e, n);
@@ -9834,12 +9863,12 @@ function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9834
9863
  return null !== this.Xn;
9835
9864
  }
9836
9865
  er(e) {
9837
- __PRIVATE_logDebug(St, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9866
+ __PRIVATE_logDebug(bt, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9838
9867
  this.Xn = null;
9839
9868
  try {
9840
9869
  await this.localStore.collectGarbage(this.garbageCollector);
9841
9870
  } catch (e) {
9842
- __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(St, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9871
+ __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(bt, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9843
9872
  }
9844
9873
  await this.er(3e5);
9845
9874
  }));
@@ -10957,13 +10986,13 @@ class OverlayedDocument {
10957
10986
  */ removeReference(e, t) {
10958
10987
  this.wr(new __PRIVATE_DocReference(e, t));
10959
10988
  }
10960
- br(e, t) {
10989
+ Sr(e, t) {
10961
10990
  e.forEach((e => this.removeReference(e, t)));
10962
10991
  }
10963
10992
  /**
10964
10993
  * Clears all references with a given ID. Calls removeRef() for each key
10965
10994
  * removed.
10966
- */ Sr(e) {
10995
+ */ br(e) {
10967
10996
  const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1), i = [];
10968
10997
  return this.gr.forEachInRange([ n, r ], (e => {
10969
10998
  this.wr(e), i.push(e.key);
@@ -11330,7 +11359,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11330
11359
  * A ordered bidirectional mapping between documents and the remote target
11331
11360
  * IDs.
11332
11361
  */
11333
- this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11362
+ this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11334
11363
  }
11335
11364
  forEachTarget(e, t) {
11336
11365
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11342,7 +11371,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11342
11371
  return PersistencePromise.resolve(this.$r);
11343
11372
  }
11344
11373
  allocateTargetId(e) {
11345
- return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11374
+ return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11346
11375
  }
11347
11376
  setTargetsMetadata(e, t, n) {
11348
11377
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11351,7 +11380,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11351
11380
  zn(e) {
11352
11381
  this.Qr.set(e.target, e);
11353
11382
  const t = e.targetId;
11354
- t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11383
+ t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11355
11384
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11356
11385
  }
11357
11386
  addTargetData(e, t) {
@@ -11361,7 +11390,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11361
11390
  return this.zn(t), PersistencePromise.resolve();
11362
11391
  }
11363
11392
  removeTargetData(e, t) {
11364
- return this.Qr.delete(t.target), this.Kr.Sr(t.targetId), this.targetCount -= 1,
11393
+ return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11365
11394
  PersistencePromise.resolve();
11366
11395
  }
11367
11396
  removeTargets(e, t, n) {
@@ -11380,24 +11409,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11380
11409
  return PersistencePromise.resolve(n);
11381
11410
  }
11382
11411
  addMatchingKeys(e, t, n) {
11383
- return this.Kr.yr(t, n), PersistencePromise.resolve();
11412
+ return this.Ur.yr(t, n), PersistencePromise.resolve();
11384
11413
  }
11385
11414
  removeMatchingKeys(e, t, n) {
11386
- this.Kr.br(t, n);
11415
+ this.Ur.Sr(t, n);
11387
11416
  const r = this.persistence.referenceDelegate, i = [];
11388
11417
  return r && t.forEach((t => {
11389
11418
  i.push(r.markPotentiallyOrphaned(e, t));
11390
11419
  })), PersistencePromise.waitFor(i);
11391
11420
  }
11392
11421
  removeMatchingKeysForTargetId(e, t) {
11393
- return this.Kr.Sr(t), PersistencePromise.resolve();
11422
+ return this.Ur.br(t), PersistencePromise.resolve();
11394
11423
  }
11395
11424
  getMatchingKeysForTargetId(e, t) {
11396
- const n = this.Kr.vr(t);
11425
+ const n = this.Ur.vr(t);
11397
11426
  return PersistencePromise.resolve(n);
11398
11427
  }
11399
11428
  containsKey(e, t) {
11400
- return PersistencePromise.resolve(this.Kr.containsKey(t));
11429
+ return PersistencePromise.resolve(this.Ur.containsKey(t));
11401
11430
  }
11402
11431
  }
11403
11432
 
@@ -11525,7 +11554,7 @@ class __PRIVATE_MemoryEagerDelegate {
11525
11554
  return this.ii.add(t.toString()), PersistencePromise.resolve();
11526
11555
  }
11527
11556
  removeTarget(e, t) {
11528
- this.ti.Sr(t.targetId).forEach((e => this.ii.add(e.toString())));
11557
+ this.ti.br(t.targetId).forEach((e => this.ii.add(e.toString())));
11529
11558
  const n = this.persistence.getTargetCache();
11530
11559
  return n.getMatchingKeysForTargetId(e, t.targetId).next((e => {
11531
11560
  e.forEach((e => this.ii.add(e.toString())));
@@ -11658,7 +11687,7 @@ class __PRIVATE_MemoryLruDelegate {
11658
11687
  */ B(e, t, n, r) {
11659
11688
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11660
11689
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11661
- e.createObjectStore(U);
11690
+ e.createObjectStore(K);
11662
11691
  }(e), function __PRIVATE_createMutationQueue(e) {
11663
11692
  e.createObjectStore(G, {
11664
11693
  keyPath: z
@@ -11675,7 +11704,7 @@ class __PRIVATE_MemoryLruDelegate {
11675
11704
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11676
11705
  * and rewrites all data.
11677
11706
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11678
- e.createObjectStore(K);
11707
+ e.createObjectStore(U);
11679
11708
  }(e));
11680
11709
  // Migration 2 to populate the targetGlobal object no longer needed since
11681
11710
  // migration 3 unconditionally clears it.
@@ -11763,13 +11792,13 @@ class __PRIVATE_MemoryLruDelegate {
11763
11792
  keyPath: te
11764
11793
  });
11765
11794
  t.createIndex(ne, re), t.createIndex(ie, se);
11766
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11795
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11767
11796
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11768
11797
  const t = e.createObjectStore(ye, {
11769
11798
  keyPath: we,
11770
11799
  autoIncrement: !0
11771
11800
  });
11772
- t.createIndex(be, Se, {
11801
+ t.createIndex(Se, be, {
11773
11802
  unique: !1
11774
11803
  });
11775
11804
  const n = e.createObjectStore(De, {
@@ -11792,15 +11821,15 @@ class __PRIVATE_MemoryLruDelegate {
11792
11821
  t.objectStore(Me).clear();
11793
11822
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11794
11823
  !function __PRIVATE_createGlobalsStore(e) {
11795
- e.createObjectStore(Ke, {
11796
- keyPath: Ue
11824
+ e.createObjectStore(Ue, {
11825
+ keyPath: Ke
11797
11826
  });
11798
11827
  }(e);
11799
11828
  }))), s;
11800
11829
  }
11801
11830
  ai(e) {
11802
11831
  let t = 0;
11803
- return e.store(K).Z(((e, n) => {
11832
+ return e.store(U).Z(((e, n) => {
11804
11833
  t += __PRIVATE_dbDocumentSize(n);
11805
11834
  })).next((() => {
11806
11835
  const n = {
@@ -11824,7 +11853,7 @@ class __PRIVATE_MemoryLruDelegate {
11824
11853
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11825
11854
  * with a sequence number. Missing rows are given the most recently used sequence number.
11826
11855
  */ ui(e) {
11827
- const t = e.store(le), n = e.store(K);
11856
+ const t = e.store(le), n = e.store(U);
11828
11857
  return e.store(Ee).get(Ie).next((e => {
11829
11858
  const r = [];
11830
11859
  return n.Z(((n, i) => {
@@ -11855,7 +11884,7 @@ class __PRIVATE_MemoryLruDelegate {
11855
11884
  };
11856
11885
  // Helper to add an index entry iff we haven't already written it.
11857
11886
  // Index existing remote documents.
11858
- return t.store(K).Z({
11887
+ return t.store(U).Z({
11859
11888
  Y: !0
11860
11889
  }, ((e, t) => {
11861
11890
  const n = new ResourcePath(e);
@@ -11875,7 +11904,7 @@ class __PRIVATE_MemoryLruDelegate {
11875
11904
  }));
11876
11905
  }
11877
11906
  hi(e, t) {
11878
- const n = t.store(K), r = [];
11907
+ const n = t.store(U), r = [];
11879
11908
  return n.Z(((e, n) => {
11880
11909
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11881
11910
  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();
@@ -12036,7 +12065,7 @@ class __PRIVATE_IndexedDbPersistence {
12036
12065
  // Fail `start()` if `synchronizeTabs` is disabled and we cannot
12037
12066
  // obtain the primary lease.
12038
12067
  throw new FirestoreError(C.FAILED_PRECONDITION, Mt);
12039
- return this.bi(), this.Si(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12068
+ return this.Si(), this.bi(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12040
12069
  })).then((e => {
12041
12070
  this.Gr = new __PRIVATE_ListenSequence(e, this.Ii);
12042
12071
  })).then((() => {
@@ -12193,11 +12222,11 @@ class __PRIVATE_IndexedDbPersistence {
12193
12222
  async shutdown() {
12194
12223
  // The shutdown() operations are idempotent and can be called even when
12195
12224
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12196
- this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12225
+ this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12197
12226
  this.Wi(),
12198
12227
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12199
12228
  // has obtained the primary lease.
12200
- await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12229
+ await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12201
12230
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12202
12231
  return this.xi(t).next((() => this.Bi(t)));
12203
12232
  })), this.pi.close(),
@@ -12297,13 +12326,13 @@ class __PRIVATE_IndexedDbPersistence {
12297
12326
  return !(e < n - t) && (!(e > n) || (__PRIVATE_logError(`Detected an update time that is in the future: ${e} > ${n}`),
12298
12327
  !1));
12299
12328
  }
12300
- bi() {
12329
+ Si() {
12301
12330
  null !== this.document && "function" == typeof this.document.addEventListener && (this.Ri = () => {
12302
12331
  this.Ti.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
12303
12332
  this.wi())));
12304
12333
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12305
12334
  }
12306
- Ui() {
12335
+ Ki() {
12307
12336
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12308
12337
  }
12309
12338
  /**
@@ -12315,13 +12344,13 @@ class __PRIVATE_IndexedDbPersistence {
12315
12344
  * primary lease). LocalStorage is used for this rather than IndexedDb because
12316
12345
  * it is a synchronous API and so can be used reliably from an unload
12317
12346
  * handler.
12318
- */ Si() {
12347
+ */ bi() {
12319
12348
  var e;
12320
12349
  "function" == typeof (null === (e = this.window) || void 0 === e ? void 0 : e.addEventListener) && (this.Ai = () => {
12321
12350
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12322
12351
  // accesses internal state. We execute this code directly during shutdown
12323
12352
  // to make sure it gets a chance to run.
12324
- this.Ki();
12353
+ this.Ui();
12325
12354
  const e = /(?:Version|Mobile)\/1[456]/;
12326
12355
  isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12327
12356
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12352,7 +12381,7 @@ class __PRIVATE_IndexedDbPersistence {
12352
12381
  /**
12353
12382
  * Record client as zombied (a client that had its tab closed). Zombied
12354
12383
  * clients are ignored during primary tab selection.
12355
- */ Ki() {
12384
+ */ Ui() {
12356
12385
  if (this.yi) try {
12357
12386
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12358
12387
  } catch (e) {
@@ -12375,7 +12404,7 @@ class __PRIVATE_IndexedDbPersistence {
12375
12404
  /**
12376
12405
  * Helper to get a typed SimpleDbStore for the primary client object store.
12377
12406
  */ function __PRIVATE_primaryClientStore(e) {
12378
- return __PRIVATE_getStore(e, U);
12407
+ return __PRIVATE_getStore(e, K);
12379
12408
  }
12380
12409
 
12381
12410
  /**
@@ -13230,14 +13259,14 @@ class __PRIVATE_MutationMetadata {
13230
13259
  /**
13231
13260
  * Parses a MutationMetadata from its JSON representation in WebStorage.
13232
13261
  * Logs a warning and returns null if the format of the data is not valid.
13233
- */ static bs(e, t, n) {
13262
+ */ static Ss(e, t, n) {
13234
13263
  const r = JSON.parse(n);
13235
13264
  let i, s = "object" == typeof r && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(r.state) && (void 0 === r.error || "object" == typeof r.error);
13236
13265
  return s && r.error && (s = "string" == typeof r.error.message && "string" == typeof r.error.code,
13237
13266
  s && (i = new FirestoreError(r.error.code, r.error.message))), s ? new __PRIVATE_MutationMetadata(e, t, r.state, i) : (__PRIVATE_logError(qt, `Failed to parse mutation state for ID '${t}': ${n}`),
13238
13267
  null);
13239
13268
  }
13240
- Ss() {
13269
+ bs() {
13241
13270
  const e = {
13242
13271
  state: this.state,
13243
13272
  updateTimeMs: Date.now()
@@ -13261,14 +13290,14 @@ class __PRIVATE_QueryTargetMetadata {
13261
13290
  /**
13262
13291
  * Parses a QueryTargetMetadata from its JSON representation in WebStorage.
13263
13292
  * Logs a warning and returns null if the format of the data is not valid.
13264
- */ static bs(e, t) {
13293
+ */ static Ss(e, t) {
13265
13294
  const n = JSON.parse(t);
13266
13295
  let r, i = "object" == typeof n && -1 !== [ "not-current", "current", "rejected" ].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error);
13267
13296
  return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code,
13268
13297
  i && (r = new FirestoreError(n.error.code, n.error.message))), i ? new __PRIVATE_QueryTargetMetadata(e, n.state, r) : (__PRIVATE_logError(qt, `Failed to parse target state for ID '${e}': ${t}`),
13269
13298
  null);
13270
13299
  }
13271
- Ss() {
13300
+ bs() {
13272
13301
  const e = {
13273
13302
  state: this.state,
13274
13303
  updateTimeMs: Date.now()
@@ -13290,7 +13319,7 @@ class __PRIVATE_QueryTargetMetadata {
13290
13319
  /**
13291
13320
  * Parses a RemoteClientState from the JSON representation in WebStorage.
13292
13321
  * Logs a warning and returns null if the format of the data is not valid.
13293
- */ static bs(e, t) {
13322
+ */ static Ss(e, t) {
13294
13323
  const n = JSON.parse(t);
13295
13324
  let r = "object" == typeof n && n.activeTargetIds instanceof Array, i = __PRIVATE_targetIdSet();
13296
13325
  for (let e = 0; r && e < n.activeTargetIds.length; ++e) r = isSafeInteger(n.activeTargetIds[e]),
@@ -13311,7 +13340,7 @@ class __PRIVATE_QueryTargetMetadata {
13311
13340
  /**
13312
13341
  * Parses a SharedOnlineState from its JSON representation in WebStorage.
13313
13342
  * Logs a warning and returns null if the format of the data is not valid.
13314
- */ static bs(e) {
13343
+ */ static Ss(e) {
13315
13344
  const t = JSON.parse(e);
13316
13345
  return "object" == typeof t && -1 !== [ "Unknown", "Online", "Offline" ].indexOf(t.onlineState) && "string" == typeof t.clientId ? new __PRIVATE_SharedOnlineState(t.clientId, t.onlineState) : (__PRIVATE_logError(qt, `Failed to parse online state: ${e}`),
13317
13346
  null);
@@ -13342,7 +13371,7 @@ class __PRIVATE_LocalClientState {
13342
13371
  /**
13343
13372
  * Converts this entry into a JSON-encoded format we can use for WebStorage.
13344
13373
  * Does not encode `clientId` as it is part of the key in WebStorage.
13345
- */ Ss() {
13374
+ */ bs() {
13346
13375
  const e = {
13347
13376
  activeTargetIds: this.activeTargetIds.toArray(),
13348
13377
  updateTimeMs: Date.now()
@@ -13410,16 +13439,16 @@ class __PRIVATE_LocalClientState {
13410
13439
  if (t === this.Cs) continue;
13411
13440
  const e = this.getItem(createWebStorageClientStateKey(this.persistenceKey, t));
13412
13441
  if (e) {
13413
- const n = __PRIVATE_RemoteClientState.bs(t, e);
13442
+ const n = __PRIVATE_RemoteClientState.Ss(t, e);
13414
13443
  n && (this.xs = this.xs.insert(n.clientId, n));
13415
13444
  }
13416
13445
  }
13417
- this.Ks();
13446
+ this.Us();
13418
13447
  // Check if there is an existing online state and call the callback handler
13419
13448
  // if applicable.
13420
13449
  const t = this.storage.getItem(this.Qs);
13421
13450
  if (t) {
13422
- const e = this.Us(t);
13451
+ const e = this.Ks(t);
13423
13452
  e && this.Ws(e);
13424
13453
  }
13425
13454
  for (const e of this.Os) this.Ms(e);
@@ -13457,16 +13486,16 @@ class __PRIVATE_LocalClientState {
13457
13486
  if (this.isActiveQueryTarget(e)) {
13458
13487
  const t = this.storage.getItem(createWebStorageQueryTargetMetadataKey(this.persistenceKey, e));
13459
13488
  if (t) {
13460
- const r = __PRIVATE_QueryTargetMetadata.bs(e, t);
13489
+ const r = __PRIVATE_QueryTargetMetadata.Ss(e, t);
13461
13490
  r && (n = r.state);
13462
13491
  }
13463
13492
  }
13464
13493
  // If the query is listening to cache only, the target ID should not be registered with the
13465
13494
  // local Firestore client as an active watch target.
13466
- return t && this.Hs.Ds(e), this.Ks(), n;
13495
+ return t && this.Hs.Ds(e), this.Us(), n;
13467
13496
  }
13468
13497
  removeLocalQueryTarget(e) {
13469
- this.Hs.vs(e), this.Ks();
13498
+ this.Hs.vs(e), this.Us();
13470
13499
  }
13471
13500
  isLocalQueryTarget(e) {
13472
13501
  return this.Hs.activeTargetIds.has(e);
@@ -13533,7 +13562,7 @@ class __PRIVATE_LocalClientState {
13533
13562
  }
13534
13563
  } else if (t.key === this.Qs) {
13535
13564
  if (null !== t.newValue) {
13536
- const e = this.Us(t.newValue);
13565
+ const e = this.Ks(t.newValue);
13537
13566
  if (e) return this.Ws(e);
13538
13567
  }
13539
13568
  } else if (t.key === this.Bs) {
@@ -13564,12 +13593,12 @@ class __PRIVATE_LocalClientState {
13564
13593
  get Hs() {
13565
13594
  return this.xs.get(this.Cs);
13566
13595
  }
13567
- Ks() {
13568
- this.setItem(this.Ns, this.Hs.Ss());
13596
+ Us() {
13597
+ this.setItem(this.Ns, this.Hs.bs());
13569
13598
  }
13570
13599
  zs(e, t, n) {
13571
13600
  const r = new __PRIVATE_MutationMetadata(this.currentUser, e, t, n), i = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
13572
- this.setItem(i, r.Ss());
13601
+ this.setItem(i, r.bs());
13573
13602
  }
13574
13603
  js(e) {
13575
13604
  const t = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
@@ -13584,7 +13613,7 @@ class __PRIVATE_LocalClientState {
13584
13613
  }
13585
13614
  Js(e, t, n) {
13586
13615
  const r = createWebStorageQueryTargetMetadataKey(this.persistenceKey, e), i = new __PRIVATE_QueryTargetMetadata(e, t, n);
13587
- this.setItem(r, i.Ss());
13616
+ this.setItem(r, i.bs());
13588
13617
  }
13589
13618
  Zs(e) {
13590
13619
  const t = JSON.stringify(Array.from(e));
@@ -13602,27 +13631,27 @@ class __PRIVATE_LocalClientState {
13602
13631
  * be parsed.
13603
13632
  */ no(e, t) {
13604
13633
  const n = this.Xs(e);
13605
- return __PRIVATE_RemoteClientState.bs(n, t);
13634
+ return __PRIVATE_RemoteClientState.Ss(n, t);
13606
13635
  }
13607
13636
  /**
13608
13637
  * Parses a mutation batch state in WebStorage. Returns 'null' if the value
13609
13638
  * could not be parsed.
13610
13639
  */ ro(e, t) {
13611
13640
  const n = this.ks.exec(e), r = Number(n[1]), i = void 0 !== n[2] ? n[2] : null;
13612
- return __PRIVATE_MutationMetadata.bs(new User(i), r, t);
13641
+ return __PRIVATE_MutationMetadata.Ss(new User(i), r, t);
13613
13642
  }
13614
13643
  /**
13615
13644
  * Parses a query target state from WebStorage. Returns 'null' if the value
13616
13645
  * could not be parsed.
13617
13646
  */ so(e, t) {
13618
13647
  const n = this.qs.exec(e), r = Number(n[1]);
13619
- return __PRIVATE_QueryTargetMetadata.bs(r, t);
13648
+ return __PRIVATE_QueryTargetMetadata.Ss(r, t);
13620
13649
  }
13621
13650
  /**
13622
13651
  * Parses an online state from WebStorage. Returns 'null' if the value
13623
13652
  * could not be parsed.
13624
- */ Us(e) {
13625
- return __PRIVATE_SharedOnlineState.bs(e);
13653
+ */ Ks(e) {
13654
+ return __PRIVATE_SharedOnlineState.Ss(e);
13626
13655
  }
13627
13656
  _o(e) {
13628
13657
  return JSON.parse(e);
@@ -13846,7 +13875,7 @@ function __PRIVATE_generateUniqueDebugId() {
13846
13875
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13847
13876
  * See the License for the specific language governing permissions and
13848
13877
  * limitations under the License.
13849
- */ const Kt = "RestConnection", Ut = {
13878
+ */ const Ut = "RestConnection", Kt = {
13850
13879
  BatchGetDocuments: "batchGet",
13851
13880
  Commit: "commit",
13852
13881
  RunQuery: "runQuery",
@@ -13873,23 +13902,23 @@ class __PRIVATE_RestConnection {
13873
13902
  const t = e.ssl ? "https" : "http", n = encodeURIComponent(this.databaseId.projectId), r = encodeURIComponent(this.databaseId.database);
13874
13903
  this.po = t + "://" + e.host, this.yo = `projects/${n}/databases/${r}`, this.wo = this.databaseId.database === rt ? `project_id=${n}` : `project_id=${n}&database_id=${r}`;
13875
13904
  }
13876
- bo(e, t, n, r, i) {
13877
- const s = __PRIVATE_generateUniqueDebugId(), o = this.So(e, t.toUriEncodedString());
13878
- __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13905
+ So(e, t, n, r, i) {
13906
+ const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13907
+ __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13879
13908
  const _ = {
13880
13909
  "google-cloud-resource-prefix": this.yo,
13881
13910
  "x-goog-request-params": this.wo
13882
13911
  };
13883
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13912
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13884
13913
  t)), (t => {
13885
- throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13914
+ throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13886
13915
  t;
13887
13916
  }));
13888
13917
  }
13889
13918
  Co(e, t, n, r, i, s) {
13890
13919
  // The REST API automatically aggregates all of the streamed results, so we
13891
13920
  // can just use the normal invoke() method.
13892
- return this.bo(e, t, n, r, i);
13921
+ return this.So(e, t, n, r, i);
13893
13922
  }
13894
13923
  /**
13895
13924
  * Modifies the headers for a request, adding any authorization token if
@@ -13908,8 +13937,8 @@ class __PRIVATE_RestConnection {
13908
13937
  e["Content-Type"] = "text/plain", this.databaseInfo.appId && (e["X-Firebase-GMPID"] = this.databaseInfo.appId),
13909
13938
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13910
13939
  }
13911
- So(e, t) {
13912
- const n = Ut[e];
13940
+ bo(e, t) {
13941
+ const n = Kt[e];
13913
13942
  return `${this.po}/v1/${t}:${n}`;
13914
13943
  }
13915
13944
  /**
@@ -13969,10 +13998,10 @@ class __PRIVATE_RestConnection {
13969
13998
  $o() {
13970
13999
  this.Bo();
13971
14000
  }
13972
- Ko(e) {
14001
+ Uo(e) {
13973
14002
  this.ko(e);
13974
14003
  }
13975
- Uo(e) {
14004
+ Ko(e) {
13976
14005
  this.qo(e);
13977
14006
  }
13978
14007
  }
@@ -14124,10 +14153,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14124
14153
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14125
14154
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
14126
14155
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14127
- P.Ko());
14156
+ P.Uo());
14128
14157
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {
14129
14158
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14130
- P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14159
+ P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14131
14160
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {
14132
14161
  var n;
14133
14162
  if (!h) {
@@ -14158,8 +14187,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14158
14187
  }(t), i = o.message;
14159
14188
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14160
14189
  // Mark closed so no further events are propagated
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);
14190
+ h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14191
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14163
14192
  }
14164
14193
  })), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {
14165
14194
  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`);
@@ -14670,7 +14699,7 @@ class __PRIVATE_PersistentStream {
14670
14699
  /**
14671
14700
  * Tracks whether or not a handshake has been successfully exchanged and
14672
14701
  * the stream is ready to accept mutations.
14673
- */ get b_() {
14702
+ */ get S_() {
14674
14703
  return this.__ > 0;
14675
14704
  }
14676
14705
  // Override of PersistentStream.start
@@ -14678,7 +14707,7 @@ class __PRIVATE_PersistentStream {
14678
14707
  this.lastStreamToken = void 0, super.start();
14679
14708
  }
14680
14709
  A_() {
14681
- this.b_ && this.S_([]);
14710
+ this.S_ && this.b_([]);
14682
14711
  }
14683
14712
  f_(e, t) {
14684
14713
  return this.connection.Wo("Write", e, t);
@@ -14709,7 +14738,7 @@ class __PRIVATE_PersistentStream {
14709
14738
  const e = {};
14710
14739
  e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.I_(e);
14711
14740
  }
14712
- /** Sends a group of mutations to the Firestore backend to apply. */ S_(e) {
14741
+ /** Sends a group of mutations to the Firestore backend to apply. */ b_(e) {
14713
14742
  const t = {
14714
14743
  streamToken: this.lastStreamToken,
14715
14744
  writes: e.map((e => toMutation(this.serializer, e)))
@@ -14751,8 +14780,8 @@ class __PRIVATE_PersistentStream {
14751
14780
  M_() {
14752
14781
  if (this.F_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
14753
14782
  }
14754
- /** Invokes the provided RPC with auth and AppCheck tokens. */ bo(e, t, n, r) {
14755
- return this.M_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.bo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14783
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ So(e, t, n, r) {
14784
+ return this.M_(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.So(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {
14756
14785
  throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14757
14786
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
14758
14787
  }));
@@ -14894,7 +14923,7 @@ class __PRIVATE_RemoteStoreImpl {
14894
14923
  * purely based on order, and so we can just shift() writes from the front of
14895
14924
  * the writePipeline as we receive responses.
14896
14925
  */
14897
- this.K_ = [],
14926
+ this.U_ = [],
14898
14927
  /**
14899
14928
  * A mapping of watched targets that the client cares about tracking and the
14900
14929
  * user has explicitly called a 'listen' for this target.
@@ -14904,7 +14933,7 @@ class __PRIVATE_RemoteStoreImpl {
14904
14933
  * to the server. The targets removed with unlistens are removed eagerly
14905
14934
  * without waiting for confirmation from the listen stream.
14906
14935
  */
14907
- this.U_ = new Map,
14936
+ this.K_ = new Map,
14908
14937
  /**
14909
14938
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14910
14939
  * RemoteStore may start its network connections.
@@ -14951,9 +14980,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14951
14980
  */
14952
14981
  function __PRIVATE_remoteStoreListen(e, t) {
14953
14982
  const n = __PRIVATE_debugCast(e);
14954
- n.U_.has(t.targetId) || (
14983
+ n.K_.has(t.targetId) || (
14955
14984
  // Mark this as something the client is currently listening for.
14956
- n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14985
+ n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14957
14986
  // The listen will be sent in onWatchStreamOpen
14958
14987
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14959
14988
  }
@@ -14963,7 +14992,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14963
14992
  * not being listened to.
14964
14993
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14965
14994
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14966
- n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14995
+ n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14967
14996
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14968
14997
  // have no listeners, since without any listens to send we cannot
14969
14998
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14992,7 +15021,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14992
15021
  function __PRIVATE_startWatchStream(e) {
14993
15022
  e.H_ = new __PRIVATE_WatchChangeAggregator({
14994
15023
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14995
- lt: t => e.U_.get(t) || null,
15024
+ lt: t => e.K_.get(t) || null,
14996
15025
  it: () => e.datastore.serializer.databaseId
14997
15026
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
14998
15027
  }
@@ -15001,7 +15030,7 @@ function __PRIVATE_startWatchStream(e) {
15001
15030
  * Returns whether the watch stream should be started because it's necessary
15002
15031
  * and has not yet been started.
15003
15032
  */ function __PRIVATE_shouldStartWatchStream(e) {
15004
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15033
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15005
15034
  }
15006
15035
 
15007
15036
  function __PRIVATE_canUseNetwork(e) {
@@ -15018,7 +15047,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15018
15047
  }
15019
15048
 
15020
15049
  async function __PRIVATE_onWatchStreamOpen(e) {
15021
- e.U_.forEach(((t, n) => {
15050
+ e.K_.forEach(((t, n) => {
15022
15051
  __PRIVATE_sendWatchRequest(e, t);
15023
15052
  }));
15024
15053
  }
@@ -15045,7 +15074,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15045
15074
  const n = t.cause;
15046
15075
  for (const r of t.targetIds)
15047
15076
  // A watched target might have been removed already.
15048
- e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15077
+ e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15049
15078
  }
15050
15079
  /**
15051
15080
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15075,21 +15104,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15075
15104
  // persistent view of these when applying the completed RemoteEvent.
15076
15105
  return n.targetChanges.forEach(((n, r) => {
15077
15106
  if (n.resumeToken.approximateByteSize() > 0) {
15078
- const i = e.U_.get(r);
15107
+ const i = e.K_.get(r);
15079
15108
  // A watched target might have been removed already.
15080
- i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15109
+ i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15081
15110
  }
15082
15111
  })),
15083
15112
  // Re-establish listens for the targets that have been invalidated by
15084
15113
  // existence filter mismatches.
15085
15114
  n.targetMismatches.forEach(((t, n) => {
15086
- const r = e.U_.get(t);
15115
+ const r = e.K_.get(t);
15087
15116
  if (!r)
15088
15117
  // A watched target might have been removed already.
15089
15118
  return;
15090
15119
  // Clear the resume token for the target, since we're in a known mismatch
15091
15120
  // state.
15092
- e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15121
+ e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15093
15122
  // Cause a hard reset by unwatching and rewatching immediately, but
15094
15123
  // deliberately don't send a resume token so that we get a full update.
15095
15124
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15140,11 +15169,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15140
15169
 
15141
15170
  async function __PRIVATE_fillWritePipeline(e) {
15142
15171
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15143
- let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15172
+ let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15144
15173
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15145
15174
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15146
15175
  if (null === e) {
15147
- 0 === t.K_.length && n.P_();
15176
+ 0 === t.U_.length && n.P_();
15148
15177
  break;
15149
15178
  }
15150
15179
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15158,20 +15187,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15158
15187
  * Returns true if we can add to the write pipeline (i.e. the network is
15159
15188
  * enabled and the write pipeline is not full).
15160
15189
  */ function __PRIVATE_canAddToWritePipeline(e) {
15161
- return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15190
+ return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15162
15191
  }
15163
15192
 
15164
15193
  /**
15165
15194
  * Queues additional writes to be sent to the write stream, sending them
15166
15195
  * immediately if the write stream is established.
15167
15196
  */ function __PRIVATE_addToWritePipeline(e, t) {
15168
- e.K_.push(t);
15197
+ e.U_.push(t);
15169
15198
  const n = __PRIVATE_ensureWriteStream(e);
15170
- n.c_() && n.b_ && n.S_(t.mutations);
15199
+ n.c_() && n.S_ && n.b_(t.mutations);
15171
15200
  }
15172
15201
 
15173
15202
  function __PRIVATE_shouldStartWriteStream(e) {
15174
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15203
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15175
15204
  }
15176
15205
 
15177
15206
  function __PRIVATE_startWriteStream(e) {
@@ -15185,11 +15214,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15185
15214
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15186
15215
  const t = __PRIVATE_ensureWriteStream(e);
15187
15216
  // Send the write pipeline now that the stream is established.
15188
- for (const n of e.K_) t.S_(n.mutations);
15217
+ for (const n of e.U_) t.b_(n.mutations);
15189
15218
  }
15190
15219
 
15191
15220
  async function __PRIVATE_onMutationResult(e, t, n) {
15192
- const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15221
+ const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15193
15222
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15194
15223
  // It's possible that with the completion of this mutation another
15195
15224
  // slot has freed up.
@@ -15199,7 +15228,7 @@ async function __PRIVATE_onMutationResult(e, t, n) {
15199
15228
  async function __PRIVATE_onWriteStreamClose(e, t) {
15200
15229
  // If the write stream closed after the write handshake completes, a write
15201
15230
  // operation failed and we fail the pending operation.
15202
- t && __PRIVATE_ensureWriteStream(e).b_ &&
15231
+ t && __PRIVATE_ensureWriteStream(e).S_ &&
15203
15232
  // This error affects the actual write.
15204
15233
  await async function __PRIVATE_handleWriteError(e, t) {
15205
15234
  // Only handle permanent errors here. If it's transient, just let the retry
@@ -15209,7 +15238,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15209
15238
  }(t.code)) {
15210
15239
  // This was a permanent error, the request itself was the problem
15211
15240
  // so it's not going to succeed if we resend it.
15212
- const n = e.K_.shift();
15241
+ const n = e.U_.shift();
15213
15242
  // In this case it's also unlikely that the server itself is melting
15214
15243
  // down -- this was just a bad request so inhibit backoff on the next
15215
15244
  // restart.
@@ -15308,8 +15337,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15308
15337
  }), e.G_.push((async t => {
15309
15338
  t ? (e.Y_.h_(),
15310
15339
  // This will start the write stream if necessary.
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_ = []));
15340
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15341
+ e.U_ = []));
15313
15342
  }))), e.Y_;
15314
15343
  }
15315
15344
 
@@ -16006,7 +16035,7 @@ class __PRIVATE_RemovedLimboDocument {
16006
16035
  /**
16007
16036
  * The set of remote documents that the server has told us belongs to the target associated with
16008
16037
  * this view.
16009
- */ get ba() {
16038
+ */ get Sa() {
16010
16039
  return this.fa;
16011
16040
  }
16012
16041
  /**
@@ -16018,7 +16047,7 @@ class __PRIVATE_RemovedLimboDocument {
16018
16047
  * @param previousChanges - If this is being called with a refill, then start
16019
16048
  * with this set of docs and changes instead of the current view.
16020
16049
  * @returns a new set of docs, changes, and refill flag.
16021
- */ Sa(e, t) {
16050
+ */ ba(e, t) {
16022
16051
  const n = t ? t.Da : new __PRIVATE_DocumentChangeSet, r = t ? t.wa : this.wa;
16023
16052
  let i = t ? t.mutatedKeys : this.mutatedKeys, s = r, o = !1;
16024
16053
  // Track the last doc in a (full) limit. This is necessary, because some
@@ -16231,7 +16260,7 @@ class __PRIVATE_RemovedLimboDocument {
16231
16260
  // PORTING NOTE: Multi-tab only.
16232
16261
  Oa(e) {
16233
16262
  this.fa = e.gs, this.pa = __PRIVATE_documentKeySet();
16234
- const t = this.Sa(e.documents);
16263
+ const t = this.ba(e.documents);
16235
16264
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
16236
16265
  }
16237
16266
  /**
@@ -16323,11 +16352,11 @@ const Jt = "SyncEngine";
16323
16352
  * Keeps track of the information about an active limbo resolution for each
16324
16353
  * active target ID that was started for the purpose of limbo resolution.
16325
16354
  */
16326
- this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16355
+ this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16327
16356
  /** Stores user completion handlers, indexed by User and BatchId. */
16328
16357
  this.Wa = {},
16329
16358
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16330
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16359
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16331
16360
  // The primary state is set to `true` or `false` immediately after Firestore
16332
16361
  // startup. In the interim, a client should only be considered primary if
16333
16362
  // `isPrimary` is true.
@@ -16380,19 +16409,19 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16380
16409
  // targets based on view changes. This allows us to only depend on Limbo
16381
16410
  // changes when user code includes queries.
16382
16411
  e.Ha = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {
16383
- let i = t.view.Sa(n);
16412
+ let i = t.view.ba(n);
16384
16413
  i.ls && (
16385
16414
  // The query has a limit and some docs were removed, so we need
16386
16415
  // to re-run the query against the local store to make sure we
16387
16416
  // didn't lose any good docs that had been past the limit.
16388
16417
  i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query,
16389
- /* usePreviousResults= */ !1).then((({documents: e}) => t.view.Sa(e, i))));
16418
+ /* usePreviousResults= */ !1).then((({documents: e}) => t.view.ba(e, i))));
16390
16419
  const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16391
16420
  /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16392
16421
  return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Ma), _.snapshot;
16393
16422
  }(e, t, n, r);
16394
16423
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16395
- /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.gs), _ = o.Sa(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16424
+ /* usePreviousResults= */ !0), o = new __PRIVATE_View(t, s.gs), _ = o.ba(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && "Offline" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_,
16396
16425
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16397
16426
  __PRIVATE_updateTrackedLimbos(e, n, u.Ma);
16398
16427
  const c = new __PRIVATE_QueryView(t, n, o);
@@ -16507,7 +16536,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16507
16536
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16508
16537
  // Update `receivedDocument` as appropriate for any limbo targets.
16509
16538
  t.targetChanges.forEach(((e, t) => {
16510
- const r = n.Ka.get(t);
16539
+ const r = n.Ua.get(t);
16511
16540
  r && (
16512
16541
  // Since this is a limbo resolution lookup, it's for a single document
16513
16542
  // and it could be added, modified, or removed, but not a combination.
@@ -16561,7 +16590,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16561
16590
  const r = __PRIVATE_debugCast(e);
16562
16591
  // PORTING NOTE: Multi-tab only.
16563
16592
  r.sharedClientState.updateQueryState(t, "rejected", n);
16564
- const i = r.Ka.get(t), s = i && i.key;
16593
+ const i = r.Ua.get(t), s = i && i.key;
16565
16594
  if (s) {
16566
16595
  // TODO(klimt): We really only should do the following on permission
16567
16596
  // denied errors, but we don't have the cause code here.
@@ -16583,7 +16612,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16583
16612
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16584
16613
  // this query when the RemoteStore restarts the Watch stream, which should
16585
16614
  // re-trigger the target failure.
16586
- r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16615
+ r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16587
16616
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16588
16617
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16589
16618
  }
@@ -16677,8 +16706,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16677
16706
  e.sharedClientState.removeLocalQueryTarget(t);
16678
16707
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16679
16708
  if (e.qa.delete(t), e.isPrimaryClient) {
16680
- e.Ua.Sr(t).forEach((t => {
16681
- e.Ua.containsKey(t) ||
16709
+ e.Ka.br(t).forEach((t => {
16710
+ e.Ka.containsKey(t) ||
16682
16711
  // We removed the last reference for this key
16683
16712
  __PRIVATE_removeLimboTarget(e, t);
16684
16713
  }));
@@ -16691,14 +16720,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16691
16720
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16692
16721
  const n = e.$a.get(t);
16693
16722
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16694
- e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16723
+ e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16695
16724
  }
16696
16725
 
16697
16726
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16698
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16727
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16699
16728
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16700
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16701
- e.Ua.containsKey(r.key) ||
16729
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16730
+ e.Ka.containsKey(r.key) ||
16702
16731
  // We removed the last reference for this key
16703
16732
  __PRIVATE_removeLimboTarget(e, r.key);
16704
16733
  } else fail();
@@ -16722,7 +16751,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16722
16751
  const t = e.Qa.values().next().value;
16723
16752
  e.Qa.delete(t);
16724
16753
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
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));
16754
+ 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));
16726
16755
  }
16727
16756
  }
16728
16757
 
@@ -16790,7 +16819,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16790
16819
  }
16791
16820
 
16792
16821
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16793
- const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16822
+ const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16794
16823
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16795
16824
  {
16796
16825
  let e = __PRIVATE_documentKeySet();
@@ -16798,7 +16827,7 @@ function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16798
16827
  if (!r) return e;
16799
16828
  for (const t of r) {
16800
16829
  const r = n.ka.get(t);
16801
- e = e.unionWith(r.view.ba);
16830
+ e = e.unionWith(r.view.Sa);
16802
16831
  }
16803
16832
  return e;
16804
16833
  }
@@ -16882,9 +16911,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16882
16911
  // PORTING NOTE: Multi-Tab only.
16883
16912
  function __PRIVATE_resetLimboDocuments(e) {
16884
16913
  const t = __PRIVATE_debugCast(e);
16885
- t.Ka.forEach(((e, n) => {
16914
+ t.Ua.forEach(((e, n) => {
16886
16915
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16887
- })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16916
+ })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16888
16917
  }
16889
16918
  /**
16890
16919
  * Reconcile the query views of the provided query targets with the state from
@@ -17584,7 +17613,7 @@ class Transaction$2 {
17584
17613
  const n = __PRIVATE_debugCast(e), r = {
17585
17614
  writes: t.map((e => toMutation(n.serializer, e)))
17586
17615
  };
17587
- await n.bo("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17616
+ await n.So("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17588
17617
  }(this.datastore, this.mutations), this.committed = !0;
17589
17618
  }
17590
17619
  recordVersion(e) {
@@ -17946,7 +17975,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17946
17975
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17947
17976
  try {
17948
17977
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17949
- /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.gs), s = i.Sa(r.documents), o = i.applyChanges(s,
17978
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.gs), s = i.ba(r.documents), o = i.applyChanges(s,
17950
17979
  /* limboResolutionEnabled= */ !1);
17951
17980
  n.resolve(o.snapshot);
17952
17981
  } catch (e) {
@@ -18319,7 +18348,7 @@ class FirestoreSettingsImpl {
18319
18348
  this.host = Xt, this.ssl = en;
18320
18349
  } else this.host = e.host, this.ssl = null !== (t = e.ssl) && void 0 !== t ? t : en;
18321
18350
  if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
18322
- this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = bt; else {
18351
+ this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = St; else {
18323
18352
  if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < Dt) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
18324
18353
  this.cacheSizeBytes = e.cacheSizeBytes;
18325
18354
  }
@@ -18721,13 +18750,13 @@ class __PRIVATE_AsyncQueueImpl {
18721
18750
  // Visibility handler that triggers an immediate retry of all retryable
18722
18751
  // operations. Meant to speed up recovery when we regain file system access
18723
18752
  // after page comes into foreground.
18724
- this.bu = () => {
18753
+ this.Su = () => {
18725
18754
  const e = getDocument();
18726
18755
  e && __PRIVATE_logDebug(tn, "Visibility state changed to " + e.visibilityState),
18727
18756
  this.a_.t_();
18728
- }, this.Su = e;
18757
+ }, this.bu = e;
18729
18758
  const t = getDocument();
18730
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.bu);
18759
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Su);
18731
18760
  }
18732
18761
  get isShuttingDown() {
18733
18762
  return this.mu;
@@ -18748,7 +18777,7 @@ class __PRIVATE_AsyncQueueImpl {
18748
18777
  if (!this.mu) {
18749
18778
  this.mu = !0, this.yu = e || !1;
18750
18779
  const t = getDocument();
18751
- t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.bu);
18780
+ t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.Su);
18752
18781
  }
18753
18782
  }
18754
18783
  enqueue(e) {
@@ -18792,7 +18821,7 @@ class __PRIVATE_AsyncQueueImpl {
18792
18821
  }
18793
18822
  }
18794
18823
  vu(e) {
18795
- const t = this.Su.then((() => (this.pu = !0, e().catch((e => {
18824
+ const t = this.bu.then((() => (this.pu = !0, e().catch((e => {
18796
18825
  this.gu = e, this.pu = !1;
18797
18826
  const t =
18798
18827
  /**
@@ -18826,7 +18855,7 @@ class __PRIVATE_AsyncQueueImpl {
18826
18855
  // and return the rejected Promise.
18827
18856
  throw __PRIVATE_logError("INTERNAL UNHANDLED ERROR: ", t), e;
18828
18857
  })).then((e => (this.pu = !1, e))))));
18829
- return this.Su = t, t;
18858
+ return this.bu = t, t;
18830
18859
  }
18831
18860
  enqueueAfterDelay(e, t, n) {
18832
18861
  this.Du(),
@@ -18849,8 +18878,8 @@ class __PRIVATE_AsyncQueueImpl {
18849
18878
  // operations were executed.
18850
18879
  let e;
18851
18880
  do {
18852
- e = this.Su, await e;
18853
- } while (e !== this.Su);
18881
+ e = this.bu, await e;
18882
+ } while (e !== this.bu);
18854
18883
  }
18855
18884
  /**
18856
18885
  * For Tests: Determine if a delayed operation with a particular TimerId
@@ -19753,7 +19782,7 @@ function __PRIVATE_isWrite(e) {
19753
19782
  });
19754
19783
  return r.$u(e), r;
19755
19784
  }
19756
- Ku(e) {
19785
+ Uu(e) {
19757
19786
  var t;
19758
19787
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19759
19788
  path: n,
@@ -19761,7 +19790,7 @@ function __PRIVATE_isWrite(e) {
19761
19790
  });
19762
19791
  return r.Bu(), r;
19763
19792
  }
19764
- Uu(e) {
19793
+ Ku(e) {
19765
19794
  // TODO(b/34871131): We don't support array paths right now; so make path
19766
19795
  // undefined.
19767
19796
  return this.ku({
@@ -19922,7 +19951,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19922
19951
  // For Compat types, we have to "extract" the underlying types before
19923
19952
  // performing validation.
19924
19953
  r = getModularInstance(r);
19925
- const a = i.Ku(_);
19954
+ const a = i.Uu(_);
19926
19955
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19927
19956
  // Add it to the field mask, but don't add anything to updateData.
19928
19957
  s.push(_); else {
@@ -19948,7 +19977,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19948
19977
  // For Compat types, we have to "extract" the underlying types before
19949
19978
  // performing validation.
19950
19979
  n = getModularInstance(n);
19951
- const r = o.Ku(t);
19980
+ const r = o.Uu(t);
19952
19981
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19953
19982
  // Add it to the field mask, but don't add anything to updateData.
19954
19983
  u.push(t); else {
@@ -20026,7 +20055,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20026
20055
  const n = [];
20027
20056
  let r = 0;
20028
20057
  for (const i of e) {
20029
- let e = __PRIVATE_parseData(i, t.Uu(r));
20058
+ let e = __PRIVATE_parseData(i, t.Ku(r));
20030
20059
  null == e && (
20031
20060
  // Just include nulls in the array for fields being replaced with a
20032
20061
  // sentinel.
@@ -22349,9 +22378,9 @@ let an = null;
22349
22378
  return r = Object.assign({
22350
22379
  useFetchStreams: t
22351
22380
  }, r), s._setSettings(r), s;
22352
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, S, e),
22381
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(S, b, e),
22353
22382
  // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
22354
- registerVersion(b, S, "esm2017");
22383
+ registerVersion(S, b, "esm2017");
22355
22384
  }();
22356
22385
 
22357
22386
  export { AbstractUserDataWriter, AggregateField, AggregateQuerySnapshot, Bytes, nn as CACHE_SIZE_UNLIMITED, CollectionReference, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Firestore, FirestoreError, GeoPoint, LoadBundleTask, PersistentCacheIndexManager, Query, QueryCompositeFilterConstraint, QueryConstraint, QueryDocumentSnapshot, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryLimitConstraint, QueryOrderByConstraint, QuerySnapshot, QueryStartAtConstraint, SnapshotMetadata, Timestamp, Transaction, VectorValue, WriteBatch, __PRIVATE_AutoId as _AutoId, ByteString as _ByteString, DatabaseId as _DatabaseId, DocumentKey as _DocumentKey, __PRIVATE_EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider, __PRIVATE_EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider, FieldPath$1 as _FieldPath, TestingHooks as _TestingHooks, __PRIVATE_cast as _cast, __PRIVATE_debugAssert as _debugAssert, _internalAggregationQueryToProtoRunAggregationQueryRequest, _internalQueryToProtoQueryTarget, __PRIVATE_isBase64Available as _isBase64Available, __PRIVATE_logWarn as _logWarn, __PRIVATE_validateIsNotUsedTogether as _validateIsNotUsedTogether, addDoc, aggregateFieldEqual, aggregateQuerySnapshotEqual, and, arrayRemove, arrayUnion, average, clearIndexedDbPersistence, collection, collectionGroup, connectFirestoreEmulator, count, deleteAllPersistentCacheIndexes, deleteDoc, deleteField, disableNetwork, disablePersistentCacheIndexAutoCreation, doc, documentId, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, enablePersistentCacheIndexAutoCreation, endAt, endBefore, ensureFirestoreConfigured, executeWrite, getAggregateFromServer, getCountFromServer, getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, getFirestore, getPersistentCacheIndexManager, increment, initializeFirestore, limit, limitToLast, loadBundle, memoryEagerGarbageCollector, memoryLocalCache, memoryLruGarbageCollector, namedQuery, onSnapshot, onSnapshotsInSync, or, orderBy, persistentLocalCache, persistentMultipleTabManager, persistentSingleTabManager, query, queryEqual, refEqual, runTransaction, serverTimestamp, setDoc, setIndexConfiguration, setLogLevel, snapshotEqual, startAfter, startAt, sum, terminate, updateDoc, vector, waitForPendingWrites, where, writeBatch };