@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
package/dist/index.cjs.js CHANGED
@@ -9,7 +9,7 @@ var util = require('@firebase/util');
9
9
  var bloomBlob = require('@firebase/webchannel-wrapper/bloom-blob');
10
10
  var webchannelBlob = require('@firebase/webchannel-wrapper/webchannel-blob');
11
11
 
12
- const b = "@firebase/firestore", S = "4.7.7-canary.c8e5b3e77";
12
+ const S = "@firebase/firestore", b = "4.7.7-canary.deb917b5f";
13
13
 
14
14
  /**
15
15
  * @license
@@ -71,7 +71,7 @@ User.MOCK_USER = new User("mock-user");
71
71
  * See the License for the specific language governing permissions and
72
72
  * limitations under the License.
73
73
  */
74
- let D = "11.3.0-canary.c8e5b3e77";
74
+ let D = "11.3.0-canary.deb917b5f";
75
75
 
76
76
  /**
77
77
  * @license
@@ -688,6 +688,31 @@ function __PRIVATE_randomBytes(e) {
688
688
  return n;
689
689
  }
690
690
 
691
+ /**
692
+ * @license
693
+ * Copyright 2023 Google LLC
694
+ *
695
+ * Licensed under the Apache License, Version 2.0 (the "License");
696
+ * you may not use this file except in compliance with the License.
697
+ * You may obtain a copy of the License at
698
+ *
699
+ * http://www.apache.org/licenses/LICENSE-2.0
700
+ *
701
+ * Unless required by applicable law or agreed to in writing, software
702
+ * distributed under the License is distributed on an "AS IS" BASIS,
703
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704
+ * See the License for the specific language governing permissions and
705
+ * limitations under the License.
706
+ */
707
+ /**
708
+ * An instance of the Platform's 'TextEncoder' implementation.
709
+ */ function __PRIVATE_newTextEncoder() {
710
+ return new TextEncoder;
711
+ }
712
+
713
+ /**
714
+ * An instance of the Platform's 'TextDecoder' implementation.
715
+ */
691
716
  /**
692
717
  * @license
693
718
  * Copyright 2017 Google LLC
@@ -709,7 +734,8 @@ function __PRIVATE_randomBytes(e) {
709
734
  *
710
735
  * @internal
711
736
  * Exported internally for testing purposes.
712
- */ class __PRIVATE_AutoId {
737
+ */
738
+ class __PRIVATE_AutoId {
713
739
  static newId() {
714
740
  // Alphanumeric characters
715
741
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -730,6 +756,16 @@ function __PRIVATE_primitiveComparator(e, t) {
730
756
  return e < t ? -1 : e > t ? 1 : 0;
731
757
  }
732
758
 
759
+ /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
760
+ // Convert the string to UTF-8 encoded bytes
761
+ const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
762
+ for (let e = 0; e < Math.min(n.length, r.length); e++) {
763
+ const t = __PRIVATE_primitiveComparator(n[e], r[e]);
764
+ if (0 !== t) return t;
765
+ }
766
+ return __PRIVATE_primitiveComparator(n.length, r.length);
767
+ }
768
+
733
769
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
734
770
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
735
771
  }
@@ -1020,13 +1056,11 @@ class Timestamp {
1020
1056
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1021
1057
  if (0 !== n) return n;
1022
1058
  }
1023
- return Math.sign(e.length - t.length);
1059
+ return __PRIVATE_primitiveComparator(e.length, t.length);
1024
1060
  }
1025
1061
  static compareSegments(e, t) {
1026
1062
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1027
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1028
- // both non-numeric
1029
- e < t ? -1 : e > t ? 1 : 0;
1063
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1030
1064
  }
