@firebase/firestore 3.4.3 → 3.4.4-202202622812

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 (49) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/firestore/src/api/database.d.ts +14 -9
  3. package/dist/firestore/src/api/index_configuration.d.ts +117 -0
  4. package/dist/firestore/src/api.d.ts +1 -0
  5. package/dist/firestore/src/core/firestore_client.d.ts +2 -0
  6. package/dist/firestore/src/model/field_index.d.ts +76 -0
  7. package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  8. package/dist/index.d.ts +15 -9
  9. package/dist/index.esm2017.js +663 -602
  10. package/dist/index.esm2017.js.map +1 -1
  11. package/dist/index.esm5.js +680 -617
  12. package/dist/index.esm5.js.map +1 -1
  13. package/dist/index.node.cjs.js +100 -13
  14. package/dist/index.node.cjs.js.map +1 -1
  15. package/dist/index.node.mjs +100 -14
  16. package/dist/index.node.mjs.map +1 -1
  17. package/dist/index.rn.js +705 -602
  18. package/dist/index.rn.js.map +1 -1
  19. package/dist/internal.d.ts +120 -9
  20. package/dist/lite/firestore/src/api/database.d.ts +14 -9
  21. package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
  22. package/dist/lite/firestore/src/api.d.ts +1 -0
  23. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -0
  24. package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
  25. package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  26. package/dist/lite/index.browser.esm2017.js +2 -2
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +2 -2
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.node.cjs.js +2 -2
  31. package/dist/lite/index.node.mjs +2 -2
  32. package/dist/lite/index.node.mjs.map +1 -1
  33. package/dist/lite/index.rn.esm2017.js +2 -2
  34. package/dist/lite/index.rn.esm2017.js.map +1 -1
  35. package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
  36. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
  37. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  38. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -0
  39. package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
  40. package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  41. package/dist/packages/firestore/dist/index.esm2017.d.ts +152 -131
  42. package/dist/packages/firestore/src/api/database.d.ts +14 -9
  43. package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
  44. package/dist/packages/firestore/src/api.d.ts +1 -0
  45. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -0
  46. package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
  47. package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
  48. package/dist/private.d.ts +24 -9
  49. package/package.json +5 -5
