@firebase/firestore 4.7.7-canary.c8e5b3e77 → 4.7.7-canary.deb917b5f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/firestore/src/global_index.d.ts +0 -7
  2. package/dist/firestore/src/lite-api/database.d.ts +0 -4
  3. package/dist/firestore/src/lite-api/settings.d.ts +0 -4
  4. package/dist/firestore/src/util/misc.d.ts +2 -0
  5. package/dist/firestore/test/integration/util/settings.d.ts +0 -1
  6. package/dist/index.cjs.js +241 -243
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.esm2017.js +242 -244
  9. package/dist/index.esm2017.js.map +1 -1
  10. package/dist/index.node.cjs.js +53 -54
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +54 -55
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +194 -196
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +0 -7
  17. package/dist/lite/firestore/src/lite-api/database.d.ts +0 -4
  18. package/dist/lite/firestore/src/lite-api/settings.d.ts +0 -4
  19. package/dist/lite/firestore/src/util/misc.d.ts +2 -0
  20. package/dist/lite/firestore/test/integration/util/settings.d.ts +0 -1
  21. package/dist/lite/index.browser.esm2017.js +166 -146
  22. package/dist/lite/index.browser.esm2017.js.map +1 -1
  23. package/dist/lite/index.cjs.js +166 -146
  24. package/dist/lite/index.cjs.js.map +1 -1
  25. package/dist/lite/index.node.cjs.js +128 -110
  26. package/dist/lite/index.node.cjs.js.map +1 -1
  27. package/dist/lite/index.node.mjs +129 -111
  28. package/dist/lite/index.node.mjs.map +1 -1
  29. package/dist/lite/index.rn.esm2017.js +179 -159
  30. package/dist/lite/index.rn.esm2017.js.map +1 -1
  31. package/dist/lite/internal.d.ts +0 -7
  32. package/dist/lite/private.d.ts +0 -4
  33. package/dist/private.d.ts +0 -4
  34. package/package.json +9 -9
@@ -1,11 +1,11 @@
1
1
  import { _registerComponent, registerVersion, _isFirebaseServerApp, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from '@firebase/app';
2
2
  import { Component } from '@firebase/component';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
- import { FirebaseError, deepEqual, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort, isIndexedDBAvailable, getUA, isSafari } from '@firebase/util';
4
+ import { FirebaseError, createMockUserToken, getModularInstance, deepEqual, getDefaultEmulatorHostnameAndPort, isIndexedDBAvailable, getUA, isSafari } from '@firebase/util';
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.7-canary.c8e5b3e77";
8
+ const S = "@firebase/firestore", b = "4.7.7-canary.deb917b5f";
9
9
 
10
10
  /**
11
11
  * @license
@@ -67,7 +67,7 @@ User.MOCK_USER = new User("mock-user");
67
67
  * See the License for the specific language governing permissions and
68
68
  * limitations under the License.
69
69
  */
70
- let D = "11.3.0-canary.c8e5b3e77";
70
+ let D = "11.3.0-canary.deb917b5f";
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,16 @@ 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
+ // Convert the string to UTF-8 encoded bytes
757
+ const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
758
+ for (let e = 0; e < Math.min(n.length, r.length); e++) {
759
+ const t = __PRIVATE_primitiveComparator(n[e], r[e]);
760
+ if (0 !== t) return t;
761
+ }
762
+ return __PRIVATE_primitiveComparator(n.length, r.length);
763
+ }
764
+
729
765
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
730
766
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
731
767
  }
@@ -1016,13 +1052,11 @@ class Timestamp {
1016
1052
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1017
1053
  if (0 !== n) return n;
1018
1054
  }
1019
- return Math.sign(e.length - t.length);
1055
+ return __PRIVATE_primitiveComparator(e.length, t.length);
1020
1056
  }
1021
1057
  static compareSegments(e, t) {
1022
1058
  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;
1059
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1026
1060
  }