1031
1065
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1032
1066
  static isNumericId(e) {
@@ -1814,13 +1848,13 @@ class __PRIVATE_SimpleDbTransaction {
1814
1848
  * within the key range or index.
1815
1849
  */ class __PRIVATE_IterationController {
1816
1850
  constructor(e) {
1817
- this.q = e, this.$ = !1, this.K = null;
1851
+ this.q = e, this.$ = !1, this.U = null;
1818
1852
  }
1819
1853
  get isDone() {
1820
1854
  return this.$;
1821
1855
  }
1822
- get U() {
1823
- return this.K;
1856
+ get K() {
1857
+ return this.U;
1824
1858
  }
1825
1859
  set cursor(e) {
1826
1860
  this.q = e;
@@ -1834,7 +1868,7 @@ class __PRIVATE_SimpleDbTransaction {
1834
1868
  * This function can be called to skip to that next key, which could be
1835
1869
  * an index or a primary key.
1836
1870
  */ W(e) {
1837
- this.K = e;
1871
+ this.U = e;
1838
1872
  }
1839
1873
  /**
1840
1874
  * Delete the current cursor value from the object store.
@@ -1993,7 +2027,7 @@ class __PRIVATE_SimpleDbTransaction {
1993
2027
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
1994
2028
  n.push(e);
1995
2029
  }
1996
- s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2030
+ s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1997
2031
  };
1998
2032
  })).next((() => PersistencePromise.waitFor(n)));
1999
2033
  }
@@ -2314,7 +2348,7 @@ function __PRIVATE_encodeResourcePath(e) {
2314
2348
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2315
2349
  * See the License for the specific language governing permissions and
2316
2350
  * limitations under the License.
2317
- */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2351
+ */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2318
2352
 
2319
2353
  /**
2320
2354
  * @license
@@ -2359,7 +2393,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2359
2393
  * there is no useful information to store as the value. The raw (unencoded)
2360
2394
  * path cannot be stored because IndexedDb doesn't store prototype
2361
2395
  * information.
2362
- */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", 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 ];
2396
+ */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ue = "globals", Ke = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, U, ae, K, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, K, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ue ];
2363
2397
 
2364
2398
  /**
2365
2399
  * @license
@@ -3421,7 +3455,7 @@ function __PRIVATE_valueCompare(e, t) {
3421
3455
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3422
3456
 
3423
3457
  case 5 /* TypeOrder.StringValue */ :
3424
- return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3458
+ return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3425
3459
 
3426
3460
  case 6 /* TypeOrder.BlobValue */ :
3427
3461
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3469,7 +3503,7 @@ function __PRIVATE_valueCompare(e, t) {
3469
3503
  // canonical IDs are independent of insertion order.
3470
3504
  r.sort(), s.sort();
3471
3505
  for (let e = 0; e < r.length && e < s.length; ++e) {
3472
- const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3506
+ const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3473
3507
  if (0 !== t) return t;
3474
3508
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3475
3509
  if (0 !== o) return o;
@@ -5881,32 +5915,6 @@ let At = null;
5881
5915
  * Sets the value of the `testingHooksSpi` object.
5882
5916
  * @param instance the instance to set.
5883
5917
  */
5884
- /**
5885
- * @license
5886
- * Copyright 2023 Google LLC
5887
- *
5888
- * Licensed under the Apache License, Version 2.0 (the "License");
5889
- * you may not use this file except in compliance with the License.
5890
- * You may obtain a copy of the License at
5891
- *
5892
- * http://www.apache.org/licenses/LICENSE-2.0
5893
- *
5894
- * Unless required by applicable law or agreed to in writing, software
5895
- * distributed under the License is distributed on an "AS IS" BASIS,
5896
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5897
- * See the License for the specific language governing permissions and
5898
- * limitations under the License.
5899
- */
5900
- /**
5901
- * An instance of the Platform's 'TextEncoder' implementation.
5902
- */
5903
- function __PRIVATE_newTextEncoder() {
5904
- return new TextEncoder;
5905
- }
5906
-
5907
- /**
5908
- * An instance of the Platform's 'TextDecoder' implementation.
5909
- */
5910
5918
  /**
5911
5919
  * @license
5912
5920
  * Copyright 2022 Google LLC
@@ -6187,13 +6195,13 @@ class __PRIVATE_WatchTargetChange {
6187
6195
  */
6188
6196
  this.ye = __PRIVATE_snapshotChangesMap(),
6189
6197
  /** See public getters for explanations of these fields. */
6190
- this.we = ByteString.EMPTY_BYTE_STRING, this.be = !1,
6198
+ this.we = ByteString.EMPTY_BYTE_STRING, this.Se = !1,
6191
6199
  /**
6192
6200
  * Whether this target state should be included in the next snapshot. We
6193
6201
  * initialize to true so that newly-added targets are included in the next
6194
6202
  * RemoteEvent.
6195
6203
  */
6196
- this.Se = !0;
6204
+ this.be = !0;
6197
6205
  }
6198
6206
  /**
6199
6207
  * Whether this target has been marked 'current'.
@@ -6203,7 +6211,7 @@ class __PRIVATE_WatchTargetChange {
6203
6211
  * was added and that the target is consistent with the rest of the watch
6204
6212
  * stream.
6205
6213
  */ get current() {
6206
- return this.be;
6214
+ return this.Se;
6207
6215
  }
6208
6216
  /** The last resume token sent to us for this target. */ get resumeToken() {
6209
6217
  return this.we;
@@ -6212,13 +6220,13 @@ class __PRIVATE_WatchTargetChange {
6212
6220
  return 0 !== this.pe;
6213
6221
  }
6214
6222
  /** Whether we have modified any state that should trigger a snapshot. */ get ve() {
6215
- return this.Se;
6223
+ return this.be;
6216
6224
  }
6217
6225
  /**
6218
6226
  * Applies the resume token to the TargetChange, but only when it has a new
6219
6227
  * value. Empty resumeTokens are discarded.
6220
6228
  */ Ce(e) {
6221
- e.approximateByteSize() > 0 && (this.Se = !0, this.we = e);
6229
+ e.approximateByteSize() > 0 && (this.be = !0, this.we = e);
6222
6230
  }
6223
6231
  /**
6224
6232
  * Creates a target change from the current set of changes.
@@ -6244,18 +6252,18 @@ class __PRIVATE_WatchTargetChange {
6244
6252
  default:
6245
6253
  fail();
6246
6254
  }
6247
- })), new TargetChange(this.we, this.be, e, t, n);
6255
+ })), new TargetChange(this.we, this.Se, e, t, n);
6248
6256
  }
6249
6257
  /**
6250
6258
  * Resets the document changes and sets `hasPendingChanges` to false.
6251
6259
  */ Me() {
6252
- this.Se = !1, this.ye = __PRIVATE_snapshotChangesMap();
6260
+ this.be = !1, this.ye = __PRIVATE_snapshotChangesMap();
6253
6261
  }
6254
6262
  xe(e, t) {
6255
- this.Se = !0, this.ye = this.ye.insert(e, t);
6263
+ this.be = !0, this.ye = this.ye.insert(e, t);
6256
6264
  }
6257
6265
  Oe(e) {
6258
- this.Se = !0, this.ye = this.ye.remove(e);
6266
+ this.be = !0, this.ye = this.ye.remove(e);
6259
6267
  }
6260
6268
  Ne() {
6261
6269
  this.pe += 1;
@@ -6264,7 +6272,7 @@ class __PRIVATE_WatchTargetChange {
6264
6272
  this.pe -= 1, __PRIVATE_hardAssert(this.pe >= 0);
6265
6273
  }
6266
6274
  Le() {
6267
- this.Se = !0, this.be = !0;
6275
+ this.be = !0, this.Se = !0;
6268
6276
  }
6269
6277
  }
6270
6278
 
@@ -6279,13 +6287,13 @@ class __PRIVATE_WatchChangeAggregator {
6279
6287
  /** Keeps track of the documents to update since the last raised snapshot. */
6280
6288
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6281
6289
  /** A mapping of document keys to their set of target IDs. */
6282
- this.Ke = __PRIVATE_documentTargetMap(),
6290
+ this.Ue = __PRIVATE_documentTargetMap(),
6283
6291
  /**
6284
6292
  * A map of targets with existence filter mismatches. These targets are
6285
6293
  * known to be inconsistent and their listens needs to be re-established by
6286
6294
  * RemoteStore.
6287
6295
  */
6288
- this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6296
+ this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6289
6297
  }
6290
6298
  /**
6291
6299
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6374,7 +6382,7 @@ class __PRIVATE_WatchChangeAggregator {
6374
6382
  // trigger re-run of the query.
6375
6383
  this.Ye(t);
6376
6384
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6377
- this.Ue = this.Ue.insert(t, e);
6385
+ this.Ke = this.Ke.insert(t, e);
6378
6386
  }
6379
6387
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6380
6388
  var s, o, _, a, u, c;
@@ -6486,7 +6494,7 @@ class __PRIVATE_WatchChangeAggregator {
6486
6494
 
6487
6495
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6488
6496
  // client.
6489
- this.Ke.forEach(((e, t) => {
6497
+ this.Ue.forEach(((e, t) => {
6490
6498
  let r = !0;
6491
6499
  t.forEachWhile((e => {
6492
6500
  const t = this.Xe(e);
@@ -6494,9 +6502,9 @@ class __PRIVATE_WatchChangeAggregator {
6494
6502
  !1);
6495
6503
  })), r && (n = n.add(e));
6496
6504
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6497
- const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6505
+ const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6498
6506
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6499
- this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6507
+ this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6500
6508
  r;
6501
6509
  }
6502
6510
  /**
@@ -6508,7 +6516,7 @@ class __PRIVATE_WatchChangeAggregator {
6508
6516
  if (!this.Je(e)) return;
6509
6517
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6510
6518
  this.He(e).xe(t.key, n), this.Qe = this.Qe.insert(t.key, t), this.$e = this.$e.insert(t.key, this._t(t.key).add(e)),
6511
- this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6519
+ this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6512
6520
  }
6513
6521
  /**
6514
6522
  * Removes the provided document from the target mapping. If the
@@ -6524,7 +6532,7 @@ class __PRIVATE_WatchChangeAggregator {
6524
6532
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6525
6533
  // The document may have entered and left the target before we raised a
6526
6534
  // snapshot, so we can just ignore the change.
6527
- r.Oe(t), this.Ke = this.Ke.insert(t, this.ct(t).delete(e)), this.Ke = this.Ke.insert(t, this.ct(t).add(e)),
6535
+ r.Oe(t), this.Ue = this.Ue.insert(t, this.ct(t).delete(e)), this.Ue = this.Ue.insert(t, this.ct(t).add(e)),
6528
6536
  n && (this.Qe = this.Qe.insert(t, n));
6529
6537
  }
6530
6538
  removeTarget(e) {
@@ -6549,8 +6557,8 @@ class __PRIVATE_WatchChangeAggregator {
6549
6557
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6550
6558
  }
6551
6559
  ct(e) {
6552
- let t = this.Ke.get(e);
6553
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6560
+ let t = this.Ue.get(e);
6561
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6554
6562
  t;
6555
6563
  }
6556
6564
  _t(e) {
@@ -7733,7 +7741,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7733
7741
  * limitations under the License.
7734
7742
  */ class __PRIVATE_IndexedDbGlobalsCache {
7735
7743
  dt(e) {
7736
- return __PRIVATE_getStore(e, Ke);
7744
+ return __PRIVATE_getStore(e, Ue);
7737
7745
  }
7738
7746
  getSessionToken(e) {
7739
7747
  return this.dt(e).get("sessionToken").next((e => {
@@ -7794,12 +7802,12 @@ class __PRIVATE_FirestoreIndexValueWriter {
7794
7802
  let n = e.timestampValue;
7795
7803
  this.ft(t, 20), "string" == typeof n && (n = __PRIVATE_normalizeTimestamp(n)), t.yt(`${n.seconds || ""}`),
7796
7804
  t.gt(n.nanos || 0);
7797
- } else if ("stringValue" in e) this.wt(e.stringValue, t), this.bt(t); else if ("bytesValue" in e) this.ft(t, 30),
7798
- t.St(__PRIVATE_normalizeByteString(e.bytesValue)), this.bt(t); else if ("referenceValue" in e) this.Dt(e.referenceValue, t); else if ("geoPointValue" in e) {
7805
+ } else if ("stringValue" in e) this.wt(e.stringValue, t), this.St(t); else if ("bytesValue" in e) this.ft(t, 30),
7806
+ t.bt(__PRIVATE_normalizeByteString(e.bytesValue)), this.St(t); else if ("referenceValue" in e) this.Dt(e.referenceValue, t); else if ("geoPointValue" in e) {
7799
7807
  const n = e.geoPointValue;
7800
7808
  this.ft(t, 45), t.gt(n.latitude || 0), t.gt(n.longitude || 0);
7801
7809
  } 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),
7802
- this.bt(t)) : "arrayValue" in e ? (this.Ft(e.arrayValue, t), this.bt(t)) : fail();
7810
+ this.St(t)) : "arrayValue" in e ? (this.Ft(e.arrayValue, t), this.St(t)) : fail();
7803
7811
  }
7804
7812
  wt(e, t) {
7805
7813
  this.ft(t, 25), this.Mt(e, t);
@@ -7836,7 +7844,7 @@ class __PRIVATE_FirestoreIndexValueWriter {
7836
7844
  ft(e, t) {
7837
7845
  e.gt(t);
7838
7846
  }
7839
- bt(e) {
7847
+ St(e) {
7840
7848
  // While the SDK does not implement truncation, the truncation marker is
7841
7849
  // used to terminate all variable length values (which are strings, bytes,
7842
7850
  // references, arrays and maps).
@@ -7945,10 +7953,10 @@ function __PRIVATE_unsignedNumLength(e) {
7945
7953
  }
7946
7954
  this.qt();
7947
7955
  }
7948
- Kt(e) {
7956
+ Ut(e) {
7949
7957
  // Values are encoded with a single byte length prefix, followed by the
7950
7958
  // actual value in big-endian format with leading 0 bytes dropped.
7951
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7959
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7952
7960
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7953
7961
  // Write the length
7954
7962
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7956,7 +7964,7 @@ function __PRIVATE_unsignedNumLength(e) {
7956
7964
  Gt(e) {
7957
7965
  // Values are encoded with a single byte length prefix, followed by the
7958
7966
  // inverted value in big-endian format with leading 0 bytes dropped.
7959
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7967
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7960
7968
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7961
7969
  // Write the length
7962
7970
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7991,7 +7999,7 @@ function __PRIVATE_unsignedNumLength(e) {
7991
7999
  * -0.0 < 0.0
7992
8000
  * all non-NaN < NaN
7993
8001
  * NaN = NaN
7994
- */ Ut(e) {
8002
+ */ Kt(e) {
7995
8003
  const t =
7996
8004
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
7997
8005
  function __PRIVATE_doubleToLongBits(e) {
@@ -8043,14 +8051,14 @@ class __PRIVATE_AscendingIndexByteEncoder {
8043
8051
  constructor(e) {
8044
8052
  this.Zt = e;
8045
8053
  }
8046
- St(e) {
8054
+ bt(e) {
8047
8055
  this.Zt.Ot(e);
8048
8056
  }
8049
8057
  yt(e) {
8050
8058
  this.Zt.Qt(e);
8051
8059
  }
8052
8060
  gt(e) {
8053
- this.Zt.Kt(e);
8061
+ this.Zt.Ut(e);
8054
8062
  }
8055
8063
  Vt() {
8056
8064
  this.Zt.zt();
@@ -8061,7 +8069,7 @@ class __PRIVATE_DescendingIndexByteEncoder {
8061
8069
  constructor(e) {
8062
8070
  this.Zt = e;
8063
8071
  }
8064
- St(e) {
8072
+ bt(e) {
8065
8073
  this.Zt.Lt(e);
8066
8074
  }
8067
8075
  yt(e) {
@@ -8891,7 +8899,7 @@ class __PRIVATE_IndexedDbIndexManager {
8891
8899
  let i = 0;
8892
8900
  for (const s of __PRIVATE_fieldIndexGetDirectionalSegments(e)) {
8893
8901
  const e = n[i++];
8894
- for (const n of r) if (this.bn(t, s.fieldPath) && isArray(e)) r = this.Sn(r, s, e); else {
8902
+ for (const n of r) if (this.Sn(t, s.fieldPath) && isArray(e)) r = this.bn(r, s, e); else {
8895
8903
  const t = n.tn(s.kind);
8896
8904
  __PRIVATE_FirestoreIndexValueWriter.xt.At(e, t);
8897
8905
  }
@@ -8915,7 +8923,7 @@ class __PRIVATE_IndexedDbIndexManager {
8915
8923
  * The method appends each value to all existing encoders (e.g. filter("a",
8916
8924
  * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A
8917
8925
  * list of new encoders is returned.
8918
- */ Sn(e, t, n) {
8926
+ */ bn(e, t, n) {
8919
8927
  const r = [ ...e ], i = [];
8920
8928
  for (const e of n.arrayValue.values || []) for (const n of r) {
8921
8929
  const r = new __PRIVATE_IndexByteEncoder;
@@ -8923,12 +8931,12 @@ class __PRIVATE_IndexedDbIndexManager {
8923
8931
  }
8924
8932
  return i;
8925
8933
  }
8926
- bn(e, t) {
8934
+ Sn(e, t) {
8927
8935
  return !!e.filters.find((e => e instanceof FieldFilter && e.field.isEqual(t) && ("in" /* Operator.IN */ === e.op || "not-in" /* Operator.NOT_IN */ === e.op)));
8928
8936
  }
8929
8937
  getFieldIndexes(e, t) {
8930
8938
  const n = __PRIVATE_indexConfigurationStore(e), r = __PRIVATE_indexStateStore(e);
8931
- return (t ? n.G(be, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8939
+ return (t ? n.G(Se, IDBKeyRange.bound(t, t)) : n.G()).next((e => {
8932
8940
  const t = [];
8933
8941
  return PersistencePromise.forEach(e, (e => r.get([ e.indexId, this.uid ]).next((n => {
8934
8942
  t.push(function __PRIVATE_fromDbIndexConfiguration(e, t) {
@@ -8946,7 +8954,7 @@ class __PRIVATE_IndexedDbIndexManager {
8946
8954
  }
8947
8955
  updateCollectionGroup(e, t, n) {
8948
8956
  const r = __PRIVATE_indexConfigurationStore(e), i = __PRIVATE_indexStateStore(e);
8949
- 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))))))));
8957
+ 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))))))));
8950
8958
  }
8951
8959
  updateIndexEntries(e, t) {
8952
8960
  // Porting Note: `getFieldIndexes()` on Web does not cache index lookups as
@@ -9143,7 +9151,7 @@ function __PRIVATE_getMinOffsetFromFieldIndexes(e) {
9143
9151
  sequenceNumbersCollected: 0,
9144
9152
  targetsRemoved: 0,
9145
9153
  documentsRemoved: 0
9146
- }, bt = 41943040;
9154
+ }, St = 41943040;
9147
9155
 
9148
9156
  class LruParams {
9149
9157
  static withCacheSize(e) {
@@ -9228,7 +9236,7 @@ function removeMutationBatch(e, t, n) {
9228
9236
  * limitations under the License.
9229
9237
  */
9230
9238
  /** A mutation queue for a specific user, backed by IndexedDB. */ LruParams.DEFAULT_COLLECTION_PERCENTILE = 10,
9231
- LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, LruParams.DEFAULT = new LruParams(bt, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),
9239
+ LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, LruParams.DEFAULT = new LruParams(St, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),
9232
9240
  LruParams.DISABLED = new LruParams(-1, 0, 0);
9233
9241
 
9234
9242
  class __PRIVATE_IndexedDbMutationQueue {
@@ -9559,14 +9567,14 @@ class __PRIVATE_TargetIdGenerator {
9559
9567
  next() {
9560
9568
  return this.$n += 2, this.$n;
9561
9569
  }
9562
- static Kn() {
9570
+ static Un() {
9563
9571
  // The target cache generator must return '2' in its first call to `next()`
9564
9572
  // as there is no differentiation in the protocol layer between an unset
9565
9573
  // number and the number '0'. If we were to sent a target with target ID
9566
9574
  // '0', the backend would consider it unset and replace it with its own ID.
9567
9575
  return new __PRIVATE_TargetIdGenerator(0);
9568
9576
  }
9569
- static Un() {
9577
+ static Kn() {
9570
9578
  // Sync engine assigns target IDs for limbo document detection.
9571
9579
  return new __PRIVATE_TargetIdGenerator(-1);
9572
9580
  }
@@ -9785,7 +9793,7 @@ class __PRIVATE_TargetIdGenerator {
9785
9793
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9786
9794
  * See the License for the specific language governing permissions and
9787
9795
  * limitations under the License.
9788
- */ const St = "LruGarbageCollector", Dt = 1048576;
9796
+ */ const bt = "LruGarbageCollector", Dt = 1048576;
9789
9797
 
9790
9798
  function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9791
9799
  const i = __PRIVATE_primitiveComparator(e, n);
@@ -9838,12 +9846,12 @@ function __PRIVATE_bufferEntryComparator([e, t], [n, r]) {
9838
9846
  return null !== this.Xn;
9839
9847
  }
9840
9848
  er(e) {
9841
- __PRIVATE_logDebug(St, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9849
+ __PRIVATE_logDebug(bt, `Garbage collection scheduled in ${e}ms`), this.Xn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , e, (async () => {
9842
9850
  this.Xn = null;
9843
9851
  try {
9844
9852
  await this.localStore.collectGarbage(this.garbageCollector);
9845
9853
  } catch (e) {
9846
- __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(St, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9854
+ __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(bt, "Ignoring IndexedDB error during garbage collection: ", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);
9847
9855
  }
9848
9856
  await this.er(3e5);
9849
9857
  }));
@@ -10961,13 +10969,13 @@ class OverlayedDocument {
10961
10969
  */ removeReference(e, t) {
10962
10970
  this.wr(new __PRIVATE_DocReference(e, t));
10963
10971
  }
10964
- br(e, t) {
10972
+ Sr(e, t) {
10965
10973
  e.forEach((e => this.removeReference(e, t)));
10966
10974
  }
10967
10975
  /**
10968
10976
  * Clears all references with a given ID. Calls removeRef() for each key
10969
10977
  * removed.
10970
- */ Sr(e) {
10978
+ */ br(e) {
10971
10979
  const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1), i = [];
10972
10980
  return this.gr.forEachInRange([ n, r ], (e => {
10973
10981
  this.wr(e), i.push(e.key);
@@ -11334,7 +11342,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11334
11342
  * A ordered bidirectional mapping between documents and the remote target
11335
11343
  * IDs.
11336
11344
  */
11337
- this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11345
+ this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11338
11346
  }
11339
11347
  forEachTarget(e, t) {
11340
11348
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11346,7 +11354,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11346
11354
  return PersistencePromise.resolve(this.$r);
11347
11355
  }
11348
11356
  allocateTargetId(e) {
11349
- return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11357
+ return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11350
11358
  }
11351
11359
  setTargetsMetadata(e, t, n) {
11352
11360
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11355,7 +11363,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11355
11363
  zn(e) {
11356
11364
  this.Qr.set(e.target, e);
11357
11365
  const t = e.targetId;
11358
- t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11366
+ t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11359
11367
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11360
11368
  }
11361
11369
  addTargetData(e, t) {
@@ -11365,7 +11373,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11365
11373
  return this.zn(t), PersistencePromise.resolve();
11366
11374
  }
11367
11375
  removeTargetData(e, t) {
11368
- return this.Qr.delete(t.target), this.Kr.Sr(t.targetId), this.targetCount -= 1,
11376
+ return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11369
11377
  PersistencePromise.resolve();
11370
11378
  }
11371
11379
  removeTargets(e, t, n) {
@@ -11384,24 +11392,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11384
11392
  return PersistencePromise.resolve(n);
11385
11393
  }
11386
11394
  addMatchingKeys(e, t, n) {
11387
- return this.Kr.yr(t, n), PersistencePromise.resolve();
11395
+ return this.Ur.yr(t, n), PersistencePromise.resolve();
11388
11396
  }
11389
11397
  removeMatchingKeys(e, t, n) {
11390
- this.Kr.br(t, n);
11398
+ this.Ur.Sr(t, n);
11391
11399
  const r = this.persistence.referenceDelegate, i = [];
11392
11400
  return r && t.forEach((t => {
11393
11401
  i.push(r.markPotentiallyOrphaned(e, t));
11394
11402
  })), PersistencePromise.waitFor(i);
11395
11403
  }
11396
11404
  removeMatchingKeysForTargetId(e, t) {
11397
- return this.Kr.Sr(t), PersistencePromise.resolve();
11405
+ return this.Ur.br(t), PersistencePromise.resolve();
11398
11406
  }
11399
11407
  getMatchingKeysForTargetId(e, t) {
11400
- const n = this.Kr.vr(t);
11408
+ const n = this.Ur.vr(t);
11401
11409
  return PersistencePromise.resolve(n);
11402
11410
  }
11403
11411
  containsKey(e, t) {
11404
- return PersistencePromise.resolve(this.Kr.containsKey(t));
11412
+ return PersistencePromise.resolve(this.Ur.containsKey(t));
11405
11413
  }
11406
11414
  }
11407
11415
 
@@ -11529,7 +11537,7 @@ class __PRIVATE_MemoryEagerDelegate {
11529
11537
  return this.ii.add(t.toString()), PersistencePromise.resolve();
11530
11538
  }
11531
11539
  removeTarget(e, t) {
11532
- this.ti.Sr(t.targetId).forEach((e => this.ii.add(e.toString())));
11540
+ this.ti.br(t.targetId).forEach((e => this.ii.add(e.toString())));
11533
11541
  const n = this.persistence.getTargetCache();
11534
11542
  return n.getMatchingKeysForTargetId(e, t.targetId).next((e => {
11535
11543
  e.forEach((e => this.ii.add(e.toString())));
@@ -11662,7 +11670,7 @@ class __PRIVATE_MemoryLruDelegate {
11662
11670
  */ B(e, t, n, r) {
11663
11671
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11664
11672
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11665
- e.createObjectStore(U);
11673
+ e.createObjectStore(K);
11666
11674
  }(e), function __PRIVATE_createMutationQueue(e) {
11667
11675
  e.createObjectStore(G, {
11668
11676
  keyPath: z
@@ -11679,7 +11687,7 @@ class __PRIVATE_MemoryLruDelegate {
11679
11687
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11680
11688
  * and rewrites all data.
11681
11689
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11682
- e.createObjectStore(K);
11690
+ e.createObjectStore(U);
11683
11691
  }(e));
11684
11692
  // Migration 2 to populate the targetGlobal object no longer needed since
11685
11693
  // migration 3 unconditionally clears it.
@@ -11767,13 +11775,13 @@ class __PRIVATE_MemoryLruDelegate {
11767
11775
  keyPath: te
11768
11776
  });
11769
11777
  t.createIndex(ne, re), t.createIndex(ie, se);
11770
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11778
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11771
11779
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11772
11780
  const t = e.createObjectStore(ye, {
11773
11781
  keyPath: we,
11774
11782
  autoIncrement: !0
11775
11783
  });
11776
- t.createIndex(be, Se, {
11784
+ t.createIndex(Se, be, {
11777
11785
  unique: !1
11778
11786
  });
11779
11787
  const n = e.createObjectStore(De, {
@@ -11796,15 +11804,15 @@ class __PRIVATE_MemoryLruDelegate {
11796
11804
  t.objectStore(Me).clear();
11797
11805
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11798
11806
  !function __PRIVATE_createGlobalsStore(e) {
11799
- e.createObjectStore(Ke, {
11800
- keyPath: Ue
11807
+ e.createObjectStore(Ue, {
11808
+ keyPath: Ke
11801
11809
  });
11802
11810
  }(e);
11803
11811
  }))), s;
11804
11812
  }
11805
11813
  ai(e) {
11806
11814
  let t = 0;
11807
- return e.store(K).Z(((e, n) => {
11815
+ return e.store(U).Z(((e, n) => {
11808
11816
  t += __PRIVATE_dbDocumentSize(n);
11809
11817
  })).next((() => {
11810
11818
  const n = {
@@ -11828,7 +11836,7 @@ class __PRIVATE_MemoryLruDelegate {
11828
11836
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11829
11837
  * with a sequence number. Missing rows are given the most recently used sequence number.
11830
11838
  */ ui(e) {
11831
- const t = e.store(le), n = e.store(K);
11839
+ const t = e.store(le), n = e.store(U);
11832
11840
  return e.store(Ee).get(Ie).next((e => {
11833
11841
  const r = [];
11834
11842
  return n.Z(((n, i) => {
@@ -11859,7 +11867,7 @@ class __PRIVATE_MemoryLruDelegate {
11859
11867
  };
11860
11868
  // Helper to add an index entry iff we haven't already written it.
11861
11869
  // Index existing remote documents.
11862
- return t.store(K).Z({
11870
+ return t.store(U).Z({
11863
11871
  Y: !0
11864
11872
  }, ((e, t) => {
11865
11873
  const n = new ResourcePath(e);
@@ -11879,7 +11887,7 @@ class __PRIVATE_MemoryLruDelegate {
11879
11887
  }));
11880
11888
  }
11881
11889
  hi(e, t) {
11882
- const n = t.store(K), r = [];
11890
+ const n = t.store(U), r = [];
11883
11891
  return n.Z(((e, n) => {
11884
11892
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11885
11893
  return e.document ? new DocumentKey(ResourcePath.fromString(e.document.name).popFirst(5)) : e.noDocument ? DocumentKey.fromSegments(e.noDocument.path) : e.unknownDocument ? DocumentKey.fromSegments(e.unknownDocument.path) : fail();
@@ -12040,7 +12048,7 @@ class __PRIVATE_IndexedDbPersistence {
12040
12048
  // Fail `start()` if `synchronizeTabs` is disabled and we cannot
12041
12049
  // obtain the primary lease.
12042
12050
  throw new FirestoreError(C.FAILED_PRECONDITION, Mt);
12043
- return this.bi(), this.Si(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12051
+ return this.Si(), this.bi(), this.Di(), this.runTransaction("getHighestListenSequenceNumber", "readonly", (e => this.Hr.getHighestSequenceNumber(e)));
12044
12052
  })).then((e => {
12045
12053
  this.Gr = new __PRIVATE_ListenSequence(e, this.Ii);
12046
12054
  })).then((() => {
@@ -12197,11 +12205,11 @@ class __PRIVATE_IndexedDbPersistence {
12197
12205
  async shutdown() {
12198
12206
  // The shutdown() operations are idempotent and can be called even when
12199
12207
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12200
- this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12208
+ this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12201
12209
  this.Wi(),
12202
12210
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12203
12211
  // has obtained the primary lease.
12204
- await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12212
+ await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12205
12213
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12206
12214
  return this.xi(t).next((() => this.Bi(t)));
12207
12215
  })), this.pi.close(),
@@ -12301,13 +12309,13 @@ class __PRIVATE_IndexedDbPersistence {
12301
12309
  return !(e < n - t) && (!(e > n) || (__PRIVATE_logError(`Detected an update time that is in the future: ${e} > ${n}`),
12302
12310
  !1));
12303
12311
  }
12304
- bi() {
12312
+ Si() {
12305
12313
  null !== this.document && "function" == typeof this.document.addEventListener && (this.Ri = () => {
12306
12314
  this.Ti.enqueueAndForget((() => (this.inForeground = "visible" === this.document.visibilityState,
12307
12315
  this.wi())));
12308
12316
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12309
12317
  }
12310
- Ui() {
12318
+ Ki() {
12311
12319
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12312
12320
  }
12313
12321
  /**
@@ -12319,13 +12327,13 @@ class __PRIVATE_IndexedDbPersistence {
12319
12327
  * primary lease). LocalStorage is used for this rather than IndexedDb because
12320
12328
  * it is a synchronous API and so can be used reliably from an unload
12321
12329
  * handler.
12322
- */ Si() {
12330
+ */ bi() {
12323
12331
  var e;
12324
12332
  "function" == typeof (null === (e = this.window) || void 0 === e ? void 0 : e.addEventListener) && (this.Ai = () => {
12325
12333
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12326
12334
  // accesses internal state. We execute this code directly during shutdown
12327
12335
  // to make sure it gets a chance to run.
12328
- this.Ki();
12336
+ this.Ui();
12329
12337
  const e = /(?:Version|Mobile)\/1[456]/;
12330
12338
  util.isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12331
12339
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12356,7 +12364,7 @@ class __PRIVATE_IndexedDbPersistence {
12356
12364
  /**
12357
12365
  * Record client as zombied (a client that had its tab closed). Zombied
12358
12366
  * clients are ignored during primary tab selection.
12359
- */ Ki() {
12367
+ */ Ui() {
12360
12368
  if (this.yi) try {
12361
12369
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12362
12370
  } catch (e) {
@@ -12379,7 +12387,7 @@ class __PRIVATE_IndexedDbPersistence {
12379
12387
  /**
12380
12388
  * Helper to get a typed SimpleDbStore for the primary client object store.
12381
12389
  */ function __PRIVATE_primaryClientStore(e) {
12382
- return __PRIVATE_getStore(e, U);
12390
+ return __PRIVATE_getStore(e, K);
12383
12391
  }
12384
12392
 
12385
12393
  /**
@@ -13234,14 +13242,14 @@ class __PRIVATE_MutationMetadata {
13234
13242
  /**
13235
13243
  * Parses a MutationMetadata from its JSON representation in WebStorage.
13236
13244
  * Logs a warning and returns null if the format of the data is not valid.
13237
- */ static bs(e, t, n) {
13245
+ */ static Ss(e, t, n) {
13238
13246
  const r = JSON.parse(n);
13239
13247
  let i, s = "object" == typeof r && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(r.state) && (void 0 === r.error || "object" == typeof r.error);
13240
13248
  return s && r.error && (s = "string" == typeof r.error.message && "string" == typeof r.error.code,
13241
13249
  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}`),
13242
13250
  null);
13243
13251
  }
13244
- Ss() {
13252
+ bs() {
13245
13253
  const e = {
13246
13254
  state: this.state,
13247
13255
  updateTimeMs: Date.now()
@@ -13265,14 +13273,14 @@ class __PRIVATE_QueryTargetMetadata {
13265
13273
  /**
13266
13274
  * Parses a QueryTargetMetadata from its JSON representation in WebStorage.
13267
13275
  * Logs a warning and returns null if the format of the data is not valid.
13268
- */ static bs(e, t) {
13276
+ */ static Ss(e, t) {
13269
13277
  const n = JSON.parse(t);
13270
13278
  let r, i = "object" == typeof n && -1 !== [ "not-current", "current", "rejected" ].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error);
13271
13279
  return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code,
13272
13280
  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}`),
13273
13281
  null);
13274
13282
  }
13275
- Ss() {
13283
+ bs() {
13276
13284
  const e = {
13277
13285
  state: this.state,
13278
13286
  updateTimeMs: Date.now()
@@ -13294,7 +13302,7 @@ class __PRIVATE_QueryTargetMetadata {
13294
13302
  /**
13295
13303
  * Parses a RemoteClientState from the JSON representation in WebStorage.
13296
13304
  * Logs a warning and returns null if the format of the data is not valid.
13297
- */ static bs(e, t) {
13305
+ */ static Ss(e, t) {
13298
13306
  const n = JSON.parse(t);
13299
13307
  let r = "object" == typeof n && n.activeTargetIds instanceof Array, i = __PRIVATE_targetIdSet();
13300
13308
  for (let e = 0; r && e < n.activeTargetIds.length; ++e) r = isSafeInteger(n.activeTargetIds[e]),
@@ -13315,7 +13323,7 @@ class __PRIVATE_QueryTargetMetadata {
13315
13323
  /**
13316
13324
  * Parses a SharedOnlineState from its JSON representation in WebStorage.
13317
13325
  * Logs a warning and returns null if the format of the data is not valid.
13318
- */ static bs(e) {
13326
+ */ static Ss(e) {
13319
13327
  const t = JSON.parse(e);
13320
13328
  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}`),
13321
13329
  null);
@@ -13346,7 +13354,7 @@ class __PRIVATE_LocalClientState {
13346
13354
  /**
13347
13355
  * Converts this entry into a JSON-encoded format we can use for WebStorage.
13348
13356
  * Does not encode `clientId` as it is part of the key in WebStorage.
13349
- */ Ss() {
13357
+ */ bs() {
13350
13358
  const e = {
13351
13359
  activeTargetIds: this.activeTargetIds.toArray(),
13352
13360
  updateTimeMs: Date.now()
@@ -13414,16 +13422,16 @@ class __PRIVATE_LocalClientState {
13414
13422
  if (t === this.Cs) continue;
13415
13423
  const e = this.getItem(createWebStorageClientStateKey(this.persistenceKey, t));
13416
13424
  if (e) {
13417
- const n = __PRIVATE_RemoteClientState.bs(t, e);
13425
+ const n = __PRIVATE_RemoteClientState.Ss(t, e);
13418
13426
  n && (this.xs = this.xs.insert(n.clientId, n));
13419
13427
  }
13420
13428
  }
13421
- this.Ks();
13429
+ this.Us();
13422
13430
  // Check if there is an existing online state and call the callback handler
13423
13431
  // if applicable.
13424
13432
  const t = this.storage.getItem(this.Qs);
13425
13433
  if (t) {
13426
- const e = this.Us(t);
13434
+ const e = this.Ks(t);
13427
13435
  e && this.Ws(e);
13428
13436
  }
13429
13437
  for (const e of this.Os) this.Ms(e);
@@ -13461,16 +13469,16 @@ class __PRIVATE_LocalClientState {
13461
13469
  if (this.isActiveQueryTarget(e)) {
13462
13470
  const t = this.storage.getItem(createWebStorageQueryTargetMetadataKey(this.persistenceKey, e));
13463
13471
  if (t) {
13464
- const r = __PRIVATE_QueryTargetMetadata.bs(e, t);
13472
+ const r = __PRIVATE_QueryTargetMetadata.Ss(e, t);
13465
13473
  r && (n = r.state);
13466
13474
  }
13467
13475
  }
13468
13476
  // If the query is listening to cache only, the target ID should not be registered with the
13469
13477
  // local Firestore client as an active watch target.
13470
- return t && this.Hs.Ds(e), this.Ks(), n;
13478
+ return t && this.Hs.Ds(e), this.Us(), n;
13471
13479
  }
13472
13480
  removeLocalQueryTarget(e) {
13473
- this.Hs.vs(e), this.Ks();
13481
+ this.Hs.vs(e), this.Us();
13474
13482
  }
13475
13483
  isLocalQueryTarget(e) {
13476
13484
  return this.Hs.activeTargetIds.has(e);
@@ -13537,7 +13545,7 @@ class __PRIVATE_LocalClientState {
13537
13545
  }
13538
13546
  } else if (t.key === this.Qs) {
13539
13547
  if (null !== t.newValue) {
13540
- const e = this.Us(t.newValue);
13548
+ const e = this.Ks(t.newValue);
13541
13549
  if (e) return this.Ws(e);
13542
13550
  }
13543
13551
  } else if (t.key === this.Bs) {
@@ -13568,12 +13576,12 @@ class __PRIVATE_LocalClientState {
13568
13576
  get Hs() {
13569
13577
  return this.xs.get(this.Cs);
13570
13578
  }
13571
- Ks() {
13572
- this.setItem(this.Ns, this.Hs.Ss());
13579
+ Us() {
13580
+ this.setItem(this.Ns, this.Hs.bs());
13573
13581
  }
13574
13582
  zs(e, t, n) {
13575
13583
  const r = new __PRIVATE_MutationMetadata(this.currentUser, e, t, n), i = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
13576
- this.setItem(i, r.Ss());
13584
+ this.setItem(i, r.bs());
13577
13585
  }
13578
13586
  js(e) {
13579
13587
  const t = createWebStorageMutationBatchKey(this.persistenceKey, this.currentUser, e);
@@ -13588,7 +13596,7 @@ class __PRIVATE_LocalClientState {
13588
13596
  }
13589
13597
  Js(e, t, n) {
13590
13598
  const r = createWebStorageQueryTargetMetadataKey(this.persistenceKey, e), i = new __PRIVATE_QueryTargetMetadata(e, t, n);
13591
- this.setItem(r, i.Ss());
13599
+ this.setItem(r, i.bs());
13592
13600
  }
13593
13601
  Zs(e) {
13594
13602
  const t = JSON.stringify(Array.from(e));
@@ -13606,27 +13614,27 @@ class __PRIVATE_LocalClientState {
13606
13614
  * be parsed.
13607
13615
  */ no(e, t) {
13608
13616
  const n = this.Xs(e);
13609
- return __PRIVATE_RemoteClientState.bs(n, t);
13617
+ return __PRIVATE_RemoteClientState.Ss(n, t);
13610
13618
  }
13611
13619
  /**
13612
13620
  * Parses a mutation batch state in WebStorage. Returns 'null' if the value
13613
13621
  * could not be parsed.
13614
13622
  */ ro(e, t) {
13615
13623
  const n = this.ks.exec(e), r = Number(n[1]), i = void 0 !== n[2] ? n[2] : null;
13616
- return __PRIVATE_MutationMetadata.bs(new User(i), r, t);
13624
+ return __PRIVATE_MutationMetadata.Ss(new User(i), r, t);
13617
13625
  }
13618
13626
  /**
13619
13627
  * Parses a query target state from WebStorage. Returns 'null' if the value
13620
13628
  * could not be parsed.
13621
13629
  */ so(e, t) {
13622
13630
  const n = this.qs.exec(e), r = Number(n[1]);
13623
- return __PRIVATE_QueryTargetMetadata.bs(r, t);
13631
+ return __PRIVATE_QueryTargetMetadata.Ss(r, t);
13624
13632
  }
13625
13633
  /**
13626
13634
  * Parses an online state from WebStorage. Returns 'null' if the value
13627
13635
  * could not be parsed.
13628
- */ Us(e) {
13629
- return __PRIVATE_SharedOnlineState.bs(e);
13636
+ */ Ks(e) {
13637
+ return __PRIVATE_SharedOnlineState.Ss(e);
13630
13638
  }
13631
13639
  _o(e) {
13632
13640
  return JSON.parse(e);
@@ -13850,7 +13858,7 @@ function __PRIVATE_generateUniqueDebugId() {
13850
13858
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13851
13859
  * See the License for the specific language governing permissions and
13852
13860
  * limitations under the License.
13853
- */ const Kt = "RestConnection", Ut = {
13861
+ */ const Ut = "RestConnection", Kt = {
13854
13862
  BatchGetDocuments: "batchGet",
13855
13863
  Commit: "commit",
13856
13864
  RunQuery: "runQuery",
@@ -13877,23 +13885,23 @@ class __PRIVATE_RestConnection {
13877
13885
  const t = e.ssl ? "https" : "http", n = encodeURIComponent(this.databaseId.projectId), r = encodeURIComponent(this.databaseId.database);
13878
13886
  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}`;
13879
13887
  }
13880
- bo(e, t, n, r, i) {
13881
- const s = __PRIVATE_generateUniqueDebugId(), o = this.So(e, t.toUriEncodedString());
13882
- __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13888
+ So(e, t, n, r, i) {
13889
+ const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13890
+ __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13883
13891
  const _ = {
13884
13892
  "google-cloud-resource-prefix": this.yo,
13885
13893
  "x-goog-request-params": this.wo
13886
13894
  };
13887
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13895
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13888
13896
  t)), (t => {
13889
- throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13897
+ throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13890
13898
  t;
13891
13899
  }));
13892
13900
  }
13893
13901
  Co(e, t, n, r, i, s) {
13894
13902
  // The REST API automatically aggregates all of the streamed results, so we
13895
13903
  // can just use the normal invoke() method.
13896
- return this.bo(e, t, n, r, i);
13904
+ return this.So(e, t, n, r, i);
13897
13905
  }
13898
13906
  /**
13899
13907
  * Modifies the headers for a request, adding any authorization token if
@@ -13912,8 +13920,8 @@ class __PRIVATE_RestConnection {
13912
13920
  e["Content-Type"] = "text/plain", this.databaseInfo.appId && (e["X-Firebase-GMPID"] = this.databaseInfo.appId),
13913
13921
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13914
13922
  }
13915
- So(e, t) {
13916
- const n = Ut[e];
13923
+ bo(e, t) {
13924
+ const n = Kt[e];
13917
13925
  return `${this.po}/v1/${t}:${n}`;
13918
13926
  }
13919
13927
  /**
@@ -13973,10 +13981,10 @@ class __PRIVATE_RestConnection {
13973
13981
  $o() {
13974
13982
  this.Bo();
13975
13983
  }
13976
- Ko(e) {
13984
+ Uo(e) {
13977
13985
  this.ko(e);
13978
13986
  }
13979
- Uo(e) {
13987
+ Ko(e) {
13980
13988
  this.qo(e);
13981
13989
  }
13982
13990
  }
@@ -14128,10 +14136,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14128
14136
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14129
14137
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.CLOSE, (() => {
14130
14138
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14131
- P.Ko());
14139
+ P.Uo());
14132
14140
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.ERROR, (t => {
14133
14141
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14134
- P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14142
+ P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14135
14143
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.MESSAGE, (t => {
14136
14144
  var n;
14137
14145
  if (!h) {
@@ -14162,8 +14170,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14162
14170
  }(t), i = o.message;
14163
14171
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14164
14172
  // Mark closed so no further events are propagated
14165
- h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14166
- } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14173
+ h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14174
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14167
14175
  }
14168
14176
  })), __PRIVATE_unguardedEventListen(o, webchannelBlob.Event.STAT_EVENT, (t => {
14169
14177
  t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelBlob.Stat.NOPROXY && __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14674,7 +14682,7 @@ class __PRIVATE_PersistentStream {
14674
14682
  /**
14675
14683
  * Tracks whether or not a handshake has been successfully exchanged and
14676
14684
  * the stream is ready to accept mutations.
14677
- */ get b_() {
14685
+ */ get S_() {
14678
14686
  return this.__ > 0;
14679
14687
  }
14680
14688
  // Override of PersistentStream.start
@@ -14682,7 +14690,7 @@ class __PRIVATE_PersistentStream {
14682
14690
  this.lastStreamToken = void 0, super.start();
14683
14691
  }
14684
14692
  A_() {
14685
- this.b_ && this.S_([]);
14693
+ this.S_ && this.b_([]);
14686
14694
  }
14687
14695
  f_(e, t) {
14688
14696
  return this.connection.Wo("Write", e, t);
@@ -14713,7 +14721,7 @@ class __PRIVATE_PersistentStream {
14713
14721
  const e = {};
14714
14722
  e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.I_(e);
14715
14723
  }
14716
- /** Sends a group of mutations to the Firestore backend to apply. */ S_(e) {
14724
+ /** Sends a group of mutations to the Firestore backend to apply. */ b_(e) {
14717
14725
  const t = {
14718
14726
  streamToken: this.lastStreamToken,
14719
14727
  writes: e.map((e => toMutation(this.serializer, e)))
@@ -14755,8 +14763,8 @@ class __PRIVATE_PersistentStream {
14755
14763
  M_() {
14756
14764
  if (this.F_) throw new FirestoreError(C.FAILED_PRECONDITION, "The client has already been terminated.");
14757
14765
  }
14758
- /** Invokes the provided RPC with auth and AppCheck tokens. */ bo(e, t, n, r) {
14759
- 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 => {
14766
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ So(e, t, n, r) {
14767
+ 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 => {
14760
14768
  throw "FirebaseError" === e.name ? (e.code === C.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
14761
14769
  this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(C.UNKNOWN, e.toString());
14762
14770
  }));
@@ -14898,7 +14906,7 @@ class __PRIVATE_RemoteStoreImpl {
14898
14906
  * purely based on order, and so we can just shift() writes from the front of
14899
14907
  * the writePipeline as we receive responses.
14900
14908
  */
14901
- this.K_ = [],
14909
+ this.U_ = [],
14902
14910
  /**
14903
14911
  * A mapping of watched targets that the client cares about tracking and the
14904
14912
  * user has explicitly called a 'listen' for this target.
@@ -14908,7 +14916,7 @@ class __PRIVATE_RemoteStoreImpl {
14908
14916
  * to the server. The targets removed with unlistens are removed eagerly
14909
14917
  * without waiting for confirmation from the listen stream.
14910
14918
  */
14911
- this.U_ = new Map,
14919
+ this.K_ = new Map,
14912
14920
  /**
14913
14921
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14914
14922
  * RemoteStore may start its network connections.
@@ -14955,9 +14963,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14955
14963
  */
14956
14964
  function __PRIVATE_remoteStoreListen(e, t) {
14957
14965
  const n = __PRIVATE_debugCast(e);
14958
- n.U_.has(t.targetId) || (
14966
+ n.K_.has(t.targetId) || (
14959
14967
  // Mark this as something the client is currently listening for.
14960
- n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14968
+ n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14961
14969
  // The listen will be sent in onWatchStreamOpen
14962
14970
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14963
14971
  }
@@ -14967,7 +14975,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14967
14975
  * not being listened to.
14968
14976
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14969
14977
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14970
- n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14978
+ n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14971
14979
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14972
14980
  // have no listeners, since without any listens to send we cannot
14973
14981
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14996,7 +15004,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14996
15004
  function __PRIVATE_startWatchStream(e) {
14997
15005
  e.H_ = new __PRIVATE_WatchChangeAggregator({
14998
15006
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14999
- lt: t => e.U_.get(t) || null,
15007
+ lt: t => e.K_.get(t) || null,
15000
15008
  it: () => e.datastore.serializer.databaseId
15001
15009
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
15002
15010
  }
@@ -15005,7 +15013,7 @@ function __PRIVATE_startWatchStream(e) {
15005
15013
  * Returns whether the watch stream should be started because it's necessary
15006
15014
  * and has not yet been started.
15007
15015
  */ function __PRIVATE_shouldStartWatchStream(e) {
15008
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15016
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15009
15017
  }
15010
15018
 
15011
15019
  function __PRIVATE_canUseNetwork(e) {
@@ -15022,7 +15030,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15022
15030
  }
15023
15031
 
15024
15032
  async function __PRIVATE_onWatchStreamOpen(e) {
15025
- e.U_.forEach(((t, n) => {
15033
+ e.K_.forEach(((t, n) => {
15026
15034
  __PRIVATE_sendWatchRequest(e, t);
15027
15035
  }));
15028
15036
  }
@@ -15049,7 +15057,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15049
15057
  const n = t.cause;
15050
15058
  for (const r of t.targetIds)
15051
15059
  // A watched target might have been removed already.
15052
- e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15060
+ e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15053
15061
  }
15054
15062
  /**
15055
15063
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15079,21 +15087,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15079
15087
  // persistent view of these when applying the completed RemoteEvent.
15080
15088
  return n.targetChanges.forEach(((n, r) => {
15081
15089
  if (n.resumeToken.approximateByteSize() > 0) {
15082
- const i = e.U_.get(r);
15090
+ const i = e.K_.get(r);
15083
15091
  // A watched target might have been removed already.
15084
- i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15092
+ i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15085
15093
  }
15086
15094
  })),
15087
15095
  // Re-establish listens for the targets that have been invalidated by
15088
15096
  // existence filter mismatches.
15089
15097
  n.targetMismatches.forEach(((t, n) => {
15090
- const r = e.U_.get(t);
15098
+ const r = e.K_.get(t);
15091
15099
  if (!r)
15092
15100
  // A watched target might have been removed already.
15093
15101
  return;
15094
15102
  // Clear the resume token for the target, since we're in a known mismatch
15095
15103
  // state.
15096
- e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15104
+ e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15097
15105
  // Cause a hard reset by unwatching and rewatching immediately, but
15098
15106
  // deliberately don't send a resume token so that we get a full update.
15099
15107
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15144,11 +15152,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15144
15152
 
15145
15153
  async function __PRIVATE_fillWritePipeline(e) {
15146
15154
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15147
- let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15155
+ let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15148
15156
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15149
15157
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15150
15158
  if (null === e) {
15151
- 0 === t.K_.length && n.P_();
15159
+ 0 === t.U_.length && n.P_();
15152
15160
  break;
15153
15161
  }
15154
15162
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15162,20 +15170,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15162
15170
  * Returns true if we can add to the write pipeline (i.e. the network is
15163
15171
  * enabled and the write pipeline is not full).
15164
15172
  */ function __PRIVATE_canAddToWritePipeline(e) {
15165
- return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15173
+ return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15166
15174
  }
15167
15175
 
15168
15176
  /**
15169
15177
  * Queues additional writes to be sent to the write stream, sending them
15170
15178
  * immediately if the write stream is established.
15171
15179
  */ function __PRIVATE_addToWritePipeline(e, t) {
15172
- e.K_.push(t);
15180
+ e.U_.push(t);
15173
15181
  const n = __PRIVATE_ensureWriteStream(e);
15174
- n.c_() && n.b_ && n.S_(t.mutations);
15182
+ n.c_() && n.S_ && n.b_(t.mutations);
15175
15183
  }
15176
15184
 
15177
15185
  function __PRIVATE_shouldStartWriteStream(e) {
15178
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15186
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15179
15187
  }
15180
15188
 
15181
15189
  function __PRIVATE_startWriteStream(e) {
@@ -15189,11 +15197,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15189
15197
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15190
15198
  const t = __PRIVATE_ensureWriteStream(e);
15191
15199
  // Send the write pipeline now that the stream is established.
15192
- for (const n of e.K_) t.S_(n.mutations);
15200
+ for (const n of e.U_) t.b_(n.mutations);
15193
15201
  }
15194
15202
 
15195
15203
  async function __PRIVATE_onMutationResult(e, t, n) {
15196
- const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15204
+ const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15197
15205
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15198
15206
  // It's possible that with the completion of this mutation another
15199
15207
  // slot has freed up.
@@ -15203,7 +15211,7 @@ async function __PRIVATE_onMutationResult(e, t, n) {
15203
15211
  async function __PRIVATE_onWriteStreamClose(e, t) {
15204
15212
  // If the write stream closed after the write handshake completes, a write
15205
15213
  // operation failed and we fail the pending operation.
15206
- t && __PRIVATE_ensureWriteStream(e).b_ &&
15214
+ t && __PRIVATE_ensureWriteStream(e).S_ &&
15207
15215
  // This error affects the actual write.
15208
15216
  await async function __PRIVATE_handleWriteError(e, t) {
15209
15217
  // Only handle permanent errors here. If it's transient, just let the retry
@@ -15213,7 +15221,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15213
15221
  }(t.code)) {
15214
15222
  // This was a permanent error, the request itself was the problem
15215
15223
  // so it's not going to succeed if we resend it.
15216
- const n = e.K_.shift();
15224
+ const n = e.U_.shift();
15217
15225
  // In this case it's also unlikely that the server itself is melting
15218
15226
  // down -- this was just a bad request so inhibit backoff on the next
15219
15227
  // restart.
@@ -15312,8 +15320,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15312
15320
  }), e.G_.push((async t => {
15313
15321
  t ? (e.Y_.h_(),
15314
15322
  // This will start the write stream if necessary.
15315
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.K_.length} pending writes`),
15316
- e.K_ = []));
15323
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15324
+ e.U_ = []));
15317
15325
  }))), e.Y_;
15318
15326
  }
15319
15327
 
@@ -16010,7 +16018,7 @@ class __PRIVATE_RemovedLimboDocument {
16010
16018
  /**
16011
16019
  * The set of remote documents that the server has told us belongs to the target associated with
16012
16020
  * this view.
16013
- */ get ba() {
16021
+ */ get Sa() {
16014
16022
  return this.fa;
16015
16023
  }
16016
16024
  /**
@@ -16022,7 +16030,7 @@ class __PRIVATE_RemovedLimboDocument {
16022
16030
  * @param previousChanges - If this is being called with a refill, then start
16023
16031
  * with this set of docs and changes instead of the current view.
16024
16032
  * @returns a new set of docs, changes, and refill flag.
16025
- */ Sa(e, t) {
16033
+ */ ba(e, t) {
16026
16034
  const n = t ? t.Da : new __PRIVATE_DocumentChangeSet, r = t ? t.wa : this.wa;
16027
16035
  let i = t ? t.mutatedKeys : this.mutatedKeys, s = r, o = !1;
16028
16036
  // Track the last doc in a (full) limit. This is necessary, because some
@@ -16235,7 +16243,7 @@ class __PRIVATE_RemovedLimboDocument {
16235
16243
  // PORTING NOTE: Multi-tab only.
16236
16244
  Oa(e) {
16237
16245
  this.fa = e.gs, this.pa = __PRIVATE_documentKeySet();
16238
- const t = this.Sa(e.documents);
16246
+ const t = this.ba(e.documents);
16239
16247
  return this.applyChanges(t, /* limboResolutionEnabled= */ !0);
16240
16248
  }
16241
16249
  /**
@@ -16327,11 +16335,11 @@ const Jt = "SyncEngine";
16327
16335
  * Keeps track of the information about an active limbo resolution for each
16328
16336
  * active target ID that was started for the purpose of limbo resolution.
16329
16337
  */
16330
- this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16338
+ this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16331
16339
  /** Stores user completion handlers, indexed by User and BatchId. */
16332
16340
  this.Wa = {},
16333
16341
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16334
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16342
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16335
16343
  // The primary state is set to `true` or `false` immediately after Firestore
16336
16344
  // startup. In the interim, a client should only be considered primary if
16337
16345
  // `isPrimary` is true.
@@ -16384,19 +16392,19 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16384
16392
  // targets based on view changes. This allows us to only depend on Limbo
16385
16393
  // changes when user code includes queries.
16386
16394
  e.Ha = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {
16387
- let i = t.view.Sa(n);
16395
+ let i = t.view.ba(n);
16388
16396
  i.ls && (
16389
16397
  // The query has a limit and some docs were removed, so we need
16390
16398
  // to re-run the query against the local store to make sure we
16391
16399
  // didn't lose any good docs that had been past the limit.
16392
16400
  i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query,
16393
- /* usePreviousResults= */ !1).then((({documents: e}) => t.view.Sa(e, i))));
16401
+ /* usePreviousResults= */ !1).then((({documents: e}) => t.view.ba(e, i))));
16394
16402
  const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i,
16395
16403
  /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);
16396
16404
  return __PRIVATE_updateTrackedLimbos(e, t.targetId, _.Ma), _.snapshot;
16397
16405
  }(e, t, n, r);
16398
16406
  const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t,
16399
- /* 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(_,
16407
+ /* 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(_,
16400
16408
  /* limboResolutionEnabled= */ e.isPrimaryClient, a);
16401
16409
  __PRIVATE_updateTrackedLimbos(e, n, u.Ma);
16402
16410
  const c = new __PRIVATE_QueryView(t, n, o);
@@ -16511,7 +16519,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16511
16519
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16512
16520
  // Update `receivedDocument` as appropriate for any limbo targets.
16513
16521
  t.targetChanges.forEach(((e, t) => {
16514
- const r = n.Ka.get(t);
16522
+ const r = n.Ua.get(t);
16515
16523
  r && (
16516
16524
  // Since this is a limbo resolution lookup, it's for a single document
16517
16525
  // and it could be added, modified, or removed, but not a combination.
@@ -16565,7 +16573,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16565
16573
  const r = __PRIVATE_debugCast(e);
16566
16574
  // PORTING NOTE: Multi-tab only.
16567
16575
  r.sharedClientState.updateQueryState(t, "rejected", n);
16568
- const i = r.Ka.get(t), s = i && i.key;
16576
+ const i = r.Ua.get(t), s = i && i.key;
16569
16577
  if (s) {
16570
16578
  // TODO(klimt): We really only should do the following on permission
16571
16579
  // denied errors, but we don't have the cause code here.
@@ -16587,7 +16595,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16587
16595
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16588
16596
  // this query when the RemoteStore restarts the Watch stream, which should
16589
16597
  // re-trigger the target failure.
16590
- r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16598
+ r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16591
16599
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16592
16600
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16593
16601
  }
@@ -16681,8 +16689,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16681
16689
  e.sharedClientState.removeLocalQueryTarget(t);
16682
16690
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16683
16691
  if (e.qa.delete(t), e.isPrimaryClient) {
16684
- e.Ua.Sr(t).forEach((t => {
16685
- e.Ua.containsKey(t) ||
16692
+ e.Ka.br(t).forEach((t => {
16693
+ e.Ka.containsKey(t) ||
16686
16694
  // We removed the last reference for this key
16687
16695
  __PRIVATE_removeLimboTarget(e, t);
16688
16696
  }));
@@ -16695,14 +16703,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16695
16703
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16696
16704
  const n = e.$a.get(t);
16697
16705
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16698
- e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16706
+ e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16699
16707
  }
16700
16708
 
16701
16709
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16702
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16710
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16703
16711
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16704
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16705
- e.Ua.containsKey(r.key) ||
16712
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16713
+ e.Ka.containsKey(r.key) ||
16706
16714
  // We removed the last reference for this key
16707
16715
  __PRIVATE_removeLimboTarget(e, r.key);
16708
16716
  } else fail();
@@ -16726,7 +16734,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16726
16734
  const t = e.Qa.values().next().value;
16727
16735
  e.Qa.delete(t);
16728
16736
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16729
- e.Ka.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16737
+ e.Ua.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16730
16738
  }
16731
16739
  }
16732
16740
 
@@ -16794,7 +16802,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16794
16802
  }
16795
16803
 
16796
16804
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16797
- const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16805
+ const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16798
16806
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16799
16807
  {
16800
16808
  let e = __PRIVATE_documentKeySet();
@@ -16802,7 +16810,7 @@ function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16802
16810
  if (!r) return e;
16803
16811
  for (const t of r) {
16804
16812
  const r = n.ka.get(t);
16805
- e = e.unionWith(r.view.ba);
16813
+ e = e.unionWith(r.view.Sa);
16806
16814
  }
16807
16815
  return e;
16808
16816
  }
@@ -16886,9 +16894,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16886
16894
  // PORTING NOTE: Multi-Tab only.
16887
16895
  function __PRIVATE_resetLimboDocuments(e) {
16888
16896
  const t = __PRIVATE_debugCast(e);
16889
- t.Ka.forEach(((e, n) => {
16897
+ t.Ua.forEach(((e, n) => {
16890
16898
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16891
- })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16899
+ })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16892
16900
  }
16893
16901
  /**
16894
16902
  * Reconcile the query views of the provided query targets with the state from
@@ -17588,7 +17596,7 @@ class Transaction$2 {
17588
17596
  const n = __PRIVATE_debugCast(e), r = {
17589
17597
  writes: t.map((e => toMutation(n.serializer, e)))
17590
17598
  };
17591
- await n.bo("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17599
+ await n.So("Commit", n.serializer.databaseId, ResourcePath.emptyPath(), r);
17592
17600
  }(this.datastore, this.mutations), this.committed = !0;
17593
17601
  }
17594
17602
  recordVersion(e) {
@@ -17950,7 +17958,7 @@ function __PRIVATE_firestoreClientGetDocumentsFromLocalCache(e, t) {
17950
17958
  return e.asyncQueue.enqueueAndForget((async () => async function __PRIVATE_executeQueryFromCache(e, t, n) {
17951
17959
  try {
17952
17960
  const r = await __PRIVATE_localStoreExecuteQuery(e, t,
17953
- /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.gs), s = i.Sa(r.documents), o = i.applyChanges(s,
17961
+ /* usePreviousResults= */ !0), i = new __PRIVATE_View(t, r.gs), s = i.ba(r.documents), o = i.applyChanges(s,
17954
17962
  /* limboResolutionEnabled= */ !1);
17955
17963
  n.resolve(o.snapshot);
17956
17964
  } catch (e) {
@@ -18323,7 +18331,7 @@ class FirestoreSettingsImpl {
18323
18331
  this.host = Xt, this.ssl = en;
18324
18332
  } else this.host = e.host, this.ssl = null !== (t = e.ssl) && void 0 !== t ? t : en;
18325
18333
  if (this.credentials = e.credentials, this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties,
18326
- this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = bt; else {
18334
+ this.localCache = e.localCache, void 0 === e.cacheSizeBytes) this.cacheSizeBytes = St; else {
18327
18335
  if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < Dt) throw new FirestoreError(C.INVALID_ARGUMENT, "cacheSizeBytes must be at least 1048576");
18328
18336
  this.cacheSizeBytes = e.cacheSizeBytes;
18329
18337
  }
@@ -18379,7 +18387,7 @@ class Firestore$1 {
18379
18387
  * Whether it's a Firestore or Firestore Lite instance.
18380
18388
  */
18381
18389
  this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new FirestoreSettingsImpl({}),
18382
- this._settingsFrozen = !1, this._emulatorOptions = {},
18390
+ this._settingsFrozen = !1,
18383
18391
  // A task that is assigned when the terminate() is invoked and resolved when
18384
18392
  // all components have shut down. Otherwise, Firestore is not terminated,
18385
18393
  // which can mean either the FirestoreClient is in the process of starting,
@@ -18401,8 +18409,7 @@ class Firestore$1 {
18401
18409
  }
18402
18410
  _setSettings(e) {
18403
18411
  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.");
18404
- this._settings = new FirestoreSettingsImpl(e), this._emulatorOptions = e.emulatorOptions || {},
18405
- void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
18412
+ this._settings = new FirestoreSettingsImpl(e), void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {
18406
18413
  if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;
18407
18414
  switch (e.type) {
18408
18415
  case "firstParty":
@@ -18419,9 +18426,6 @@ class Firestore$1 {
18419
18426
  _getSettings() {
18420
18427
  return this._settings;
18421
18428
  }
18422
- _getEmulatorOptions() {
18423
- return this._emulatorOptions;
18424
- }
18425
18429
  _freezeSettings() {
18426
18430
  return this._settingsFrozen = !0, this._settings;
18427
18431
  }
@@ -18477,18 +18481,12 @@ class Firestore$1 {
18477
18481
  * Security Rules.
18478
18482
  */ function connectFirestoreEmulator(e, t, n, r = {}) {
18479
18483
  var i;
18480
- const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o = Object.assign(Object.assign({}, s), {
18481
- emulatorOptions: e._getEmulatorOptions()
18482
- }), _ = `${t}:${n}`;
18483
- s.host !== Xt && s.host !== _ && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");
18484
- const a = Object.assign(Object.assign({}, s), {
18485
- host: _,
18486
- ssl: !1,
18487
- emulatorOptions: r
18488
- });
18489
- // No-op if the new configuration matches the current configuration. This supports SSR
18490
- // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
18491
- if (!util.deepEqual(a, o) && (e._setSettings(a), r.mockUserToken)) {
18484
+ const s = (e = __PRIVATE_cast(e, Firestore$1))._getSettings(), o = `${t}:${n}`;
18485
+ if (s.host !== Xt && s.host !== o && __PRIVATE_logWarn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),
18486
+ e._setSettings(Object.assign(Object.assign({}, s), {
18487
+ host: o,
18488
+ ssl: !1
18489
+ })), r.mockUserToken) {
18492
18490
  let t, n;
18493
18491
  if ("string" == typeof r.mockUserToken) t = r.mockUserToken, n = User.MOCK_USER; else {
18494
18492
  // Let createMockUserToken validate first (catches common mistakes like
@@ -18725,13 +18723,13 @@ class __PRIVATE_AsyncQueueImpl {
18725
18723
  // Visibility handler that triggers an immediate retry of all retryable
18726
18724
  // operations. Meant to speed up recovery when we regain file system access
18727
18725
  // after page comes into foreground.
18728
- this.bu = () => {
18726
+ this.Su = () => {
18729
18727
  const e = getDocument();
18730
18728
  e && __PRIVATE_logDebug(tn, "Visibility state changed to " + e.visibilityState),
18731
18729
  this.a_.t_();
18732
- }, this.Su = e;
18730
+ }, this.bu = e;
18733
18731
  const t = getDocument();
18734
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.bu);
18732
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Su);
18735
18733
  }
18736
18734
  get isShuttingDown() {
18737
18735
  return this.mu;
@@ -18752,7 +18750,7 @@ class __PRIVATE_AsyncQueueImpl {
18752
18750
  if (!this.mu) {
18753
18751
  this.mu = !0, this.yu = e || !1;
18754
18752
  const t = getDocument();
18755
- t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.bu);
18753
+ t && "function" == typeof t.removeEventListener && t.removeEventListener("visibilitychange", this.Su);
18756
18754
  }
18757
18755
  }
18758
18756
  enqueue(e) {
@@ -18796,7 +18794,7 @@ class __PRIVATE_AsyncQueueImpl {
18796
18794
  }
18797
18795
  }
18798
18796
  vu(e) {
18799
- const t = this.Su.then((() => (this.pu = !0, e().catch((e => {
18797
+ const t = this.bu.then((() => (this.pu = !0, e().catch((e => {
18800
18798
  this.gu = e, this.pu = !1;
18801
18799
  const t =
18802
18800
  /**
@@ -18830,7 +18828,7 @@ class __PRIVATE_AsyncQueueImpl {
18830
18828
  // and return the rejected Promise.
18831
18829
  throw __PRIVATE_logError("INTERNAL UNHANDLED ERROR: ", t), e;
18832
18830
  })).then((e => (this.pu = !1, e))))));
18833
- return this.Su = t, t;
18831
+ return this.bu = t, t;
18834
18832
  }
18835
18833
  enqueueAfterDelay(e, t, n) {
18836
18834
  this.Du(),
@@ -18853,8 +18851,8 @@ class __PRIVATE_AsyncQueueImpl {
18853
18851
  // operations were executed.
18854
18852
  let e;
18855
18853
  do {
18856
- e = this.Su, await e;
18857
- } while (e !== this.Su);
18854
+ e = this.bu, await e;
18855
+ } while (e !== this.bu);
18858
18856
  }
18859
18857
  /**
18860
18858
  * For Tests: Determine if a delayed operation with a particular TimerId
@@ -19757,7 +19755,7 @@ function __PRIVATE_isWrite(e) {
19757
19755
  });
19758
19756
  return r.$u(e), r;
19759
19757
  }
19760
- Ku(e) {
19758
+ Uu(e) {
19761
19759
  var t;
19762
19760
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19763
19761
  path: n,
@@ -19765,7 +19763,7 @@ function __PRIVATE_isWrite(e) {
19765
19763
  });
19766
19764
  return r.Bu(), r;
19767
19765
  }
19768
- Uu(e) {
19766
+ Ku(e) {
19769
19767
  // TODO(b/34871131): We don't support array paths right now; so make path
19770
19768
  // undefined.
19771
19769
  return this.ku({
@@ -19926,7 +19924,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19926
19924
  // For Compat types, we have to "extract" the underlying types before
19927
19925
  // performing validation.
19928
19926
  r = util.getModularInstance(r);
19929
- const a = i.Ku(_);
19927
+ const a = i.Uu(_);
19930
19928
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19931
19929
  // Add it to the field mask, but don't add anything to updateData.
19932
19930
  s.push(_); else {
@@ -19952,7 +19950,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19952
19950
  // For Compat types, we have to "extract" the underlying types before
19953
19951
  // performing validation.
19954
19952
  n = util.getModularInstance(n);
19955
- const r = o.Ku(t);
19953
+ const r = o.Uu(t);
19956
19954
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19957
19955
  // Add it to the field mask, but don't add anything to updateData.
19958
19956
  u.push(t); else {
@@ -20030,7 +20028,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20030
20028
  const n = [];
20031
20029
  let r = 0;
20032
20030
  for (const i of e) {
20033
- let e = __PRIVATE_parseData(i, t.Uu(r));
20031
+ let e = __PRIVATE_parseData(i, t.Ku(r));
20034
20032
  null == e && (
20035
20033
  // Just include nulls in the array for fields being replaced with a
20036
20034
  // sentinel.
@@ -22353,9 +22351,9 @@ let an = null;
22353
22351
  return r = Object.assign({
22354
22352
  useFetchStreams: t
22355
22353
  }, r), s._setSettings(r), s;
22356
- }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(b, S, e),
22354
+ }), "PUBLIC").setMultipleInstances(!0)), app.registerVersion(S, b, e),
22357
22355
  // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
22358
- app.registerVersion(b, S, "cjs2017");
22356
+ app.registerVersion(S, b, "cjs2017");
22359
22357
  }();
22360
22358
 
22361
22359
  exports.AbstractUserDataWriter = AbstractUserDataWriter;