package/dist/index.rn.js CHANGED
@@ -70,7 +70,7 @@ N.MOCK_USER = new N("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let k = "9.6.3";
73
+ let k = "9.6.5-202202622812";
74
74
 
75
75
  /**
76
76
  * @license
@@ -11690,14 +11690,14 @@ function wo(t, e) {
11690
11690
  // Mark this as something the client is currently listening for.
11691
11691
  n.Wr.set(e.targetId, e), po(n) ?
11692
11692
  // The listen will be sent in onWatchStreamOpen
11693
- yo(n) : Mo(n).lr() && mo(n, e));
11693
+ yo(n) : Fo(n).lr() && mo(n, e));
11694
11694
  }
11695
11695
 
11696
11696
  /**
11697
11697
  * Removes the listen from server. It is a no-op if the given target id is
11698
11698
  * not being listened to.
11699
11699
  */ function _o(t, e) {
11700
- const n = j(t), s = Mo(n);
11700
+ const n = j(t), s = Fo(n);
11701
11701
  n.Wr.delete(e), s.lr() && go(n, e), 0 === n.Wr.size && (s.lr() ? s._r() : To(n) &&
11702
11702
  // Revert to OnlineState.Unknown if the watch stream is not open and we
11703
11703
  // have no listeners, since without any listens to send we cannot
@@ -11709,7 +11709,7 @@ function wo(t, e) {
11709
11709
  * We need to increment the the expected number of pending responses we're due
11710
11710
  * from watch so we wait for the ack to process any messages from this target.
11711
11711
  */ function mo(t, e) {
11712
- t.Yr.X(e.targetId), Mo(t).Pr(e);
11712
+ t.Yr.X(e.targetId), Fo(t).Pr(e);
11713
11713
  }
11714
11714
 
11715
11715
  /**
@@ -11717,21 +11717,21 @@ function wo(t, e) {
11717
11717
  * from watch so we wait for the removal on the server before we process any
11718
11718
  * messages from this target.
11719
11719
  */ function go(t, e) {
11720
- t.Yr.X(e), Mo(t).vr(e);
11720
+ t.Yr.X(e), Fo(t).vr(e);
11721
11721
  }
11722
11722
 
11723
11723
  function yo(t) {
11724
11724
  t.Yr = new Un({
11725
11725
  getRemoteKeysForTarget: e => t.remoteSyncer.getRemoteKeysForTarget(e),
11726
11726
  Et: e => t.Wr.get(e) || null
11727
- }), Mo(t).start(), t.Jr.Br();
11727
+ }), Fo(t).start(), t.Jr.Br();
11728
11728
  }
11729
11729
 
11730
11730
  /**
11731
11731
  * Returns whether the watch stream should be started because it's necessary
11732
11732
  * and has not yet been started.
11733
11733
  */ function po(t) {
11734
- return To(t) && !Mo(t).hr() && t.Wr.size > 0;
11734
+ return To(t) && !Fo(t).hr() && t.Wr.size > 0;
11735
11735
  }
11736
11736
 
11737
11737
  function To(t) {
@@ -11865,7 +11865,7 @@ async function Ro(t, e, n) {
11865
11865
  }
11866
11866
 
11867
11867
  async function vo(t) {
11868
- const e = j(t), n = Fo(e);
11868
+ const e = j(t), n = Lo(e);
11869
11869
  let s = e.Qr.length > 0 ? e.Qr[e.Qr.length - 1].batchId : -1;
11870
11870
  for (;Vo(e); ) try {
11871
11871
  const t = await Er(e.localStore, s);
@@ -11892,24 +11892,24 @@ async function vo(t) {
11892
11892
  * immediately if the write stream is established.
11893
11893
  */ function So(t, e) {
11894
11894
  t.Qr.push(e);
11895
- const n = Fo(t);
11895
+ const n = Lo(t);
11896
11896
  n.lr() && n.Sr && n.Dr(e.mutations);
11897
11897
  }
11898
11898
 
11899
11899
  function Do(t) {
11900
- return To(t) && !Fo(t).hr() && t.Qr.length > 0;
11900
+ return To(t) && !Lo(t).hr() && t.Qr.length > 0;
11901
11901
  }
11902
11902
 
11903
11903
  function Co(t) {
11904
- Fo(t).start();
11904
+ Lo(t).start();
11905
11905
  }
11906
11906
 
11907
11907
  async function No(t) {
11908
- Fo(t).kr();
11908
+ Lo(t).kr();
11909
11909
  }
11910
11910
 
11911
11911
  async function ko(t) {
11912
- const e = Fo(t);
11912
+ const e = Lo(t);
11913
11913
  // Send the write pipeline now that the stream is established.
11914
11914
  for (const n of t.Qr) e.Dr(n.mutations);
11915
11915
  }
@@ -11925,7 +11925,7 @@ async function xo(t, e, n) {
11925
11925
  async function $o(t, e) {
11926
11926
  // If the write stream closed after the write handshake completes, a write
11927
11927
  // operation failed and we fail the pending operation.
11928
- e && Fo(t).Sr &&
11928
+ e && Lo(t).Sr &&
11929
11929
  // This error affects the actual write.
11930
11930
  await async function(t, e) {
11931
11931
  // Only handle permanent errors here. If it's transient, just let the retry
@@ -11937,7 +11937,7 @@ async function $o(t, e) {
11937
11937
  // In this case it's also unlikely that the server itself is melting
11938
11938
  // down -- this was just a bad request so inhibit backoff on the next
11939
11939
  // restart.
11940
- Fo(t).wr(), await Po(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
11940
+ Lo(t).wr(), await Po(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
11941
11941
  // It's possible that with the completion of this mutation
11942
11942
  // another slot has freed up.
11943
11943
  await vo(t);
@@ -11949,10 +11949,22 @@ async function $o(t, e) {
11949
11949
  Do(t) && Co(t);
11950
11950
  }
11951
11951
 
11952
+ async function Oo(t, e) {
11953
+ const n = j(t);
11954
+ n.asyncQueue.verifyOperationInProgress(), M("RemoteStore", "RemoteStore received new credentials");
11955
+ const s = To(n);
11956
+ // Tear down and re-create our network streams. This will ensure we get a
11957
+ // fresh auth token for the new user and re-fill the write pipeline with
11958
+ // new mutations from the LocalStore (since mutations are per-user).
11959
+ n.Gr.add(3 /* CredentialChange */), await fo(n), s &&
11960
+ // Don't set the network status to Unknown if we are offline.
11961
+ n.Jr.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
11962
+ n.Gr.delete(3 /* CredentialChange */), await lo(n);
11963
+ }
11964
+
11952
11965
  /**
11953
11966
  * Toggles the network state when the client gains or loses its primary lease.
11954
- */
11955
- async function Oo(t, e) {
11967
+ */ async function Mo(t, e) {
11956
11968
  const n = j(t);
11957
11969
  e ? (n.Gr.delete(2 /* IsSecondary */), await lo(n)) : e || (n.Gr.add(2 /* IsSecondary */),
11958
11970
  await fo(n), n.Jr.set("Unknown" /* Unknown */));
@@ -11965,7 +11977,7 @@ async function Oo(t, e) {
11965
11977
  *
11966
11978
  * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
11967
11979
  * This is not done on Web to allow it to be tree-shaken.
11968
- */ function Mo(t) {
11980
+ */ function Fo(t) {
11969
11981
  return t.Xr || (
11970
11982
  // Create stream (but note that it is not started yet).
11971
11983
  t.Xr = function(t, e, n) {
@@ -12004,7 +12016,7 @@ async function Oo(t, e) {
12004
12016
  *
12005
12017
  * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.
12006
12018
  * This is not done on Web to allow it to be tree-shaken.
12007
- */ function Fo(t) {
12019
+ */ function Lo(t) {
12008
12020
  return t.Zr || (
12009
12021
  // Create stream (but note that it is not started yet).
12010
12022
  t.Zr = function(t, e, n) {
@@ -12050,7 +12062,7 @@ async function Oo(t, e) {
12050
12062
  * in newer versions of TypeScript defines `finally`, which is not available in
12051
12063
  * IE.
12052
12064
  */
12053
- class Lo {
12065
+ class Bo {
12054
12066
  constructor(t, e, n, s, i) {
12055
12067
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = s, this.removalCallback = i,
12056
12068
  this.deferred = new G, this.then = this.deferred.promise.then.bind(this.deferred.promise),
@@ -12073,7 +12085,7 @@ class Lo {
12073
12085
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
12074
12086
  * the DelayedOperation class public.
12075
12087
  */ static createAndSchedule(t, e, n, s, i) {
12076
- const r = Date.now() + n, o = new Lo(t, e, r, s, i);
12088
+ const r = Date.now() + n, o = new Bo(t, e, r, s, i);
12077
12089
  return o.start(n), o;
12078
12090
  }
12079
12091
  /**
@@ -12110,7 +12122,7 @@ class Lo {
12110
12122
  /**
12111
12123
  * Returns a FirestoreError that can be surfaced to the user if the provided
12112
12124
  * error is an IndexedDbTransactionError. Re-throws the error otherwise.
12113
- */ function Bo(t, e) {
12125
+ */ function Uo(t, e) {
12114
12126
  if (F("AsyncQueue", `${e}: ${t}`), ei(t)) return new W(Q.UNAVAILABLE, `${e}: ${t}`);
12115
12127
  throw t;
12116
12128
  }
@@ -12136,7 +12148,7 @@ class Lo {
12136
12148
  * in order specified by the provided comparator. We always add a document key
12137
12149
  * comparator on top of what is provided to guarantee document equality based on
12138
12150
  * the key.
12139
- */ class Uo {
12151
+ */ class qo {
12140
12152
  /** The default ordering is by key if the comparator is omitted */
12141
12153
  constructor(t) {
12142
12154
  // We are adding document key comparator to the end as it's the only
@@ -12148,7 +12160,7 @@ class Lo {
12148
12160
  * Returns an empty copy of the existing DocumentSet, using the same
12149
12161
  * comparator.
12150
12162
  */ static emptySet(t) {
12151
- return new Uo(t.comparator);
12163
+ return new qo(t.comparator);
12152
12164
  }
12153
12165
  has(t) {
12154
12166
  return null != this.keyedMap.get(t);
@@ -12188,7 +12200,7 @@ class Lo {
12188
12200
  return e ? this.copy(this.keyedMap.remove(t), this.sortedSet.remove(e)) : this;
12189
12201
  }
12190
12202
  isEqual(t) {
12191
- if (!(t instanceof Uo)) return !1;
12203
+ if (!(t instanceof qo)) return !1;
12192
12204
  if (this.size !== t.size) return !1;
12193
12205
  const e = this.sortedSet.getIterator(), n = t.sortedSet.getIterator();
12194
12206
  for (;e.hasNext(); ) {
@@ -12204,7 +12216,7 @@ class Lo {
12204
12216
  })), 0 === t.length ? "DocumentSet ()" : "DocumentSet (\n " + t.join(" \n") + "\n)";
12205
12217
  }
12206
12218
  copy(t, e) {
12207
- const n = new Uo;
12219
+ const n = new qo;
12208
12220
  return n.comparator = this.comparator, n.keyedMap = t, n.sortedSet = e, n;
12209
12221
  }
12210
12222
  }
@@ -12228,7 +12240,7 @@ class Lo {
12228
12240
  /**
12229
12241
  * DocumentChangeSet keeps track of a set of changes to docs in a query, merging
12230
12242
  * duplicate events for the same doc.
12231
- */ class qo {
12243
+ */ class Ko {
12232
12244
  constructor() {
12233
12245
  this.eo = new Tn(Nt.comparator);
12234
12246
  }
@@ -12269,7 +12281,7 @@ class Lo {
12269
12281
  }
12270
12282
  }
12271
12283
 
12272
- class Ko {
12284
+ class jo {
12273
12285
  constructor(t, e, n, s, i, r, o, c) {
12274
12286
  this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
12275
12287
  this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = c;
@@ -12281,7 +12293,7 @@ class Ko {
12281
12293
  type: 0 /* Added */ ,
12282
12294
  doc: t
12283
12295
  });
12284
- })), new Ko(t, e, Uo.emptySet(e), i, n, s,
12296
+ })), new jo(t, e, qo.emptySet(e), i, n, s,
12285
12297
  /* syncStateChanged= */ !0,
12286
12298
  /* excludesMetadataChanges= */ !1);
12287
12299
  }
@@ -12316,36 +12328,36 @@ class Ko {
12316
12328
  /**
12317
12329
  * Holds the listeners and the last received ViewSnapshot for a query being
12318
12330
  * tracked by EventManager.
12319
- */ class jo {
12331
+ */ class Qo {
12320
12332
  constructor() {
12321
12333
  this.so = void 0, this.listeners = [];
12322
12334
  }
12323
12335
  }
12324
12336
 
12325
- class Qo {
12337
+ class Wo {
12326
12338
  constructor() {
12327
12339
  this.queries = new Ji((t => De(t)), Se), this.onlineState = "Unknown" /* Unknown */ ,
12328
12340
  this.io = new Set;
12329
12341
  }
12330
12342
  }
12331
12343
 
12332
- async function Wo(t, e) {
12344
+ async function Go(t, e) {
12333
12345
  const n = j(t), s = e.query;
12334
12346
  let i = !1, r = n.queries.get(s);
12335
- if (r || (i = !0, r = new jo), i) try {
12347
+ if (r || (i = !0, r = new Qo), i) try {
12336
12348
  r.so = await n.onListen(s);
12337
12349
  } catch (t) {
12338
- const n = Bo(t, `Initialization of query '${Ce(e.query)}' failed`);
12350
+ const n = Uo(t, `Initialization of query '${Ce(e.query)}' failed`);
12339
12351
  return void e.onError(n);
12340
12352
  }
12341
12353
  if (n.queries.set(s, r), r.listeners.push(e),
12342
12354
  // Run global snapshot listeners if a consistent snapshot has been emitted.
12343
12355
  e.ro(n.onlineState), r.so) {
12344
- e.oo(r.so) && Jo(n);
12356
+ e.oo(r.so) && Yo(n);
12345
12357
  }
12346
12358
  }
12347
12359
 
12348
- async function Go(t, e) {
12360
+ async function zo(t, e) {
12349
12361
  const n = j(t), s = e.query;
12350
12362
  let i = !1;
12351
12363
  const r = n.queries.get(s);
@@ -12356,7 +12368,7 @@ async function Go(t, e) {
12356
12368
  if (i) return n.queries.delete(s), n.onUnlisten(s);
12357
12369
  }
12358
12370
 
12359
- function zo(t, e) {
12371
+ function Ho(t, e) {
12360
12372
  const n = j(t);
12361
12373
  let s = !1;
12362
12374
  for (const t of e) {
@@ -12366,10 +12378,10 @@ function zo(t, e) {
12366
12378
  i.so = t;
12367
12379
  }
12368
12380
  }
12369
- s && Jo(n);
12381
+ s && Yo(n);
12370
12382
  }
12371
12383
 
12372
- function Ho(t, e, n) {
12384
+ function Jo(t, e, n) {
12373
12385
  const s = j(t), i = s.queries.get(e);
12374
12386
  if (i) for (const t of i.listeners) t.onError(n);
12375
12387
  // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()
@@ -12378,7 +12390,7 @@ function Ho(t, e, n) {
12378
12390
  }
12379
12391
 
12380
12392
  // Call all global snapshot listeners that have been set.
12381
- function Jo(t) {
12393
+ function Yo(t) {
12382
12394
  t.io.forEach((t => {
12383
12395
  t.next();
12384
12396
  }));
@@ -12389,7 +12401,7 @@ function Jo(t) {
12389
12401
  * when to raise the event.
12390
12402
  *
12391
12403
  * It uses an Observer to dispatch events.
12392
- */ class Yo {
12404
+ */ class Xo {
12393
12405
  constructor(t, e, n) {
12394
12406
  this.query = t, this.co = e,
12395
12407
  /**
@@ -12408,7 +12420,7 @@ function Jo(t) {
12408
12420
  // Remove the metadata only changes.
12409
12421
  const e = [];
12410
12422
  for (const n of t.docChanges) 3 /* Metadata */ !== n.type && e.push(n);
12411
- t = new Ko(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
12423
+ t = new jo(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
12412
12424
  /* excludesMetadataChanges= */ !0);
12413
12425
  }
12414
12426
  let e = !1;
@@ -12448,7 +12460,7 @@ function Jo(t) {
12448
12460
  // stripped out.
12449
12461
  }
12450
12462
  fo(t) {
12451
- t = Ko.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
12463
+ t = jo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
12452
12464
  this.co.next(t);
12453
12465
  }
12454
12466
  }
@@ -12472,7 +12484,7 @@ function Jo(t) {
12472
12484
  /**
12473
12485
  * A complete element in the bundle stream, together with the byte length it
12474
12486
  * occupies in the stream.
12475
- */ class Xo {
12487
+ */ class Zo {
12476
12488
  constructor(t,
12477
12489
  // How many bytes this element takes to store in the bundle.
12478
12490
  e) {
@@ -12501,7 +12513,7 @@ function Jo(t) {
12501
12513
  */
12502
12514
  /**
12503
12515
  * Helper to convert objects from bundles to model objects in the SDK.
12504
- */ class Zo {
12516
+ */ class tc {
12505
12517
  constructor(t) {
12506
12518
  this.k = t;
12507
12519
  }
@@ -12521,13 +12533,13 @@ function Jo(t) {
12521
12533
  /**
12522
12534
  * A class to process the elements from a bundle, load them into local
12523
12535
  * storage and provide progress update while loading.
12524
- */ class tc {
12536
+ */ class ec {
12525
12537
  constructor(t, e, n) {
12526
12538
  this.mo = t, this.localStore = e, this.k = n,
12527
12539
  /** Batched queries to be saved into storage */
12528
12540
  this.queries = [],
12529
12541
  /** Batched documents to be saved into storage */
12530
- this.documents = [], this.progress = ec(t);
12542
+ this.documents = [], this.progress = nc(t);
12531
12543
  }
12532
12544
  /**
12533
12545
  * Adds an element from the bundle to the loader.
@@ -12544,7 +12556,7 @@ function Jo(t) {
12544
12556
  Object.assign({}, this.progress)) : null;
12545
12557
  }
12546
12558
  po(t) {
12547
- const e = new Map, n = new Zo(this.k);
12559
+ const e = new Map, n = new tc(this.k);
12548
12560
  for (const s of t) if (s.metadata.queries) {
12549
12561
  const t = n.Hn(s.metadata.name);
12550
12562
  for (const n of s.metadata.queries) {
@@ -12557,7 +12569,7 @@ function Jo(t) {
12557
12569
  /**
12558
12570
  * Update the progress to 'Success' and return the updated progress.
12559
12571
  */ async complete() {
12560
- const t = await Vr(this.localStore, new Zo(this.k), this.documents, this.mo.id), e = this.po(this.documents);
12572
+ const t = await Vr(this.localStore, new tc(this.k), this.documents, this.mo.id), e = this.po(this.documents);
12561
12573
  for (const t of this.queries) await Sr(this.localStore, t, e.get(t.name));
12562
12574
  return this.progress.taskState = "Success", new hr(Object.assign({}, this.progress), t);
12563
12575
  }
@@ -12566,7 +12578,7 @@ function Jo(t) {
12566
12578
  /**
12567
12579
  * Returns a `LoadBundleTaskProgress` representing the initial progress of
12568
12580
  * loading a bundle.
12569
- */ function ec(t) {
12581
+ */ function nc(t) {
12570
12582
  return {
12571
12583
  taskState: "Running",
12572
12584
  documentsLoaded: 0,
@@ -12596,13 +12608,13 @@ function Jo(t) {
12596
12608
  * See the License for the specific language governing permissions and
12597
12609
  * limitations under the License.
12598
12610
  */
12599
- class nc {
12611
+ class sc {
12600
12612
  constructor(t) {
12601
12613
  this.key = t;
12602
12614
  }
12603
12615
  }
12604
12616
 
12605
- class sc {
12617
+ class ic {
12606
12618
  constructor(t) {
12607
12619
  this.key = t;
12608
12620
  }
@@ -12612,7 +12624,7 @@ class sc {
12612
12624
  * View is responsible for computing the final merged truth of what docs are in
12613
12625
  * a query. It gets notified of local and remote changes to docs, and applies
12614
12626
  * the query filters and limits to determine the most correct possible results.
12615
- */ class ic {
12627
+ */ class rc {
12616
12628
  constructor(t,
12617
12629
  /** Documents included in the remote target */
12618
12630
  e) {
@@ -12627,7 +12639,7 @@ class sc {
12627
12639
  /** Documents in the view but not in the remote target */
12628
12640
  this.Io = Nn(),
12629
12641
  /** Document Keys that have local changes */
12630
- this.mutatedKeys = Nn(), this.Ao = ke(t), this.Ro = new Uo(this.Ao);
12642
+ this.mutatedKeys = Nn(), this.Ao = ke(t), this.Ro = new qo(this.Ao);
12631
12643
  }
12632
12644
  /**
12633
12645
  * The set of remote documents that the server has told us belongs to the target associated with
@@ -12645,7 +12657,7 @@ class sc {
12645
12657
  * with this set of docs and changes instead of the current view.
12646
12658
  * @returns a new set of docs, changes, and refill flag.
12647
12659
  */ Po(t, e) {
12648
- const n = e ? e.vo : new qo, s = e ? e.Ro : this.Ro;
12660
+ const n = e ? e.vo : new Ko, s = e ? e.Ro : this.Ro;
12649
12661
  let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
12650
12662
  // Track the last doc in a (full) limit. This is necessary, because some
12651
12663
  // update (a delete, or an update moving a doc past the old limit) might
@@ -12769,7 +12781,7 @@ class sc {
12769
12781
  const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , c = o !== this.Eo;
12770
12782
  if (this.Eo = o, 0 !== i.length || c) {
12771
12783
  return {
12772
- snapshot: new Ko(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
12784
+ snapshot: new jo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
12773
12785
  /* excludesMetadataChanges= */ !1),
12774
12786
  Co: r
12775
12787
  };
@@ -12790,7 +12802,7 @@ class sc {
12790
12802
  // true once the client is back online.
12791
12803
  this.current = !1, this.applyChanges({
12792
12804
  Ro: this.Ro,
12793
- vo: new qo,
12805
+ vo: new Ko,
12794
12806
  mutatedKeys: this.mutatedKeys,
12795
12807
  Bn: !1
12796
12808
  },
@@ -12825,9 +12837,9 @@ class sc {
12825
12837
  // Diff the new limbo docs with the old limbo docs.
12826
12838
  const e = [];
12827
12839
  return t.forEach((t => {
12828
- this.Io.has(t) || e.push(new sc(t));
12840
+ this.Io.has(t) || e.push(new ic(t));
12829
12841
  })), this.Io.forEach((n => {
12830
- t.has(n) || e.push(new nc(n));
12842
+ t.has(n) || e.push(new sc(n));
12831
12843
  })), e;
12832
12844
  }
12833
12845
  /**
@@ -12862,7 +12874,7 @@ class sc {
12862
12874
  */
12863
12875
  // PORTING NOTE: Multi-tab only.
12864
12876
  xo() {
12865
- return Ko.fromInitialDocuments(this.query, this.Ro, this.mutatedKeys, 0 /* Local */ === this.Eo);
12877
+ return jo.fromInitialDocuments(this.query, this.Ro, this.mutatedKeys, 0 /* Local */ === this.Eo);
12866
12878
  }
12867
12879
  }
12868
12880
 
@@ -12870,7 +12882,7 @@ class sc {
12870
12882
  * QueryView contains all of the data that SyncEngine needs to keep track of for
12871
12883
  * a particular query.
12872
12884
  */
12873
- class rc {
12885
+ class oc {
12874
12886
  constructor(
12875
12887
  /**
12876
12888
  * The query itself.
@@ -12892,7 +12904,7 @@ class rc {
12892
12904
  }
12893
12905
  }
12894
12906
 
12895
- /** Tracks a limbo resolution. */ class oc {
12907
+ /** Tracks a limbo resolution. */ class cc {
12896
12908
  constructor(t) {
12897
12909
  this.key = t,
12898
12910
  /**
@@ -12917,7 +12929,7 @@ class rc {
12917
12929
  * the class is not exported so they are only accessible from this module.
12918
12930
  * This is useful to implement optional features (like bundles) in free
12919
12931
  * functions, such that they are tree-shakeable.
12920
- */ class cc {
12932
+ */ class ac {
12921
12933
  constructor(t, e, n,
12922
12934
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
12923
12935
  s, i, r) {
@@ -12963,8 +12975,8 @@ class rc {
12963
12975
  * server. All the subsequent view snapshots or errors are sent to the
12964
12976
  * subscribed handlers. Returns the initial snapshot.
12965
12977
  */
12966
- async function ac(t, e) {
12967
- const n = Mc(t);
12978
+ async function uc(t, e) {
12979
+ const n = Fc(t);
12968
12980
  let s, i;
12969
12981
  const r = n.Mo.get(e);
12970
12982
  if (r)
@@ -12976,7 +12988,7 @@ async function ac(t, e) {
12976
12988
  // case and calls `listen` to obtain this ID.
12977
12989
  s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
12978
12990
  const t = await Ir(n.localStore, ve(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
12979
- s = t.targetId, i = await uc(n, e, s, "current" === r), n.isPrimaryClient && wo(n.remoteStore, t);
12991
+ s = t.targetId, i = await hc(n, e, s, "current" === r), n.isPrimaryClient && wo(n.remoteStore, t);
12980
12992
  }
12981
12993
  return i;
12982
12994
  }
@@ -12984,7 +12996,7 @@ async function ac(t, e) {
12984
12996
  /**
12985
12997
  * Registers a view for a previously unknown query and computes its initial
12986
12998
  * snapshot.
12987
- */ async function uc(t, e, n, s) {
12999
+ */ async function hc(t, e, n, s) {
12988
13000
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
12989
13001
  // targets based on view changes. This allows us to only depend on Limbo
12990
13002
  // changes when user code includes queries.
@@ -12998,17 +13010,17 @@ async function ac(t, e) {
12998
13010
  /* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
12999
13011
  const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
13000
13012
  /* updateLimboDocuments= */ t.isPrimaryClient, r);
13001
- return Ic(t, e.targetId, o.Co), o.snapshot;
13013
+ return Ac(t, e.targetId, o.Co), o.snapshot;
13002
13014
  }(t, e, n, s);
13003
13015
  const i = await Rr(t.localStore, e,
13004
- /* usePreviousResults= */ !0), r = new ic(e, i.zn), o = r.Po(i.documents), c = On.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
13016
+ /* usePreviousResults= */ !0), r = new rc(e, i.zn), o = r.Po(i.documents), c = On.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
13005
13017
  /* updateLimboDocuments= */ t.isPrimaryClient, c);
13006
- Ic(t, n, a.Co);
13007
- const u = new rc(e, n, r);
13018
+ Ac(t, n, a.Co);
13019
+ const u = new oc(e, n, r);
13008
13020
  return t.Mo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]), a.snapshot;
13009
13021
  }
13010
13022
 
13011
- /** Stops listening to the query. */ async function hc(t, e) {
13023
+ /** Stops listening to the query. */ async function lc(t, e) {
13012
13024
  const n = j(t), s = n.Mo.get(e), i = n.Fo.get(s.targetId);
13013
13025
  if (i.length > 1) return n.Fo.set(s.targetId, i.filter((t => !Se(t, e)))), void n.Mo.delete(e);
13014
13026
  // No other queries are mapped to the target, clean up the query and the target.
@@ -13019,9 +13031,9 @@ async function ac(t, e) {
13019
13031
  n.sharedClientState.isActiveQueryTarget(s.targetId) || await Ar(n.localStore, s.targetId,
13020
13032
  /*keepPersistedTargetData=*/ !1).then((() => {
13021
13033
  n.sharedClientState.clearQueryState(s.targetId), _o(n.remoteStore, s.targetId),
13022
- Tc(n, s.targetId);
13034
+ Ec(n, s.targetId);
13023
13035
  })).catch(Ki);
13024
- } else Tc(n, s.targetId), await Ar(n.localStore, s.targetId,
13036
+ } else Ec(n, s.targetId), await Ar(n.localStore, s.targetId,
13025
13037
  /*keepPersistedTargetData=*/ !0);
13026
13038
  }
13027
13039
 
@@ -13034,8 +13046,8 @@ async function ac(t, e) {
13034
13046
  * have completed, *not* when the write was acked by the backend. The
13035
13047
  * userCallback is resolved once the write was acked/rejected by the
13036
13048
  * backend (or failed locally for any other reason).
13037
- */ async function lc(t, e, n) {
13038
- const s = Fc(t);
13049
+ */ async function fc(t, e, n) {
13050
+ const s = Lc(t);
13039
13051
  try {
13040
13052
  const t = await function(t, e) {
13041
13053
  const n = j(t), s = ut.now(), i = e.reduce(((t, e) => t.add(e.key)), Nn());
@@ -13070,11 +13082,11 @@ async function ac(t, e) {
13070
13082
  /**
13071
13083
  * Resolves or rejects the user callback for the given batch and then discards
13072
13084
  * it.
13073
- */ (s, t.batchId, n), await bc(s, t.changes), await vo(s.remoteStore);
13085
+ */ (s, t.batchId, n), await Pc(s, t.changes), await vo(s.remoteStore);
13074
13086
  } catch (t) {
13075
13087
  // If we can't persist the mutation, we reject the user callback and
13076
13088
  // don't send the mutation. The user can then retry the write.
13077
- const e = Bo(t, "Failed to persist write");
13089
+ const e = Uo(t, "Failed to persist write");
13078
13090
  n.reject(e);
13079
13091
  }
13080
13092
  }
@@ -13083,7 +13095,7 @@ async function ac(t, e) {
13083
13095
  * Applies one remote event to the sync engine, notifying any views of the
13084
13096
  * changes, and releasing any pending mutation batches that would become
13085
13097
  * visible because of the snapshot version the remote event contains.
13086
- */ async function fc(t, e) {
13098
+ */ async function dc(t, e) {
13087
13099
  const n = j(t);
13088
13100
  try {
13089
13101
  const t = await pr(n.localStore, e);
@@ -13096,7 +13108,7 @@ async function ac(t, e) {
13096
13108
  q(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
13097
13109
  t.addedDocuments.size > 0 ? s.$o = !0 : t.modifiedDocuments.size > 0 ? q(s.$o) : t.removedDocuments.size > 0 && (q(s.$o),
13098
13110
  s.$o = !1));
13099
- })), await bc(n, t, e);
13111
+ })), await Pc(n, t, e);
13100
13112
  } catch (t) {
13101
13113
  await Ki(t);
13102
13114
  }
@@ -13105,7 +13117,7 @@ async function ac(t, e) {
13105
13117
  /**
13106
13118
  * Applies an OnlineState change to the sync engine and notifies any views of
13107
13119
  * the change.
13108
- */ function dc(t, e, n) {
13120
+ */ function wc(t, e, n) {
13109
13121
  const s = j(t);
13110
13122
  // If we are the secondary client, we explicitly ignore the remote store's
13111
13123
  // online state (the local client may go offline, even though the primary
@@ -13124,7 +13136,7 @@ async function ac(t, e) {
13124
13136
  for (const t of n.listeners)
13125
13137
  // Run global snapshot listeners if a consistent snapshot has been emitted.
13126
13138
  t.ro(e) && (s = !0);
13127
- })), s && Jo(n);
13139
+ })), s && Yo(n);
13128
13140
  }(s.eventManager, e), t.length && s.Oo.br(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
13129
13141
  }
13130
13142
  }
@@ -13139,7 +13151,7 @@ async function ac(t, e) {
13139
13151
  * @param err - A description of the condition that has forced the rejection.
13140
13152
  * Nearly always this will be an indication that the user is no longer
13141
13153
  * authorized to see the data matching the target.
13142
- */ async function wc(t, e, n) {
13154
+ */ async function _c(t, e, n) {
13143
13155
  const s = j(t);
13144
13156
  // PORTING NOTE: Multi-tab only.
13145
13157
  s.sharedClientState.updateQueryState(e, "rejected", n);
@@ -13156,18 +13168,18 @@ async function ac(t, e) {
13156
13168
  const n = Nn().add(r), i = new $n(ht.min(),
13157
13169
  /* targetChanges= */ new Map,
13158
13170
  /* targetMismatches= */ new An(ot), t, n);
13159
- await fc(s, i),
13171
+ await dc(s, i),
13160
13172
  // Since this query failed, we won't want to manually unlisten to it.
13161
13173
  // We only remove it from bookkeeping after we successfully applied the
13162
13174
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
13163
13175
  // this query when the RemoteStore restarts the Watch stream, which should
13164
13176
  // re-trigger the target failure.
13165
- s.Bo = s.Bo.remove(r), s.Uo.delete(e), Rc(s);
13177
+ s.Bo = s.Bo.remove(r), s.Uo.delete(e), bc(s);
13166
13178
  } else await Ar(s.localStore, e,
13167
- /* keepPersistedTargetData */ !1).then((() => Tc(s, e, n))).catch(Ki);
13179
+ /* keepPersistedTargetData */ !1).then((() => Ec(s, e, n))).catch(Ki);
13168
13180
  }
13169
13181
 
13170
- async function _c(t, e) {
13182
+ async function mc(t, e) {
13171
13183
  const n = j(t), s = e.batch.batchId;
13172
13184
  try {
13173
13185
  const t = await gr(n.localStore, e);
@@ -13175,14 +13187,14 @@ async function _c(t, e) {
13175
13187
  // raise events immediately (depending on whether the watcher is caught
13176
13188
  // up), so we raise user callbacks first so that they consistently happen
13177
13189
  // before listen events.
13178
- pc(n, s, /*error=*/ null), yc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13179
- await bc(n, t);
13190
+ Tc(n, s, /*error=*/ null), pc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13191
+ await Pc(n, t);
13180
13192
  } catch (t) {
13181
13193
  await Ki(t);
13182
13194
  }
13183
13195
  }
13184
13196
 
13185
- async function mc(t, e, n) {
13197
+ async function gc(t, e, n) {
13186
13198
  const s = j(t);
13187
13199
  try {
13188
13200
  const t = await function(t, e) {
@@ -13202,8 +13214,8 @@ async function mc(t, e, n) {
13202
13214
  // raise events immediately (depending on whether the watcher is caught up),
13203
13215
  // so we raise user callbacks first so that they consistently happen before
13204
13216
  // listen events.
13205
- pc(s, e, n), yc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13206
- await bc(s, t);
13217
+ Tc(s, e, n), pc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13218
+ await Pc(s, t);
13207
13219
  } catch (n) {
13208
13220
  await Ki(n);
13209
13221
  }
@@ -13212,7 +13224,7 @@ async function mc(t, e, n) {
13212
13224
  /**
13213
13225
  * Registers a user callback that resolves when all pending mutations at the moment of calling
13214
13226
  * are acknowledged .
13215
- */ async function gc(t, e) {
13227
+ */ async function yc(t, e) {
13216
13228
  const n = j(t);
13217
13229
  To(n.remoteStore) || M("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
13218
13230
  try {
@@ -13226,7 +13238,7 @@ async function mc(t, e, n) {
13226
13238
  const s = n.jo.get(t) || [];
13227
13239
  s.push(e), n.jo.set(t, s);
13228
13240
  } catch (t) {
13229
- const n = Bo(t, "Initialization of waitForPendingWrites() operation failed");
13241
+ const n = Uo(t, "Initialization of waitForPendingWrites() operation failed");
13230
13242
  e.reject(n);
13231
13243
  }
13232
13244
  }
@@ -13234,13 +13246,13 @@ async function mc(t, e, n) {
13234
13246
  /**
13235
13247
  * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
13236
13248
  * if there are any.
13237
- */ function yc(t, e) {
13249
+ */ function pc(t, e) {
13238
13250
  (t.jo.get(e) || []).forEach((t => {
13239
13251
  t.resolve();
13240
13252
  })), t.jo.delete(e);
13241
13253
  }
13242
13254
 
13243
- /** Reject all outstanding callbacks waiting for pending writes to complete. */ function pc(t, e, n) {
13255
+ /** Reject all outstanding callbacks waiting for pending writes to complete. */ function Tc(t, e, n) {
13244
13256
  const s = j(t);
13245
13257
  let i = s.Ko[s.currentUser.toKey()];
13246
13258
  // NOTE: Mutations restored from persistence won't have callbacks, so it's
@@ -13251,39 +13263,39 @@ async function mc(t, e, n) {
13251
13263
  }
13252
13264
  }
13253
13265
 
13254
- function Tc(t, e, n = null) {
13266
+ function Ec(t, e, n = null) {
13255
13267
  t.sharedClientState.removeLocalQueryTarget(e);
13256
13268
  for (const s of t.Fo.get(e)) t.Mo.delete(s), n && t.Oo.zo(s, n);
13257
13269
  if (t.Fo.delete(e), t.isPrimaryClient) {
13258
13270
  t.qo.us(e).forEach((e => {
13259
13271
  t.qo.containsKey(e) ||
13260
13272
  // We removed the last reference for this key
13261
- Ec(t, e);
13273
+ Ic(t, e);
13262
13274
  }));
13263
13275
  }
13264
13276
  }
13265
13277
 
13266
- function Ec(t, e) {
13278
+ function Ic(t, e) {
13267
13279
  t.Lo.delete(e.path.canonicalString());
13268
13280
  // It's possible that the target already got removed because the query failed. In that case,
13269
13281
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
13270
13282
  const n = t.Bo.get(e);
13271
- null !== n && (_o(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Rc(t));
13283
+ null !== n && (_o(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), bc(t));
13272
13284
  }
13273
13285
 
13274
- function Ic(t, e, n) {
13275
- for (const s of n) if (s instanceof nc) t.qo.addReference(s.key, e), Ac(t, s); else if (s instanceof sc) {
13286
+ function Ac(t, e, n) {
13287
+ for (const s of n) if (s instanceof sc) t.qo.addReference(s.key, e), Rc(t, s); else if (s instanceof ic) {
13276
13288
  M("SyncEngine", "Document no longer in limbo: " + s.key), t.qo.removeReference(s.key, e);
13277
13289
  t.qo.containsKey(s.key) ||
13278
13290
  // We removed the last reference for this key
13279
- Ec(t, s.key);
13291
+ Ic(t, s.key);
13280
13292
  } else U();
13281
13293
  }
13282
13294
 
13283
- function Ac(t, e) {
13295
+ function Rc(t, e) {
13284
13296
  const n = e.key, s = n.path.canonicalString();
13285
13297
  t.Bo.get(n) || t.Lo.has(s) || (M("SyncEngine", "New document in limbo: " + n), t.Lo.add(s),
13286
- Rc(t));
13298
+ bc(t));
13287
13299
  }
13288
13300
 
13289
13301
  /**
@@ -13293,16 +13305,16 @@ function Ac(t, e) {
13293
13305
  * Without bounding the number of concurrent resolutions, the server can fail
13294
13306
  * with "resource exhausted" errors which can lead to pathological client
13295
13307
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
13296
- */ function Rc(t) {
13308
+ */ function bc(t) {
13297
13309
  for (;t.Lo.size > 0 && t.Bo.size < t.maxConcurrentLimboResolutions; ) {
13298
13310
  const e = t.Lo.values().next().value;
13299
13311
  t.Lo.delete(e);
13300
13312
  const n = new Nt(_t.fromString(e)), s = t.Qo.next();
13301
- t.Uo.set(s, new oc(n)), t.Bo = t.Bo.insert(n, s), wo(t.remoteStore, new hi(ve(Te(n.path)), s, 2 /* LimboResolution */ , st.I));
13313
+ t.Uo.set(s, new cc(n)), t.Bo = t.Bo.insert(n, s), wo(t.remoteStore, new hi(ve(Te(n.path)), s, 2 /* LimboResolution */ , st.I));
13302
13314
  }
13303
13315
  }
13304
13316
 
13305
- async function bc(t, e, n) {
13317
+ async function Pc(t, e, n) {
13306
13318
  const s = j(t), i = [], r = [], o = [];
13307
13319
  s.Mo.isEmpty() || (s.Mo.forEach(((t, c) => {
13308
13320
  o.push(s.Go(c, e, n).then((t => {
@@ -13336,7 +13348,7 @@ async function bc(t, e, n) {
13336
13348
  }(s.localStore, r));
13337
13349
  }
13338
13350
 
13339
- async function Pc(t, e) {
13351
+ async function vc(t, e) {
13340
13352
  const n = j(t);
13341
13353
  if (!n.currentUser.isEqual(e)) {
13342
13354
  M("SyncEngine", "User change. New user:", e.toKey());
@@ -13351,11 +13363,11 @@ async function Pc(t, e) {
13351
13363
  })), t.jo.clear();
13352
13364
  }(n, "'waitForPendingWrites' promise is rejected due to a user change."),
13353
13365
  // TODO(b/114226417): Consider calling this only in the primary tab.
13354
- n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await bc(n, t.Gn);
13366
+ n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Pc(n, t.Gn);
13355
13367
  }
13356
13368
  }
13357
13369
 
13358
- function vc(t, e) {
13370
+ function Vc(t, e) {
13359
13371
  const n = j(t), s = n.Uo.get(e);
13360
13372
  if (s && s.$o) return Nn().add(s.key);
13361
13373
  {
@@ -13373,10 +13385,10 @@ function vc(t, e) {
13373
13385
  /**
13374
13386
  * Reconcile the list of synced documents in an existing view with those
13375
13387
  * from persistence.
13376
- */ async function Vc(t, e) {
13388
+ */ async function Sc(t, e) {
13377
13389
  const n = j(t), s = await Rr(n.localStore, e.query,
13378
13390
  /* usePreviousResults= */ !0), i = e.view.ko(s);
13379
- return n.isPrimaryClient && Ic(n, e.targetId, i.Co), i;
13391
+ return n.isPrimaryClient && Ac(n, e.targetId, i.Co), i;
13380
13392
  }
13381
13393
 
13382
13394
  /**
@@ -13384,14 +13396,14 @@ function vc(t, e) {
13384
13396
  * snapshots if needed.
13385
13397
  */
13386
13398
  // PORTING NOTE: Multi-Tab only.
13387
- async function Sc(t) {
13399
+ async function Dc(t) {
13388
13400
  const e = j(t);
13389
- return Pr(e.localStore).then((t => bc(e, t)));
13401
+ return Pr(e.localStore).then((t => Pc(e, t)));
13390
13402
  }
13391
13403
 
13392
13404
  /** Applies a mutation state to an existing batch. */
13393
13405
  // PORTING NOTE: Multi-Tab only.
13394
- async function Dc(t, e, n, s) {
13406
+ async function Cc(t, e, n, s) {
13395
13407
  const i = j(t), r = await function(t, e) {
13396
13408
  const n = j(t), s = j(n.An);
13397
13409
  return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Zt(t, e).next((e => e ? n.Wn.vn(t, e) : Js.resolve(null)))));
@@ -13405,11 +13417,11 @@ async function Dc(t, e, n, s) {
13405
13417
  await vo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
13406
13418
  // NOTE: Both these methods are no-ops for batches that originated from
13407
13419
  // other clients.
13408
- pc(i, e, s || null), yc(i, e), function(t, e) {
13420
+ Tc(i, e, s || null), pc(i, e), function(t, e) {
13409
13421
  j(j(t).An).ee(e);
13410
13422
  }
13411
13423
  // PORTING NOTE: Multi-Tab only.
13412
- (i.localStore, e)) : U(), await bc(i, r)) :
13424
+ (i.localStore, e)) : U(), await Pc(i, r)) :
13413
13425
  // A throttled tab may not have seen the mutation before it was completed
13414
13426
  // and removed from the mutation queue, in which case we won't have cached
13415
13427
  // the affected documents. In this case we can safely ignore the update
@@ -13422,26 +13434,26 @@ async function Dc(t, e, n, s) {
13422
13434
 
13423
13435
  /** Applies a query target change from a different tab. */
13424
13436
  // PORTING NOTE: Multi-Tab only.
13425
- async function Cc(t, e) {
13437
+ async function Nc(t, e) {
13426
13438
  const n = j(t);
13427
- if (Mc(n), Fc(n), !0 === e && !0 !== n.Wo) {
13439
+ if (Fc(n), Lc(n), !0 === e && !0 !== n.Wo) {
13428
13440
  // Secondary tabs only maintain Views for their local listeners and the
13429
13441
  // Views internal state may not be 100% populated (in particular
13430
13442
  // secondary tabs don't track syncedDocuments, the set of documents the
13431
13443
  // server considers to be in the target). So when a secondary becomes
13432
13444
  // primary, we need to need to make sure that all views for all targets
13433
13445
  // match the state on disk.
13434
- const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Nc(n, t.toArray());
13435
- n.Wo = !0, await Oo(n.remoteStore, !0);
13446
+ const t = n.sharedClientState.getAllActiveQueryTargets(), e = await kc(n, t.toArray());
13447
+ n.Wo = !0, await Mo(n.remoteStore, !0);
13436
13448
  for (const t of e) wo(n.remoteStore, t);
13437
13449
  } else if (!1 === e && !1 !== n.Wo) {
13438
13450
  const t = [];
13439
13451
  let e = Promise.resolve();
13440
13452
  n.Fo.forEach(((s, i) => {
13441
- n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (Tc(n, i),
13453
+ n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (Ec(n, i),
13442
13454
  Ar(n.localStore, i,
13443
13455
  /*keepPersistedTargetData=*/ !0)))), _o(n.remoteStore, i);
13444
- })), await e, await Nc(n, t),
13456
+ })), await e, await kc(n, t),
13445
13457
  // PORTING NOTE: Multi-Tab only.
13446
13458
  function(t) {
13447
13459
  const e = j(t);
@@ -13460,11 +13472,11 @@ async function Cc(t, e) {
13460
13472
  * tab to a primary tab
13461
13473
  */
13462
13474
  // PORTING NOTE: Multi-Tab only.
13463
- (n), n.Wo = !1, await Oo(n.remoteStore, !1);
13475
+ (n), n.Wo = !1, await Mo(n.remoteStore, !1);
13464
13476
  }
13465
13477
  }
13466
13478
 
13467
- async function Nc(t, e, n) {
13479
+ async function kc(t, e, n) {
13468
13480
  const s = j(t), i = [], r = [];
13469
13481
  for (const t of e) {
13470
13482
  let e;
@@ -13476,14 +13488,14 @@ async function Nc(t, e, n) {
13476
13488
  // state (the list of syncedDocuments may have gotten out of sync).
13477
13489
  e = await Ir(s.localStore, ve(n[0]));
13478
13490
  for (const t of n) {
13479
- const e = s.Mo.get(t), n = await Vc(s, e);
13491
+ const e = s.Mo.get(t), n = await Sc(s, e);
13480
13492
  n.snapshot && r.push(n.snapshot);
13481
13493
  }
13482
13494
  } else {
13483
13495
  // For queries that never executed on this client, we need to
13484
13496
  // allocate the target in LocalStore and initialize a new View.
13485
13497
  const n = await br(s.localStore, t);
13486
- e = await Ir(s.localStore, n), await uc(s, kc(n), t,
13498
+ e = await Ir(s.localStore, n), await hc(s, xc(n), t,
13487
13499
  /*current=*/ !1);
13488
13500
  }
13489
13501
  i.push(e);
@@ -13502,20 +13514,20 @@ async function Nc(t, e, n) {
13502
13514
  * difference will not cause issues.
13503
13515
  */
13504
13516
  // PORTING NOTE: Multi-Tab only.
13505
- function kc(t) {
13517
+ function xc(t) {
13506
13518
  return pe(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
13507
13519
  }
13508
13520
 
13509
13521
  /** Returns the IDs of the clients that are currently active. */
13510
13522
  // PORTING NOTE: Multi-Tab only.
13511
- function xc(t) {
13523
+ function $c(t) {
13512
13524
  const e = j(t);
13513
13525
  return j(j(e.localStore).persistence).Tn();
13514
13526
  }
13515
13527
 
13516
13528
  /** Applies a query target change from a different tab. */
13517
13529
  // PORTING NOTE: Multi-Tab only.
13518
- async function $c(t, e, n, s) {
13530
+ async function Oc(t, e, n, s) {
13519
13531
  const i = j(t);
13520
13532
  if (i.Wo)
13521
13533
  // If we receive a target state notification via WebStorage, we are
@@ -13525,13 +13537,13 @@ async function $c(t, e, n, s) {
13525
13537
  case "not-current":
13526
13538
  {
13527
13539
  const t = await Pr(i.localStore), s = $n.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
13528
- await bc(i, t, s);
13540
+ await Pc(i, t, s);
13529
13541
  break;
13530
13542
  }
13531
13543
 
13532
13544
  case "rejected":
13533
13545
  await Ar(i.localStore, e,
13534
- /* keepPersistedTargetData */ !0), Tc(i, e, s);
13546
+ /* keepPersistedTargetData */ !0), Ec(i, e, s);
13535
13547
  break;
13536
13548
 
13537
13549
  default:
@@ -13539,8 +13551,8 @@ async function $c(t, e, n, s) {
13539
13551
  }
13540
13552
  }
13541
13553
 
13542
- /** Adds or removes Watch targets for queries from different tabs. */ async function Oc(t, e, n) {
13543
- const s = Mc(t);
13554
+ /** Adds or removes Watch targets for queries from different tabs. */ async function Mc(t, e, n) {
13555
+ const s = Fc(t);
13544
13556
  if (s.Wo) {
13545
13557
  for (const t of e) {
13546
13558
  if (s.Fo.has(t)) {
@@ -13549,7 +13561,7 @@ async function $c(t, e, n, s) {
13549
13561
  continue;
13550
13562
  }
13551
13563
  const e = await br(s.localStore, t), n = await Ir(s.localStore, e);
13552
- await uc(s, kc(e), n.targetId,
13564
+ await hc(s, xc(e), n.targetId,
13553
13565
  /*current=*/ !1), wo(s.remoteStore, n);
13554
13566
  }
13555
13567
  for (const t of n)
@@ -13559,21 +13571,21 @@ async function $c(t, e, n, s) {
13559
13571
  // Release queries that are still active.
13560
13572
  await Ar(s.localStore, t,
13561
13573
  /* keepPersistedTargetData */ !1).then((() => {
13562
- _o(s.remoteStore, t), Tc(s, t);
13574
+ _o(s.remoteStore, t), Ec(s, t);
13563
13575
  })).catch(Ki);
13564
13576
  }
13565
13577
  }
13566
13578
 
13567
- function Mc(t) {
13579
+ function Fc(t) {
13568
13580
  const e = j(t);
13569
- return e.remoteStore.remoteSyncer.applyRemoteEvent = fc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = vc.bind(null, e),
13570
- e.remoteStore.remoteSyncer.rejectListen = wc.bind(null, e), e.Oo.br = zo.bind(null, e.eventManager),
13571
- e.Oo.zo = Ho.bind(null, e.eventManager), e;
13581
+ return e.remoteStore.remoteSyncer.applyRemoteEvent = dc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Vc.bind(null, e),
13582
+ e.remoteStore.remoteSyncer.rejectListen = _c.bind(null, e), e.Oo.br = Ho.bind(null, e.eventManager),
13583
+ e.Oo.zo = Jo.bind(null, e.eventManager), e;
13572
13584
  }
13573
13585
 
13574
- function Fc(t) {
13586
+ function Lc(t) {
13575
13587
  const e = j(t);
13576
- return e.remoteStore.remoteSyncer.applySuccessfulWrite = _c.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = mc.bind(null, e),
13588
+ return e.remoteStore.remoteSyncer.applySuccessfulWrite = mc.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = gc.bind(null, e),
13577
13589
  e;
13578
13590
  }
13579
13591
 
@@ -13584,7 +13596,7 @@ function Fc(t) {
13584
13596
  * @param syncEngine - SyncEngine to use.
13585
13597
  * @param bundleReader - Bundle to load into the SDK.
13586
13598
  * @param task - LoadBundleTask used to update the loading progress to public API.
13587
- */ function Lc(t, e, n) {
13599
+ */ function Bc(t, e, n) {
13588
13600
  const s = j(t);
13589
13601
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
13590
13602
  (async function(t, e, n) {
@@ -13605,8 +13617,8 @@ function Fc(t) {
13605
13617
  totalBytes: t.totalBytes
13606
13618
  };
13607
13619
  }(s));
13608
- n._updateProgress(ec(s));
13609
- const i = new tc(s, t.localStore, e.k);
13620
+ n._updateProgress(nc(s));
13621
+ const i = new ec(s, t.localStore, e.k);
13610
13622
  let r = await e.Ho();
13611
13623
  for (;r; ) {
13612
13624
  const t = await i.yo(r);
@@ -13616,7 +13628,7 @@ function Fc(t) {
13616
13628
  // TODO(b/160876443): This currently raises snapshots with
13617
13629
  // `fromCache=false` if users already listen to some queries and bundles
13618
13630
  // has newer version.
13619
- await bc(t, o.In,
13631
+ await Pc(t, o.In,
13620
13632
  /* remoteEvent */ void 0),
13621
13633
  // Save metadata, so loading the same bundle will skip.
13622
13634
  await function(t, e) {
@@ -13655,7 +13667,7 @@ function Fc(t) {
13655
13667
  }));
13656
13668
  }
13657
13669
 
13658
- class Bc {
13670
+ class Uc {
13659
13671
  constructor() {
13660
13672
  this.synchronizeTabs = !1;
13661
13673
  }
@@ -13683,14 +13695,14 @@ class Bc {
13683
13695
 
13684
13696
  /**
13685
13697
  * Provides all components needed for Firestore with IndexedDB persistence.
13686
- */ class Uc extends Bc {
13698
+ */ class qc extends Uc {
13687
13699
  constructor(t, e, n) {
13688
13700
  super(), this.tc = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
13689
13701
  }
13690
13702
  async initialize(t) {
13691
13703
  await super.initialize(t), await vr(this.localStore), await this.tc.initialize(this, t),
13692
13704
  // Enqueue writes from a previous session
13693
- await Fc(this.tc.syncEngine), await vo(this.tc.remoteStore),
13705
+ await Lc(this.tc.syncEngine), await vo(this.tc.remoteStore),
13694
13706
  // NOTE: This will immediately call the listener, so we make sure to
13695
13707
  // set it after localStore / remoteStore are started.
13696
13708
  await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
@@ -13719,7 +13731,7 @@ class Bc {
13719
13731
  * In the legacy client, this provider is used to provide both multi-tab and
13720
13732
  * non-multi-tab persistence since we cannot tell at build time whether
13721
13733
  * `synchronizeTabs` will be enabled.
13722
- */ class qc extends Uc {
13734
+ */ class Kc extends qc {
13723
13735
  constructor(t, e) {
13724
13736
  super(t, e, /* forceOwnership= */ !1), this.tc = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
13725
13737
  }
@@ -13727,16 +13739,16 @@ class Bc {
13727
13739
  await super.initialize(t);
13728
13740
  const e = this.tc.syncEngine;
13729
13741
  this.sharedClientState instanceof zr && (this.sharedClientState.syncEngine = {
13730
- mi: Dc.bind(null, e),
13731
- gi: $c.bind(null, e),
13732
- yi: Oc.bind(null, e),
13733
- Tn: xc.bind(null, e),
13734
- _i: Sc.bind(null, e)
13742
+ mi: Cc.bind(null, e),
13743
+ gi: Oc.bind(null, e),
13744
+ yi: Mc.bind(null, e),
13745
+ Tn: $c.bind(null, e),
13746
+ _i: Dc.bind(null, e)
13735
13747
  }, await this.sharedClientState.start()),
13736
13748
  // NOTE: This will immediately call the listener, so we make sure to
13737
13749
  // set it after localStore / remoteStore are started.
13738
13750
  await this.persistence.sn((async t => {
13739
- await Cc(this.tc.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13751
+ await Nc(this.tc.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13740
13752
  }));
13741
13753
  }
13742
13754
  Jo(t) {
@@ -13750,17 +13762,17 @@ class Bc {
13750
13762
  /**
13751
13763
  * Initializes and wires the components that are needed to interface with the
13752
13764
  * network.
13753
- */ class Kc {
13765
+ */ class jc {
13754
13766
  async initialize(t, e) {
13755
13767
  this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
13756
13768
  this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
13757
13769
  this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
13758
- /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => dc(this.syncEngine, t, 1 /* SharedClientState */),
13759
- this.remoteStore.remoteSyncer.handleCredentialChange = Pc.bind(null, this.syncEngine),
13760
- await Oo(this.remoteStore, this.syncEngine.isPrimaryClient));
13770
+ /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => wc(this.syncEngine, t, 1 /* SharedClientState */),
13771
+ this.remoteStore.remoteSyncer.handleCredentialChange = vc.bind(null, this.syncEngine),
13772
+ await Mo(this.remoteStore, this.syncEngine.isPrimaryClient));
13761
13773
  }
13762
13774
  createEventManager(t) {
13763
- return new Qo;
13775
+ return new Wo;
13764
13776
  }
13765
13777
  createDatastore(t) {
13766
13778
  const e = so(t.databaseInfo.databaseId), n = (s = t.databaseInfo, new to(s));
@@ -13770,7 +13782,7 @@ class Bc {
13770
13782
  }(t.authCredentials, t.appCheckCredentials, n, e);
13771
13783
  }
13772
13784
  createRemoteStore(t) {
13773
- return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => dc(this.syncEngine, t, 0 /* RemoteStore */),
13785
+ return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => wc(this.syncEngine, t, 0 /* RemoteStore */),
13774
13786
  r = Yr.Pt() ? new Yr : new Jr, new ho(e, n, s, i, r);
13775
13787
  var e, n, s, i, r;
13776
13788
  /** Re-enables the network. Idempotent. */ }
@@ -13778,7 +13790,7 @@ class Bc {
13778
13790
  return function(t, e, n,
13779
13791
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
13780
13792
  s, i, r, o) {
13781
- const c = new cc(t, e, n, s, i, r);
13793
+ const c = new ac(t, e, n, s, i, r);
13782
13794
  return o && (c.Wo = !0), c;
13783
13795
  }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
13784
13796
  }
@@ -13821,7 +13833,7 @@ class Bc {
13821
13833
  * @param bytesPerRead - How many bytes each `read()` from the returned reader
13822
13834
  * will read.
13823
13835
  */
13824
- function jc(t, e = 10240) {
13836
+ function Qc(t, e = 10240) {
13825
13837
  let n = 0;
13826
13838
  // The TypeScript definition for ReadableStreamReader changed. We use
13827
13839
  // `any` here to allow this code to compile with different versions.
@@ -13887,7 +13899,7 @@ function jc(t, e = 10240) {
13887
13899
  * asynchronously. To allow immediate silencing, a mute call is added which
13888
13900
  * causes events scheduled to no longer be raised.
13889
13901
  */
13890
- class Qc {
13902
+ class Wc {
13891
13903
  constructor(t) {
13892
13904
  this.observer = t,
13893
13905
  /**
@@ -13933,7 +13945,7 @@ class Qc {
13933
13945
  *
13934
13946
  * Takes a bundle stream or buffer, and presents abstractions to read bundled
13935
13947
  * elements out of the underlying content.
13936
- */ class Wc {
13948
+ */ class Gc {
13937
13949
  constructor(
13938
13950
  /** The reader to read from underlying binary bundle data source. */
13939
13951
  t, e) {
@@ -13975,7 +13987,7 @@ class Qc {
13975
13987
  const e = this.ic.decode(t), n = Number(e);
13976
13988
  isNaN(n) && this.cc(`length string (${e}) is not valid number`);
13977
13989
  const s = await this.ac(n);
13978
- return new Xo(JSON.parse(s), t.length + n);
13990
+ return new Zo(JSON.parse(s), t.length + n);
13979
13991
  }
13980
13992
  /** First index of '{' from the underlying buffer. */ uc() {
13981
13993
  return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
@@ -14050,7 +14062,7 @@ class Qc {
14050
14062
  * Internal transaction object responsible for accumulating the mutations to
14051
14063
  * perform and the base versions for any documents read.
14052
14064
  */
14053
- class Gc {
14065
+ class zc {
14054
14066
  constructor(t) {
14055
14067
  this.datastore = t,
14056
14068
  // The version of each document that was read during this transaction.
@@ -14191,7 +14203,7 @@ class Gc {
14191
14203
  * TransactionRunner encapsulates the logic needed to run and retry transactions
14192
14204
  * with backoff.
14193
14205
  */
14194
- class zc {
14206
+ class Hc {
14195
14207
  constructor(t, e, n, s) {
14196
14208
  this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
14197
14209
  this.lc = 5, this.ur = new io(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
@@ -14201,7 +14213,7 @@ class zc {
14201
14213
  }
14202
14214
  fc() {
14203
14215
  this.ur.Zi((async () => {
14204
- const t = new Gc(this.datastore), e = this.dc(t);
14216
+ const t = new zc(this.datastore), e = this.dc(t);
14205
14217
  e && e.then((e => {
14206
14218
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
14207
14219
  this.deferred.resolve(e);
@@ -14259,7 +14271,7 @@ class zc {
14259
14271
  * pieces of the client SDK architecture. It is responsible for creating the
14260
14272
  * async queue that is shared by all of the other components in the system.
14261
14273
  */
14262
- class Hc {
14274
+ class Jc {
14263
14275
  constructor(t, e,
14264
14276
  /**
14265
14277
  * Asynchronous queue responsible for all of our internal processing. When
@@ -14272,12 +14284,11 @@ class Hc {
14272
14284
  n, s) {
14273
14285
  this.authCredentials = t, this.appCheckCredentials = e, this.asyncQueue = n, this.databaseInfo = s,
14274
14286
  this.user = N.UNAUTHENTICATED, this.clientId = rt.A(), this.authCredentialListener = () => Promise.resolve(),
14275
- this.authCredentials.start(n, (async t => {
14287
+ this.appCheckCredentialListener = () => Promise.resolve(), this.authCredentials.start(n, (async t => {
14276
14288
  M("FirestoreClient", "Received user=", t.uid), await this.authCredentialListener(t),
14277
14289
  this.user = t;
14278
- })),
14279
- // Register an empty credentials change listener to activate token refresh.
14280
- this.appCheckCredentials.start(n, (() => Promise.resolve()));
14290
+ })), this.appCheckCredentials.start(n, (t => (M("FirestoreClient", "Received new app check token=", t),
14291
+ this.appCheckCredentialListener(t, this.user))));
14281
14292
  }
14282
14293
  async getConfiguration() {
14283
14294
  return {
@@ -14293,6 +14304,9 @@ class Hc {
14293
14304
  setCredentialChangeListener(t) {
14294
14305
  this.authCredentialListener = t;
14295
14306
  }
14307
+ setAppCheckTokenChangeListener(t) {
14308
+ this.appCheckCredentialListener = t;
14309
+ }
14296
14310
  /**
14297
14311
  * Checks that the client has not been terminated. Ensures that other methods on
14298
14312
  * this class cannot be called after the client is terminated.
@@ -14310,14 +14324,14 @@ class Hc {
14310
14324
  // tokens.
14311
14325
  this.authCredentials.shutdown(), this.appCheckCredentials.shutdown(), t.resolve();
14312
14326
  } catch (e) {
14313
- const n = Bo(e, "Failed to shutdown persistence");
14327
+ const n = Uo(e, "Failed to shutdown persistence");
14314
14328
  t.reject(n);
14315
14329
  }
14316
14330
  })), t.promise;
14317
14331
  }
14318
14332
  }
14319
14333
 
14320
- async function Jc(t, e) {
14334
+ async function Yc(t, e) {
14321
14335
  t.asyncQueue.verifyOperationInProgress(), M("FirestoreClient", "Initializing OfflineComponentProvider");
14322
14336
  const n = await t.getConfiguration();
14323
14337
  await e.initialize(n);
@@ -14330,63 +14344,53 @@ async function Jc(t, e) {
14330
14344
  e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
14331
14345
  }
14332
14346
 
14333
- async function Yc(t, e) {
14347
+ async function Xc(t, e) {
14334
14348
  t.asyncQueue.verifyOperationInProgress();
14335
- const n = await Xc(t);
14349
+ const n = await Zc(t);
14336
14350
  M("FirestoreClient", "Initializing OnlineComponentProvider");
14337
14351
  const s = await t.getConfiguration();
14338
14352
  await e.initialize(n, s),
14339
14353
  // The CredentialChangeListener of the online component provider takes
14340
14354
  // precedence over the offline component provider.
14341
- t.setCredentialChangeListener((t => async function(t, e) {
14342
- const n = j(t);
14343
- n.asyncQueue.verifyOperationInProgress(), M("RemoteStore", "RemoteStore received new credentials");
14344
- const s = To(n);
14345
- // Tear down and re-create our network streams. This will ensure we get a
14346
- // fresh auth token for the new user and re-fill the write pipeline with
14347
- // new mutations from the LocalStore (since mutations are per-user).
14348
- n.Gr.add(3 /* CredentialChange */), await fo(n), s &&
14349
- // Don't set the network status to Unknown if we are offline.
14350
- n.Jr.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
14351
- n.Gr.delete(3 /* CredentialChange */), await lo(n);
14352
- }(e.remoteStore, t))), t.onlineComponents = e;
14353
- }
14354
-
14355
- async function Xc(t) {
14356
- return t.offlineComponents || (M("FirestoreClient", "Using default OfflineComponentProvider"),
14357
- await Jc(t, new Bc)), t.offlineComponents;
14355
+ t.setCredentialChangeListener((t => Oo(e.remoteStore, t))), t.setAppCheckTokenChangeListener(((t, n) => Oo(e.remoteStore, n))),
14356
+ t.onlineComponents = e;
14358
14357
  }
14359
14358
 
14360
14359
  async function Zc(t) {
14361
- return t.onlineComponents || (M("FirestoreClient", "Using default OnlineComponentProvider"),
14362
- await Yc(t, new Kc)), t.onlineComponents;
14360
+ return t.offlineComponents || (M("FirestoreClient", "Using default OfflineComponentProvider"),
14361
+ await Yc(t, new Uc)), t.offlineComponents;
14363
14362
  }
14364
14363
 
14365
- function ta(t) {
14366
- return Xc(t).then((t => t.persistence));
14364
+ async function ta(t) {
14365
+ return t.onlineComponents || (M("FirestoreClient", "Using default OnlineComponentProvider"),
14366
+ await Xc(t, new jc)), t.onlineComponents;
14367
14367
  }
14368
14368
 
14369
14369
  function ea(t) {
14370
- return Xc(t).then((t => t.localStore));
14370
+ return Zc(t).then((t => t.persistence));
14371
14371
  }
14372
14372
 
14373
14373
  function na(t) {
14374
- return Zc(t).then((t => t.remoteStore));
14374
+ return Zc(t).then((t => t.localStore));
14375
14375
  }
14376
14376
 
14377
14377
  function sa(t) {
14378
- return Zc(t).then((t => t.syncEngine));
14378
+ return ta(t).then((t => t.remoteStore));
14379
14379
  }
14380
14380
 
14381
- async function ia(t) {
14382
- const e = await Zc(t), n = e.eventManager;
14383
- return n.onListen = ac.bind(null, e.syncEngine), n.onUnlisten = hc.bind(null, e.syncEngine),
14381
+ function ia(t) {
14382
+ return ta(t).then((t => t.syncEngine));
14383
+ }
14384
+
14385
+ async function ra(t) {
14386
+ const e = await ta(t), n = e.eventManager;
14387
+ return n.onListen = uc.bind(null, e.syncEngine), n.onUnlisten = lc.bind(null, e.syncEngine),
14384
14388
  n;
14385
14389
  }
14386
14390
 
14387
- /** Enables the network connection and re-enqueues all pending operations. */ function ra(t) {
14391
+ /** Enables the network connection and re-enqueues all pending operations. */ function oa(t) {
14388
14392
  return t.asyncQueue.enqueue((async () => {
14389
- const e = await ta(t), n = await na(t);
14393
+ const e = await ea(t), n = await sa(t);
14390
14394
  return e.setNetworkEnabled(!0), function(t) {
14391
14395
  const e = j(t);
14392
14396
  return e.Gr.delete(0 /* UserDisabled */), lo(e);
@@ -14394,9 +14398,9 @@ async function ia(t) {
14394
14398
  }));
14395
14399
  }
14396
14400
 
14397
- /** Disables the network connection. Pending operations will not complete. */ function oa(t) {
14401
+ /** Disables the network connection. Pending operations will not complete. */ function ca(t) {
14398
14402
  return t.asyncQueue.enqueue((async () => {
14399
- const e = await ta(t), n = await na(t);
14403
+ const e = await ea(t), n = await sa(t);
14400
14404
  return e.setNetworkEnabled(!1), async function(t) {
14401
14405
  const e = j(t);
14402
14406
  e.Gr.add(0 /* UserDisabled */), await fo(e),
@@ -14410,7 +14414,7 @@ async function ia(t) {
14410
14414
  * Returns a Promise that resolves when all writes that were pending at the time
14411
14415
  * this method was called received server acknowledgement. An acknowledgement
14412
14416
  * can be either acceptance or rejection.
14413
- */ function ca(t, e) {
14417
+ */ function aa(t, e) {
14414
14418
  const n = new G;
14415
14419
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14416
14420
  try {
@@ -14420,24 +14424,24 @@ async function ia(t) {
14420
14424
  }(t, e);
14421
14425
  s.isFoundDocument() ? n.resolve(s) : s.isNoDocument() ? n.resolve(null) : n.reject(new W(Q.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"));
14422
14426
  } catch (t) {
14423
- const s = Bo(t, `Failed to get document '${e} from cache`);
14427
+ const s = Uo(t, `Failed to get document '${e} from cache`);
14424
14428
  n.reject(s);
14425
14429
  }
14426
14430
  }
14427
14431
  /**
14428
14432
  * Retrieves a latency-compensated document from the backend via a
14429
14433
  * SnapshotListener.
14430
- */ (await ea(t), e, n))), n.promise;
14434
+ */ (await na(t), e, n))), n.promise;
14431
14435
  }
14432
14436
 
14433
- function aa(t, e, n = {}) {
14437
+ function ua(t, e, n = {}) {
14434
14438
  const s = new G;
14435
14439
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14436
- const r = new Qc({
14440
+ const r = new Wc({
14437
14441
  next: r => {
14438
14442
  // Remove query first before passing event to user to avoid
14439
14443
  // user actions affecting the now stale query.
14440
- e.enqueueAndForget((() => Go(t, o)));
14444
+ e.enqueueAndForget((() => zo(t, o)));
14441
14445
  const c = r.docs.has(n);
14442
14446
  !c && r.fromCache ?
14443
14447
  // TODO(dimond): If we're online and the document doesn't
@@ -14450,62 +14454,62 @@ function aa(t, e, n = {}) {
14450
14454
  i.reject(new W(Q.UNAVAILABLE, "Failed to get document because the client is offline.")) : c && r.fromCache && s && "server" === s.source ? i.reject(new W(Q.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
14451
14455
  },
14452
14456
  error: t => i.reject(t)
14453
- }), o = new Yo(Te(n.path), r, {
14457
+ }), o = new Xo(Te(n.path), r, {
14454
14458
  includeMetadataChanges: !0,
14455
14459
  wo: !0
14456
14460
  });
14457
- return Wo(t, o);
14458
- }(await ia(t), t.asyncQueue, e, n, s))), s.promise;
14461
+ return Go(t, o);
14462
+ }(await ra(t), t.asyncQueue, e, n, s))), s.promise;
14459
14463
  }
14460
14464
 
14461
- function ua(t, e) {
14465
+ function ha(t, e) {
14462
14466
  const n = new G;
14463
14467
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14464
14468
  try {
14465
14469
  const s = await Rr(t, e,
14466
- /* usePreviousResults= */ !0), i = new ic(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
14470
+ /* usePreviousResults= */ !0), i = new rc(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
14467
14471
  /* updateLimboDocuments= */ !1);
14468
14472
  n.resolve(o.snapshot);
14469
14473
  } catch (t) {
14470
- const s = Bo(t, `Failed to execute query '${e} against cache`);
14474
+ const s = Uo(t, `Failed to execute query '${e} against cache`);
14471
14475
  n.reject(s);
14472
14476
  }
14473
14477
  }
14474
14478
  /**
14475
14479
  * Retrieves a latency-compensated query snapshot from the backend via a
14476
14480
  * SnapshotListener.
14477
- */ (await ea(t), e, n))), n.promise;
14481
+ */ (await na(t), e, n))), n.promise;
14478
14482
  }
14479
14483
 
14480
- function ha(t, e, n = {}) {
14484
+ function la(t, e, n = {}) {
14481
14485
  const s = new G;
14482
14486
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14483
- const r = new Qc({
14487
+ const r = new Wc({
14484
14488
  next: n => {
14485
14489
  // Remove query first before passing event to user to avoid
14486
14490
  // user actions affecting the now stale query.
14487
- e.enqueueAndForget((() => Go(t, o))), n.fromCache && "server" === s.source ? i.reject(new W(Q.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
14491
+ e.enqueueAndForget((() => zo(t, o))), n.fromCache && "server" === s.source ? i.reject(new W(Q.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
14488
14492
  },
14489
14493
  error: t => i.reject(t)
14490
- }), o = new Yo(n, r, {
14494
+ }), o = new Xo(n, r, {
14491
14495
  includeMetadataChanges: !0,
14492
14496
  wo: !0
14493
14497
  });
14494
- return Wo(t, o);
14495
- }(await ia(t), t.asyncQueue, e, n, s))), s.promise;
14498
+ return Go(t, o);
14499
+ }(await ra(t), t.asyncQueue, e, n, s))), s.promise;
14496
14500
  }
14497
14501
 
14498
- function la(t, e) {
14499
- const n = new Qc(e);
14502
+ function fa(t, e) {
14503
+ const n = new Wc(e);
14500
14504
  return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14501
14505
  j(t).io.add(e),
14502
14506
  // Immediately fire an initial event, indicating all existing listeners
14503
14507
  // are in-sync.
14504
14508
  e.next();
14505
- }(await ia(t), n))), () => {
14509
+ }(await ra(t), n))), () => {
14506
14510
  n.nc(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14507
14511
  j(t).io.delete(e);
14508
- }(await ia(t), n)));
14512
+ }(await ra(t), n)));
14509
14513
  };
14510
14514
  }
14511
14515
 
@@ -14523,25 +14527,25 @@ function la(t, e) {
14523
14527
  * accessed with the transaction will not reflect local changes that have not
14524
14528
  * been committed. For this reason, it is required that all reads are
14525
14529
  * performed before any writes. Transactions must be performed while online.
14526
- */ function fa(t, e) {
14530
+ */ function da(t, e) {
14527
14531
  const n = new G;
14528
14532
  return t.asyncQueue.enqueueAndForget((async () => {
14529
14533
  const s = await function(t) {
14530
- return Zc(t).then((t => t.datastore));
14534
+ return ta(t).then((t => t.datastore));
14531
14535
  }(t);
14532
- new zc(t.asyncQueue, s, e, n).run();
14536
+ new Hc(t.asyncQueue, s, e, n).run();
14533
14537
  })), n.promise;
14534
14538
  }
14535
14539
 
14536
- function da(t, e, n, s) {
14540
+ function wa(t, e, n, s) {
14537
14541
  const i = function(t, e) {
14538
14542
  let n;
14539
14543
  n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
14540
14544
  return function(t, e) {
14541
- return new Wc(t, e);
14545
+ return new Gc(t, e);
14542
14546
  }(function(t, e) {
14543
- if (t instanceof Uint8Array) return jc(t, e);
14544
- if (t instanceof ArrayBuffer) return jc(new Uint8Array(t), e);
14547
+ if (t instanceof Uint8Array) return Qc(t, e);
14548
+ if (t instanceof ArrayBuffer) return Qc(new Uint8Array(t), e);
14545
14549
  if (t instanceof ReadableStream) return t.getReader();
14546
14550
  throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
14547
14551
  }(n), e);
@@ -14563,18 +14567,18 @@ function da(t, e, n, s) {
14563
14567
  * limitations under the License.
14564
14568
  */ (n, so(e));
14565
14569
  t.asyncQueue.enqueueAndForget((async () => {
14566
- Lc(await sa(t), i, s);
14570
+ Bc(await ia(t), i, s);
14567
14571
  }));
14568
14572
  }
14569
14573
 
14570
- function wa(t, e) {
14574
+ function _a(t, e) {
14571
14575
  return t.asyncQueue.enqueue((async () => function(t, e) {
14572
14576
  const n = j(t);
14573
14577
  return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ye.getNamedQuery(t, e)));
14574
- }(await ea(t), e)));
14578
+ }(await na(t), e)));
14575
14579
  }
14576
14580
 
14577
- class _a {
14581
+ class ma {
14578
14582
  /**
14579
14583
  * Constructs a DatabaseInfo using the provided host, databaseId and
14580
14584
  * persistenceKey.
@@ -14603,7 +14607,7 @@ class _a {
14603
14607
  * Represents the database ID a Firestore client is associated with.
14604
14608
  * @internal
14605
14609
  */
14606
- class ma {
14610
+ class ga {
14607
14611
  constructor(t, e) {
14608
14612
  this.projectId = t, this.database = e || "(default)";
14609
14613
  }
@@ -14611,7 +14615,7 @@ class ma {
14611
14615
  return "(default)" === this.database;
14612
14616
  }
14613
14617
  isEqual(t) {
14614
- return t instanceof ma && t.projectId === this.projectId && t.database === this.database;
14618
+ return t instanceof ga && t.projectId === this.projectId && t.database === this.database;
14615
14619
  }
14616
14620
  }
14617
14621
 
@@ -14630,7 +14634,7 @@ class ma {
14630
14634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14631
14635
  * See the License for the specific language governing permissions and
14632
14636
  * limitations under the License.
14633
- */ const ga = new Map;
14637
+ */ const ya = new Map;
14634
14638
 
14635
14639
  /**
14636
14640
  * An instance map that ensures only one Datastore exists per Firestore
@@ -14652,28 +14656,28 @@ class ma {
14652
14656
  * See the License for the specific language governing permissions and
14653
14657
  * limitations under the License.
14654
14658
  */
14655
- function ya(t, e, n) {
14659
+ function pa(t, e, n) {
14656
14660
  if (!n) throw new W(Q.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
14657
14661
  }
14658
14662
 
14659
14663
  /**
14660
14664
  * Validates that two boolean options are not set at the same time.
14661
14665
  * @internal
14662
- */ function pa(t, e, n, s) {
14666
+ */ function Ta(t, e, n, s) {
14663
14667
  if (!0 === e && !0 === s) throw new W(Q.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
14664
14668
  }
14665
14669
 
14666
14670
  /**
14667
14671
  * Validates that `path` refers to a document (indicated by the fact it contains
14668
14672
  * an even numbers of segments).
14669
- */ function Ta(t) {
14673
+ */ function Ea(t) {
14670
14674
  if (!Nt.isDocumentKey(t)) throw new W(Q.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
14671
14675
  }
14672
14676
 
14673
14677
  /**
14674
14678
  * Validates that `path` refers to a collection (indicated by the fact it
14675
14679
  * contains an odd numbers of segments).
14676
- */ function Ea(t) {
14680
+ */ function Ia(t) {
14677
14681
  if (Nt.isDocumentKey(t)) throw new W(Q.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
14678
14682
  }
14679
14683
 
@@ -14682,7 +14686,7 @@ function ya(t, e, n) {
14682
14686
  * (i.e. excludes Array, Date, etc.).
14683
14687
  */
14684
14688
  /** Returns a string describing the type / value of the provided input. */
14685
- function Ia(t) {
14689
+ function Aa(t) {
14686
14690
  if (void 0 === t) return "undefined";
14687
14691
  if (null === t) return "null";
14688
14692
  if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
@@ -14711,7 +14715,7 @@ function Ia(t) {
14711
14715
  return "function" == typeof t ? "a function" : U();
14712
14716
  }
14713
14717
 
14714
- function Aa(t,
14718
+ function Ra(t,
14715
14719
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14716
14720
  e) {
14717
14721
  if ("_delegate" in t && (
@@ -14720,14 +14724,14 @@ e) {
14720
14724
  t = t._delegate), !(t instanceof e)) {
14721
14725
  if (e.name === t.constructor.name) throw new W(Q.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
14722
14726
  {
14723
- const n = Ia(t);
14727
+ const n = Aa(t);
14724
14728
  throw new W(Q.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
14725
14729
  }
14726
14730
  }
14727
14731
  return t;
14728
14732
  }
14729
14733
 
14730
- function Ra(t, e) {
14734
+ function ba(t, e) {
14731
14735
  if (e <= 0) throw new W(Q.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
14732
14736
  }
14733
14737
 
@@ -14753,7 +14757,7 @@ function Ra(t, e) {
14753
14757
  * user-supplied `FirestoreSettings` object. This is a separate type so that
14754
14758
  * defaults can be supplied and the value can be checked for equality.
14755
14759
  */
14756
- class ba {
14760
+ class Pa {
14757
14761
  constructor(t) {
14758
14762
  var e;
14759
14763
  if (void 0 === t.host) {
@@ -14766,7 +14770,7 @@ class ba {
14766
14770
  this.cacheSizeBytes = t.cacheSizeBytes;
14767
14771
  }
14768
14772
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
14769
- this.useFetchStreams = !!t.useFetchStreams, pa("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14773
+ this.useFetchStreams = !!t.useFetchStreams, Ta("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14770
14774
  }
14771
14775
  isEqual(t) {
14772
14776
  return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
@@ -14793,18 +14797,18 @@ class ba {
14793
14797
  * The Cloud Firestore service interface.
14794
14798
  *
14795
14799
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
14796
- */ class Pa {
14800
+ */ class va {
14797
14801
  /** @hideconstructor */
14798
14802
  constructor(t, e, n) {
14799
14803
  this._authCredentials = e, this._appCheckCredentials = n,
14800
14804
  /**
14801
14805
  * Whether it's a Firestore or Firestore Lite instance.
14802
14806
  */
14803
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new ba({}),
14804
- this._settingsFrozen = !1, t instanceof ma ? this._databaseId = t : (this._app = t,
14807
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Pa({}),
14808
+ this._settingsFrozen = !1, t instanceof ga ? this._databaseId = t : (this._app = t,
14805
14809
  this._databaseId = function(t) {
14806
14810
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new W(Q.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
14807
- return new ma(t.options.projectId);
14811
+ return new ga(t.options.projectId);
14808
14812
  }
14809
14813
  /**
14810
14814
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -14835,7 +14839,7 @@ class ba {
14835
14839
  }
14836
14840
  _setSettings(t) {
14837
14841
  if (this._settingsFrozen) throw new W(Q.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.");
14838
- this._settings = new ba(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
14842
+ this._settings = new Pa(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
14839
14843
  if (!t) return new H;
14840
14844
  switch (t.type) {
14841
14845
  case "gapi":
@@ -14880,15 +14884,15 @@ class ba {
14880
14884
  * when the `Firestore` instance is terminated.
14881
14885
  */
14882
14886
  return function(t) {
14883
- const e = ga.get(t);
14884
- e && (M("ComponentProvider", "Removing Datastore"), ga.delete(t), e.terminate());
14887
+ const e = ya.get(t);
14888
+ e && (M("ComponentProvider", "Removing Datastore"), ya.delete(t), e.terminate());
14885
14889
  }(this), Promise.resolve();
14886
14890
  }
14887
14891
  }
14888
14892
 
14889
- function va(t, e, n, s = {}) {
14893
+ function Va(t, e, n, s = {}) {
14890
14894
  var i;
14891
- const r = (t = Aa(t, Pa))._getSettings();
14895
+ const r = (t = Ra(t, va))._getSettings();
14892
14896
  if ("firestore.googleapis.com" !== r.host && r.host !== e && L("Host has been set in both settings() and useEmulator(), emulator host will be used"),
14893
14897
  t._setSettings(Object.assign(Object.assign({}, r), {
14894
14898
  host: `${e}:${n}`,
@@ -14927,7 +14931,7 @@ function va(t, e, n, s = {}) {
14927
14931
  * A `DocumentReference` refers to a document location in a Firestore database
14928
14932
  * and can be used to write, read, or listen to the location. The document at
14929
14933
  * the referenced location may or may not exist.
14930
- */ class Va {
14934
+ */ class Sa {
14931
14935
  /** @hideconstructor */
14932
14936
  constructor(t,
14933
14937
  /**
@@ -14955,17 +14959,17 @@ function va(t, e, n, s = {}) {
14955
14959
  /**
14956
14960
  * The collection this `DocumentReference` belongs to.
14957
14961
  */ get parent() {
14958
- return new Da(this.firestore, this.converter, this._key.path.popLast());
14962
+ return new Ca(this.firestore, this.converter, this._key.path.popLast());
14959
14963
  }
14960
14964
  withConverter(t) {
14961
- return new Va(this.firestore, t, this._key);
14965
+ return new Sa(this.firestore, t, this._key);
14962
14966
  }
14963
14967
  }
14964
14968
 
14965
14969
  /**
14966
14970
  * A `Query` refers to a query which you can read or listen to. You can also
14967
14971
  * construct refined `Query` objects by adding filters and ordering.
14968
- */ class Sa {
14972
+ */ class Da {
14969
14973
  // This is the lite version of the Query class in the main SDK.
14970
14974
  /** @hideconstructor protected */
14971
14975
  constructor(t,
@@ -14978,14 +14982,14 @@ function va(t, e, n, s = {}) {
14978
14982
  this.type = "query", this.firestore = t;
14979
14983
  }
14980
14984
  withConverter(t) {
14981
- return new Sa(this.firestore, t, this._query);
14985
+ return new Da(this.firestore, t, this._query);
14982
14986
  }
14983
14987
  }
14984
14988
 
14985
14989
  /**
14986
14990
  * A `CollectionReference` object can be used for adding documents, getting
14987
14991
  * document references, and querying for documents (using {@link query}).
14988
- */ class Da extends Sa {
14992
+ */ class Ca extends Da {
14989
14993
  /** @hideconstructor */
14990
14994
  constructor(t, e, n) {
14991
14995
  super(t, e, Te(n)), this._path = n,
@@ -15006,23 +15010,23 @@ function va(t, e, n, s = {}) {
15006
15010
  * subcollection. If this isn't a subcollection, the reference is null.
15007
15011
  */ get parent() {
15008
15012
  const t = this._path.popLast();
15009
- return t.isEmpty() ? null : new Va(this.firestore,
15013
+ return t.isEmpty() ? null : new Sa(this.firestore,
15010
15014
  /* converter= */ null, new Nt(t));
15011
15015
  }
15012
15016
  withConverter(t) {
15013
- return new Da(this.firestore, t, this._path);
15017
+ return new Ca(this.firestore, t, this._path);
15014
15018
  }
15015
15019
  }
15016
15020
 
15017
- function Ca(t, e, ...n) {
15018
- if (t = T(t), ya("collection", "path", e), t instanceof Pa) {
15021
+ function Na(t, e, ...n) {
15022
+ if (t = T(t), pa("collection", "path", e), t instanceof va) {
15019
15023
  const s = _t.fromString(e, ...n);
15020
- return Ea(s), new Da(t, /* converter= */ null, s);
15024
+ return Ia(s), new Ca(t, /* converter= */ null, s);
15021
15025
  }
15022
15026
  {
15023
- if (!(t instanceof Va || t instanceof Da)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15027
+ if (!(t instanceof Sa || t instanceof Ca)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15024
15028
  const s = t._path.child(_t.fromString(e, ...n));
15025
- return Ea(s), new Da(t.firestore,
15029
+ return Ia(s), new Ca(t.firestore,
15026
15030
  /* converter= */ null, s);
15027
15031
  }
15028
15032
  }
@@ -15039,9 +15043,9 @@ function Ca(t, e, ...n) {
15039
15043
  * collection or subcollection with this ID as the last segment of its path
15040
15044
  * will be included. Cannot contain a slash.
15041
15045
  * @returns The created `Query`.
15042
- */ function Na(t, e) {
15043
- if (t = Aa(t, Pa), ya("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new W(Q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
15044
- return new Sa(t,
15046
+ */ function ka(t, e) {
15047
+ if (t = Ra(t, va), pa("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new W(Q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
15048
+ return new Da(t,
15045
15049
  /* converter= */ null,
15046
15050
  /**
15047
15051
  * Creates a new Query for a collection group query that matches all documents
@@ -15052,19 +15056,19 @@ function Ca(t, e, ...n) {
15052
15056
  }(e));
15053
15057
  }
15054
15058
 
15055
- function ka(t, e, ...n) {
15059
+ function xa(t, e, ...n) {
15056
15060
  if (t = T(t),
15057
15061
  // We allow omission of 'pathString' but explicitly prohibit passing in both
15058
15062
  // 'undefined' and 'null'.
15059
- 1 === arguments.length && (e = rt.A()), ya("doc", "path", e), t instanceof Pa) {
15063
+ 1 === arguments.length && (e = rt.A()), pa("doc", "path", e), t instanceof va) {
15060
15064
  const s = _t.fromString(e, ...n);
15061
- return Ta(s), new Va(t,
15065
+ return Ea(s), new Sa(t,
15062
15066
  /* converter= */ null, new Nt(s));
15063
15067
  }
15064
15068
  {
15065
- if (!(t instanceof Va || t instanceof Da)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15069
+ if (!(t instanceof Sa || t instanceof Ca)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15066
15070
  const s = t._path.child(_t.fromString(e, ...n));
15067
- return Ta(s), new Va(t.firestore, t instanceof Da ? t.converter : null, new Nt(s));
15071
+ return Ea(s), new Sa(t.firestore, t instanceof Ca ? t.converter : null, new Nt(s));
15068
15072
  }
15069
15073
  }
15070
15074
 
@@ -15075,8 +15079,8 @@ function ka(t, e, ...n) {
15075
15079
  * @param right - A reference to compare.
15076
15080
  * @returns true if the references point to the same location in the same
15077
15081
  * Firestore database.
15078
- */ function xa(t, e) {
15079
- return t = T(t), e = T(e), (t instanceof Va || t instanceof Da) && (e instanceof Va || e instanceof Da) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
15082
+ */ function $a(t, e) {
15083
+ return t = T(t), e = T(e), (t instanceof Sa || t instanceof Ca) && (e instanceof Sa || e instanceof Ca) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
15080
15084
  }
15081
15085
 
15082
15086
  /**
@@ -15087,8 +15091,8 @@ function ka(t, e, ...n) {
15087
15091
  * @param right - A `Query` to compare.
15088
15092
  * @returns true if the references point to the same location in the same
15089
15093
  * Firestore database.
15090
- */ function $a(t, e) {
15091
- return t = T(t), e = T(e), t instanceof Sa && e instanceof Sa && (t.firestore === e.firestore && Se(t._query, e._query) && t.converter === e.converter);
15094
+ */ function Oa(t, e) {
15095
+ return t = T(t), e = T(e), t instanceof Da && e instanceof Da && (t.firestore === e.firestore && Se(t._query, e._query) && t.converter === e.converter);
15092
15096
  }
15093
15097
 
15094
15098
  /**
@@ -15106,7 +15110,7 @@ function ka(t, e, ...n) {
15106
15110
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15107
15111
  * See the License for the specific language governing permissions and
15108
15112
  * limitations under the License.
15109
- */ class Oa {
15113
+ */ class Ma {
15110
15114
  constructor() {
15111
15115
  // The last promise in the queue.
15112
15116
  this.mc = Promise.resolve(),
@@ -15243,7 +15247,7 @@ function ka(t, e, ...n) {
15243
15247
  this.Pc(),
15244
15248
  // Fast-forward delays for timerIds that have been overriden.
15245
15249
  this.Rc.indexOf(t) > -1 && (e = 0);
15246
- const s = Lo.createAndSchedule(this, t, e, n, (t => this.Sc(t)));
15250
+ const s = Bo.createAndSchedule(this, t, e, n, (t => this.Sc(t)));
15247
15251
  return this.Tc.push(s), s;
15248
15252
  }
15249
15253
  Pc() {
@@ -15297,7 +15301,7 @@ function ka(t, e, ...n) {
15297
15301
  }
15298
15302
  }
15299
15303
 
15300
- function Ma(t) {
15304
+ function Fa(t) {
15301
15305
  /**
15302
15306
  * Returns true if obj is an object and contains at least one of the specified
15303
15307
  * methods.
@@ -15332,7 +15336,7 @@ function Ma(t) {
15332
15336
  */ (t, [ "next", "error", "complete" ]);
15333
15337
  }
15334
15338
 
15335
- class Fa {
15339
+ class La {
15336
15340
  constructor() {
15337
15341
  this._progressObserver = {}, this._taskCompletionResolver = new G, this._lastProgress = {
15338
15342
  taskState: "Running",
@@ -15416,27 +15420,27 @@ class Fa {
15416
15420
  * See the License for the specific language governing permissions and
15417
15421
  * limitations under the License.
15418
15422
  */
15419
- /** DOMException error code constants. */ const La = -1;
15423
+ /** DOMException error code constants. */ const Ba = -1;
15420
15424
 
15421
15425
  /**
15422
15426
  * The Cloud Firestore service interface.
15423
15427
  *
15424
15428
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
15425
15429
  */
15426
- class Ba extends Pa {
15430
+ class Ua extends va {
15427
15431
  /** @hideconstructor */
15428
15432
  constructor(t, e, n) {
15429
15433
  super(t, e, n),
15430
15434
  /**
15431
15435
  * Whether it's a {@link Firestore} or Firestore Lite instance.
15432
15436
  */
15433
- this.type = "firestore", this._queue = new Oa, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15437
+ this.type = "firestore", this._queue = new Ma, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15434
15438
  }
15435
15439
  _terminate() {
15436
15440
  return this._firestoreClient ||
15437
15441
  // The client must be initialized to ensure that all subsequent API
15438
15442
  // usage throws an exception.
15439
- ja(this), this._firestoreClient.terminate();
15443
+ Qa(this), this._firestoreClient.terminate();
15440
15444
  }
15441
15445
  }
15442
15446
 
@@ -15450,7 +15454,7 @@ class Ba extends Pa {
15450
15454
  * be associated.
15451
15455
  * @param settings - A settings object to configure the {@link Firestore} instance.
15452
15456
  * @returns A newly initialized {@link Firestore} instance.
15453
- */ function Ua(t, e) {
15457
+ */ function qa(t, e) {
15454
15458
  const n = _getProvider(t, "firestore");
15455
15459
  if (n.isInitialized()) {
15456
15460
  const t = n.getImmediate(), s = n.getOptions();
@@ -15471,22 +15475,22 @@ class Ba extends Pa {
15471
15475
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
15472
15476
  * instance is associated with.
15473
15477
  * @returns The {@link Firestore} instance of the provided app.
15474
- */ function qa(e = t()) {
15478
+ */ function Ka(e = t()) {
15475
15479
  return _getProvider(e, "firestore").getImmediate();
15476
15480
  }
15477
15481
 
15478
15482
  /**
15479
15483
  * @internal
15480
- */ function Ka(t) {
15481
- return t._firestoreClient || ja(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15484
+ */ function ja(t) {
15485
+ return t._firestoreClient || Qa(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15482
15486
  }
15483
15487
 
15484
- function ja(t) {
15488
+ function Qa(t) {
15485
15489
  var e;
15486
15490
  const n = t._freezeSettings(), s = function(t, e, n, s) {
15487
- return new _a(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15491
+ return new ma(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15488
15492
  }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
15489
- t._firestoreClient = new Hc(t._authCredentials, t._appCheckCredentials, t._queue, s);
15493
+ t._firestoreClient = new Jc(t._authCredentials, t._appCheckCredentials, t._queue, s);
15490
15494
  }
15491
15495
 
15492
15496
  /**
@@ -15511,10 +15515,10 @@ function ja(t) {
15511
15515
  * @param persistenceSettings - Optional settings object to configure
15512
15516
  * persistence.
15513
15517
  * @returns A `Promise` that represents successfully enabling persistent storage.
15514
- */ function Qa(t, e) {
15515
- eu(t = Aa(t, Ba));
15516
- const n = Ka(t), s = t._freezeSettings(), i = new Kc;
15517
- return Ga(n, i, new Uc(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15518
+ */ function Wa(t, e) {
15519
+ nu(t = Ra(t, Ua));
15520
+ const n = ja(t), s = t._freezeSettings(), i = new jc;
15521
+ return za(n, i, new qc(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15518
15522
  }
15519
15523
 
15520
15524
  /**
@@ -15538,10 +15542,10 @@ function ja(t) {
15538
15542
  * @param firestore - The {@link Firestore} instance to enable persistence for.
15539
15543
  * @returns A `Promise` that represents successfully enabling persistent
15540
15544
  * storage.
15541
- */ function Wa(t) {
15542
- eu(t = Aa(t, Ba));
15543
- const e = Ka(t), n = t._freezeSettings(), s = new Kc;
15544
- return Ga(e, s, new qc(s, n.cacheSizeBytes));
15545
+ */ function Ga(t) {
15546
+ nu(t = Ra(t, Ua));
15547
+ const e = ja(t), n = t._freezeSettings(), s = new jc;
15548
+ return za(e, s, new Kc(s, n.cacheSizeBytes));
15545
15549
  }
15546
15550
 
15547
15551
  /**
@@ -15549,11 +15553,11 @@ function ja(t) {
15549
15553
  * If the operation fails with a recoverable error (see
15550
15554
  * `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
15551
15555
  * but the client remains usable.
15552
- */ function Ga(t, e, n) {
15556
+ */ function za(t, e, n) {
15553
15557
  const s = new G;
15554
15558
  return t.asyncQueue.enqueue((async () => {
15555
15559
  try {
15556
- await Jc(t, n), await Yc(t, e), s.resolve();
15560
+ await Yc(t, n), await Xc(t, e), s.resolve();
15557
15561
  } catch (t) {
15558
15562
  if (!
15559
15563
  /**
@@ -15607,7 +15611,7 @@ function ja(t) {
15607
15611
  })).then((() => s.promise));
15608
15612
  }
15609
15613
 
15610
- function za(t) {
15614
+ function Ha(t) {
15611
15615
  if (t._initialized && !t._terminated) throw new W(Q.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
15612
15616
  const e = new G;
15613
15617
  return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
@@ -15638,11 +15642,11 @@ function za(t) {
15638
15642
  *
15639
15643
  * @returns A `Promise` which resolves when all currently pending writes have been
15640
15644
  * acknowledged by the backend.
15641
- */ function Ha(t) {
15645
+ */ function Ja(t) {
15642
15646
  return function(t) {
15643
15647
  const e = new G;
15644
- return t.asyncQueue.enqueueAndForget((async () => gc(await sa(t), e))), e.promise;
15645
- }(Ka(t = Aa(t, Ba)));
15648
+ return t.asyncQueue.enqueueAndForget((async () => yc(await ia(t), e))), e.promise;
15649
+ }(ja(t = Ra(t, Ua)));
15646
15650
  }
15647
15651
 
15648
15652
  /**
@@ -15650,8 +15654,8 @@ function za(t) {
15650
15654
  * call to {@link disableNetwork}.
15651
15655
  *
15652
15656
  * @returns A `Promise` that is resolved once the network has been enabled.
15653
- */ function Ja(t) {
15654
- return ra(Ka(t = Aa(t, Ba)));
15657
+ */ function Ya(t) {
15658
+ return oa(ja(t = Ra(t, Ua)));
15655
15659
  }
15656
15660
 
15657
15661
  /**
@@ -15661,8 +15665,8 @@ function za(t) {
15661
15665
  * operations will be queued until the network is restored.
15662
15666
  *
15663
15667
  * @returns A `Promise` that is resolved once the network has been disabled.
15664
- */ function Ya(t) {
15665
- return oa(Ka(t = Aa(t, Ba)));
15668
+ */ function Xa(t) {
15669
+ return ca(ja(t = Ra(t, Ua)));
15666
15670
  }
15667
15671
 
15668
15672
  /**
@@ -15686,36 +15690,41 @@ function za(t) {
15686
15690
  *
15687
15691
  * @returns A `Promise` that is resolved when the instance has been successfully
15688
15692
  * terminated.
15689
- */ function Xa(t) {
15693
+ */ function Za(t) {
15690
15694
  return e(t.app, "firestore"), t._delete();
15691
15695
  }
15692
15696
 
15693
15697
  /**
15694
15698
  * Loads a Firestore bundle into the local cache.
15695
15699
  *
15696
- * @param firestore - The {@link Firestore} instance to load bundles for for.
15697
- * @param bundleData - An object representing the bundle to be loaded. Valid objects are
15698
- * `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
15700
+ * @param firestore - The {@link Firestore} instance to load bundles for.
15701
+ * @param bundleData - An object representing the bundle to be loaded. Valid
15702
+ * objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
15699
15703
  *
15700
- * @returns
15701
- * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
15702
- * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
15703
- */ function Za(t, e) {
15704
- const n = Ka(t = Aa(t, Ba)), s = new Fa;
15705
- return da(n, t._databaseId, e, s), s;
15704
+ * @returns A `LoadBundleTask` object, which notifies callers with progress
15705
+ * updates, and completion or error events. It can be used as a
15706
+ * `Promise<LoadBundleTaskProgress>`.
15707
+ */ function tu(t, e) {
15708
+ const n = ja(t = Ra(t, Ua)), s = new La;
15709
+ return wa(n, t._databaseId, e, s), s;
15706
15710
  }
15707
15711
 
15708
15712
  /**
15709
- * Reads a Firestore {@link Query} from local cache, identified by the given name.
15713
+ * Reads a Firestore {@link Query} from local cache, identified by the given
15714
+ * name.
15710
15715
  *
15711
15716
  * The named queries are packaged into bundles on the server side (along
15712
- * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
15713
- * cache, use this method to extract a {@link Query} by name.
15714
- */ function tu(t, e) {
15715
- return wa(Ka(t = Aa(t, Ba)), e).then((e => e ? new Sa(t, null, e.query) : null));
15717
+ * with resulting documents), and loaded to local cache using `loadBundle`. Once
15718
+ * in local cache, use this method to extract a {@link Query} by name.
15719
+ *
15720
+ * @param firestore - The {@link Firestore} instance to read the query from.
15721
+ * @param name - The name of the query.
15722
+ * @returns A `Promise` that is resolved with the Query or `null`.
15723
+ */ function eu(t, e) {
15724
+ return _a(ja(t = Ra(t, Ua)), e).then((e => e ? new Da(t, null, e.query) : null));
15716
15725
  }
15717
15726
 
15718
- function eu(t) {
15727
+ function nu(t) {
15719
15728
  if (t._initialized || t._terminated) throw new W(Q.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
15720
15729
  }
15721
15730
 
@@ -15759,7 +15768,7 @@ function eu(t) {
15759
15768
  * Create a `FieldPath` by providing field names. If more than one field
15760
15769
  * name is provided, the path will point to a nested field in a document.
15761
15770
  */
15762
- class nu {
15771
+ class su {
15763
15772
  /**
15764
15773
  * Creates a `FieldPath` from the provided field names. If more than one field
15765
15774
  * name is provided, the path will point to a nested field in a document.
@@ -15783,8 +15792,8 @@ class nu {
15783
15792
  /**
15784
15793
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
15785
15794
  * It can be used in queries to sort or filter by the document ID.
15786
- */ function su() {
15787
- return new nu("__name__");
15795
+ */ function iu() {
15796
+ return new su("__name__");
15788
15797
  }
15789
15798
 
15790
15799
  /**
@@ -15805,7 +15814,7 @@ class nu {
15805
15814
  */
15806
15815
  /**
15807
15816
  * An immutable object representing an array of bytes.
15808
- */ class iu {
15817
+ */ class ru {
15809
15818
  /** @hideconstructor */
15810
15819
  constructor(t) {
15811
15820
  this._byteString = t;
@@ -15817,7 +15826,7 @@ class nu {
15817
15826
  * @param base64 - The Base64 string used to create the `Bytes` object.
15818
15827
  */ static fromBase64String(t) {
15819
15828
  try {
15820
- return new iu(Et.fromBase64String(t));
15829
+ return new ru(Et.fromBase64String(t));
15821
15830
  } catch (t) {
15822
15831
  throw new W(Q.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t);
15823
15832
  }
@@ -15827,7 +15836,7 @@ class nu {
15827
15836
  *
15828
15837
  * @param array - The Uint8Array used to create the `Bytes` object.
15829
15838
  */ static fromUint8Array(t) {
15830
- return new iu(Et.fromUint8Array(t));
15839
+ return new ru(Et.fromUint8Array(t));
15831
15840
  }
15832
15841
  /**
15833
15842
  * Returns the underlying bytes as a Base64-encoded string.
@@ -15879,7 +15888,7 @@ class nu {
15879
15888
  /**
15880
15889
  * Sentinel values that can be used when writing document fields with `set()`
15881
15890
  * or `update()`.
15882
- */ class ru {
15891
+ */ class ou {
15883
15892
  /**
15884
15893
  * @param _methodName - The public API endpoint that returns this class.
15885
15894
  * @hideconstructor
@@ -15911,7 +15920,7 @@ class nu {
15911
15920
  *
15912
15921
  * Latitude values are in the range of [-90, 90].
15913
15922
  * Longitude values are in the range of [-180, 180].
15914
- */ class ou {
15923
+ */ class cu {
15915
15924
  /**
15916
15925
  * Creates a new immutable `GeoPoint` object with the provided latitude and
15917
15926
  * longitude values.
@@ -15970,9 +15979,9 @@ class nu {
15970
15979
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15971
15980
  * See the License for the specific language governing permissions and
15972
15981
  * limitations under the License.
15973
- */ const cu = /^__.*__$/;
15982
+ */ const au = /^__.*__$/;
15974
15983
 
15975
- /** The result of parsing document data (e.g. for a setData call). */ class au {
15984
+ /** The result of parsing document data (e.g. for a setData call). */ class uu {
15976
15985
  constructor(t, e, n) {
15977
15986
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
15978
15987
  }
@@ -15981,7 +15990,7 @@ class nu {
15981
15990
  }
15982
15991
  }
15983
15992
 
15984
- /** The result of parsing "update" data (i.e. for an updateData call). */ class uu {
15993
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class hu {
15985
15994
  constructor(t,
15986
15995
  // The fieldMask does not include document transforms.
15987
15996
  e, n) {
@@ -15992,7 +16001,7 @@ class nu {
15992
16001
  }
15993
16002
  }
15994
16003
 
15995
- function hu(t) {
16004
+ function lu(t) {
15996
16005
  switch (t) {
15997
16006
  case 0 /* Set */ :
15998
16007
  // fall through
@@ -16010,7 +16019,7 @@ function hu(t) {
16010
16019
  }
16011
16020
  }
16012
16021
 
16013
- /** A "context" object passed around while parsing user data. */ class lu {
16022
+ /** A "context" object passed around while parsing user data. */ class fu {
16014
16023
  /**
16015
16024
  * Initializes a ParseContext with the given source and path.
16016
16025
  *
@@ -16042,7 +16051,7 @@ function hu(t) {
16042
16051
  return this.settings.$c;
16043
16052
  }
16044
16053
  /** Returns a new context with the specified settings overwritten. */ Oc(t) {
16045
- return new lu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
16054
+ return new fu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
16046
16055
  }
16047
16056
  Mc(t) {
16048
16057
  var e;
@@ -16069,7 +16078,7 @@ function hu(t) {
16069
16078
  });
16070
16079
  }
16071
16080
  qc(t) {
16072
- return Cu(t, this.settings.methodName, this.settings.Kc || !1, this.path, this.settings.jc);
16081
+ return Nu(t, this.settings.methodName, this.settings.Kc || !1, this.path, this.settings.jc);
16073
16082
  }
16074
16083
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
16075
16084
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
@@ -16081,19 +16090,19 @@ function hu(t) {
16081
16090
  }
16082
16091
  Lc(t) {
16083
16092
  if (0 === t.length) throw this.qc("Document fields must not be empty");
16084
- if (hu(this.$c) && cu.test(t)) throw this.qc('Document fields cannot begin and end with "__"');
16093
+ if (lu(this.$c) && au.test(t)) throw this.qc('Document fields cannot begin and end with "__"');
16085
16094
  }
16086
16095
  }
16087
16096
 
16088
16097
  /**
16089
16098
  * Helper for parsing raw user input (provided via the API) into internal model
16090
16099
  * classes.
16091
- */ class fu {
16100
+ */ class du {
16092
16101
  constructor(t, e, n) {
16093
16102
  this.databaseId = t, this.ignoreUndefinedProperties = e, this.k = n || so(t);
16094
16103
  }
16095
16104
  /** Creates a new top-level parse context. */ Qc(t, e, n, s = !1) {
16096
- return new lu({
16105
+ return new fu({
16097
16106
  $c: t,
16098
16107
  methodName: e,
16099
16108
  jc: n,
@@ -16104,29 +16113,29 @@ function hu(t) {
16104
16113
  }
16105
16114
  }
16106
16115
 
16107
- function du(t) {
16116
+ function wu(t) {
16108
16117
  const e = t._freezeSettings(), n = so(t._databaseId);
16109
- return new fu(t._databaseId, !!e.ignoreUndefinedProperties, n);
16118
+ return new du(t._databaseId, !!e.ignoreUndefinedProperties, n);
16110
16119
  }
16111
16120
 
16112
- /** Parse document data from a set() call. */ function wu(t, e, n, s, i, r = {}) {
16121
+ /** Parse document data from a set() call. */ function _u(t, e, n, s, i, r = {}) {
16113
16122
  const o = t.Qc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
16114
- vu("Data must be an object, but it was:", o, s);
16115
- const c = bu(s, o);
16123
+ Vu("Data must be an object, but it was:", o, s);
16124
+ const c = Pu(s, o);
16116
16125
  let a, u;
16117
16126
  if (r.merge) a = new yt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
16118
16127
  const t = [];
16119
16128
  for (const s of r.mergeFields) {
16120
- const i = Vu(e, s, n);
16129
+ const i = Su(e, s, n);
16121
16130
  if (!o.contains(i)) throw new W(Q.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
16122
- Nu(t, i) || t.push(i);
16131
+ ku(t, i) || t.push(i);
16123
16132
  }
16124
16133
  a = new yt(t), u = o.fieldTransforms.filter((t => a.covers(t.field)));
16125
16134
  } else a = null, u = o.fieldTransforms;
16126
- return new au(new Gt(c), a, u);
16135
+ return new uu(new Gt(c), a, u);
16127
16136
  }
16128
16137
 
16129
- class _u extends ru {
16138
+ class mu extends ou {
16130
16139
  _toFieldTransform(t) {
16131
16140
  if (2 /* MergeSet */ !== t.$c) throw 1 /* Update */ === t.$c ? t.qc(`${this._methodName}() can only appear at the top level of your update data`) : t.qc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
16132
16141
  // No transform to add for a delete, but we need to add it to our
@@ -16134,7 +16143,7 @@ class _u extends ru {
16134
16143
  return t.fieldMask.push(t.path), null;
16135
16144
  }
16136
16145
  isEqual(t) {
16137
- return t instanceof _u;
16146
+ return t instanceof mu;
16138
16147
  }
16139
16148
  }
16140
16149
 
@@ -16153,8 +16162,8 @@ class _u extends ru {
16153
16162
  * context.
16154
16163
  * @param context - The parent context.
16155
16164
  * @param arrayElement - Whether or not the FieldValue has an array.
16156
- */ function mu(t, e, n) {
16157
- return new lu({
16165
+ */ function gu(t, e, n) {
16166
+ return new fu({
16158
16167
  $c: 3 /* Argument */ ,
16159
16168
  jc: e.settings.jc,
16160
16169
  methodName: t._methodName,
@@ -16162,22 +16171,22 @@ class _u extends ru {
16162
16171
  }, e.databaseId, e.k, e.ignoreUndefinedProperties);
16163
16172
  }
16164
16173
 
16165
- class gu extends ru {
16174
+ class yu extends ou {
16166
16175
  _toFieldTransform(t) {
16167
16176
  return new Je(t.path, new qe);
16168
16177
  }
16169
16178
  isEqual(t) {
16170
- return t instanceof gu;
16179
+ return t instanceof yu;
16171
16180
  }
16172
16181
  }
16173
16182
 
16174
- class yu extends ru {
16183
+ class pu extends ou {
16175
16184
  constructor(t, e) {
16176
16185
  super(t), this.Wc = e;
16177
16186
  }
16178
16187
  _toFieldTransform(t) {
16179
- const e = mu(this, t,
16180
- /*array=*/ !0), n = this.Wc.map((t => Ru(t, e))), s = new Ke(n);
16188
+ const e = gu(this, t,
16189
+ /*array=*/ !0), n = this.Wc.map((t => bu(t, e))), s = new Ke(n);
16181
16190
  return new Je(t.path, s);
16182
16191
  }
16183
16192
  isEqual(t) {
@@ -16186,13 +16195,13 @@ class yu extends ru {
16186
16195
  }
16187
16196
  }
16188
16197
 
16189
- class pu extends ru {
16198
+ class Tu extends ou {
16190
16199
  constructor(t, e) {
16191
16200
  super(t), this.Wc = e;
16192
16201
  }
16193
16202
  _toFieldTransform(t) {
16194
- const e = mu(this, t,
16195
- /*array=*/ !0), n = this.Wc.map((t => Ru(t, e))), s = new Qe(n);
16203
+ const e = gu(this, t,
16204
+ /*array=*/ !0), n = this.Wc.map((t => bu(t, e))), s = new Qe(n);
16196
16205
  return new Je(t.path, s);
16197
16206
  }
16198
16207
  isEqual(t) {
@@ -16201,7 +16210,7 @@ class pu extends ru {
16201
16210
  }
16202
16211
  }
16203
16212
 
16204
- class Tu extends ru {
16213
+ class Eu extends ou {
16205
16214
  constructor(t, e) {
16206
16215
  super(t), this.Gc = e;
16207
16216
  }
@@ -16215,50 +16224,50 @@ class Tu extends ru {
16215
16224
  }
16216
16225
  }
16217
16226
 
16218
- /** Parse update data from an update() call. */ function Eu(t, e, n, s) {
16227
+ /** Parse update data from an update() call. */ function Iu(t, e, n, s) {
16219
16228
  const i = t.Qc(1 /* Update */ , e, n);
16220
- vu("Data must be an object, but it was:", i, s);
16229
+ Vu("Data must be an object, but it was:", i, s);
16221
16230
  const r = [], o = Gt.empty();
16222
16231
  ft(s, ((t, s) => {
16223
- const c = Du(e, t, n);
16232
+ const c = Cu(e, t, n);
16224
16233
  // For Compat types, we have to "extract" the underlying types before
16225
16234
  // performing validation.
16226
16235
  s = T(s);
16227
16236
  const a = i.Bc(c);
16228
- if (s instanceof _u)
16237
+ if (s instanceof mu)
16229
16238
  // Add it to the field mask, but don't add anything to updateData.
16230
16239
  r.push(c); else {
16231
- const t = Ru(s, a);
16240
+ const t = bu(s, a);
16232
16241
  null != t && (r.push(c), o.set(c, t));
16233
16242
  }
16234
16243
  }));
16235
16244
  const c = new yt(r);
16236
- return new uu(o, c, i.fieldTransforms);
16245
+ return new hu(o, c, i.fieldTransforms);
16237
16246
  }
16238
16247
 
16239
- /** Parse update data from a list of field/value arguments. */ function Iu(t, e, n, s, i, r) {
16240
- const o = t.Qc(1 /* Update */ , e, n), c = [ Vu(e, s, n) ], a = [ i ];
16248
+ /** Parse update data from a list of field/value arguments. */ function Au(t, e, n, s, i, r) {
16249
+ const o = t.Qc(1 /* Update */ , e, n), c = [ Su(e, s, n) ], a = [ i ];
16241
16250
  if (r.length % 2 != 0) throw new W(Q.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
16242
- for (let t = 0; t < r.length; t += 2) c.push(Vu(e, r[t])), a.push(r[t + 1]);
16251
+ for (let t = 0; t < r.length; t += 2) c.push(Su(e, r[t])), a.push(r[t + 1]);
16243
16252
  const u = [], h = Gt.empty();
16244
16253
  // We iterate in reverse order to pick the last value for a field if the
16245
16254
  // user specified the field multiple times.
16246
- for (let t = c.length - 1; t >= 0; --t) if (!Nu(u, c[t])) {
16255
+ for (let t = c.length - 1; t >= 0; --t) if (!ku(u, c[t])) {
16247
16256
  const e = c[t];
16248
16257
  let n = a[t];
16249
16258
  // For Compat types, we have to "extract" the underlying types before
16250
16259
  // performing validation.
16251
16260
  n = T(n);
16252
16261
  const s = o.Bc(e);
16253
- if (n instanceof _u)
16262
+ if (n instanceof mu)
16254
16263
  // Add it to the field mask, but don't add anything to updateData.
16255
16264
  u.push(e); else {
16256
- const t = Ru(n, s);
16265
+ const t = bu(n, s);
16257
16266
  null != t && (u.push(e), h.set(e, t));
16258
16267
  }
16259
16268
  }
16260
16269
  const l = new yt(u);
16261
- return new uu(h, l, o.fieldTransforms);
16270
+ return new hu(h, l, o.fieldTransforms);
16262
16271
  }
16263
16272
 
16264
16273
  /**
@@ -16267,8 +16276,8 @@ class Tu extends ru {
16267
16276
  *
16268
16277
  * @param allowArrays - Whether the query value is an array that may directly
16269
16278
  * contain additional arrays (e.g. the operand of an `in` query).
16270
- */ function Au(t, e, n, s = !1) {
16271
- return Ru(n, t.Qc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16279
+ */ function Ru(t, e, n, s = !1) {
16280
+ return bu(n, t.Qc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16272
16281
  }
16273
16282
 
16274
16283
  /**
@@ -16279,12 +16288,12 @@ class Tu extends ru {
16279
16288
  * the source of the data being parsed, etc.
16280
16289
  * @returns The parsed value, or null if the value was a FieldValue sentinel
16281
16290
  * that should not be included in the resulting parsed data.
16282
- */ function Ru(t, e) {
16283
- if (Pu(
16291
+ */ function bu(t, e) {
16292
+ if (vu(
16284
16293
  // Unwrap the API type from the Compat SDK. This will return the API type
16285
16294
  // from firestore-exp.
16286
- t = T(t))) return vu("Unsupported field value:", e, t), bu(t, e);
16287
- if (t instanceof ru)
16295
+ t = T(t))) return Vu("Unsupported field value:", e, t), Pu(t, e);
16296
+ if (t instanceof ou)
16288
16297
  // FieldValues usually parse into transforms (except deleteField())
16289
16298
  // in which case we do not want to include this field in our parsed data
16290
16299
  // (as doing so will overwrite the field directly prior to the transform
@@ -16296,7 +16305,7 @@ class Tu extends ru {
16296
16305
  */
16297
16306
  return function(t, e) {
16298
16307
  // Sentinels are only supported with writes, and not within arrays.
16299
- if (!hu(e.$c)) throw e.qc(`${t._methodName}() can only be used with update() and set()`);
16308
+ if (!lu(e.$c)) throw e.qc(`${t._methodName}() can only be used with update() and set()`);
16300
16309
  if (!e.path) throw e.qc(`${t._methodName}() is not currently supported inside arrays`);
16301
16310
  const n = t._toFieldTransform(e);
16302
16311
  n && e.fieldTransforms.push(n);
@@ -16326,7 +16335,7 @@ class Tu extends ru {
16326
16335
  const n = [];
16327
16336
  let s = 0;
16328
16337
  for (const i of t) {
16329
- let t = Ru(i, e.Uc(s));
16338
+ let t = bu(i, e.Uc(s));
16330
16339
  null == t && (
16331
16340
  // Just include nulls in the array for fields being replaced with a
16332
16341
  // sentinel.
@@ -16367,23 +16376,23 @@ class Tu extends ru {
16367
16376
  timestampValue: Gn(e.k, n)
16368
16377
  };
16369
16378
  }
16370
- if (t instanceof ou) return {
16379
+ if (t instanceof cu) return {
16371
16380
  geoPointValue: {
16372
16381
  latitude: t.latitude,
16373
16382
  longitude: t.longitude
16374
16383
  }
16375
16384
  };
16376
- if (t instanceof iu) return {
16385
+ if (t instanceof ru) return {
16377
16386
  bytesValue: zn(e.k, t._byteString)
16378
16387
  };
16379
- if (t instanceof Va) {
16388
+ if (t instanceof Sa) {
16380
16389
  const n = e.databaseId, s = t.firestore._databaseId;
16381
16390
  if (!s.isEqual(n)) throw e.qc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
16382
16391
  return {
16383
16392
  referenceValue: Yn(t.firestore._databaseId || e.databaseId, t._key.path)
16384
16393
  };
16385
16394
  }
16386
- throw e.qc(`Unsupported field value: ${Ia(t)}`);
16395
+ throw e.qc(`Unsupported field value: ${Aa(t)}`);
16387
16396
  }
16388
16397
  /**
16389
16398
  * Checks whether an object looks like a JSON object that should be converted
@@ -16394,13 +16403,13 @@ class Tu extends ru {
16394
16403
  */ (t, e);
16395
16404
  }
16396
16405
 
16397
- function bu(t, e) {
16406
+ function Pu(t, e) {
16398
16407
  const n = {};
16399
16408
  return dt(t) ?
16400
16409
  // If we encounter an empty object, we explicitly add it to the update
16401
16410
  // mask to ensure that the server creates a map entry.
16402
16411
  e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ft(t, ((t, s) => {
16403
- const i = Ru(s, e.Mc(t));
16412
+ const i = bu(s, e.Mc(t));
16404
16413
  null != i && (n[t] = i);
16405
16414
  })), {
16406
16415
  mapValue: {
@@ -16409,35 +16418,35 @@ function bu(t, e) {
16409
16418
  };
16410
16419
  }
16411
16420
 
16412
- function Pu(t) {
16413
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof ou || t instanceof iu || t instanceof Va || t instanceof ru);
16421
+ function vu(t) {
16422
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof cu || t instanceof ru || t instanceof Sa || t instanceof ou);
16414
16423
  }
16415
16424
 
16416
- function vu(t, e, n) {
16417
- if (!Pu(n) || !function(t) {
16425
+ function Vu(t, e, n) {
16426
+ if (!vu(n) || !function(t) {
16418
16427
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
16419
16428
  }(n)) {
16420
- const s = Ia(n);
16429
+ const s = Aa(n);
16421
16430
  throw "an object" === s ? e.qc(t + " a custom object") : e.qc(t + " " + s);
16422
16431
  }
16423
16432
  }
16424
16433
 
16425
16434
  /**
16426
16435
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
16427
- */ function Vu(t, e, n) {
16436
+ */ function Su(t, e, n) {
16428
16437
  if ((
16429
16438
  // If required, replace the FieldPath Compat class with with the firestore-exp
16430
16439
  // FieldPath.
16431
- e = T(e)) instanceof nu) return e._internalPath;
16432
- if ("string" == typeof e) return Du(t, e);
16433
- throw Cu("Field path arguments must be of type string or ", t,
16440
+ e = T(e)) instanceof su) return e._internalPath;
16441
+ if ("string" == typeof e) return Cu(t, e);
16442
+ throw Nu("Field path arguments must be of type string or ", t,
16434
16443
  /* hasConverter= */ !1,
16435
16444
  /* path= */ void 0, n);
16436
16445
  }
16437
16446
 
16438
16447
  /**
16439
16448
  * Matches any characters in a field path string that are reserved.
16440
- */ const Su = new RegExp("[~\\*/\\[\\]]");
16449
+ */ const Du = new RegExp("[~\\*/\\[\\]]");
16441
16450
 
16442
16451
  /**
16443
16452
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -16447,20 +16456,20 @@ function vu(t, e, n) {
16447
16456
  * split on dots.
16448
16457
  * @param targetDoc - The document against which the field path will be
16449
16458
  * evaluated.
16450
- */ function Du(t, e, n) {
16451
- if (e.search(Su) >= 0) throw Cu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
16459
+ */ function Cu(t, e, n) {
16460
+ if (e.search(Du) >= 0) throw Nu(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
16452
16461
  /* hasConverter= */ !1,
16453
16462
  /* path= */ void 0, n);
16454
16463
  try {
16455
- return new nu(...e.split("."))._internalPath;
16464
+ return new su(...e.split("."))._internalPath;
16456
16465
  } catch (s) {
16457
- throw Cu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
16466
+ throw Nu(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
16458
16467
  /* hasConverter= */ !1,
16459
16468
  /* path= */ void 0, n);
16460
16469
  }
16461
16470
  }
16462
16471
 
16463
- function Cu(t, e, n, s, i) {
16472
+ function Nu(t, e, n, s, i) {
16464
16473
  const r = s && !s.isEmpty(), o = void 0 !== i;
16465
16474
  let c = `Function ${e}() called with invalid data`;
16466
16475
  n && (c += " (via `toFirestore()`)"), c += ". ";
@@ -16469,7 +16478,7 @@ function Cu(t, e, n, s, i) {
16469
16478
  a += ")"), new W(Q.INVALID_ARGUMENT, c + t + a);
16470
16479
  }
16471
16480
 
16472
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Nu(t, e) {
16481
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function ku(t, e) {
16473
16482
  return t.some((t => t.isEqual(e)));
16474
16483
  }
16475
16484
 
@@ -16497,7 +16506,7 @@ function Cu(t, e, n, s, i) {
16497
16506
  * For a `DocumentSnapshot` that points to a non-existing document, any data
16498
16507
  * access will return 'undefined'. You can use the `exists()` method to
16499
16508
  * explicitly verify a document's existence.
16500
- */ class ku {
16509
+ */ class xu {
16501
16510
  // Note: This class is stripped down version of the DocumentSnapshot in
16502
16511
  // the legacy SDK. The changes are:
16503
16512
  // - No support for SnapshotMetadata.
@@ -16513,7 +16522,7 @@ function Cu(t, e, n, s, i) {
16513
16522
  /**
16514
16523
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
16515
16524
  */ get ref() {
16516
- return new Va(this._firestore, this._converter, this._key);
16525
+ return new Sa(this._firestore, this._converter, this._key);
16517
16526
  }
16518
16527
  /**
16519
16528
  * Signals whether or not the document at the snapshot's location exists.
@@ -16533,7 +16542,7 @@ function Cu(t, e, n, s, i) {
16533
16542
  if (this._converter) {
16534
16543
  // We only want to use the converter and create a new DocumentSnapshot
16535
16544
  // if a converter has been provided.
16536
- const t = new xu(this._firestore, this._userDataWriter, this._key, this._document,
16545
+ const t = new $u(this._firestore, this._userDataWriter, this._key, this._document,
16537
16546
  /* converter= */ null);
16538
16547
  return this._converter.fromFirestore(t);
16539
16548
  }
@@ -16553,7 +16562,7 @@ function Cu(t, e, n, s, i) {
16553
16562
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16554
16563
  get(t) {
16555
16564
  if (this._document) {
16556
- const e = this._document.data.field($u("DocumentSnapshot.get", t));
16565
+ const e = this._document.data.field(Ou("DocumentSnapshot.get", t));
16557
16566
  if (null !== e) return this._userDataWriter.convertValue(e);
16558
16567
  }
16559
16568
  }
@@ -16569,7 +16578,7 @@ function Cu(t, e, n, s, i) {
16569
16578
  * `DocumentSnapshot`. Since query results contain only existing documents, the
16570
16579
  * `exists` property will always be true and `data()` will never return
16571
16580
  * 'undefined'.
16572
- */ class xu extends ku {
16581
+ */ class $u extends xu {
16573
16582
  /**
16574
16583
  * Retrieves all fields in the document as an `Object`.
16575
16584
  *
@@ -16583,8 +16592,8 @@ function Cu(t, e, n, s, i) {
16583
16592
 
16584
16593
  /**
16585
16594
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
16586
- */ function $u(t, e) {
16587
- return "string" == typeof e ? Du(t, e) : e instanceof nu ? e._internalPath : e._delegate._internalPath;
16595
+ */ function Ou(t, e) {
16596
+ return "string" == typeof e ? Cu(t, e) : e instanceof su ? e._internalPath : e._delegate._internalPath;
16588
16597
  }
16589
16598
 
16590
16599
  /**
@@ -16605,7 +16614,7 @@ function Cu(t, e, n, s, i) {
16605
16614
  */
16606
16615
  /**
16607
16616
  * Metadata about a snapshot, describing the state of the snapshot.
16608
- */ class Ou {
16617
+ */ class Mu {
16609
16618
  /** @hideconstructor */
16610
16619
  constructor(t, e) {
16611
16620
  this.hasPendingWrites = t, this.fromCache = e;
@@ -16628,7 +16637,7 @@ function Cu(t, e, n, s, i) {
16628
16637
  * For a `DocumentSnapshot` that points to a non-existing document, any data
16629
16638
  * access will return 'undefined'. You can use the `exists()` method to
16630
16639
  * explicitly verify a document's existence.
16631
- */ class Mu extends ku {
16640
+ */ class Fu extends xu {
16632
16641
  /** @hideconstructor protected */
16633
16642
  constructor(t, e, n, s, i, r) {
16634
16643
  super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i;
@@ -16657,7 +16666,7 @@ function Cu(t, e, n, s, i) {
16657
16666
  if (this._converter) {
16658
16667
  // We only want to use the converter and create a new DocumentSnapshot
16659
16668
  // if a converter has been provided.
16660
- const e = new Fu(this._firestore, this._userDataWriter, this._key, this._document, this.metadata,
16669
+ const e = new Lu(this._firestore, this._userDataWriter, this._key, this._document, this.metadata,
16661
16670
  /* converter= */ null);
16662
16671
  return this._converter.fromFirestore(e, t);
16663
16672
  }
@@ -16684,7 +16693,7 @@ function Cu(t, e, n, s, i) {
16684
16693
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16685
16694
  get(t, e = {}) {
16686
16695
  if (this._document) {
16687
- const n = this._document.data.field($u("DocumentSnapshot.get", t));
16696
+ const n = this._document.data.field(Ou("DocumentSnapshot.get", t));
16688
16697
  if (null !== n) return this._userDataWriter.convertValue(n, e.serverTimestamps);
16689
16698
  }
16690
16699
  }
@@ -16700,7 +16709,7 @@ function Cu(t, e, n, s, i) {
16700
16709
  * `DocumentSnapshot`. Since query results contain only existing documents, the
16701
16710
  * `exists` property will always be true and `data()` will never return
16702
16711
  * 'undefined'.
16703
- */ class Fu extends Mu {
16712
+ */ class Lu extends Fu {
16704
16713
  /**
16705
16714
  * Retrieves all fields in the document as an `Object`.
16706
16715
  *
@@ -16725,10 +16734,10 @@ function Cu(t, e, n, s, i) {
16725
16734
  * array via the `docs` property or enumerated using the `forEach` method. The
16726
16735
  * number of documents can be determined via the `empty` and `size`
16727
16736
  * properties.
16728
- */ class Lu {
16737
+ */ class Bu {
16729
16738
  /** @hideconstructor */
16730
16739
  constructor(t, e, n, s) {
16731
- this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new Ou(s.hasPendingWrites, s.fromCache),
16740
+ this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new Mu(s.hasPendingWrites, s.fromCache),
16732
16741
  this.query = n;
16733
16742
  }
16734
16743
  /** An array of all the documents in the `QuerySnapshot`. */ get docs() {
@@ -16749,7 +16758,7 @@ function Cu(t, e, n, s, i) {
16749
16758
  * @param thisArg - The `this` binding for the callback.
16750
16759
  */ forEach(t, e) {
16751
16760
  this._snapshot.docs.forEach((n => {
16752
- t.call(e, new Fu(this._firestore, this._userDataWriter, n.key, n, new Ou(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));
16761
+ t.call(e, new Lu(this._firestore, this._userDataWriter, n.key, n, new Mu(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));
16753
16762
  }));
16754
16763
  }
16755
16764
  /**
@@ -16770,7 +16779,7 @@ function Cu(t, e, n, s, i) {
16770
16779
  let e = 0;
16771
16780
  return t._snapshot.docChanges.map((n => ({
16772
16781
  type: "added",
16773
- doc: new Fu(t._firestore, t._userDataWriter, n.doc.key, n.doc, new Ou(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter),
16782
+ doc: new Lu(t._firestore, t._userDataWriter, n.doc.key, n.doc, new Mu(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter),
16774
16783
  oldIndex: -1,
16775
16784
  newIndex: e++
16776
16785
  })));
@@ -16780,11 +16789,11 @@ function Cu(t, e, n, s, i) {
16780
16789
  // to lookup the index of a document.
16781
16790
  let n = t._snapshot.oldDocs;
16782
16791
  return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
16783
- const s = new Fu(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Ou(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
16792
+ const s = new Lu(t._firestore, t._userDataWriter, e.doc.key, e.doc, new Mu(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
16784
16793
  let i = -1, r = -1;
16785
16794
  return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
16786
16795
  1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), {
16787
- type: Bu(e.type),
16796
+ type: Uu(e.type),
16788
16797
  doc: s,
16789
16798
  oldIndex: i,
16790
16799
  newIndex: r
@@ -16795,7 +16804,7 @@ function Cu(t, e, n, s, i) {
16795
16804
  }
16796
16805
  }
16797
16806
 
16798
- function Bu(t) {
16807
+ function Uu(t) {
16799
16808
  switch (t) {
16800
16809
  case 0 /* Added */ :
16801
16810
  return "added";
@@ -16820,8 +16829,8 @@ function Bu(t) {
16820
16829
  * @param left - A snapshot to compare.
16821
16830
  * @param right - A snapshot to compare.
16822
16831
  * @returns true if the snapshots are equal.
16823
- */ function Uu(t, e) {
16824
- return t instanceof Mu && e instanceof Mu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Lu && e instanceof Lu && (t._firestore === e._firestore && $a(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16832
+ */ function qu(t, e) {
16833
+ return t instanceof Fu && e instanceof Fu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Bu && e instanceof Bu && (t._firestore === e._firestore && Oa(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16825
16834
  }
16826
16835
 
16827
16836
  /**
@@ -16839,7 +16848,7 @@ function Bu(t) {
16839
16848
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16840
16849
  * See the License for the specific language governing permissions and
16841
16850
  * limitations under the License.
16842
- */ function qu(t) {
16851
+ */ function Ku(t) {
16843
16852
  if (Ie(t) && 0 === t.explicitOrderBy.length) throw new W(Q.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
16844
16853
  }
16845
16854
 
@@ -16850,7 +16859,7 @@ function Bu(t) {
16850
16859
  * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
16851
16860
  * can then be passed to {@link query} to create a new query instance that
16852
16861
  * also contains this `QueryConstraint`.
16853
- */ class Ku {}
16862
+ */ class ju {}
16854
16863
 
16855
16864
  /**
16856
16865
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -16860,32 +16869,32 @@ function Bu(t) {
16860
16869
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
16861
16870
  * @throws if any of the provided query constraints cannot be combined with the
16862
16871
  * existing or new constraints.
16863
- */ function ju(t, ...e) {
16872
+ */ function Qu(t, ...e) {
16864
16873
  for (const n of e) t = n._apply(t);
16865
16874
  return t;
16866
16875
  }
16867
16876
 
16868
- class Qu extends Ku {
16877
+ class Wu extends ju {
16869
16878
  constructor(t, e, n) {
16870
16879
  super(), this.zc = t, this.Hc = e, this.Jc = n, this.type = "where";
16871
16880
  }
16872
16881
  _apply(t) {
16873
- const e = du(t.firestore), n = function(t, e, n, s, i, r, o) {
16882
+ const e = wu(t.firestore), n = function(t, e, n, s, i, r, o) {
16874
16883
  let c;
16875
16884
  if (i.isKeyField()) {
16876
16885
  if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new W(Q.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`);
16877
16886
  if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
16878
- oh(o, r);
16887
+ ch(o, r);
16879
16888
  const e = [];
16880
- for (const n of o) e.push(rh(s, t, n));
16889
+ for (const n of o) e.push(oh(s, t, n));
16881
16890
  c = {
16882
16891
  arrayValue: {
16883
16892
  values: e
16884
16893
  }
16885
16894
  };
16886
- } else c = rh(s, t, o);
16887
- } else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || oh(o, r),
16888
- c = Au(n, e, o,
16895
+ } else c = oh(s, t, o);
16896
+ } else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || ch(o, r),
16897
+ c = Ru(n, e, o,
16889
16898
  /* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
16890
16899
  const a = ne.create(i, r, c);
16891
16900
  return function(t, e) {
@@ -16893,7 +16902,7 @@ class Qu extends Ku {
16893
16902
  const n = Re(t);
16894
16903
  if (null !== n && !n.isEqual(e.field)) throw new W(Q.INVALID_ARGUMENT, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
16895
16904
  const s = Ae(t);
16896
- null !== s && ch(t, e.field, s);
16905
+ null !== s && ah(t, e.field, s);
16897
16906
  }
16898
16907
  const n = function(t, e) {
16899
16908
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -16937,7 +16946,7 @@ class Qu extends Ku {
16937
16946
  throw n === e.op ? new W(Q.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new W(Q.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
16938
16947
  }(t, a), a;
16939
16948
  }(t._query, "where", e, t.firestore._databaseId, this.zc, this.Hc, this.Jc);
16940
- return new Sa(t.firestore, t.converter, function(t, e) {
16949
+ return new Da(t.firestore, t.converter, function(t, e) {
16941
16950
  const n = t.filters.concat([ e ]);
16942
16951
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
16943
16952
  }(t._query, n));
@@ -16954,12 +16963,12 @@ class Qu extends Ku {
16954
16963
  * "&lt;=", "!=").
16955
16964
  * @param value - The value for comparison
16956
16965
  * @returns The created {@link Query}.
16957
- */ function Wu(t, e, n) {
16958
- const s = e, i = $u("where", t);
16959
- return new Qu(i, s, n);
16966
+ */ function Gu(t, e, n) {
16967
+ const s = e, i = Ou("where", t);
16968
+ return new Wu(i, s, n);
16960
16969
  }
16961
16970
 
16962
- class Gu extends Ku {
16971
+ class zu extends ju {
16963
16972
  constructor(t, e) {
16964
16973
  super(), this.zc = t, this.Yc = e, this.type = "orderBy";
16965
16974
  }
@@ -16972,7 +16981,7 @@ class Gu extends Ku {
16972
16981
  if (null === Ae(t)) {
16973
16982
  // This is the first order by. It must match any inequality.
16974
16983
  const n = Re(t);
16975
- null !== n && ch(t, n, e.field);
16984
+ null !== n && ah(t, n, e.field);
16976
16985
  }
16977
16986
  }(t, s), s;
16978
16987
  }
@@ -16987,7 +16996,7 @@ class Gu extends Ku {
16987
16996
  * of the query or if any of the fields in the order by are an uncommitted
16988
16997
  * server timestamp.
16989
16998
  */ (t._query, this.zc, this.Yc);
16990
- return new Sa(t.firestore, t.converter, function(t, e) {
16999
+ return new Da(t.firestore, t.converter, function(t, e) {
16991
17000
  // TODO(dimond): validate that orderBy does not list the same key twice.
16992
17001
  const n = t.explicitOrderBy.concat([ e ]);
16993
17002
  return new ye(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
@@ -17003,17 +17012,17 @@ class Gu extends Ku {
17003
17012
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
17004
17013
  * not specified, order will be ascending.
17005
17014
  * @returns The created {@link Query}.
17006
- */ function zu(t, e = "asc") {
17007
- const n = e, s = $u("orderBy", t);
17008
- return new Gu(s, n);
17015
+ */ function Hu(t, e = "asc") {
17016
+ const n = e, s = Ou("orderBy", t);
17017
+ return new zu(s, n);
17009
17018
  }
17010
17019
 
17011
- class Hu extends Ku {
17020
+ class Ju extends ju {
17012
17021
  constructor(t, e, n) {
17013
17022
  super(), this.type = t, this.Xc = e, this.Zc = n;
17014
17023
  }
17015
17024
  _apply(t) {
17016
- return new Sa(t.firestore, t.converter, Ve(t._query, this.Xc, this.Zc));
17025
+ return new Da(t.firestore, t.converter, Ve(t._query, this.Xc, this.Zc));
17017
17026
  }
17018
17027
  }
17019
17028
 
@@ -17022,8 +17031,8 @@ class Hu extends Ku {
17022
17031
  *
17023
17032
  * @param limit - The maximum number of items to return.
17024
17033
  * @returns The created {@link Query}.
17025
- */ function Ju(t) {
17026
- return Ra("limit", t), new Hu("limit", t, "F" /* First */);
17034
+ */ function Yu(t) {
17035
+ return ba("limit", t), new Ju("limit", t, "F" /* First */);
17027
17036
  }
17028
17037
 
17029
17038
  /**
@@ -17034,53 +17043,53 @@ class Hu extends Ku {
17034
17043
  *
17035
17044
  * @param limit - The maximum number of items to return.
17036
17045
  * @returns The created {@link Query}.
17037
- */ function Yu(t) {
17038
- return Ra("limitToLast", t), new Hu("limitToLast", t, "L" /* Last */);
17046
+ */ function Xu(t) {
17047
+ return ba("limitToLast", t), new Ju("limitToLast", t, "L" /* Last */);
17039
17048
  }
17040
17049
 
17041
- class Xu extends Ku {
17050
+ class Zu extends ju {
17042
17051
  constructor(t, e, n) {
17043
17052
  super(), this.type = t, this.ta = e, this.ea = n;
17044
17053
  }
17045
17054
  _apply(t) {
17046
- const e = ih(t, this.type, this.ta, this.ea);
17047
- return new Sa(t.firestore, t.converter, function(t, e) {
17055
+ const e = rh(t, this.type, this.ta, this.ea);
17056
+ return new Da(t.firestore, t.converter, function(t, e) {
17048
17057
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
17049
17058
  }(t._query, e));
17050
17059
  }
17051
17060
  }
17052
17061
 
17053
- function Zu(...t) {
17054
- return new Xu("startAt", t, /*before=*/ !0);
17062
+ function th(...t) {
17063
+ return new Zu("startAt", t, /*before=*/ !0);
17055
17064
  }
17056
17065
 
17057
- function th(...t) {
17058
- return new Xu("startAfter", t,
17066
+ function eh(...t) {
17067
+ return new Zu("startAfter", t,
17059
17068
  /*before=*/ !1);
17060
17069
  }
17061
17070
 
17062
- class eh extends Ku {
17071
+ class nh extends ju {
17063
17072
  constructor(t, e, n) {
17064
17073
  super(), this.type = t, this.ta = e, this.ea = n;
17065
17074
  }
17066
17075
  _apply(t) {
17067
- const e = ih(t, this.type, this.ta, this.ea);
17068
- return new Sa(t.firestore, t.converter, function(t, e) {
17076
+ const e = rh(t, this.type, this.ta, this.ea);
17077
+ return new Da(t.firestore, t.converter, function(t, e) {
17069
17078
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
17070
17079
  }(t._query, e));
17071
17080
  }
17072
17081
  }
17073
17082
 
17074
- function nh(...t) {
17075
- return new eh("endBefore", t, /*before=*/ !0);
17083
+ function sh(...t) {
17084
+ return new nh("endBefore", t, /*before=*/ !0);
17076
17085
  }
17077
17086
 
17078
- function sh(...t) {
17079
- return new eh("endAt", t, /*before=*/ !1);
17087
+ function ih(...t) {
17088
+ return new nh("endAt", t, /*before=*/ !1);
17080
17089
  }
17081
17090
 
17082
- /** Helper function to create a bound from a document or fields */ function ih(t, e, n, s) {
17083
- if (n[0] = T(n[0]), n[0] instanceof ku) return function(t, e, n, s, i) {
17091
+ /** Helper function to create a bound from a document or fields */ function rh(t, e, n, s) {
17092
+ if (n[0] = T(n[0]), n[0] instanceof xu) return function(t, e, n, s, i) {
17084
17093
  if (!s) throw new W(Q.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
17085
17094
  const r = [];
17086
17095
  // Because people expect to continue/end a query at the exact document
@@ -17105,7 +17114,7 @@ function sh(...t) {
17105
17114
  * Converts a list of field values to a `Bound` for the given query.
17106
17115
  */ (t._query, t.firestore._databaseId, e, n[0]._document, s);
17107
17116
  {
17108
- const i = du(t.firestore);
17117
+ const i = wu(t.firestore);
17109
17118
  return function(t, e, n, s, i, r) {
17110
17119
  // Use explicit order by's because it has to match the query the user made
17111
17120
  const o = t.explicitOrderBy;
@@ -17121,7 +17130,7 @@ function sh(...t) {
17121
17130
  const i = new Nt(n);
17122
17131
  c.push(Bt(e, i));
17123
17132
  } else {
17124
- const t = Au(n, s, a);
17133
+ const t = Ru(n, s, a);
17125
17134
  c.push(t);
17126
17135
  }
17127
17136
  }
@@ -17135,7 +17144,7 @@ function sh(...t) {
17135
17144
  }
17136
17145
  }
17137
17146
 
17138
- function rh(t, e, n) {
17147
+ function oh(t, e, n) {
17139
17148
  if ("string" == typeof (n = T(n))) {
17140
17149
  if ("" === n) throw new W(Q.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
17141
17150
  if (!be(e) && -1 !== n.indexOf("/")) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
@@ -17143,19 +17152,19 @@ function rh(t, e, n) {
17143
17152
  if (!Nt.isDocumentKey(s)) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
17144
17153
  return Bt(t, new Nt(s));
17145
17154
  }
17146
- if (n instanceof Va) return Bt(t, n._key);
17147
- throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ia(n)}.`);
17155
+ if (n instanceof Sa) return Bt(t, n._key);
17156
+ throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Aa(n)}.`);
17148
17157
  }
17149
17158
 
17150
17159
  /**
17151
17160
  * Validates that the value passed into a disjunctive filter satisfies all
17152
17161
  * array requirements.
17153
- */ function oh(t, e) {
17162
+ */ function ch(t, e) {
17154
17163
  if (!Array.isArray(t) || 0 === t.length) throw new W(Q.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
17155
17164
  if (t.length > 10) throw new W(Q.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
17156
17165
  }
17157
17166
 
17158
- function ch(t, e, n) {
17167
+ function ah(t, e, n) {
17159
17168
  if (!n.isEqual(e)) throw new W(Q.INVALID_ARGUMENT, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
17160
17169
  }
17161
17170
 
@@ -17180,7 +17189,7 @@ function ch(t, e, n) {
17180
17189
  * to the user.
17181
17190
  *
17182
17191
  * @internal
17183
- */ class ah {
17192
+ */ class uh {
17184
17193
  convertValue(t, e = "none") {
17185
17194
  switch (kt(t)) {
17186
17195
  case 0 /* NullValue */ :
@@ -17227,7 +17236,7 @@ function ch(t, e, n) {
17227
17236
  })), n;
17228
17237
  }
17229
17238
  convertGeoPoint(t) {
17230
- return new ou(Rt(t.latitude), Rt(t.longitude));
17239
+ return new cu(Rt(t.latitude), Rt(t.longitude));
17231
17240
  }
17232
17241
  convertArray(t, e) {
17233
17242
  return (t.values || []).map((t => this.convertValue(t, e)));
@@ -17252,7 +17261,7 @@ function ch(t, e, n) {
17252
17261
  convertDocumentKey(t, e) {
17253
17262
  const n = _t.fromString(t);
17254
17263
  q(Ps(n));
17255
- const s = new ma(n.get(1), n.get(3)), i = new Nt(n.popFirst(5));
17264
+ const s = new ga(n.get(1), n.get(3)), i = new Nt(n.popFirst(5));
17256
17265
  return s.isEqual(e) ||
17257
17266
  // TODO(b/64130202): Somehow support foreign references.
17258
17267
  F(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
@@ -17284,7 +17293,7 @@ function ch(t, e, n) {
17284
17293
  * because we want to provide the user with a more specific error message if
17285
17294
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
17286
17295
  * call.
17287
- */ function uh(t, e, n) {
17296
+ */ function hh(t, e, n) {
17288
17297
  let s;
17289
17298
  // Cast to `any` in order to satisfy the union type constraint on
17290
17299
  // toFirestore().
@@ -17293,16 +17302,16 @@ function ch(t, e, n) {
17293
17302
  s;
17294
17303
  }
17295
17304
 
17296
- class hh extends ah {
17305
+ class lh extends uh {
17297
17306
  constructor(t) {
17298
17307
  super(), this.firestore = t;
17299
17308
  }
17300
17309
  convertBytes(t) {
17301
- return new iu(t);
17310
+ return new ru(t);
17302
17311
  }
17303
17312
  convertReference(t) {
17304
17313
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17305
- return new Va(this.firestore, /* converter= */ null, e);
17314
+ return new Sa(this.firestore, /* converter= */ null, e);
17306
17315
  }
17307
17316
  }
17308
17317
 
@@ -17329,24 +17338,24 @@ class hh extends ah {
17329
17338
  * provides methods for adding writes to the write batch. None of the writes
17330
17339
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
17331
17340
  * called.
17332
- */ class lh {
17341
+ */ class fh {
17333
17342
  /** @hideconstructor */
17334
17343
  constructor(t, e) {
17335
17344
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
17336
- this._dataReader = du(t);
17345
+ this._dataReader = wu(t);
17337
17346
  }
17338
17347
  set(t, e, n) {
17339
17348
  this._verifyNotCommitted();
17340
- const s = fh(t, this._firestore), i = uh(s.converter, e, n), r = wu(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
17349
+ const s = dh(t, this._firestore), i = hh(s.converter, e, n), r = _u(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
17341
17350
  return this._mutations.push(r.toMutation(s._key, Ze.none())), this;
17342
17351
  }
17343
17352
  update(t, e, n, ...s) {
17344
17353
  this._verifyNotCommitted();
17345
- const i = fh(t, this._firestore);
17354
+ const i = dh(t, this._firestore);
17346
17355
  // For Compat types, we have to "extract" the underlying types before
17347
17356
  // performing validation.
17348
17357
  let r;
17349
- return r = "string" == typeof (e = T(e)) || e instanceof nu ? Iu(this._dataReader, "WriteBatch.update", i._key, e, n, s) : Eu(this._dataReader, "WriteBatch.update", i._key, e),
17358
+ return r = "string" == typeof (e = T(e)) || e instanceof su ? Au(this._dataReader, "WriteBatch.update", i._key, e, n, s) : Iu(this._dataReader, "WriteBatch.update", i._key, e),
17350
17359
  this._mutations.push(r.toMutation(i._key, Ze.exists(!0))), this;
17351
17360
  }
17352
17361
  /**
@@ -17356,7 +17365,7 @@ class hh extends ah {
17356
17365
  * @returns This `WriteBatch` instance. Used for chaining method calls.
17357
17366
  */ delete(t) {
17358
17367
  this._verifyNotCommitted();
17359
- const e = fh(t, this._firestore);
17368
+ const e = dh(t, this._firestore);
17360
17369
  return this._mutations = this._mutations.concat(new dn(e._key, Ze.none())), this;
17361
17370
  }
17362
17371
  /**
@@ -17378,7 +17387,7 @@ class hh extends ah {
17378
17387
  }
17379
17388
  }
17380
17389
 
17381
- function fh(t, e) {
17390
+ function dh(t, e) {
17382
17391
  if ((t = T(t)).firestore !== e) throw new W(Q.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
17383
17392
  return t;
17384
17393
  }
@@ -17436,22 +17445,22 @@ function fh(t, e) {
17436
17445
  * @returns A Promise resolved with a `DocumentSnapshot` containing the
17437
17446
  * current document contents.
17438
17447
  */
17439
- function dh(t) {
17440
- t = Aa(t, Va);
17441
- const e = Aa(t.firestore, Ba);
17442
- return aa(Ka(e), t._key).then((n => vh(e, t, n)));
17448
+ function wh(t) {
17449
+ t = Ra(t, Sa);
17450
+ const e = Ra(t.firestore, Ua);
17451
+ return ua(ja(e), t._key).then((n => Vh(e, t, n)));
17443
17452
  }
17444
17453
 
17445
- class wh extends ah {
17454
+ class _h extends uh {
17446
17455
  constructor(t) {
17447
17456
  super(), this.firestore = t;
17448
17457
  }
17449
17458
  convertBytes(t) {
17450
- return new iu(t);
17459
+ return new ru(t);
17451
17460
  }
17452
17461
  convertReference(t) {
17453
17462
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17454
- return new Va(this.firestore, /* converter= */ null, e);
17463
+ return new Sa(this.firestore, /* converter= */ null, e);
17455
17464
  }
17456
17465
  }
17457
17466
 
@@ -17461,10 +17470,10 @@ class wh extends ah {
17461
17470
  *
17462
17471
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17463
17472
  * current document contents.
17464
- */ function _h(t) {
17465
- t = Aa(t, Va);
17466
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17467
- return ca(n, t._key).then((n => new Mu(e, s, t._key, n, new Ou(null !== n && n.hasLocalMutations,
17473
+ */ function mh(t) {
17474
+ t = Ra(t, Sa);
17475
+ const e = Ra(t.firestore, Ua), n = ja(e), s = new _h(e);
17476
+ return aa(n, t._key).then((n => new Fu(e, s, t._key, n, new Mu(null !== n && n.hasLocalMutations,
17468
17477
  /* fromCache= */ !0), t.converter)));
17469
17478
  }
17470
17479
 
@@ -17474,12 +17483,12 @@ class wh extends ah {
17474
17483
  *
17475
17484
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17476
17485
  * current document contents.
17477
- */ function mh(t) {
17478
- t = Aa(t, Va);
17479
- const e = Aa(t.firestore, Ba);
17480
- return aa(Ka(e), t._key, {
17486
+ */ function gh(t) {
17487
+ t = Ra(t, Sa);
17488
+ const e = Ra(t.firestore, Ua);
17489
+ return ua(ja(e), t._key, {
17481
17490
  source: "server"
17482
- }).then((n => vh(e, t, n)));
17491
+ }).then((n => Vh(e, t, n)));
17483
17492
  }
17484
17493
 
17485
17494
  /**
@@ -17491,10 +17500,10 @@ class wh extends ah {
17491
17500
  * invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
17492
17501
  *
17493
17502
  * @returns A `Promise` that will be resolved with the results of the query.
17494
- */ function gh(t) {
17495
- t = Aa(t, Sa);
17496
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17497
- return qu(t._query), ha(n, t._query).then((n => new Lu(e, s, t, n)));
17503
+ */ function yh(t) {
17504
+ t = Ra(t, Da);
17505
+ const e = Ra(t.firestore, Ua), n = ja(e), s = new _h(e);
17506
+ return Ku(t._query), la(n, t._query).then((n => new Bu(e, s, t, n)));
17498
17507
  }
17499
17508
 
17500
17509
  /**
@@ -17502,10 +17511,10 @@ class wh extends ah {
17502
17511
  * Returns an error if the document is not currently cached.
17503
17512
  *
17504
17513
  * @returns A `Promise` that will be resolved with the results of the query.
17505
- */ function yh(t) {
17506
- t = Aa(t, Sa);
17507
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17508
- return ua(n, t._query).then((n => new Lu(e, s, t, n)));
17514
+ */ function ph(t) {
17515
+ t = Ra(t, Da);
17516
+ const e = Ra(t.firestore, Ua), n = ja(e), s = new _h(e);
17517
+ return ha(n, t._query).then((n => new Bu(e, s, t, n)));
17509
17518
  }
17510
17519
 
17511
17520
  /**
@@ -17513,29 +17522,29 @@ class wh extends ah {
17513
17522
  * server. Returns an error if the network is not available.
17514
17523
  *
17515
17524
  * @returns A `Promise` that will be resolved with the results of the query.
17516
- */ function ph(t) {
17517
- t = Aa(t, Sa);
17518
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17519
- return ha(n, t._query, {
17525
+ */ function Th(t) {
17526
+ t = Ra(t, Da);
17527
+ const e = Ra(t.firestore, Ua), n = ja(e), s = new _h(e);
17528
+ return la(n, t._query, {
17520
17529
  source: "server"
17521
- }).then((n => new Lu(e, s, t, n)));
17530
+ }).then((n => new Bu(e, s, t, n)));
17522
17531
  }
17523
17532
 
17524
- function Th(t, e, n) {
17525
- t = Aa(t, Va);
17526
- const s = Aa(t.firestore, Ba), i = uh(t.converter, e, n);
17527
- return Ph(s, [ wu(du(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ze.none()) ]);
17533
+ function Eh(t, e, n) {
17534
+ t = Ra(t, Sa);
17535
+ const s = Ra(t.firestore, Ua), i = hh(t.converter, e, n);
17536
+ return vh(s, [ _u(wu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ze.none()) ]);
17528
17537
  }
17529
17538
 
17530
- function Eh(t, e, n, ...s) {
17531
- t = Aa(t, Va);
17532
- const i = Aa(t.firestore, Ba), r = du(i);
17539
+ function Ih(t, e, n, ...s) {
17540
+ t = Ra(t, Sa);
17541
+ const i = Ra(t.firestore, Ua), r = wu(i);
17533
17542
  let o;
17534
17543
  o = "string" == typeof (
17535
17544
  // For Compat types, we have to "extract" the underlying types before
17536
17545
  // performing validation.
17537
- e = T(e)) || e instanceof nu ? Iu(r, "updateDoc", t._key, e, n, s) : Eu(r, "updateDoc", t._key, e);
17538
- return Ph(i, [ o.toMutation(t._key, Ze.exists(!0)) ]);
17546
+ e = T(e)) || e instanceof su ? Au(r, "updateDoc", t._key, e, n, s) : Iu(r, "updateDoc", t._key, e);
17547
+ return vh(i, [ o.toMutation(t._key, Ze.exists(!0)) ]);
17539
17548
  }
17540
17549
 
17541
17550
  /**
@@ -17544,8 +17553,8 @@ function Eh(t, e, n, ...s) {
17544
17553
  * @param reference - A reference to the document to delete.
17545
17554
  * @returns A Promise resolved once the document has been successfully
17546
17555
  * deleted from the backend (note that it won't resolve while you're offline).
17547
- */ function Ih(t) {
17548
- return Ph(Aa(t.firestore, Ba), [ new dn(t._key, Ze.none()) ]);
17556
+ */ function Ah(t) {
17557
+ return vh(Ra(t.firestore, Ua), [ new dn(t._key, Ze.none()) ]);
17549
17558
  }
17550
17559
 
17551
17560
  /**
@@ -17557,55 +17566,55 @@ function Eh(t, e, n, ...s) {
17557
17566
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
17558
17567
  * newly created document after it has been written to the backend (Note that it
17559
17568
  * won't resolve while you're offline).
17560
- */ function Ah(t, e) {
17561
- const n = Aa(t.firestore, Ba), s = ka(t), i = uh(t.converter, e);
17562
- return Ph(n, [ wu(du(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ze.exists(!1)) ]).then((() => s));
17569
+ */ function Rh(t, e) {
17570
+ const n = Ra(t.firestore, Ua), s = xa(t), i = hh(t.converter, e);
17571
+ return vh(n, [ _u(wu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ze.exists(!1)) ]).then((() => s));
17563
17572
  }
17564
17573
 
17565
- function Rh(t, ...e) {
17574
+ function bh(t, ...e) {
17566
17575
  var n, s, i;
17567
17576
  t = T(t);
17568
17577
  let r = {
17569
17578
  includeMetadataChanges: !1
17570
17579
  }, o = 0;
17571
- "object" != typeof e[o] || Ma(e[o]) || (r = e[o], o++);
17580
+ "object" != typeof e[o] || Fa(e[o]) || (r = e[o], o++);
17572
17581
  const c = {
17573
17582
  includeMetadataChanges: r.includeMetadataChanges
17574
17583
  };
17575
- if (Ma(e[o])) {
17584
+ if (Fa(e[o])) {
17576
17585
  const t = e[o];
17577
17586
  e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
17578
17587
  e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
17579
17588
  }
17580
17589
  let a, u, h;
17581
- if (t instanceof Va) u = Aa(t.firestore, Ba), h = Te(t._key.path), a = {
17590
+ if (t instanceof Sa) u = Ra(t.firestore, Ua), h = Te(t._key.path), a = {
17582
17591
  next: n => {
17583
- e[o] && e[o](vh(u, t, n));
17592
+ e[o] && e[o](Vh(u, t, n));
17584
17593
  },
17585
17594
  error: e[o + 1],
17586
17595
  complete: e[o + 2]
17587
17596
  }; else {
17588
- const n = Aa(t, Sa);
17589
- u = Aa(n.firestore, Ba), h = n._query;
17590
- const s = new wh(u);
17597
+ const n = Ra(t, Da);
17598
+ u = Ra(n.firestore, Ua), h = n._query;
17599
+ const s = new _h(u);
17591
17600
  a = {
17592
17601
  next: t => {
17593
- e[o] && e[o](new Lu(u, s, n, t));
17602
+ e[o] && e[o](new Bu(u, s, n, t));
17594
17603
  },
17595
17604
  error: e[o + 1],
17596
17605
  complete: e[o + 2]
17597
- }, qu(t._query);
17606
+ }, Ku(t._query);
17598
17607
  }
17599
17608
  return function(t, e, n, s) {
17600
- const i = new Qc(s), r = new Yo(e, i, n);
17601
- return t.asyncQueue.enqueueAndForget((async () => Wo(await ia(t), r))), () => {
17602
- i.nc(), t.asyncQueue.enqueueAndForget((async () => Go(await ia(t), r)));
17609
+ const i = new Wc(s), r = new Xo(e, i, n);
17610
+ return t.asyncQueue.enqueueAndForget((async () => Go(await ra(t), r))), () => {
17611
+ i.nc(), t.asyncQueue.enqueueAndForget((async () => zo(await ra(t), r)));
17603
17612
  };
17604
- }(Ka(u), h, c, a);
17613
+ }(ja(u), h, c, a);
17605
17614
  }
17606
17615
 
17607
- function bh(t, e) {
17608
- return la(Ka(t = Aa(t, Ba)), Ma(e) ? e : {
17616
+ function Ph(t, e) {
17617
+ return fa(ja(t = Ra(t, Ua)), Fa(e) ? e : {
17609
17618
  next: e
17610
17619
  });
17611
17620
  }
@@ -17613,19 +17622,19 @@ function bh(t, e) {
17613
17622
  /**
17614
17623
  * Locally writes `mutations` on the async queue.
17615
17624
  * @internal
17616
- */ function Ph(t, e) {
17625
+ */ function vh(t, e) {
17617
17626
  return function(t, e) {
17618
17627
  const n = new G;
17619
- return t.asyncQueue.enqueueAndForget((async () => lc(await sa(t), e, n))), n.promise;
17620
- }(Ka(t), e);
17628
+ return t.asyncQueue.enqueueAndForget((async () => fc(await ia(t), e, n))), n.promise;
17629
+ }(ja(t), e);
17621
17630
  }
17622
17631
 
17623
17632
  /**
17624
17633
  * Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
17625
17634
  * to a {@link DocumentSnapshot}.
17626
- */ function vh(t, e, n) {
17627
- const s = n.docs.get(e._key), i = new wh(t);
17628
- return new Mu(t, i, e._key, s, new Ou(n.hasPendingWrites, n.fromCache), e.converter);
17635
+ */ function Vh(t, e, n) {
17636
+ const s = n.docs.get(e._key), i = new _h(t);
17637
+ return new Fu(t, i, e._key, s, new Mu(n.hasPendingWrites, n.fromCache), e.converter);
17629
17638
  }
17630
17639
 
17631
17640
  /**
@@ -17650,10 +17659,10 @@ function bh(t, e) {
17650
17659
  * The `Transaction` object passed to a transaction's `updateFunction` provides
17651
17660
  * the methods to read and write data within the transaction context. See
17652
17661
  * {@link runTransaction}.
17653
- */ class Vh extends class {
17662
+ */ class Sh extends class {
17654
17663
  /** @hideconstructor */
17655
17664
  constructor(t, e) {
17656
- this._firestore = t, this._transaction = e, this._dataReader = du(t);
17665
+ this._firestore = t, this._transaction = e, this._dataReader = wu(t);
17657
17666
  }
17658
17667
  /**
17659
17668
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -17661,25 +17670,25 @@ function bh(t, e) {
17661
17670
  * @param documentRef - A reference to the document to be read.
17662
17671
  * @returns A `DocumentSnapshot` with the read data.
17663
17672
  */ get(t) {
17664
- const e = fh(t, this._firestore), n = new hh(this._firestore);
17673
+ const e = dh(t, this._firestore), n = new lh(this._firestore);
17665
17674
  return this._transaction.lookup([ e._key ]).then((t => {
17666
17675
  if (!t || 1 !== t.length) return U();
17667
17676
  const s = t[0];
17668
- if (s.isFoundDocument()) return new ku(this._firestore, n, s.key, s, e.converter);
17669
- if (s.isNoDocument()) return new ku(this._firestore, n, e._key, null, e.converter);
17677
+ if (s.isFoundDocument()) return new xu(this._firestore, n, s.key, s, e.converter);
17678
+ if (s.isNoDocument()) return new xu(this._firestore, n, e._key, null, e.converter);
17670
17679
  throw U();
17671
17680
  }));
17672
17681
  }
17673
17682
  set(t, e, n) {
17674
- const s = fh(t, this._firestore), i = uh(s.converter, e, n), r = wu(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
17683
+ const s = dh(t, this._firestore), i = hh(s.converter, e, n), r = _u(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
17675
17684
  return this._transaction.set(s._key, r), this;
17676
17685
  }
17677
17686
  update(t, e, n, ...s) {
17678
- const i = fh(t, this._firestore);
17687
+ const i = dh(t, this._firestore);
17679
17688
  // For Compat types, we have to "extract" the underlying types before
17680
17689
  // performing validation.
17681
17690
  let r;
17682
- return r = "string" == typeof (e = T(e)) || e instanceof nu ? Iu(this._dataReader, "Transaction.update", i._key, e, n, s) : Eu(this._dataReader, "Transaction.update", i._key, e),
17691
+ return r = "string" == typeof (e = T(e)) || e instanceof su ? Au(this._dataReader, "Transaction.update", i._key, e, n, s) : Iu(this._dataReader, "Transaction.update", i._key, e),
17683
17692
  this._transaction.update(i._key, r), this;
17684
17693
  }
17685
17694
  /**
@@ -17688,7 +17697,7 @@ function bh(t, e) {
17688
17697
  * @param documentRef - A reference to the document to be deleted.
17689
17698
  * @returns This `Transaction` instance. Used for chaining method calls.
17690
17699
  */ delete(t) {
17691
- const e = fh(t, this._firestore);
17700
+ const e = dh(t, this._firestore);
17692
17701
  return this._transaction.delete(e._key), this;
17693
17702
  }
17694
17703
  } {
@@ -17704,8 +17713,8 @@ function bh(t, e) {
17704
17713
  * @param documentRef - A reference to the document to be read.
17705
17714
  * @returns A `DocumentSnapshot` with the read data.
17706
17715
  */ get(t) {
17707
- const e = fh(t, this._firestore), n = new wh(this._firestore);
17708
- return super.get(t).then((t => new Mu(this._firestore, n, e._key, t._document, new Ou(
17716
+ const e = dh(t, this._firestore), n = new _h(this._firestore);
17717
+ return super.get(t).then((t => new Fu(this._firestore, n, e._key, t._document, new Mu(
17709
17718
  /* hasPendingWrites= */ !1,
17710
17719
  /* fromCache= */ !1), e.converter)));
17711
17720
  }
@@ -17727,8 +17736,8 @@ function bh(t, e) {
17727
17736
  * (the `updateFunction` returned a failed promise), the promise returned by the
17728
17737
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
17729
17738
  * rejected promise with the corresponding failure error is returned.
17730
- */ function Sh(t, e) {
17731
- return fa(Ka(t = Aa(t, Ba)), (n => e(new Vh(t, n))));
17739
+ */ function Dh(t, e) {
17740
+ return da(ja(t = Ra(t, Ua)), (n => e(new Sh(t, n))));
17732
17741
  }
17733
17742
 
17734
17743
  /**
@@ -17750,15 +17759,15 @@ function bh(t, e) {
17750
17759
  /**
17751
17760
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
17752
17761
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
17753
- */ function Dh() {
17754
- return new _u("deleteField");
17762
+ */ function Ch() {
17763
+ return new mu("deleteField");
17755
17764
  }
17756
17765
 
17757
17766
  /**
17758
17767
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
17759
17768
  * include a server-generated timestamp in the written data.
17760
- */ function Ch() {
17761
- return new gu("serverTimestamp");
17769
+ */ function Nh() {
17770
+ return new yu("serverTimestamp");
17762
17771
  }
17763
17772
 
17764
17773
  /**
@@ -17772,10 +17781,10 @@ function bh(t, e) {
17772
17781
  * @param elements - The elements to union into the array.
17773
17782
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
17774
17783
  * `updateDoc()`.
17775
- */ function Nh(...t) {
17784
+ */ function kh(...t) {
17776
17785
  // NOTE: We don't actually parse the data until it's used in set() or
17777
17786
  // update() since we'd need the Firestore instance to do this.
17778
- return new yu("arrayUnion", t);
17787
+ return new pu("arrayUnion", t);
17779
17788
  }
17780
17789
 
17781
17790
  /**
@@ -17788,10 +17797,10 @@ function bh(t, e) {
17788
17797
  * @param elements - The elements to remove from the array.
17789
17798
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
17790
17799
  * `updateDoc()`
17791
- */ function kh(...t) {
17800
+ */ function xh(...t) {
17792
17801
  // NOTE: We don't actually parse the data until it's used in set() or
17793
17802
  // update() since we'd need the Firestore instance to do this.
17794
- return new pu("arrayRemove", t);
17803
+ return new Tu("arrayRemove", t);
17795
17804
  }
17796
17805
 
17797
17806
  /**
@@ -17812,8 +17821,8 @@ function bh(t, e) {
17812
17821
  * @param n - The value to increment by.
17813
17822
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
17814
17823
  * `updateDoc()`
17815
- */ function xh(t) {
17816
- return new Tu("increment", t);
17824
+ */ function $h(t) {
17825
+ return new Eu("increment", t);
17817
17826
  }
17818
17827
 
17819
17828
  /**
@@ -17842,8 +17851,102 @@ function bh(t, e) {
17842
17851
  *
17843
17852
  * @returns A {@link WriteBatch} that can be used to atomically execute multiple
17844
17853
  * writes.
17845
- */ function $h(t) {
17846
- return Ka(t = Aa(t, Ba)), new lh(t, (e => Ph(t, e)));
17854
+ */ function Oh(t) {
17855
+ return ja(t = Ra(t, Ua)), new fh(t, (e => vh(t, e)));
17856
+ }
17857
+
17858
+ /**
17859
+ * @license
17860
+ * Copyright 2021 Google LLC
17861
+ *
17862
+ * Licensed under the Apache License, Version 2.0 (the "License");
17863
+ * you may not use this file except in compliance with the License.
17864
+ * You may obtain a copy of the License at
17865
+ *
17866
+ * http://www.apache.org/licenses/LICENSE-2.0
17867
+ *
17868
+ * Unless required by applicable law or agreed to in writing, software
17869
+ * distributed under the License is distributed on an "AS IS" BASIS,
17870
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17871
+ * See the License for the specific language governing permissions and
17872
+ * limitations under the License.
17873
+ */
17874
+ /**
17875
+ * An index definition for field indexes in Firestore.
17876
+ *
17877
+ * Every index is associated with a collection. The definition contains a list
17878
+ * of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
17879
+ * `CONTAINS` for ArrayContains/ArrayContainsAny queries).
17880
+ *
17881
+ * Unlike the backend, the SDK does not differentiate between collection or
17882
+ * collection group-scoped indices. Every index can be used for both single
17883
+ * collection and collection group queries.
17884
+ */ class Mh {
17885
+ constructor(
17886
+ /**
17887
+ * The index ID. Returns -1 if the index ID is not available (e.g. the index
17888
+ * has not yet been persisted).
17889
+ */
17890
+ t,
17891
+ /** The collection ID this index applies to. */
17892
+ e,
17893
+ /** The field segments for this index. */
17894
+ n) {
17895
+ this.na = t, this.collectionGroup = e, this.segments = n;
17896
+ }
17897
+ }
17898
+
17899
+ /** An index component consisting of field path and index type. */ class Fh {
17900
+ constructor(
17901
+ /** The field path of the component. */
17902
+ t,
17903
+ /** The fields sorting order. */
17904
+ e) {
17905
+ this.fieldPath = t, this.kind = e;
17906
+ }
17907
+ }
17908
+
17909
+ /**
17910
+ * @license
17911
+ * Copyright 2021 Google LLC
17912
+ *
17913
+ * Licensed under the Apache License, Version 2.0 (the "License");
17914
+ * you may not use this file except in compliance with the License.
17915
+ * You may obtain a copy of the License at
17916
+ *
17917
+ * http://www.apache.org/licenses/LICENSE-2.0
17918
+ *
17919
+ * Unless required by applicable law or agreed to in writing, software
17920
+ * distributed under the License is distributed on an "AS IS" BASIS,
17921
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17922
+ * See the License for the specific language governing permissions and
17923
+ * limitations under the License.
17924
+ */ function Lh(t, e) {
17925
+ ja(t = Ra(t, Ua));
17926
+ const n = "string" == typeof e ? function(t) {
17927
+ try {
17928
+ return JSON.parse(t);
17929
+ } catch (t) {
17930
+ throw new W(Q.INVALID_ARGUMENT, "Failed to parse JSON:" + t.message);
17931
+ }
17932
+ }(e) : e, s = [];
17933
+ // PORTING NOTE: We don't return an error if the user has not enabled
17934
+ // persistence since `enableIndexeddbPersistence()` can fail on the Web.
17935
+ if (Array.isArray(n.indexes)) for (const t of n.indexes) {
17936
+ const e = Bh(t, "collectionGroup"), n = [];
17937
+ if (Array.isArray(t.fields)) for (const e of t.fields) {
17938
+ const t = Cu("setIndexConfiguration", Bh(e, "fieldPath"));
17939
+ "CONTAINS" === e.arrayConfig ? n.push(new Fh(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? n.push(new Fh(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && n.push(new Fh(t, 1 /* DESCENDING */));
17940
+ }
17941
+ s.push(new Mh(Mh.sa, e, n));
17942
+ }
17943
+ // TODO(indexing): Configure indexes
17944
+ return Promise.resolve();
17945
+ }
17946
+
17947
+ function Bh(t, e) {
17948
+ if ("string" != typeof t[e]) throw new W(Q.INVALID_ARGUMENT, "Missing string value for: " + e);
17949
+ return t[e];
17847
17950
  }
17848
17951
 
17849
17952
  /**
@@ -17865,14 +17968,14 @@ function bh(t, e) {
17865
17968
  !function(t) {
17866
17969
  k = t;
17867
17970
  }(i), n(new r("firestore", ((t, {options: n}) => {
17868
- const s = t.getProvider("app").getImmediate(), i = new Ba(s, new Y(t.getProvider("auth-internal")), new et(t.getProvider("app-check-internal")));
17971
+ const s = t.getProvider("app").getImmediate(), i = new Ua(s, new Y(t.getProvider("auth-internal")), new et(t.getProvider("app-check-internal")));
17869
17972
  return n = Object.assign({
17870
17973
  useFetchStreams: e
17871
17974
  }, n), i._setSettings(n), i;
17872
- }), "PUBLIC")), s(C, "3.4.3", t),
17975
+ }), "PUBLIC")), s(C, "3.4.4-202202622812", t),
17873
17976
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
17874
- s(C, "3.4.3", "esm2017");
17977
+ s(C, "3.4.4-202202622812", "esm2017");
17875
17978
  }("rn", /* useFetchStreams= */ !1);
17876
17979
 
17877
- export { ah as AbstractUserDataWriter, iu as Bytes, La as CACHE_SIZE_UNLIMITED, Da as CollectionReference, Va as DocumentReference, Mu as DocumentSnapshot, nu as FieldPath, ru as FieldValue, Ba as Firestore, W as FirestoreError, ou as GeoPoint, Fa as LoadBundleTask, Sa as Query, Ku as QueryConstraint, Fu as QueryDocumentSnapshot, Lu as QuerySnapshot, Ou as SnapshotMetadata, ut as Timestamp, Vh as Transaction, lh as WriteBatch, ma as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Aa as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, pa as _validateIsNotUsedTogether, Ah as addDoc, kh as arrayRemove, Nh as arrayUnion, za as clearIndexedDbPersistence, Ca as collection, Na as collectionGroup, va as connectFirestoreEmulator, Ih as deleteDoc, Dh as deleteField, Ya as disableNetwork, ka as doc, su as documentId, Qa as enableIndexedDbPersistence, Wa as enableMultiTabIndexedDbPersistence, Ja as enableNetwork, sh as endAt, nh as endBefore, Ka as ensureFirestoreConfigured, Ph as executeWrite, dh as getDoc, _h as getDocFromCache, mh as getDocFromServer, gh as getDocs, yh as getDocsFromCache, ph as getDocsFromServer, qa as getFirestore, xh as increment, Ua as initializeFirestore, Ju as limit, Yu as limitToLast, Za as loadBundle, tu as namedQuery, Rh as onSnapshot, bh as onSnapshotsInSync, zu as orderBy, ju as query, $a as queryEqual, xa as refEqual, Sh as runTransaction, Ch as serverTimestamp, Th as setDoc, O as setLogLevel, Uu as snapshotEqual, th as startAfter, Zu as startAt, Xa as terminate, Eh as updateDoc, Ha as waitForPendingWrites, Wu as where, $h as writeBatch };
17980
+ export { uh as AbstractUserDataWriter, ru as Bytes, Ba as CACHE_SIZE_UNLIMITED, Ca as CollectionReference, Sa as DocumentReference, Fu as DocumentSnapshot, su as FieldPath, ou as FieldValue, Ua as Firestore, W as FirestoreError, cu as GeoPoint, La as LoadBundleTask, Da as Query, ju as QueryConstraint, Lu as QueryDocumentSnapshot, Bu as QuerySnapshot, Mu as SnapshotMetadata, ut as Timestamp, Sh as Transaction, fh as WriteBatch, ga as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Ra as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, Lh as _setIndexConfiguration, Ta as _validateIsNotUsedTogether, Rh as addDoc, xh as arrayRemove, kh as arrayUnion, Ha as clearIndexedDbPersistence, Na as collection, ka as collectionGroup, Va as connectFirestoreEmulator, Ah as deleteDoc, Ch as deleteField, Xa as disableNetwork, xa as doc, iu as documentId, Wa as enableIndexedDbPersistence, Ga as enableMultiTabIndexedDbPersistence, Ya as enableNetwork, ih as endAt, sh as endBefore, ja as ensureFirestoreConfigured, vh as executeWrite, wh as getDoc, mh as getDocFromCache, gh as getDocFromServer, yh as getDocs, ph as getDocsFromCache, Th as getDocsFromServer, Ka as getFirestore, $h as increment, qa as initializeFirestore, Yu as limit, Xu as limitToLast, tu as loadBundle, eu as namedQuery, bh as onSnapshot, Ph as onSnapshotsInSync, Hu as orderBy, Qu as query, Oa as queryEqual, $a as refEqual, Dh as runTransaction, Nh as serverTimestamp, Eh as setDoc, O as setLogLevel, qu as snapshotEqual, eh as startAfter, th as startAt, Za as terminate, Ih as updateDoc, Ja as waitForPendingWrites, Gu as where, Oh as writeBatch };
17878
17981
  //# sourceMappingURL=index.rn.js.map