1027
1061
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1028
1062
  static isNumericId(e) {
@@ -1810,13 +1844,13 @@ class __PRIVATE_SimpleDbTransaction {
1810
1844
  * within the key range or index.
1811
1845
  */ class __PRIVATE_IterationController {
1812
1846
  constructor(e) {
1813
- this.q = e, this.$ = !1, this.K = null;
1847
+ this.q = e, this.$ = !1, this.U = null;
1814
1848
  }
1815
1849
  get isDone() {
1816
1850
  return this.$;
1817
1851
  }
1818
- get U() {
1819
- return this.K;
1852
+ get K() {
1853
+ return this.U;
1820
1854
  }
1821
1855
  set cursor(e) {
1822
1856
  this.q = e;
@@ -1830,7 +1864,7 @@ class __PRIVATE_SimpleDbTransaction {
1830
1864
  * This function can be called to skip to that next key, which could be
1831
1865
  * an index or a primary key.
1832
1866
  */ W(e) {
1833
- this.K = e;
1867
+ this.U = e;
1834
1868
  }
1835
1869
  /**
1836
1870
  * Delete the current cursor value from the object store.
@@ -1989,7 +2023,7 @@ class __PRIVATE_SimpleDbTransaction {
1989
2023
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
1990
2024
  n.push(e);
1991
2025
  }
1992
- s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2026
+ s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1993
2027
  };
1994
2028
  })).next((() => PersistencePromise.waitFor(n)));
1995
2029
  }
@@ -2310,7 +2344,7 @@ function __PRIVATE_encodeResourcePath(e) {
2310
2344
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311
2345
  * See the License for the specific language governing permissions and
2312
2346
  * 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" ];
2347
+ */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2314
2348
 
2315
2349
  /**
2316
2350
  * @license
@@ -2355,7 +2389,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2355
2389
  * there is no useful information to store as the value. The raw (unencoded)
2356
2390
  * path cannot be stored because IndexedDb doesn't store prototype
2357
2391
  * 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 ];
2392
+ */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ue = "globals", Ke = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, U, ae, K, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, K, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ue ];
2359
2393
 
2360
2394
  /**
2361
2395
  * @license
@@ -3417,7 +3451,7 @@ function __PRIVATE_valueCompare(e, t) {
3417
3451
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3418
3452
 
3419
3453
  case 5 /* TypeOrder.StringValue */ :
3420
- return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3454
+ return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3421
3455
 
3422
3456
  case 6 /* TypeOrder.BlobValue */ :
3423
3457
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3465,7 +3499,7 @@ function __PRIVATE_valueCompare(e, t) {
3465
3499
  // canonical IDs are independent of insertion order.
3466
3500
  r.sort(), s.sort();
3467
3501
  for (let e = 0; e < r.length && e < s.length; ++e) {
3468
- const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3502
+ const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3469
3503
  if (0 !== t) return t;
3470
3504
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3471
3505
  if (0 !== o) return o;
@@ -5877,32 +5911,6 @@ let At = null;
5877
5911
  * Sets the value of the `testingHooksSpi` object.
5878
5912
  * @param instance the instance to set.
5879
5913
  */
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
5914
  /**
5907
5915
  * @license
5908
5916
  * Copyright 2022 Google LLC
@@ -6183,13 +6191,13 @@ class __PRIVATE_WatchTargetChange {
6183
6191
  */
6184
6192
  this.ye = __PRIVATE_snapshotChangesMap(),
6185
6193
  /** See public getters for explanations of these fields. */
6186
- this.we = ByteString.EMPTY_BYTE_STRING, this.be = !1,
6194
+ this.we = ByteString.EMPTY_BYTE_STRING, this.Se = !1,
6187
6195
  /**
6188
6196
  * Whether this target state should be included in the next snapshot. We
6189
6197
  * initialize to true so that newly-added targets are included in the next
6190
6198
  * RemoteEvent.
6191
6199
  */
6192
- this.Se = !0;
6200
+ this.be = !0;
6193
6201
  }
6194
6202
  /**
6195
6203
  * Whether this target has been marked 'current'.
@@ -6199,7 +6207,7 @@ class __PRIVATE_WatchTargetChange {
6199
6207
  * was added and that the target is consistent with the rest of the watch
6200
6208
  * stream.
6201
6209
  */ get current() {
6202
- return this.be;
6210
+ return this.Se;
6203
6211
  }
6204
6212
  /** The last resume token sent to us for this target. */ get resumeToken() {
6205
6213
  return this.we;
@@ -6208,13 +6216,13 @@ class __PRIVATE_WatchTargetChange {
6208
6216
  return 0 !== this.pe;
6209
6217
  }
6210
6218
  /** Whether we have modified any state that should trigger a snapshot. */ get ve() {
6211
- return this.Se;
6219
+ return this.be;
6212
6220
  }
6213
6221
  /**
6214
6222
  * Applies the resume token to the TargetChange, but only when it has a new
6215
6223
  * value. Empty resumeTokens are discarded.
6216
6224
  */ Ce(e) {
6217
- e.approximateByteSize() > 0 && (this.Se = !0, this.we = e);
6225
+ e.approximateByteSize() > 0 && (this.be = !0, this.we = e);
6218
6226
  }
6219
6227
  /**
6220
6228
  * Creates a target change from the current set of changes.
@@ -6240,18 +6248,18 @@ class __PRIVATE_WatchTargetChange {
6240
6248
  default:
6241
6249
  fail();
6242
6250
  }
6243
- })), new TargetChange(this.we, this.be, e, t, n);
6251
+ })), new TargetChange(this.we, this.Se, e, t, n);
6244
6252
  }
6245
6253
  /**
6246
6254
  * Resets the document changes and sets `hasPendingChanges` to false.
6247
6255
  */ Me() {
6248
- this.Se = !1, this.ye = __PRIVATE_snapshotChangesMap();
6256
+ this.be = !1, this.ye = __PRIVATE_snapshotChangesMap();
6249
6257
  }
6250
6258
  xe(e, t) {
6251
- this.Se = !0, this.ye = this.ye.insert(e, t);
6259
+ this.be = !0, this.ye = this.ye.insert(e, t);
6252
6260
  }
6253
6261
  Oe(e) {
6254
- this.Se = !0, this.ye = this.ye.remove(e);
6262
+ this.be = !0, this.ye = this.ye.remove(e);
6255
6263
  }
6256
6264
  Ne() {
6257
6265
  this.pe += 1;
@@ -6260,7 +6268,7 @@ class __PRIVATE_WatchTargetChange {
6260
6268
  this.pe -= 1, __PRIVATE_hardAssert(this.pe >= 0);
6261
6269
  }
6262
6270
  Le() {
6263
- this.Se = !0, this.be = !0;
6271
+ this.be = !0, this.Se = !0;
6264
6272
  }
6265
6273
  }
6266
6274
 
@@ -6275,13 +6283,13 @@ class __PRIVATE_WatchChangeAggregator {
6275
6283
  /** Keeps track of the documents to update since the last raised snapshot. */
6276
6284
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6277
6285
  /** A mapping of document keys to their set of target IDs. */
6278
- this.Ke = __PRIVATE_documentTargetMap(),
6286
+ this.Ue = __PRIVATE_documentTargetMap(),
6279
6287
  /**
6280
6288
  * A map of targets with existence filter mismatches. These targets are
6281
6289
  * known to be inconsistent and their listens needs to be re-established by
6282
6290
  * RemoteStore.
6283
6291
  */
6284
- this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6292
+ this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6285
6293
  }
6286
6294
  /**
6287
6295
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6370,7 +6378,7 @@ class __PRIVATE_WatchChangeAggregator {
6370
6378
  // trigger re-run of the query.
6371
6379
  this.Ye(t);
6372
6380
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6373
- this.Ue = this.Ue.insert(t, e);
6381
+ this.Ke = this.Ke.insert(t, e);
6374
6382
  }
6375
6383
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6376
6384
  var s, o, _, a, u, c;
@@ -6482,7 +6490,7 @@ class __PRIVATE_WatchChangeAggregator {
6482
6490
 
6483
6491
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6484
6492
  // client.
6485
- this.Ke.forEach(((e, t) => {
6493
+ this.Ue.forEach(((e, t) => {
6486
6494
  let r = !0;
6487
6495
  t.forEachWhile((e => {
6488
6496
  const t = this.Xe(e);
@@ -6490,9 +6498,9 @@ class __PRIVATE_WatchChangeAggregator {
6490
6498
  !1);
6491
6499
  })), r && (n = n.add(e));
6492
6500
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6493
- const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6501
+ const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6494
6502
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6495
- this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6503
+ this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6496
6504
  r;
6497
6505
  }
6498
6506
  /**
@@ -6504,7 +6512,7 @@ class __PRIVATE_WatchChangeAggregator {
6504
6512
  if (!this.Je(e)) return;
6505
6513
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6506
6514
  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));
6515
+ this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6508
6516
  }
6509
6517
  /**
6510
6518
  * Removes the provided document from the target mapping. If the
@@ -6520,7 +6528,7 @@ class __PRIVATE_WatchChangeAggregator {
6520
6528
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6521
6529
  // The document may have entered and left the target before we raised a
6522
6530
  // 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)),
6531
+ r.Oe(t), this.Ue = this.Ue.insert(t, this.ct(t).delete(e)), this.Ue = this.Ue.insert(t, this.ct(t).add(e)),
6524
6532
  n && (this.Qe = this.Qe.insert(t, n));
6525
6533
  }
6526
6534
  removeTarget(e) {
@@ -6545,8 +6553,8 @@ class __PRIVATE_WatchChangeAggregator {
6545
6553
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6546
6554
  }
6547
6555
  ct(e) {
6548
- let t = this.Ke.get(e);
6549
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6556
+ let t = this.Ue.get(e);
6557
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6550
6558
  t;
6551
6559
  }
6552
6560
  _t(e) {
@@ -7729,7 +7737,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7729
7737
  * limitations under the License.
7730
7738
  */ class __PRIVATE_IndexedDbGlobalsCache {
7731
7739
  dt(e) {
7732
- return __PRIVATE_getStore(e, Ke);
7740
+ return __PRIVATE_getStore(e, Ue);
7733
7741
  }
7734
7742
  getSessionToken(e) {
7735
7743
  return this.dt(e).get("sessionToken").next((e => {
@@ -7790,12 +7798,12 @@ class __PRIVATE_FirestoreIndexValueWriter {
7790
7798
  let n = e.timestampValue;
7791
7799
  this.ft(t, 20), "string" == typeof n && (n = __PRIVATE_normalizeTimestamp(n)), t.yt(`${n.seconds || ""}`),
7792
7800
  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) {
7801
+ } else if ("stringValue" in e) this.wt(e.stringValue, t), this.St(t); else if ("bytesValue" in e) this.ft(t, 30),
7802
+ 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
7803
  const n = e.geoPointValue;
7796
7804
  this.ft(t, 45), t.gt(n.latitude || 0), t.gt(n.longitude || 0);
7797
7805
  } 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();
7806
+ this.St(t)) : "arrayValue" in e ? (this.Ft(e.arrayValue, t), this.St(t)) : fail();
7799
7807
  }
7800
7808
  wt(e, t) {
7801
7809
  this.ft(t, 25), this.Mt(e, t);
@@ -7832,7 +7840,7 @@ class __PRIVATE_FirestoreIndexValueWriter {
7832
7840
  ft(e, t) {
7833
7841
  e.gt(t);
7834
7842
  }
7835
- bt(e) {
7843
+ St(e) {
7836
7844
  // While the SDK does not implement truncation, the truncation marker is
7837
7845
  // used to terminate all variable length values (which are strings, bytes,
7838
7846
  // references, arrays and maps).
@@ -7941,10 +7949,10 @@ function __PRIVATE_unsignedNumLength(e) {
7941
7949
  }
7942
7950
  this.qt();
7943
7951
  }
7944
- Kt(e) {
7952
+ Ut(e) {
7945
7953
  // Values are encoded with a single byte length prefix, followed by the
7946
7954
  // actual value in big-endian format with leading 0 bytes dropped.
7947
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7955
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7948
7956
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7949
7957
  // Write the length
7950
7958
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7952,7 +7960,7 @@ function __PRIVATE_unsignedNumLength(e) {
7952
7960
  Gt(e) {
7953
7961
  // Values are encoded with a single byte length prefix, followed by the
7954
7962
  // inverted value in big-endian format with leading 0 bytes dropped.
7955
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7963
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7956
7964
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7957
7965
  // Write the length
7958
7966
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7987,7 +7995,7 @@ function __PRIVATE_unsignedNumLength(e) {
7987
7995
  * -0.0 < 0.0
7988
7996
  * all non-NaN < NaN
7989
7997
  * NaN = NaN
7990
- */ Ut(e) {
7998
+ */ Kt(e) {
7991
7999
  const t =
7992
8000
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
7993
8001
  function __PRIVATE_doubleToLongBits(e) {
@@ -8039,14 +8047,14 @@ class __PRIVATE_AscendingIndexByteEncoder {
8039
8047
  constructor(e) {
8040
8048
  this.Zt = e;
8041
8049
  }
8042
- St(e) {
8050
+ bt(e) {
8043
8051
  this.Zt.Ot(e);
8044
8052
  }
8045
8053
  yt(e) {
8046
8054
  this.Zt.Qt(e);
8047
8055
  }
8048
8056
  gt(e) {
8049
- this.Zt.Kt(e);
8057
+ this.Zt.Ut(e);
8050
8058
  }
8051
8059
  Vt() {
8052
8060
  this.Zt.zt();
@@ -8057,7 +8065,7 @@ class __PRIVATE_DescendingIndexByteEncoder {
8057
8065
  constructor(e) {
8058
8066
  this.Zt = e;
8059
8067
  }
8060
- St(e) {
8068
+ bt(e) {
8061
8069
  this.Zt.Lt(e);
8062
8070
  }
8063
8071
  yt(e) {
@@ -8887,7 +8895,7 @@ class __PRIVATE_IndexedDbIndexManager {
8887
8895
  let i = 0;
8888
8896
  for (const s of __PRIVATE_fieldIndexGetDirectionalSegments(e)) {
8889
8897
  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 {
8898
+ for (const n of r) if (this.Sn(t, s.fieldPath) && isArray(e)) r = this.bn(r, s, e); else {
8891
8899
  const t = n.tn(s.kind);
8892
8900
  __PRIVATE_FirestoreIndexValueWriter.xt.At(e, t);
8893
8901
  }
@@ -8911,7 +8919,7 @@ class __PRIVATE_IndexedDbIndexManager {
8911
8919
  * The method appends each value to all existing encoders (e.g. filter("a",
8912
8920
  * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A
8913
8921
  * list of new encoders is returned.
8914
- */ Sn(e, t, n) {
8922
+ */ bn(e, t, n) {
8915
8923
  const r = [ ...e ], i = [];
8916
8924
  for (const e of n.arrayValue.values || []) for (const n of r) {
8917
8925
  const r = new __PRIVATE_IndexByteEncoder;
@@ -8919,12 +8927,12 @@ class __PRIVATE_IndexedDbIndexManager {
8919
8927
  }
8920
8928
  return i;
8921
8929
  }
8922
- bn(e, t) {
8930
+ Sn(e, t) {
8923
8931
  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
8932
  }
8925
8933
  getFieldIndexes(e, t) {
8926
8934
  const n = __PRIVATE_indexConfigurationStore(e), r = __PRIVATE_indexStateStore(e);
8927
- return (t ? n.G(be, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8935
+ return (t ? n.G(Se, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8928
8936
  const t = [];
8929
8937
  return PersistencePromise.forEach(e, (e => r.get([ e.indexId, this.uid ]).next((n => {
8930
8938
  t.push(function __PRIVATE_fromDbIndexConfiguration(e, t) {
@@ -8942,7 +8950,7 @@ class __PRIVATE_IndexedDbIndexManager {
8942
8950
  }
8943
8951
  updateCollectionGroup(e, t, n) {
8944
8952
  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))))))));
8953
+ 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
8954
  }
8947
8955
  updateIndexEntries(e, t) {
8948
8956
  // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as
@@ -9139,7 +9147,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
9139
9147
  sequenceNumbersCollected: 0,
9140
9148
  targetsRemoved: 0,
9141
9149
  documentsRemoved: 0
9142
- }, bt = 41943040;
9150
+ }, St = 41943040;
9143
9151
 
9144
9152
  class LruParams {
9145
9153
  static withCacheSize(e) {
@@ -9224,7 +9232,7 @@ function removeMutationBatch(e, t, n) {
9224
9232
  * limitations under the License.
9225
9233
  */
9226
9234
  /** 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),
9235
+ 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
9236
  LruParams.DISABLED = new LruParams(-1, 0, 0);
9229
9237
 
9230
9238
  class __PRIVATE_IndexedDbMutationQueue {
@@ -9555,14 +9563,14 @@ class __PRIVATE_TargetIdGenerator {
9555
9563
  next() {
9556
9564
  return this.$n += 2, this.$n;
9557
9565
  }
9558
- static Kn() {
9566
+ static Un() {
9559
9567
  // The target cache generator must return '2' in its first call to `next()`
9560
9568
  // as there is no differentiation in the protocol layer between an unset
9561
9569
  // number and the number '0'. If we were to sent a target with target ID
9562
9570
  // '0', the backend would consider it unset and replace it with its own ID.
9563
9571
  return new __PRIVATE_TargetIdGenerator(0);
9564
9572
  }
9565
- static Un() {
9573
+ static Kn() {
9566
9574
  // Sync engine assigns target IDs for limbo document detection.
9567
9575
  return new __PRIVATE_TargetIdGenerator(-1);
9568
9576
  }
@@ -9781,7 +9789,7 @@ class __PRIVATE_TargetIdGenerator {
9781
9789
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9782
9790
  * See the License for the specific language governing permissions and
9783
9791
  * limitations under the License.
9784
- */ const St = "LruGarbageCollector", Dt = 1048576;
9792
+ */ const bt = "LruGarbageCollector", Dt = 1048576;
9785
9793
 
9786
9794
  function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9787
9795
  const i = __PRIVATE_primitiveComparator(e, n);
@@ -9834,12 +9842,12 @@ function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9834
9842
  return null !== this.Xn;
9835
9843
  }
9836
9844
  er(e) {
9837
- __PRIVATE_logDebug(St, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9845
+ __PRIVATE_logDebug(bt, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9838
9846
  this.Xn = null;
9839
9847
  try {
9840
9848
  await this.localStore.collectGarbage(this.garbageCollector);
9841
9849
  } catch (e) {
9842
- __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(St, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9850
+ __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(bt, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9843
9851
  }
9844
9852
  await this.er(3e5);
9845
9853
  }));
@@ -10957,13 +10965,13 @@ class OverlayedDocument {
10957
10965
  */ removeReference(e, t) {
10958
10966
  this.wr(new __PRIVATE_DocReference(e, t));
10959
10967
  }
10960
- br(e, t) {
10968
+ Sr(e, t) {
10961
10969
  e.forEach((e => this.removeReference(e, t)));
10962
10970
  }
10963
10971
  /**
10964
10972
  * Clears all references with a given ID. Calls removeRef() for each key
10965
10973
  * removed.
10966
- */ Sr(e) {
10974
+ */ br(e) {
10967
10975
  const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1), i = [];
10968
10976
  return this.gr.forEachInRange([ n, r ], (e => {
10969
10977
  this.wr(e), i.push(e.key);
@@ -11330,7 +11338,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11330
11338
  * A ordered bidirectional mapping between documents and the remote target
11331
11339
  * IDs.
11332
11340
  */
11333
- this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11341
+ this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11334
11342
  }
11335
11343
  forEachTarget(e, t) {
11336
11344
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11342,7 +11350,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11342
11350
  return PersistencePromise.resolve(this.$r);
11343
11351
  }
11344
11352
  allocateTargetId(e) {
11345
- return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11353
+ return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11346
11354
  }
11347
11355
  setTargetsMetadata(e, t, n) {
11348
11356
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11351,7 +11359,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11351
11359
  zn(e) {
11352
11360
  this.Qr.set(e.target, e);
11353
11361
  const t = e.targetId;
11354
- t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11362
+ t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11355
11363
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11356
11364
  }
11357
11365
  addTargetData(e, t) {
@@ -11361,7 +11369,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11361
11369
  return this.zn(t), PersistencePromise.resolve();
11362
11370
  }
11363
11371
  removeTargetData(e, t) {
11364
- return this.Qr.delete(t.target), this.Kr.Sr(t.targetId), this.targetCount -= 1,
11372
+ return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11365
11373
  PersistencePromise.resolve();
11366
11374
  }
11367
11375
  removeTargets(e, t, n) {
@@ -11380,24 +11388,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11380
11388
  return PersistencePromise.resolve(n);
11381
11389
  }
11382
11390
  addMatchingKeys(e, t, n) {
11383
- return this.Kr.yr(t, n), PersistencePromise.resolve();
11391
+ return this.Ur.yr(t, n), PersistencePromise.resolve();
11384
11392
  }
11385
11393
  removeMatchingKeys(e, t, n) {
11386
- this.Kr.br(t, n);
11394
+ this.Ur.Sr(t, n);
11387
11395
  const r = this.persistence.referenceDelegate, i = [];
11388
11396
  return r && t.forEach((t => {
11389
11397
  i.push(r.markPotentiallyOrphaned(e, t));
11390
11398
  })), PersistencePromise.waitFor(i);
11391
11399
  }
11392
11400
  removeMatchingKeysForTargetId(e, t) {
11393
- return this.Kr.Sr(t), PersistencePromise.resolve();
11401
+ return this.Ur.br(t), PersistencePromise.resolve();
11394
11402
  }
11395
11403
  getMatchingKeysForTargetId(e, t) {
11396
- const n = this.Kr.vr(t);
11404
+ const n = this.Ur.vr(t);
11397
11405
  return PersistencePromise.resolve(n);
11398
11406
  }
11399
11407
  containsKey(e, t) {
11400
- return PersistencePromise.resolve(this.Kr.containsKey(t));
11408
+ return PersistencePromise.resolve(this.Ur.containsKey(t));
11401
11409
  }
11402
11410
  }
11403
11411
 
@@ -11525,7 +11533,7 @@ class __PRIVATE_MemoryEagerDelegate {
11525
11533
  return this.ii.add(t.toString()), PersistencePromise.resolve();
11526
11534
  }
11527
11535
  removeTarget(e, t) {
11528
- this.ti.Sr(t.targetId).forEach((e => this.ii.add(e.toString())));
11536
+ this.ti.br(t.targetId).forEach((e => this.ii.add(e.toString())));
11529
11537
  const n = this.persistence.getTargetCache();
11530
11538
  return n.getMatchingKeysForTargetId(e, t.targetId).next((e => {
11531
11539
  e.forEach((e => this.ii.add(e.toString())));
@@ -11658,7 +11666,7 @@ class __PRIVATE_MemoryLruDelegate {
11658
11666
  */ B(e, t, n, r) {
11659
11667
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11660
11668
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11661
- e.createObjectStore(U);
11669
+ e.createObjectStore(K);
11662
11670
  }(e), function __PRIVATE_createMutationQueue(e) {
11663
11671
  e.createObjectStore(G, {
11664
11672
  keyPath: z
@@ -11675,7 +11683,7 @@ class __PRIVATE_MemoryLruDelegate {
11675
11683
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11676
11684
  * and rewrites all data.
11677
11685
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11678
- e.createObjectStore(K);
11686
+ e.createObjectStore(U);
11679
11687
  }(e));
11680
11688
  // Migration 2 to populate the targetGlobal object no longer needed since
11681
11689
  // migration 3 unconditionally clears it.
@@ -11763,13 +11771,13 @@ class __PRIVATE_MemoryLruDelegate {
11763
11771
  keyPath: te
11764
11772
  });
11765
11773
  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)))),
11774
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11767
11775
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11768
11776
  const t = e.createObjectStore(ye, {
11769
11777
  keyPath: we,
11770
11778
  autoIncrement: !0
11771
11779
  });
11772
- t.createIndex(be, Se, {
11780
+ t.createIndex(Se, be, {
11773
11781
  unique: !1
11774
11782
  });
11775
11783
  const n = e.createObjectStore(De, {
@@ -11792,15 +11800,15 @@ class __PRIVATE_MemoryLruDelegate {
11792
11800
  t.objectStore(Me).clear();
11793
11801
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11794
11802
  !function __PRIVATE_createGlobalsStore(e) {
11795
- e.createObjectStore(Ke, {
11796
- keyPath: Ue
11803
+ e.createObjectStore(Ue, {
11804
+ keyPath: Ke
11797
11805
  });
11798
11806
  }(e);
11799
11807
  }))), s;
11800
11808
  }
11801
11809
  ai(e) {
11802
11810
  let t = 0;
11803
- return e.store(K).Z(((e, n) => {
11811
+ return e.store(U).Z(((e, n) => {
11804
11812
  t += __PRIVATE_dbDocumentSize(n);
11805
11813
  })).next((() => {
11806
11814
  const n = {
@@ -11824,7 +11832,7 @@ class __PRIVATE_MemoryLruDelegate {
11824
11832
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11825
11833
  * with a sequence number. Missing rows are given the most recently used sequence number.
11826
11834
  */ ui(e) {
11827
- const t = e.store(le), n = e.store(K);
11835
+ const t = e.store(le), n = e.store(U);
11828
11836
  return e.store(Ee).get(Ie).next((e => {
11829
11837
  const r = [];
11830
11838
  return n.Z(((n, i) => {
@@ -11855,7 +11863,7 @@ class __PRIVATE_MemoryLruDelegate {
11855
11863
  };
11856
11864
  // Helper to add an index entry iff we haven't already written it.
11857
11865
  // Index existing remote documents.
11858
- return t.store(K).Z({
11866
+ return t.store(U).Z({
11859
11867
  Y: !0
11860
11868
  }, ((e, t) => {
11861
11869
  const n = new ResourcePath(e);
@@ -11875,7 +11883,7 @@ class __PRIVATE_MemoryLruDelegate {
11875
11883
  }));
11876
11884
  }
11877
11885
  hi(e, t) {
11878
- const n = t.store(K), r = [];
11886
+ const n = t.store(U), r = [];
11879
11887
  return n.Z(((e, n) => {
11880
11888
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11881
11889
  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 +12044,7 @@ class __PRIVATE_IndexedDbPersistence {
12036
12044
  // Fail `start()` if `synchronizeTabs` is disabled and we cannot
12037
12045
  // obtain the primary lease.
12038
12046
  throw new FirestoreError(C.FAILED_PRECONDITION, Mt);
12039
- return this.bi(), this.Si(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12047
+ return this.Si(), this.bi(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12040
12048
  })).then((e => {
12041
12049
  this.Gr = new __PRIVATE_ListenSequence(e, this.Ii);
12042
12050
  })).then((() => {
@@ -12193,11 +12201,11 @@ class __PRIVATE_IndexedDbPersistence {
12193
12201
  async shutdown() {
12194
12202
  // The shutdown() operations are idempotent and can be called even when
12195
12203
  // 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(),
12204
+ this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12197
12205
  this.Wi(),
12198
12206
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12199
12207
  // has obtained the primary lease.
12200
- await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12208
+ await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12201
12209
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12202
12210
  return this.xi(t).next((() => this.Bi(t)));
12203
12211
  })), this.pi.close(),
@@ -12297,13 +12305,13 @@ class __PRIVATE_IndexedDbPersistence {
12297
12305
  return !(e < n - t) && (!(e > n) || (__PRIVATE_logError(`Detected an update time that is in the future: ${e} > ${n}`),
12298
12306
  !1));
12299
12307
  }
12300
- bi() {
12308
+ Si() {
12301
12309
  null !== this.document && "function" == typeof this.document.addEventListener && (this.Ri = () => {
12302
12310
  this.Ti.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
12303
12311
  this.wi())));
12304
12312
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12305
12313
  }
12306
- Ui() {
12314
+ Ki() {
12307
12315
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12308
12316
  }
12309
12317
  /**
@@ -12315,13 +12323,13 @@ class __PRIVATE_IndexedDbPersistence {
12315
12323
  * primary lease). LocalStorage is used for this rather than IndexedDb because
12316
12324
  * it is a synchronous API and so can be used reliably from an unload
12317
12325
  * handler.
12318
- */ Si() {
12326
+ */ bi() {
12319
12327
  var e;
12320
12328
  "function" == typeof (null === (e = this.window) || void 0 === e ? void 0 : e.addEventListener) && (this.Ai = () => {
12321
12329
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12322
12330
  // accesses internal state. We execute this code directly during shutdown
12323
12331
  // to make sure it gets a chance to run.
12324
- this.Ki();
12332
+ this.Ui();
12325
12333
  const e = /(?:Version|Mobile)\/1[456]/;
12326
12334
  isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12327
12335
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12352,7 +12360,7 @@ class __PRIVATE_IndexedDbPersistence {
12352
12360
  /**
12353
12361
  * Record client as zombied (a client that had its tab closed). Zombied
12354
12362
  * clients are ignored during primary tab selection.
12355
- */ Ki() {
12363
+ */ Ui() {
12356
12364
  if (this.yi) try {
12357
12365
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12358
12366
  } catch (e) {
@@ -12375,7 +12383,7 @@ class __PRIVATE_IndexedDbPersistence {
12375
12383
  /**
12376
12384
  * Helper to get a typed SimpleDbStore for the primary client object store.
12377
12385
  */ function __PRIVATE_primaryClientStore(e) {
12378
- return __PRIVATE_getStore(e, U);
12386
+ return __PRIVATE_getStore(e, K);
12379
12387
  }
12380
12388
 
12381
12389
  /**
@@ -13230,14 +13238,14 @@ class __PRIVATE_MutationMetadata {
13230
13238
  /**
13231
13239
  * Parses a MutationMetadata from its JSON representation in WebStorage.
13232
13240
  * Logs a warning and returns null if the format of the data is not valid.
13233
- */ static bs(e, t, n) {
13241
+ */ static Ss(e, t, n) {
13234
13242
  const r = JSON.parse(n);
13235
13243
  let i, s = "object" == typeof r && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(r.state) && (void 0 === r.error || "object" == typeof r.error);
13236
13244
  return s && r.error && (s = "string" == typeof r.error.message && "string" == typeof r.error.code,
13237
13245
  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
13246
  null);
13239
13247
  }
13240
- Ss() {
13248
+ bs() {
13241
13249
  const e = {
13242
13250
  state: this.state,
13243
13251
  updateTimeMs: Date.now()
@@ -13261,14 +13269,14 @@ class __PRIVATE_QueryTargetMetadata {
13261
13269
  /**
13262
13270
  * Parses a QueryTargetMetadata from its JSON representation in WebStorage.
13263
13271
  * Logs a warning and returns null if the format of the data is not valid.
13264
- */ static bs(e, t) {
13272
+ */ static Ss(e, t) {
13265
13273
  const n = JSON.parse(t);
13266
13274
  let r, i = "object" == typeof n && -1 !== [ "not-current", "current", "rejected" ].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error);
13267
13275
  return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code,
13268
13276
  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
13277
  null);
13270
13278
  }
13271
- Ss() {
13279
+ bs() {
13272
13280
  const e = {
13273
13281
  state: this.state,
13274
13282
  updateTimeMs: Date.now()
@@ -13290,7 +13298,7 @@ class __PRIVATE_QueryTargetMetadata {
13290
13298
  /**
13291
13299
  * Parses a RemoteClientState from the JSON representation in WebStorage.
13292
13300
  * Logs a warning and returns null if the format of the data is not valid.
13293
- */ static bs(e, t) {
13301
+ */ static Ss(e, t) {
13294
13302
  const n = JSON.parse(t);
13295
13303
  let r = "object" == typeof n && n.activeTargetIds instanceof Array, i = __PRIVATE_targetIdSet();
13296
13304
  for (let e = 0; r && e < n.activeTargetIds.length; ++e) r = isSafeInteger(n.activeTargetIds[e]),
@@ -13311,7 +13319,7 @@ class __PRIVATE_QueryTargetMetadata {
13311
13319
  /**
13312
13320
  * Parses a SharedOnlineState from its JSON representation in WebStorage.
13313
13321
  * Logs a warning and returns null if the format of the data is not valid.
13314
- */ static bs(e) {
13322
+ */ static Ss(e) {
13315
13323
  const t = JSON.parse(e);
13316
13324
  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
13325
  null);
@@ -13342,7 +13350,7 @@ class __PRIVATE_LocalClientState {
13342
13350
  /**
13343
13351
  * Converts this entry into a JSON-encoded format we can use for WebStorage.
13344
13352
  * Does not encode `clientId` as it is part of the key in WebStorage.
13345
- */ Ss() {
13353
+ */ bs() {
13346
13354
  const e = {
13347
13355
  activeTargetIds: this.activeTargetIds.toArray(),
13348
13356
  updateTimeMs: Date.now()
@@ -13410,16 +13418,16 @@ class __PRIVATE_LocalClientState {
13410
13418
  if (t === this.Cs) continue;
13411
13419
  const e = this.getItem(createWebStorageClientStateKey(this.persistenceKey, t));
13412
13420
  if (e) {
13413
- const n = __PRIVATE_RemoteClientState.bs(t, e);
13421
+ const n = __PRIVATE_RemoteClientState.Ss(t, e);
13414
13422
  n && (this.xs = this.xs.insert(n.clientId, n));
13415
13423
  }
13416
13424
  }
13417
- this.Ks();
13425
+ this.Us();
13418
13426
  // Check if there is an existing online state and call the callback handler
13419
13427
  // if applicable.
13420
13428
  const t = this.storage.getItem(this.Qs);
13421
13429
  if (t) {
13422
- const e = this.Us(t);
13430
+ const e = this.Ks(t);
13423
13431
  e && this.Ws(e);
13424
13432
  }
13425
13433
  for (const e of this.Os) this.Ms(e);
@@ -13457,16 +13465,16 @@ class __PRIVATE_LocalClientState {
13457
13465
  if (this.isActiveQueryTarget(e)) {
13458
13466
  const t = this.storage.getItem(createWebStorageQueryTargetMetadataKey(this.persistenceKey, e));
13459
13467
  if (t) {
13460
- const r = __PRIVATE_QueryTargetMetadata.bs(e, t);
13468
+ const r = __PRIVATE_QueryTargetMetadata.Ss(e, t);
13461
13469
  r && (n = r.state);
13462
13470
  }
13463
13471
  }
13464
13472
  // If the query is listening to cache only, the target ID should not be registered with the
13465
13473
  // local Firestore client as an active watch target.
13466
- return t && this.Hs.Ds(e), this.Ks(), n;
13474
+ return t && this.Hs.Ds(e), this.Us(), n;
13467
13475
  }
13468
13476
  removeLocalQueryTarget(e) {
13469
- this.Hs.vs(e), this.Ks();
13477
+ this.Hs.vs(e), this.Us();
13470
13478
  }
13471
13479
  isLocalQueryTarget(e) {
13472
13480
  return this.Hs.activeTargetIds.has(e);
@@ -13533,7 +13541,7 @@ class __PRIVATE_LocalClientState {
13533
13541
  }
13534
13542
  } else if (t.key === this.Qs) {
13535
13543
  if (null !== t.newValue) {
13536
- const e = this.Us(t.newValue);
13544
+ const e = this.Ks(t.newValue);
13537
13545
  if (e) return this.Ws(e);
13538
13546
  }
13539
13547
  } else if (t.key === this.Bs) {
@@ -13564,12 +13572,12 @@ class __PRIVATE_LocalClientState {
13564
13572
  get Hs() {
13565
13573
  return this.xs.get(this.Cs);
13566
13574
  }
13567
- Ks() {
13568
- this.setItem(this.Ns, this.Hs.Ss());
13575
+ Us() {
13576
+ this.setItem(this.Ns, this.Hs.bs());
13569
13577
  }
13570
13578
  zs(e, t, n) {
13571
13579
  const r = new __PRIVATE_MutationMetadata(this.currentUser, e, t, n), i = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
13572
- this.setItem(i, r.Ss());
13580
+ this.setItem(i, r.bs());
13573
13581
  }
13574
13582
  js(e) {
13575
13583
  const t = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
@@ -13584,7 +13592,7 @@ class __PRIVATE_LocalClientState {
13584
13592
  }
13585
13593
  Js(e, t, n) {
13586
13594
  const r = createWebStorageQueryTargetMetadataKey(this.persistenceKey, e), i = new __PRIVATE_QueryTargetMetadata(e, t, n);
13587
- this.setItem(r, i.Ss());
13595
+ this.setItem(r, i.bs());
13588
13596
  }
13589
13597
  Zs(e) {
13590
13598
  const t = JSON.stringify(Array.from(e));
@@ -13602,27 +13610,27 @@ class __PRIVATE_LocalClientState {
13602
13610
  * be parsed.
13603
13611
  */ no(e, t) {
13604
13612
  const n = this.Xs(e);
13605
- return __PRIVATE_RemoteClientState.bs(n, t);
13613
+ return __PRIVATE_RemoteClientState.Ss(n, t);
13606
13614
  }
13607
13615
  /**
13608
13616
  * Parses a mutation batch state in WebStorage. Returns 'null' if the value
13609
13617
  * could not be parsed.
13610
13618
  */ ro(e, t) {
13611
13619
  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);
13620
+ return __PRIVATE_MutationMetadata.Ss(new User(i), r, t);
13613
13621
  }
13614
13622
  /**
13615
13623
  * Parses a query target state from WebStorage. Returns 'null' if the value
13616
13624
  * could not be parsed.
13617
13625
  */ so(e, t) {
13618
13626
  const n = this.qs.exec(e), r = Number(n[1]);
13619
- return __PRIVATE_QueryTargetMetadata.bs(r, t);
13627
+ return __PRIVATE_QueryTargetMetadata.Ss(r, t);
13620
13628
  }
13621
13629
  /**
13622
13630
  * Parses an online state from WebStorage. Returns 'null' if the value
13623
13631
  * could not be parsed.
13624
- */ Us(e) {
13625
- return __PRIVATE_SharedOnlineState.bs(e);
13632
+ */ Ks(e) {
13633
+ return __PRIVATE_SharedOnlineState.Ss(e);
13626
13634
  }
13627
13635
  _o(e) {
13628
13636
  return JSON.parse(e);
@@ -13846,7 +13854,7 @@ function __PRIVATE_generateUniqueDebugId() {
13846
13854
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13847
13855
  * See the License for the specific language governing permissions and
13848
13856
  * limitations under the License.
13849
- */ const Kt = "RestConnection", Ut = {
13857
+ */ const Ut = "RestConnection", Kt = {
13850
13858
  BatchGetDocuments: "batchGet",
13851
13859
  Commit: "commit",
13852
13860
  RunQuery: "runQuery",
@@ -13873,23 +13881,23 @@ class __PRIVATE_RestConnection {
13873
13881
  const t = e.ssl ? "https" : "http", n = encodeURIComponent(this.databaseId.projectId), r = encodeURIComponent(this.databaseId.database);
13874
13882
  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
13883
  }
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);
13884
+ So(e, t, n, r, i) {
13885
+ const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13886
+ __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13879
13887
  const _ = {
13880
13888
  "google-cloud-resource-prefix": this.yo,
13881
13889
  "x-goog-request-params": this.wo
13882
13890
  };
13883
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13891
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13884
13892
  t)), (t => {
13885
- throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13893
+ throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13886
13894
  t;
13887
13895
  }));
13888
13896
  }
13889
13897
  Co(e, t, n, r, i, s) {
13890
13898
  // The REST API automatically aggregates all of the streamed results, so we
13891
13899
  // can just use the normal invoke() method.
13892
- return this.bo(e, t, n, r, i);
13900
+ return this.So(e, t, n, r, i);
13893
13901
  }
13894
13902
  /**
13895
13903
  * Modifies the headers for a request, adding any authorization token if
@@ -13908,8 +13916,8 @@ class __PRIVATE_RestConnection {
13908
13916
  e["Content-Type"] = "text/plain", this.databaseInfo.appId && (e["X-Firebase-GMPID"] = this.databaseInfo.appId),
13909
13917
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13910
13918
  }
13911
- So(e, t) {
13912
- const n = Ut[e];
13919
+ bo(e, t) {
13920
+ const n = Kt[e];
13913
13921
  return `${this.po}/v1/${t}:${n}`;
13914
13922
  }
13915
13923
  /**
@@ -13969,10 +13977,10 @@ class __PRIVATE_RestConnection {
13969
13977
  $o() {
13970
13978
  this.Bo();
13971
13979
  }
13972
- Ko(e) {
13980
+ Uo(e) {
13973
13981
  this.ko(e);
13974
13982
  }
13975
- Uo(e) {
13983
+ Ko(e) {
13976
13984
  this.qo(e);
13977
13985
  }
13978
13986
  }
@@ -14124,10 +14132,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14124
14132
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14125
14133
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
14126
14134
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14127
- P.Ko());
14135
+ P.Uo());
14128
14136
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {
14129
14137
  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")));
14138
+ P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14131
14139
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {
14132
14140
  var n;
14133
14141
  if (!h) {
@@ -14158,8 +14166,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14158
14166
  }(t), i = o.message;
14159
14167
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14160
14168
  // 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);
14169
+ h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14170
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14163
14171
  }
14164
14172
  })), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {
14165
14173
  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 +14678,7 @@ class __PRIVATE_PersistentStream {
14670
14678
  /**
14671
14679
  * Tracks whether or not a handshake has been successfully exchanged and
14672
14680
  * the stream is ready to accept mutations.
14673
- */ get b_() {
14681
+ */ get S_() {
14674
14682
  return this.__ > 0;
14675
14683
  }
14676
14684
  // Override of PersistentStream.start
@@ -14678,7 +14686,7 @@ class __PRIVATE_PersistentStream {
14678
14686
  this.lastStreamToken = void 0, super.start();
14679
14687
  }
14680
14688
  A_() {
14681
- this.b_ && this.S_([]);
14689
+ this.S_ && this.b_([]);
14682
14690
  }
14683
14691
  f_(e, t) {
14684
14692
  return this.connection.Wo("Write", e, t);
@@ -14709,7 +14717,7 @@ class __PRIVATE_PersistentStream {
14709
14717
  const e = {};
14710
14718
  e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.I_(e);
14711
14719
  }
14712
- /** Sends a group of mutations to the Firestore backend to apply. */ S_(e) {
14720
+ /** Sends a group of mutations to the Firestore backend to apply. */ b_(e) {
14713
14721
  const t = {
14714
14722
  streamToken: this.lastStreamToken,
14715
14723
  writes: e.map((e => toMutation(this.serializer, e)))
@@ -14751,8 +14759,8 @@ class __PRIVATE_PersistentStream {
14751
14759
  M_() {
14752
14760
  if (this.F_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
14753
14761
  }
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 => {
14762
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ So(e, t, n, r) {
14763
+ 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
14764
  throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14757
14765
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
14758
14766
  }));
@@ -14894,7 +14902,7 @@ class __PRIVATE_RemoteStoreImpl {
14894
14902
  * purely based on order, and so we can just shift() writes from the front of
14895
14903
  * the writePipeline as we receive responses.
14896
14904
  */
14897
- this.K_ = [],
14905
+ this.U_ = [],
14898
14906
  /**
14899
14907
  * A mapping of watched targets that the client cares about tracking and the
14900
14908
  * user has explicitly called a 'listen' for this target.
@@ -14904,7 +14912,7 @@ class __PRIVATE_RemoteStoreImpl {
14904
14912
  * to the server. The targets removed with unlistens are removed eagerly
14905
14913
  * without waiting for confirmation from the listen stream.
14906
14914
  */
14907
- this.U_ = new Map,
14915
+ this.K_ = new Map,
14908
14916
  /**
14909
14917
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14910
14918
  * RemoteStore may start its network connections.
@@ -14951,9 +14959,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14951
14959
  */
14952
14960
  function __PRIVATE_remoteStoreListen(e, t) {
14953
14961
  const n = __PRIVATE_debugCast(e);
14954
- n.U_.has(t.targetId) || (
14962
+ n.K_.has(t.targetId) || (
14955
14963
  // Mark this as something the client is currently listening for.
14956
- n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14964
+ n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14957
14965
  // The listen will be sent in onWatchStreamOpen
14958
14966
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14959
14967
  }
@@ -14963,7 +14971,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14963
14971
  * not being listened to.
14964
14972
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14965
14973
  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) &&
14974
+ n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14967
14975
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14968
14976
  // have no listeners, since without any listens to send we cannot
14969
14977
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14992,7 +15000,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14992
15000
  function __PRIVATE_startWatchStream(e) {
14993
15001
  e.H_ = new __PRIVATE_WatchChangeAggregator({
14994
15002
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14995
- lt: t => e.U_.get(t) || null,
15003
+ lt: t => e.K_.get(t) || null,
14996
15004
  it: () => e.datastore.serializer.databaseId
14997
15005
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
14998
15006
  }
@@ -15001,7 +15009,7 @@ function __PRIVATE_startWatchStream(e) {
15001
15009
  * Returns whether the watch stream should be started because it's necessary
15002
15010
  * and has not yet been started.
15003
15011
  */ function __PRIVATE_shouldStartWatchStream(e) {
15004
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15012
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15005
15013
  }
15006
15014
 
15007
15015
  function __PRIVATE_canUseNetwork(e) {
@@ -15018,7 +15026,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15018
15026
  }
15019
15027
 
15020
15028
  async function __PRIVATE_onWatchStreamOpen(e) {
15021
- e.U_.forEach(((t, n) => {
15029
+ e.K_.forEach(((t, n) => {
15022
15030
  __PRIVATE_sendWatchRequest(e, t);
15023
15031
  }));
15024
15032
  }
@@ -15045,7 +15053,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15045
15053
  const n = t.cause;
15046
15054
  for (const r of t.targetIds)
15047
15055
  // 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));
15056
+ e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15049
15057
  }
15050
15058
  /**
15051
15059
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15075,21 +15083,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15075
15083
  // persistent view of these when applying the completed RemoteEvent.
15076
15084
  return n.targetChanges.forEach(((n, r) => {
15077
15085
  if (n.resumeToken.approximateByteSize() > 0) {
15078
- const i = e.U_.get(r);
15086
+ const i = e.K_.get(r);
15079
15087
  // A watched target might have been removed already.
15080
- i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15088
+ i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15081
15089
  }
15082
15090
  })),
15083
15091
  // Re-establish listens for the targets that have been invalidated by
15084
15092
  // existence filter mismatches.
15085
15093
  n.targetMismatches.forEach(((t, n) => {
15086
- const r = e.U_.get(t);
15094
+ const r = e.K_.get(t);
15087
15095
  if (!r)
15088
15096
  // A watched target might have been removed already.
15089
15097
  return;
15090
15098
  // Clear the resume token for the target, since we're in a known mismatch
15091
15099
  // state.
15092
- e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15100
+ e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15093
15101
  // Cause a hard reset by unwatching and rewatching immediately, but
15094
15102
  // deliberately don't send a resume token so that we get a full update.
15095
15103
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15140,11 +15148,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15140
15148
 
15141
15149
  async function __PRIVATE_fillWritePipeline(e) {
15142
15150
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15143
- let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15151
+ let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15144
15152
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15145
15153
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15146
15154
  if (null === e) {
15147
- 0 === t.K_.length && n.P_();
15155
+ 0 === t.U_.length && n.P_();
15148
15156
  break;
15149
15157
  }
15150
15158
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15158,20 +15166,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15158
15166
  * Returns true if we can add to the write pipeline (i.e. the network is
15159
15167
  * enabled and the write pipeline is not full).
15160
15168
  */ function __PRIVATE_canAddToWritePipeline(e) {
15161
- return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15169
+ return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15162
15170
  }
15163
15171
 
15164
15172
  /**
15165
15173
  * Queues additional writes to be sent to the write stream, sending them
15166
15174
  * immediately if the write stream is established.
15167
15175
  */ function __PRIVATE_addToWritePipeline(e, t) {
15168
- e.K_.push(t);
15176
+ e.U_.push(t);
15169
15177
  const n = __PRIVATE_ensureWriteStream(e);
15170
- n.c_() && n.b_ && n.S_(t.mutations);
15178
+ n.c_() && n.S_ && n.b_(t.mutations);
15171
15179
  }
15172
15180
 
15173
15181
  function __PRIVATE_shouldStartWriteStream(e) {
15174
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15182
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15175
15183
  }
15176
15184
 
15177
15185
  function __PRIVATE_startWriteStream(e) {
@@ -15185,11 +15193,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15185
15193
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15186
15194
  const t = __PRIVATE_ensureWriteStream(e);
15187
15195
  // Send the write pipeline now that the stream is established.
15188
- for (const n of e.K_) t.S_(n.mutations);
15196
+ for (const n of e.U_) t.b_(n.mutations);
15189
15197
  }
15190
15198
 
15191
15199
  async function __PRIVATE_onMutationResult(e, t, n) {
15192
- const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15200
+ const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15193
15201
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15194
15202
  // It's possible that with the completion of this mutation another
15195
15203
  // slot has freed up.
@@ -15199,7 +15207,7 @@ async function __PRIVATE_onMutationResult(e, t, n) {
15199
15207
  async function __PRIVATE_onWriteStreamClose(e, t) {
15200
15208
  // If the write stream closed after the write handshake completes, a write
15201
15209
  // operation failed and we fail the pending operation.
15202
- t && __PRIVATE_ensureWriteStream(e).b_ &&
15210
+ t && __PRIVATE_ensureWriteStream(e).S_ &&
15203
15211
  // This error affects the actual write.
15204
15212
  await async function __PRIVATE_handleWriteError(e, t) {
15205
15213
  // Only handle permanent errors here. If it's transient, just let the retry
@@ -15209,7 +15217,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15209
15217
  }(t.code)) {
15210
15218
  // This was a permanent error, the request itself was the problem
15211
15219
  // so it's not going to succeed if we resend it.
15212
- const n = e.K_.shift();
15220
+ const n = e.U_.shift();
15213
15221
  // In this case it's also unlikely that the server itself is melting
15214
15222
  // down -- this was just a bad request so inhibit backoff on the next
15215
15223
  // restart.
@@ -15308,8 +15316,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15308
15316
  }), e.G_.push((async t => {
15309
15317
  t ? (e.Y_.h_(),
15310
15318
  // 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_ = []));
15319
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15320
+ e.U_ = []));
15313
15321
  }))), e.Y_;
15314
15322
  }
15315
15323
 
@@ -16006,7 +16014,7 @@ class __PRIVATE_RemovedLimboDocument {
16006
16014
  /**
16007
16015
  * The set of remote documents that the server has told us belongs to the target associated with
16008
16016
  * this view.
16009
- */ get ba() {
16017
+ */ get Sa() {
16010
16018
  return this.fa;
16011
16019
  }
16012
16020
  /**
@@ -16018,7 +16026,7 @@ class __PRIVATE_RemovedLimboDocument {
16018
16026
  * @param previousChanges - If this is being called with a refill, then start
16019
16027
  * with this set of docs and changes instead of the current view.
16020
16028
  * @returns a new set of docs, changes, and refill flag.
16021
- */ Sa(e, t) {
16029
+ */ ba(e, t) {
16022
16030
  const n = t ? t.Da : new __PRIVATE_DocumentChangeSet, r = t ? t.wa : this.wa;
16023
16031
  let i = t ? t.mutatedKeys : this.mutatedKeys, s = r, o = !1;
16024
16032
  // Track the last doc in a (full) limit. This is necessary, because some
@@ -16231,7 +16239,7 @@ class __PRIVATE_RemovedLimboDocument {
16231
16239
  // PORTING NOTE: Multi-tab only.
16232
16240
  Oa(e) {
16233
16241
  this.fa = e.gs, this.pa = __PRIVATE_documentKeySet();
16234
- const t = this.Sa(e.documents);
16242
+ const t = this.ba(e.documents);
16235
16243
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
16236
16244
  }
16237
16245
  /**
@@ -16323,11 +16331,11 @@ const Jt = "SyncEngine";
16323
16331
  * Keeps track of the information about an active limbo resolution for each
16324
16332
  * active target ID that was started for the purpose of limbo resolution.
16325
16333
  */
16326
- this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16334
+ this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16327
16335
  /** Stores user completion handlers, indexed by User and BatchId. */
16328
16336
  this.Wa = {},
16329
16337
  /** 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 */ ,
16338
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16331
16339
  // The primary state is set to `true` or `false` immediately after Firestore
16332
16340
  // startup. In the interim, a client should only be considered primary if
16333
16341
  // `isPrimary` is true.
@@ -16380,19 +16388,19 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16380
16388
  // targets based on view changes. This allows us to only depend on Limbo
16381
16389
  // changes when user code includes queries.
16382
16390
  e.Ha = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {
16383
- let i = t.view.Sa(n);
16391
+ let i = t.view.ba(n);
16384
16392
  i.ls && (
16385
16393
  // The query has a limit and some docs were removed, so we need
16386
16394
  // to re-run the query against the local store to make sure we
16387
16395
  // didn't lose any good docs that had been past the limit.
16388
16396
  i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query,
16389
- /* usePreviousResults= */ !1).then((({documents: e}) => t.view.Sa(e, i))));
16397
+ /* usePreviousResults= */ !1).then((({documents: e}) => t.view.ba(e, i))));
16390
16398
  const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16391
16399
  /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16392
16400
  return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Ma), _.snapshot;
16393
16401
  }(e, t, n, r);
16394
16402
  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(_,
16403
+ /* 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
16404
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16397
16405
  __PRIVATE_updateTrackedLimbos(e, n, u.Ma);
16398
16406
  const c = new __PRIVATE_QueryView(t, n, o);
@@ -16507,7 +16515,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16507
16515
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16508
16516
  // Update `receivedDocument` as appropriate for any limbo targets.
16509
16517
  t.targetChanges.forEach(((e, t) => {
16510
- const r = n.Ka.get(t);
16518
+ const r = n.Ua.get(t);
16511
16519
  r && (
16512
16520
  // Since this is a limbo resolution lookup, it's for a single document
16513
16521
  // and it could be added, modified, or removed, but not a combination.
@@ -16561,7 +16569,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16561
16569
  const r = __PRIVATE_debugCast(e);
16562
16570
  // PORTING NOTE: Multi-tab only.
16563
16571
  r.sharedClientState.updateQueryState(t, "rejected", n);
16564
- const i = r.Ka.get(t), s = i && i.key;
16572
+ const i = r.Ua.get(t), s = i && i.key;
16565
16573
  if (s) {
16566
16574
  // TODO(klimt): We really only should do the following on permission
16567
16575
  // denied errors, but we don't have the cause code here.
@@ -16583,7 +16591,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16583
16591
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16584
16592
  // this query when the RemoteStore restarts the Watch stream, which should
16585
16593
  // re-trigger the target failure.
16586
- r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16594
+ r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16587
16595
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16588
16596
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16589
16597
  }
@@ -16677,8 +16685,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16677
16685
  e.sharedClientState.removeLocalQueryTarget(t);
16678
16686
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16679
16687
  if (e.qa.delete(t), e.isPrimaryClient) {
16680
- e.Ua.Sr(t).forEach((t => {
16681
- e.Ua.containsKey(t) ||
16688
+ e.Ka.br(t).forEach((t => {
16689
+ e.Ka.containsKey(t) ||
16682
16690
  // We removed the last reference for this key
16683
16691
  __PRIVATE_removeLimboTarget(e, t);
16684
16692
  }));
@@ -16691,14 +16699,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16691
16699
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16692
16700
  const n = e.$a.get(t);
16693
16701
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16694
- e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16702
+ e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16695
16703
  }
16696
16704
 
16697
16705
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16698
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16706
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16699
16707
  __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) ||
16708
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16709
+ e.Ka.containsKey(r.key) ||
16702
16710
  // We removed the last reference for this key
16703
16711
  __PRIVATE_removeLimboTarget(e, r.key);
16704
16712
  } else fail();
@@ -16722,7 +16730,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16722
16730
  const t = e.Qa.values().next().value;
16723
16731
  e.Qa.delete(t);
16724
16732
  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));
16733
+ e.Ua.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16726
16734
  }
16727
16735
  }
16728
16736
 
@@ -16790,7 +16798,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16790
16798
  }
16791
16799
 
16792
16800
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16793
- const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16801
+ const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16794
16802
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16795
16803
  {
16796
16804
  let e = __PRIVATE_documentKeySet();
@@ -16798,7 +16806,7 @@ function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16798
16806
  if (!r) return e;
16799
16807
  for (const t of r) {
16800
16808
  const r = n.ka.get(t);
16801
- e = e.unionWith(r.view.ba);
16809
+ e = e.unionWith(r.view.Sa);
16802
16810
  }
16803
16811
  return e;
16804
16812
  }
@@ -16882,9 +16890,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16882
16890
  // PORTING NOTE: Multi-Tab only.
16883
16891
  function __PRIVATE_resetLimboDocuments(e) {
16884
16892
  const t = __PRIVATE_debugCast(e);
16885
- t.Ka.forEach(((e, n) => {
16893
+ t.Ua.forEach(((e, n) => {
16886
16894
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16887
- })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16895
+ })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16888
16896
  }
16889
16897
  /**
16890
16898
  * Reconcile the query views of the provided query targets with the state from
@@ -17584,7 +17592,7 @@ class Transaction$2 {
17584
17592
  const n = __PRIVATE_debugCast(e), r = {
17585
17593
  writes: t.map((e => toMutation(n.serializer, e)))
17586
17594
  };
17587
- await n.bo("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17595
+ await n.So("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17588
17596
  }(this.datastore, this.mutations), this.committed = !0;
17589
17597
  }
17590
17598
  recordVersion(e) {
@@ -17946,7 +17954,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17946
17954
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17947
17955
  try {
17948
17956
  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,
17957
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.gs), s = i.ba(r.documents), o = i.applyChanges(s,
17950
17958
  /* limboResolutionEnabled= */ !1);
17951
17959
  n.resolve(o.snapshot);
17952
17960
  } catch (e) {
@@ -18319,7 +18327,7 @@ class FirestoreSettingsImpl {
18319
18327
  this.host = Xt, this.ssl = en;
18320
18328
  } else this.host = e.host, this.ssl = null !== (t = e.ssl) && void 0 !== t ? t : en;
18321
18329
  if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
18322
- this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = bt; else {
18330
+ this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = St; else {
18323
18331
  if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < Dt) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
18324
18332
  this.cacheSizeBytes = e.cacheSizeBytes;
18325
18333
  }
@@ -18375,7 +18383,7 @@ class Firestore$1 {
18375
18383
  * Whether it's a Firestore or Firestore Lite instance.
18376
18384
  */
18377
18385
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
18378
- this._settingsFrozen = !1, this._emulatorOptions = {},
18386
+ this._settingsFrozen = !1,
18379
18387
  // A task that is assigned when the terminate() is invoked and resolved when
18380
18388
  // all components have shut down. Otherwise, Firestore is not terminated,
18381
18389
  // which can mean either the FirestoreClient is in the process of starting,
@@ -18397,8 +18405,7 @@ class Firestore$1 {
18397
18405
  }
18398
18406
  _setSettings(e) {
18399
18407
  if (this._settingsFrozen) throw new FirestoreError(C.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
18400
- this._settings = new FirestoreSettingsImpl(e), this._emulatorOptions = e.emulatorOptions || {},
18401
- void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
18408
+ this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
18402
18409
  if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
18403
18410
  switch (e.type) {
18404
18411
  case "firstParty":
@@ -18415,9 +18422,6 @@ class Firestore$1 {
18415
18422
  _getSettings() {
18416
18423
  return this._settings;
18417
18424
  }
18418
- _getEmulatorOptions() {
18419
- return this._emulatorOptions;
18420
- }
18421
18425
  _freezeSettings() {
18422
18426
  return this._settingsFrozen = !0, this._settings;
18423
18427
  }
@@ -18473,18 +18477,12 @@ class Firestore$1 {
18473
18477
  * Security Rules.
18474
18478
  */ function connectFirestoreEmulator(e, t, n, r = {}) {
18475
18479
  var i;
18476
- const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o = Object.assign(Object.assign({}, s), {
18477
- emulatorOptions: e._getEmulatorOptions()
18478
- }), _ = `${t}:${n}`;
18479
- s.host !== Xt && s.host !== _ && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
18480
- const a = Object.assign(Object.assign({}, s), {
18481
- host: _,
18482
- ssl: !1,
18483
- emulatorOptions: r
18484
- });
18485
- // No-op if the new configuration matches the current configuration. This supports SSR
18486
- // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
18487
- if (!deepEqual(a, o) && (e._setSettings(a), r.mockUserToken)) {
18480
+ const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o = `${t}:${n}`;
18481
+ if (s.host !== Xt && s.host !== o && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),
18482
+ e._setSettings(Object.assign(Object.assign({}, s), {
18483
+ host: o,
18484
+ ssl: !1
18485
+ })), r.mockUserToken) {
18488
18486
  let t, n;
18489
18487
  if ("string" == typeof r.mockUserToken) t = r.mockUserToken, n = User.MOCK_USER; else {
18490
18488
  // Let createMockUserToken validate first (catches common mistakes like
@@ -18721,13 +18719,13 @@ class __PRIVATE_AsyncQueueImpl {
18721
18719
  // Visibility handler that triggers an immediate retry of all retryable
18722
18720
  // operations. Meant to speed up recovery when we regain file system access
18723
18721
  // after page comes into foreground.
18724
- this.bu = () => {
18722
+ this.Su = () => {
18725
18723
  const e = getDocument();
18726
18724
  e && __PRIVATE_logDebug(tn, "Visibility state changed to " + e.visibilityState),
18727
18725
  this.a_.t_();
18728
- }, this.Su = e;
18726
+ }, this.bu = e;
18729
18727
  const t = getDocument();
18730
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.bu);
18728
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Su);
18731
18729
  }
18732
18730
  get isShuttingDown() {
18733
18731
  return this.mu;
@@ -18748,7 +18746,7 @@ class __PRIVATE_AsyncQueueImpl {
18748
18746
  if (!this.mu) {
18749
18747
  this.mu = !0, this.yu = e || !1;
18750
18748
  const t = getDocument();
18751
- t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.bu);
18749
+ t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.Su);
18752
18750
  }
18753
18751
  }
18754
18752
  enqueue(e) {
@@ -18792,7 +18790,7 @@ class __PRIVATE_AsyncQueueImpl {
18792
18790
  }
18793
18791
  }
18794
18792
  vu(e) {
18795
- const t = this.Su.then((() => (this.pu = !0, e().catch((e => {
18793
+ const t = this.bu.then((() => (this.pu = !0, e().catch((e => {
18796
18794
  this.gu = e, this.pu = !1;
18797
18795
  const t =
18798
18796
  /**
@@ -18826,7 +18824,7 @@ class __PRIVATE_AsyncQueueImpl {
18826
18824
  // and return the rejected Promise.
18827
18825
  throw __PRIVATE_logError("INTERNAL UNHANDLED ERROR: ", t), e;
18828
18826
  })).then((e => (this.pu = !1, e))))));
18829
- return this.Su = t, t;
18827
+ return this.bu = t, t;
18830
18828
  }
18831
18829
  enqueueAfterDelay(e, t, n) {
18832
18830
  this.Du(),
@@ -18849,8 +18847,8 @@ class __PRIVATE_AsyncQueueImpl {
18849
18847
  // operations were executed.
18850
18848
  let e;
18851
18849
  do {
18852
- e = this.Su, await e;
18853
- } while (e !== this.Su);
18850
+ e = this.bu, await e;
18851
+ } while (e !== this.bu);
18854
18852
  }
18855
18853
  /**
18856
18854
  * For Tests: Determine if a delayed operation with a particular TimerId
@@ -19753,7 +19751,7 @@ function __PRIVATE_isWrite(e) {
19753
19751
  });
19754
19752
  return r.$u(e), r;
19755
19753
  }
19756
- Ku(e) {
19754
+ Uu(e) {
19757
19755
  var t;
19758
19756
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19759
19757
  path: n,
@@ -19761,7 +19759,7 @@ function __PRIVATE_isWrite(e) {
19761
19759
  });
19762
19760
  return r.Bu(), r;
19763
19761
  }
19764
- Uu(e) {
19762
+ Ku(e) {
19765
19763
  // TODO(b/34871131): We don't support array paths right now; so make path
19766
19764
  // undefined.
19767
19765
  return this.ku({
@@ -19922,7 +19920,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19922
19920
  // For Compat types, we have to "extract" the underlying types before
19923
19921
  // performing validation.
19924
19922
  r = getModularInstance(r);
19925
- const a = i.Ku(_);
19923
+ const a = i.Uu(_);
19926
19924
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19927
19925
  // Add it to the field mask, but don't add anything to updateData.
19928
19926
  s.push(_); else {
@@ -19948,7 +19946,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19948
19946
  // For Compat types, we have to "extract" the underlying types before
19949
19947
  // performing validation.
19950
19948
  n = getModularInstance(n);
19951
- const r = o.Ku(t);
19949
+ const r = o.Uu(t);
19952
19950
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19953
19951
  // Add it to the field mask, but don't add anything to updateData.
19954
19952
  u.push(t); else {
@@ -20026,7 +20024,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20026
20024
  const n = [];
20027
20025
  let r = 0;
20028
20026
  for (const i of e) {
20029
- let e = __PRIVATE_parseData(i, t.Uu(r));
20027
+ let e = __PRIVATE_parseData(i, t.Ku(r));
20030
20028
  null == e && (
20031
20029
  // Just include nulls in the array for fields being replaced with a
20032
20030
  // sentinel.
@@ -22349,9 +22347,9 @@ let an = null;
22349
22347
  return r = Object.assign({
22350
22348
  useFetchStreams: t
22351
22349
  }, r), s._setSettings(r), s;
22352
- }), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, S, e),
22350
+ }), "PUBLIC").setMultipleInstances(!0)), registerVersion(S, b, e),
22353
22351
  // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
22354
- registerVersion(b, S, "esm2017");
22352
+ registerVersion(S, b, "esm2017");
22355
22353
  }();
22356
22354
 
22357
22355
  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 };