@firebase/firestore 3.4.4-canary.222f264ff → 3.4.4-canary.6c8eabfc5

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 (112) hide show
  1. package/dist/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  2. package/dist/firestore/src/api/snapshot.d.ts +1 -2
  3. package/dist/firestore/src/api.d.ts +1 -1
  4. package/dist/firestore/src/core/database_info.d.ts +1 -0
  5. package/dist/firestore/src/core/target.d.ts +34 -5
  6. package/dist/firestore/src/lite-api/query.d.ts +2 -2
  7. package/dist/firestore/src/local/index_manager.d.ts +52 -0
  8. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
  9. package/dist/firestore/src/local/indexeddb_schema.d.ts +121 -7
  10. package/dist/firestore/src/local/local_serializer.d.ts +1 -1
  11. package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
  12. package/dist/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  13. package/dist/firestore/src/local/simple_db.d.ts +1 -0
  14. package/dist/firestore/src/model/document.d.ts +7 -0
  15. package/dist/firestore/src/model/document_key.d.ts +1 -0
  16. package/dist/firestore/src/model/field_index.d.ts +87 -7
  17. package/dist/firestore/src/model/values.d.ts +7 -0
  18. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
  19. package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
  20. package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
  21. package/dist/firestore/test/util/helpers.d.ts +8 -2
  22. package/dist/index.d.ts +1 -2
  23. package/dist/index.esm2017.js +3451 -3194
  24. package/dist/index.esm2017.js.map +1 -1
  25. package/dist/index.esm5.js +3430 -3264
  26. package/dist/index.esm5.js.map +1 -1
  27. package/dist/index.node.cjs.js +543 -242
  28. package/dist/index.node.cjs.js.map +1 -1
  29. package/dist/index.node.mjs +543 -242
  30. package/dist/index.node.mjs.map +1 -1
  31. package/dist/index.rn.js +3520 -3301
  32. package/dist/index.rn.js.map +1 -1
  33. package/dist/internal.d.ts +183 -16
  34. package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  35. package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
  36. package/dist/lite/firestore/src/api.d.ts +1 -1
  37. package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
  38. package/dist/lite/firestore/src/core/target.d.ts +34 -5
  39. package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
  40. package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
  41. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
  42. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +121 -7
  43. package/dist/lite/firestore/src/local/local_serializer.d.ts +1 -1
  44. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
  45. package/dist/lite/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  46. package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
  47. package/dist/lite/firestore/src/model/document.d.ts +7 -0
  48. package/dist/lite/firestore/src/model/document_key.d.ts +1 -0
  49. package/dist/lite/firestore/src/model/field_index.d.ts +87 -7
  50. package/dist/lite/firestore/src/model/values.d.ts +7 -0
  51. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
  52. package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
  53. package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
  54. package/dist/lite/firestore/test/util/helpers.d.ts +8 -2
  55. package/dist/lite/index.browser.esm2017.js +1166 -1152
  56. package/dist/lite/index.browser.esm2017.js.map +1 -1
  57. package/dist/lite/index.browser.esm5.js +367 -359
  58. package/dist/lite/index.browser.esm5.js.map +1 -1
  59. package/dist/lite/index.node.cjs.js +53 -34
  60. package/dist/lite/index.node.cjs.js.map +1 -1
  61. package/dist/lite/index.node.mjs +53 -34
  62. package/dist/lite/index.node.mjs.map +1 -1
  63. package/dist/lite/index.rn.esm2017.js +318 -304
  64. package/dist/lite/index.rn.esm2017.js.map +1 -1
  65. package/dist/lite/internal.d.ts +11 -2
  66. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +125 -124
  67. package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  68. package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
  69. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  70. package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
  71. package/dist/lite/packages/firestore/src/core/target.d.ts +34 -5
  72. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
  73. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
  74. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
  75. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
  76. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +1 -1
  77. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  78. package/dist/lite/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  79. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
  80. package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
  81. package/dist/lite/packages/firestore/src/model/document_key.d.ts +1 -0
  82. package/dist/lite/packages/firestore/src/model/field_index.d.ts +87 -7
  83. package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
  84. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
  85. package/dist/lite/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
  86. package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
  87. package/dist/lite/packages/firestore/test/util/helpers.d.ts +8 -2
  88. package/dist/lite/private.d.ts +9 -2
  89. package/dist/packages/firestore/dist/index.esm2017.d.ts +175 -173
  90. package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
  91. package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
  92. package/dist/packages/firestore/src/api.d.ts +1 -1
  93. package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
  94. package/dist/packages/firestore/src/core/target.d.ts +34 -5
  95. package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
  96. package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
  97. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -0
  98. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
  99. package/dist/packages/firestore/src/local/local_serializer.d.ts +1 -1
  100. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  101. package/dist/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
  102. package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
  103. package/dist/packages/firestore/src/model/document.d.ts +7 -0
  104. package/dist/packages/firestore/src/model/document_key.d.ts +1 -0
  105. package/dist/packages/firestore/src/model/field_index.d.ts +87 -7
  106. package/dist/packages/firestore/src/model/values.d.ts +7 -0
  107. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
  108. package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
  109. package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
  110. package/dist/packages/firestore/test/util/helpers.d.ts +8 -2
  111. package/dist/private.d.ts +181 -16
  112. package/package.json +9 -9
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
63
63
  * See the License for the specific language governing permissions and
64
64
  * limitations under the License.
65
65
  */
66
- let f = "9.6.5-canary.222f264ff";
66
+ let f = "9.6.6-canary.6c8eabfc5";
67
67
 
68
68
  /**
69
69
  * @license
@@ -99,26 +99,26 @@ const d = new Logger("@firebase/firestore");
99
99
  d.setLogLevel(t);
100
100
  }
101
101
 
102
- function m(t, ...n) {
102
+ function m(t, ...e) {
103
103
  if (d.logLevel <= LogLevel.DEBUG) {
104
- const e = n.map(_);
105
- d.debug(`Firestore (${f}): ${t}`, ...e);
104
+ const n = e.map(_);
105
+ d.debug(`Firestore (${f}): ${t}`, ...n);
106
106
  }
107
107
  }
108
108
 
109
- function p(t, ...n) {
109
+ function p(t, ...e) {
110
110
  if (d.logLevel <= LogLevel.ERROR) {
111
- const e = n.map(_);
112
- d.error(`Firestore (${f}): ${t}`, ...e);
111
+ const n = e.map(_);
112
+ d.error(`Firestore (${f}): ${t}`, ...n);
113
113
  }
114
114
  }
115
115
 
116
116
  /**
117
117
  * @internal
118
- */ function y(t, ...n) {
118
+ */ function y(t, ...e) {
119
119
  if (d.logLevel <= LogLevel.WARN) {
120
- const e = n.map(_);
121
- d.warn(`Firestore (${f}): ${t}`, ...e);
120
+ const n = e.map(_);
121
+ d.warn(`Firestore (${f}): ${t}`, ...n);
122
122
  }
123
123
  }
124
124
 
@@ -127,8 +127,8 @@ function p(t, ...n) {
127
127
  */ function _(t) {
128
128
  if ("string" == typeof t) return t;
129
129
  try {
130
- return n = t, JSON.stringify(n);
131
- } catch (n) {
130
+ return e = t, JSON.stringify(e);
131
+ } catch (e) {
132
132
  // Converting to JSON failed, just log the object directly
133
133
  return t;
134
134
  }
@@ -149,7 +149,7 @@ function p(t, ...n) {
149
149
  * limitations under the License.
150
150
  */
151
151
  /** Formats an object as a JSON string, suitable for logging. */
152
- var n;
152
+ var e;
153
153
  }
154
154
 
155
155
  /**
@@ -178,11 +178,11 @@ function p(t, ...n) {
178
178
  */ function g(t = "Unexpected state") {
179
179
  // Log the failure in addition to throw an exception, just in case the
180
180
  // exception is swallowed.
181
- const n = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
181
+ const e = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
182
182
  // NOTE: We don't use FirestoreError here because these are internal failures
183
183
  // that cannot be handled by the user. (Also it would create a circular
184
184
  // dependency between the error and assert modules which doesn't work.)
185
- throw p(n), new Error(n);
185
+ throw p(e), new Error(e);
186
186
  }
187
187
 
188
188
  /**
@@ -190,16 +190,16 @@ function p(t, ...n) {
190
190
  * given message if it did.
191
191
  *
192
192
  * Messages are stripped in production builds.
193
- */ function v(t, n) {
193
+ */ function b(t, e) {
194
194
  t || g();
195
195
  }
196
196
 
197
197
  /**
198
198
  * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
199
199
  * instance of `T` before casting.
200
- */ function b(t,
200
+ */ function v(t,
201
201
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
- n) {
202
+ e) {
203
203
  return t;
204
204
  }
205
205
 
@@ -230,8 +230,8 @@ n) {
230
230
  /**
231
231
  * A custom error description.
232
232
  */
233
- n) {
234
- super(t, n), this.code = t, this.message = n,
233
+ e) {
234
+ super(t, e), this.code = t, this.message = e,
235
235
  // HACK: We write a toString property directly because Error is not a real
236
236
  // class and so inheritance does not work correctly. We could alternatively
237
237
  // do the same "back-door inheritance" trick that FirebaseError does.
@@ -256,8 +256,8 @@ n) {
256
256
  * limitations under the License.
257
257
  */ class k {
258
258
  constructor() {
259
- this.promise = new Promise(((t, n) => {
260
- this.resolve = t, this.reject = n;
259
+ this.promise = new Promise(((t, e) => {
260
+ this.resolve = t, this.reject = e;
261
261
  }));
262
262
  }
263
263
  }
@@ -278,8 +278,8 @@ n) {
278
278
  * See the License for the specific language governing permissions and
279
279
  * limitations under the License.
280
280
  */ class j {
281
- constructor(t, n) {
282
- this.user = n, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
281
+ constructor(t, e) {
282
+ this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
283
283
  }
284
284
  }
285
285
 
@@ -291,9 +291,9 @@ n) {
291
291
  return Promise.resolve(null);
292
292
  }
293
293
  invalidateToken() {}
294
- start(t, n) {
294
+ start(t, e) {
295
295
  // Fire with initial user.
296
- t.enqueueRetryable((() => n(l.UNAUTHENTICATED)));
296
+ t.enqueueRetryable((() => e(l.UNAUTHENTICATED)));
297
297
  }
298
298
  shutdown() {}
299
299
  }
@@ -315,10 +315,10 @@ n) {
315
315
  return Promise.resolve(this.token);
316
316
  }
317
317
  invalidateToken() {}
318
- start(t, n) {
319
- this.changeListener = n,
318
+ start(t, e) {
319
+ this.changeListener = e,
320
320
  // Fire with initial user.
321
- t.enqueueRetryable((() => n(this.token.user)));
321
+ t.enqueueRetryable((() => e(this.token.user)));
322
322
  }
323
323
  shutdown() {
324
324
  this.changeListener = null;
@@ -332,11 +332,11 @@ n) {
332
332
  }));
333
333
  }
334
334
  getToken() {
335
- return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
335
+ return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
336
336
  new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
337
337
  }
338
338
  invalidateToken() {}
339
- start(t, n) {}
339
+ start(t, e) {}
340
340
  shutdown() {}
341
341
  }
342
342
 
@@ -347,10 +347,10 @@ n) {
347
347
  * recover from unauthenticated errors (see b/33147818 for context), but it's
348
348
  * safer to keep the implementation as-is.
349
349
  */ class G {
350
- constructor(t, n, e) {
351
- this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", n);
350
+ constructor(t, e, n) {
351
+ this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
352
352
  const r = t.auth.getAuthHeaderValueForFirstParty([]);
353
- r && this.headers.set("Authorization", r), e && this.headers.set("X-Goog-Iam-Authorization-Token", e);
353
+ r && this.headers.set("Authorization", r), n && this.headers.set("X-Goog-Iam-Authorization-Token", n);
354
354
  }
355
355
  }
356
356
 
@@ -359,15 +359,15 @@ n) {
359
359
  * to authenticate the user, using technique that is only available
360
360
  * to applications hosted by Google.
361
361
  */ class Q {
362
- constructor(t, n, e) {
363
- this.t = t, this.i = n, this.o = e;
362
+ constructor(t, e, n) {
363
+ this.t = t, this.i = e, this.o = n;
364
364
  }
365
365
  getToken() {
366
366
  return Promise.resolve(new G(this.t, this.i, this.o));
367
367
  }
368
- start(t, n) {
368
+ start(t, e) {
369
369
  // Fire with initial uid.
370
- t.enqueueRetryable((() => n(l.FIRST_PARTY)));
370
+ t.enqueueRetryable((() => e(l.FIRST_PARTY)));
371
371
  }
372
372
  shutdown() {}
373
373
  invalidateToken() {}
@@ -386,11 +386,11 @@ class W {
386
386
  }));
387
387
  }
388
388
  getToken() {
389
- return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
389
+ return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
390
390
  new W(t.token)) : null)) : Promise.resolve(null);
391
391
  }
392
392
  invalidateToken() {}
393
- start(t, n) {}
393
+ start(t, e) {}
394
394
  shutdown() {}
395
395
  }
396
396
 
@@ -432,8 +432,8 @@ class H {
432
432
  * @param useFetchStreams Whether to use the Fetch API instead of
433
433
  * XMLHTTPRequest
434
434
  */
435
- constructor(t, n, e, r, s, i, o, u) {
436
- this.databaseId = t, this.appId = n, this.persistenceKey = e, this.host = r, this.ssl = s,
435
+ constructor(t, e, n, r, s, i, o, u) {
436
+ this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = s,
437
437
  this.forceLongPolling = i, this.autoDetectLongPolling = o, this.useFetchStreams = u;
438
438
  }
439
439
  }
@@ -444,8 +444,11 @@ class H {
444
444
  * @internal
445
445
  */
446
446
  class K {
447
- constructor(t, n) {
448
- this.projectId = t, this.database = n || "(default)";
447
+ constructor(t, e) {
448
+ this.projectId = t, this.database = e || "(default)";
449
+ }
450
+ static empty() {
451
+ return new K("", "");
449
452
  }
450
453
  get isDefaultDatabase() {
451
454
  return "(default)" === this.database;
@@ -475,9 +478,9 @@ class K {
475
478
  * Path represents an ordered sequence of string segments.
476
479
  */
477
480
  class J {
478
- constructor(t, n, e) {
479
- void 0 === n ? n = 0 : n > t.length && g(), void 0 === e ? e = t.length - n : e > t.length - n && g(),
480
- this.segments = t, this.offset = n, this.len = e;
481
+ constructor(t, e, n) {
482
+ void 0 === e ? e = 0 : e > t.length && g(), void 0 === n ? n = t.length - e : n > t.length - e && g(),
483
+ this.segments = t, this.offset = e, this.len = n;
481
484
  }
482
485
  get length() {
483
486
  return this.len;
@@ -486,10 +489,10 @@ class J {
486
489
  return 0 === J.comparator(this, t);
487
490
  }
488
491
  child(t) {
489
- const n = this.segments.slice(this.offset, this.limit());
492
+ const e = this.segments.slice(this.offset, this.limit());
490
493
  return t instanceof J ? t.forEach((t => {
491
- n.push(t);
492
- })) : n.push(t), this.construct(n);
494
+ e.push(t);
495
+ })) : e.push(t), this.construct(e);
493
496
  }
494
497
  /** The index of one past the last segment of the path. */ limit() {
495
498
  return this.offset + this.length;
@@ -514,28 +517,28 @@ class J {
514
517
  }
515
518
  isPrefixOf(t) {
516
519
  if (t.length < this.length) return !1;
517
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
520
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
518
521
  return !0;
519
522
  }
520
523
  isImmediateParentOf(t) {
521
524
  if (this.length + 1 !== t.length) return !1;
522
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
525
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
523
526
  return !0;
524
527
  }
525
528
  forEach(t) {
526
- for (let n = this.offset, e = this.limit(); n < e; n++) t(this.segments[n]);
529
+ for (let e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]);
527
530
  }
528
531
  toArray() {
529
532
  return this.segments.slice(this.offset, this.limit());
530
533
  }
531
- static comparator(t, n) {
532
- const e = Math.min(t.length, n.length);
533
- for (let r = 0; r < e; r++) {
534
- const e = t.get(r), s = n.get(r);
535
- if (e < s) return -1;
536
- if (e > s) return 1;
534
+ static comparator(t, e) {
535
+ const n = Math.min(t.length, e.length);
536
+ for (let r = 0; r < n; r++) {
537
+ const n = t.get(r), s = e.get(r);
538
+ if (n < s) return -1;
539
+ if (n > s) return 1;
537
540
  }
538
- return t.length < n.length ? -1 : t.length > n.length ? 1 : 0;
541
+ return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
539
542
  }
540
543
  }
541
544
 
@@ -545,8 +548,8 @@ class J {
545
548
  *
546
549
  * @internal
547
550
  */ class X extends J {
548
- construct(t, n, e) {
549
- return new X(t, n, e);
551
+ construct(t, e, n) {
552
+ return new X(t, e, n);
550
553
  }
551
554
  canonicalString() {
552
555
  // NOTE: The client is ignorant of any path segments containing escape
@@ -565,13 +568,13 @@ class J {
565
568
  // NOTE: The client is ignorant of any path segments containing escape
566
569
  // sequences (e.g. __id123__) and just passes them through raw (they exist
567
570
  // for legacy reasons and should not be used frequently).
568
- const n = [];
569
- for (const e of t) {
570
- if (e.indexOf("//") >= 0) throw new U(A, `Invalid segment (${e}). Paths must not contain // in them.`);
571
+ const e = [];
572
+ for (const n of t) {
573
+ if (n.indexOf("//") >= 0) throw new U(A, `Invalid segment (${n}). Paths must not contain // in them.`);
571
574
  // Strip leading and traling slashed.
572
- n.push(...e.split("/").filter((t => t.length > 0)));
575
+ e.push(...n.split("/").filter((t => t.length > 0)));
573
576
  }
574
- return new X(n);
577
+ return new X(e);
575
578
  }
576
579
  static emptyPath() {
577
580
  return new X([]);
@@ -584,8 +587,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
584
587
  * A dot-separated path for navigating sub-objects within a document.
585
588
  * @internal
586
589
  */ class tt extends J {
587
- construct(t, n, e) {
588
- return new tt(t, n, e);
590
+ construct(t, e, n) {
591
+ return new tt(t, e, n);
589
592
  }
590
593
  /**
591
594
  * Returns true if the string could be used as a segment in a field path
@@ -620,24 +623,24 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
620
623
  * TODO(b/37244157): we should make this more strict. Right now, it allows
621
624
  * non-identifier path components, even if they aren't escaped.
622
625
  */ static fromServerFormat(t) {
623
- const n = [];
624
- let e = "", r = 0;
626
+ const e = [];
627
+ let n = "", r = 0;
625
628
  const s = () => {
626
- if (0 === e.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
627
- n.push(e), e = "";
629
+ if (0 === n.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
630
+ e.push(n), n = "";
628
631
  };
629
632
  let i = !1;
630
633
  for (;r < t.length; ) {
631
- const n = t[r];
632
- if ("\\" === n) {
634
+ const e = t[r];
635
+ if ("\\" === e) {
633
636
  if (r + 1 === t.length) throw new U(A, "Path has trailing escape character: " + t);
634
- const n = t[r + 1];
635
- if ("\\" !== n && "." !== n && "`" !== n) throw new U(A, "Path has invalid escape sequence: " + t);
636
- e += n, r += 2;
637
- } else "`" === n ? (i = !i, r++) : "." !== n || i ? (e += n, r++) : (s(), r++);
637
+ const e = t[r + 1];
638
+ if ("\\" !== e && "." !== e && "`" !== e) throw new U(A, "Path has invalid escape sequence: " + t);
639
+ n += e, r += 2;
640
+ } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
638
641
  }
639
642
  if (s(), i) throw new U(A, "Unterminated ` in path: " + t);
640
- return new tt(n);
643
+ return new tt(e);
641
644
  }
642
645
  static emptyPath() {
643
646
  return new tt([]);
@@ -662,15 +665,18 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
662
665
  */
663
666
  /**
664
667
  * @internal
665
- */ class nt {
668
+ */ class et {
666
669
  constructor(t) {
667
670
  this.path = t;
668
671
  }
669
672
  static fromPath(t) {
670
- return new nt(X.fromString(t));
673
+ return new et(X.fromString(t));
671
674
  }
672
675
  static fromName(t) {
673
- return new nt(X.fromString(t).popFirst(5));
676
+ return new et(X.fromString(t).popFirst(5));
677
+ }
678
+ static empty() {
679
+ return new et(X.emptyPath());
674
680
  }
675
681
  /** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
676
682
  return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
@@ -681,8 +687,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
681
687
  toString() {
682
688
  return this.path.toString();
683
689
  }
684
- static comparator(t, n) {
685
- return X.comparator(t.path, n.path);
690
+ static comparator(t, e) {
691
+ return X.comparator(t.path, e.path);
686
692
  }
687
693
  static isDocumentKey(t) {
688
694
  return t.length % 2 == 0;
@@ -693,7 +699,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
693
699
  * @param segments - The segments of the path to the document
694
700
  * @returns A new instance of DocumentKey
695
701
  */ static fromSegments(t) {
696
- return new nt(new X(t.slice()));
702
+ return new et(new X(t.slice()));
697
703
  }
698
704
  }
699
705
 
@@ -712,8 +718,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
712
718
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
713
719
  * See the License for the specific language governing permissions and
714
720
  * limitations under the License.
715
- */ function et(t, n, e) {
716
- if (!e) throw new U(A, `Function ${t}() cannot be called with an empty ${n}.`);
721
+ */ function nt(t, e, n) {
722
+ if (!n) throw new U(A, `Function ${t}() cannot be called with an empty ${e}.`);
717
723
  }
718
724
 
719
725
  /**
@@ -725,14 +731,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
725
731
  * an even numbers of segments).
726
732
  */
727
733
  function rt(t) {
728
- if (!nt.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
734
+ if (!et.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
729
735
  }
730
736
 
731
737
  /**
732
738
  * Validates that `path` refers to a collection (indicated by the fact it
733
739
  * contains an odd numbers of segments).
734
740
  */ function st(t) {
735
- if (nt.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
741
+ if (et.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
736
742
  }
737
743
 
738
744
  /**
@@ -749,7 +755,7 @@ function it(t) {
749
755
  if ("object" == typeof t) {
750
756
  if (t instanceof Array) return "an array";
751
757
  {
752
- const n =
758
+ const e =
753
759
  /** try to get the constructor name for an object. */
754
760
  function(t) {
755
761
  if (t.constructor) return t.constructor.name;
@@ -763,7 +769,7 @@ function it(t) {
763
769
  * arguments passed to the public API.
764
770
  * @internal
765
771
  */ (t);
766
- return n ? `a custom ${n} object` : "an object";
772
+ return e ? `a custom ${e} object` : "an object";
767
773
  }
768
774
  }
769
775
  return "function" == typeof t ? "a function" : g();
@@ -771,22 +777,22 @@ function it(t) {
771
777
 
772
778
  function ot(t,
773
779
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
774
- n) {
780
+ e) {
775
781
  if ("_delegate" in t && (
776
782
  // Unwrap Compat types
777
783
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
778
- t = t._delegate), !(t instanceof n)) {
779
- if (n.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
784
+ t = t._delegate), !(t instanceof e)) {
785
+ if (e.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
780
786
  {
781
- const e = it(t);
782
- throw new U(A, `Expected type '${n.name}', but it was: ${e}`);
787
+ const n = it(t);
788
+ throw new U(A, `Expected type '${e.name}', but it was: ${n}`);
783
789
  }
784
790
  }
785
791
  return t;
786
792
  }
787
793
 
788
- function ut(t, n) {
789
- if (n <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${n}.`);
794
+ function ut(t, e) {
795
+ if (e <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${e}.`);
790
796
  }
791
797
 
792
798
  /**
@@ -993,58 +999,58 @@ class wt extends
993
999
  class {
994
1000
  constructor(t) {
995
1001
  this.databaseInfo = t, this.databaseId = t.databaseId;
996
- const n = t.ssl ? "https" : "http";
997
- this.h = n + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
1002
+ const e = t.ssl ? "https" : "http";
1003
+ this.h = e + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
998
1004
  }
999
- m(t, n, e, r, s) {
1000
- const i = this.p(t, n);
1001
- m("RestConnection", "Sending: ", i, e);
1005
+ m(t, e, n, r, s) {
1006
+ const i = this.p(t, e);
1007
+ m("RestConnection", "Sending: ", i, n);
1002
1008
  const o = {};
1003
- return this.g(o, r, s), this.v(t, i, o, e).then((t => (m("RestConnection", "Received: ", t),
1004
- t)), (n => {
1005
- throw y("RestConnection", `${t} failed with error: `, n, "url: ", i, "request:", e),
1006
- n;
1009
+ return this.g(o, r, s), this.v(t, i, o, n).then((t => (m("RestConnection", "Received: ", t),
1010
+ t)), (e => {
1011
+ throw y("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1012
+ e;
1007
1013
  }));
1008
1014
  }
1009
- T(t, n, e, r, s) {
1015
+ T(t, e, n, r, s) {
1010
1016
  // The REST API automatically aggregates all of the streamed results, so we
1011
1017
  // can just use the normal invoke() method.
1012
- return this.m(t, n, e, r, s);
1018
+ return this.m(t, e, n, r, s);
1013
1019
  }
1014
1020
  /**
1015
1021
  * Modifies the headers for a request, adding any authorization token if
1016
1022
  * present and any additional headers for the request.
1017
- */ g(t, n, e) {
1023
+ */ g(t, e, n) {
1018
1024
  t["X-Goog-Api-Client"] = "gl-js/ fire/" + f,
1019
1025
  // Content-Type: text/plain will avoid preflight requests which might
1020
1026
  // mess with CORS and redirects by proxies. If we add custom headers
1021
1027
  // we will need to change this code to potentially use the $httpOverwrite
1022
1028
  // parameter supported by ESF to avoid triggering preflight requests.
1023
1029
  t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
1024
- n && n.headers.forEach(((n, e) => t[e] = n)), e && e.headers.forEach(((n, e) => t[e] = n));
1030
+ e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
1025
1031
  }
1026
- p(t, n) {
1027
- const e = ht[t];
1028
- return `${this.h}/v1/${n}:${e}`;
1032
+ p(t, e) {
1033
+ const n = ht[t];
1034
+ return `${this.h}/v1/${e}:${n}`;
1029
1035
  }
1030
1036
  } {
1031
1037
  /**
1032
1038
  * @param databaseInfo - The connection info.
1033
1039
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
1034
1040
  */
1035
- constructor(t, n) {
1036
- super(t), this.I = n;
1041
+ constructor(t, e) {
1042
+ super(t), this.I = e;
1037
1043
  }
1038
- A(t, n) {
1044
+ A(t, e) {
1039
1045
  throw new Error("Not supported by FetchConnection");
1040
1046
  }
1041
- async v(t, n, e, r) {
1047
+ async v(t, e, n, r) {
1042
1048
  const s = JSON.stringify(r);
1043
1049
  let i;
1044
1050
  try {
1045
- i = await this.I(n, {
1051
+ i = await this.I(e, {
1046
1052
  method: "POST",
1047
- headers: e,
1053
+ headers: n,
1048
1054
  body: s
1049
1055
  });
1050
1056
  } catch (t) {
@@ -1095,13 +1101,13 @@ class {
1095
1101
  */
1096
1102
  function mt(t) {
1097
1103
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1098
- const n =
1104
+ const e =
1099
1105
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1100
- "undefined" != typeof self && (self.crypto || self.msCrypto), e = new Uint8Array(t);
1101
- if (n && "function" == typeof n.getRandomValues) n.getRandomValues(e); else
1106
+ "undefined" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(t);
1107
+ if (e && "function" == typeof e.getRandomValues) e.getRandomValues(n); else
1102
1108
  // Falls back to Math.random
1103
- for (let n = 0; n < t; n++) e[n] = Math.floor(256 * Math.random());
1104
- return e;
1109
+ for (let e = 0; e < t; e++) n[e] = Math.floor(256 * Math.random());
1110
+ return n;
1105
1111
  }
1106
1112
 
1107
1113
  /**
@@ -1122,26 +1128,26 @@ function mt(t) {
1122
1128
  */ class pt {
1123
1129
  static R() {
1124
1130
  // Alphanumeric characters
1125
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = Math.floor(256 / t.length) * t.length;
1131
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
1126
1132
  // The largest byte value that is a multiple of `char.length`.
1127
- let e = "";
1128
- for (;e.length < 20; ) {
1133
+ let n = "";
1134
+ for (;n.length < 20; ) {
1129
1135
  const r = mt(40);
1130
1136
  for (let s = 0; s < r.length; ++s)
1131
1137
  // Only accept values that are [0, maxMultiple), this ensures they can
1132
1138
  // be evenly mapped to indices of `chars` via a modulo operation.
1133
- e.length < 20 && r[s] < n && (e += t.charAt(r[s] % t.length));
1139
+ n.length < 20 && r[s] < e && (n += t.charAt(r[s] % t.length));
1134
1140
  }
1135
- return e;
1141
+ return n;
1136
1142
  }
1137
1143
  }
1138
1144
 
1139
- function yt(t, n) {
1140
- return t < n ? -1 : t > n ? 1 : 0;
1145
+ function yt(t, e) {
1146
+ return t < e ? -1 : t > e ? 1 : 0;
1141
1147
  }
1142
1148
 
1143
- /** Helper to compare arrays using isEqual(). */ function _t(t, n, e) {
1144
- return t.length === n.length && t.every(((t, r) => e(t, n[r])));
1149
+ /** Helper to compare arrays using isEqual(). */ function _t(t, e, n) {
1150
+ return t.length === e.length && t.every(((t, r) => n(t, e[r])));
1145
1151
  }
1146
1152
 
1147
1153
  /**
@@ -1195,9 +1201,9 @@ class gt {
1195
1201
  /**
1196
1202
  * The fractions of a second at nanosecond resolution.*
1197
1203
  */
1198
- n) {
1199
- if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(A, "Timestamp nanoseconds out of range: " + n);
1200
- if (n >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + n);
1204
+ e) {
1205
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1206
+ if (e >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1201
1207
  if (t < -62135596800) throw new U(A, "Timestamp seconds out of range: " + t);
1202
1208
  // This will break in the year 10,000.
1203
1209
  if (t >= 253402300800) throw new U(A, "Timestamp seconds out of range: " + t);
@@ -1226,8 +1232,8 @@ class gt {
1226
1232
  * @returns A new `Timestamp` representing the same point in time as the given
1227
1233
  * number of milliseconds.
1228
1234
  */ static fromMillis(t) {
1229
- const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
1230
- return new gt(n, e);
1235
+ const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
1236
+ return new gt(e, n);
1231
1237
  }
1232
1238
  /**
1233
1239
  * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
@@ -1305,15 +1311,15 @@ class gt {
1305
1311
  /**
1306
1312
  * A version of a document in Firestore. This corresponds to the version
1307
1313
  * timestamp, such as update_time or read_time.
1308
- */ class vt {
1314
+ */ class bt {
1309
1315
  constructor(t) {
1310
1316
  this.timestamp = t;
1311
1317
  }
1312
1318
  static fromTimestamp(t) {
1313
- return new vt(t);
1319
+ return new bt(t);
1314
1320
  }
1315
1321
  static min() {
1316
- return new vt(new gt(0, 0));
1322
+ return new bt(new gt(0, 0));
1317
1323
  }
1318
1324
  compareTo(t) {
1319
1325
  return this.timestamp._compareTo(t.timestamp);
@@ -1348,14 +1354,14 @@ class gt {
1348
1354
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1349
1355
  * See the License for the specific language governing permissions and
1350
1356
  * limitations under the License.
1351
- */ function bt(t) {
1352
- let n = 0;
1353
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
1354
- return n;
1357
+ */ function vt(t) {
1358
+ let e = 0;
1359
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1360
+ return e;
1355
1361
  }
1356
1362
 
1357
- function Et(t, n) {
1358
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n(e, t[e]);
1363
+ function Et(t, e) {
1364
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1359
1365
  }
1360
1366
 
1361
1367
  /**
@@ -1397,11 +1403,11 @@ class Tt {
1397
1403
  *
1398
1404
  * This is an O(n) operation, where `n` is the size of the field mask.
1399
1405
  */ covers(t) {
1400
- for (const n of this.fields) if (n.isPrefixOf(t)) return !0;
1406
+ for (const e of this.fields) if (e.isPrefixOf(t)) return !0;
1401
1407
  return !1;
1402
1408
  }
1403
1409
  isEqual(t) {
1404
- return _t(this.fields, t.fields, ((t, n) => t.isEqual(n)));
1410
+ return _t(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1405
1411
  }
1406
1412
  }
1407
1413
 
@@ -1452,23 +1458,23 @@ class It {
1452
1458
  this.binaryString = t;
1453
1459
  }
1454
1460
  static fromBase64String(t) {
1455
- const n = atob(t);
1456
- return new It(n);
1461
+ const e = atob(t);
1462
+ return new It(e);
1457
1463
  }
1458
1464
  static fromUint8Array(t) {
1459
- const n =
1465
+ const e =
1460
1466
  /**
1461
1467
  * Helper function to convert an Uint8array to a binary string.
1462
1468
  */
1463
1469
  function(t) {
1464
- let n = "";
1465
- for (let e = 0; e < t.length; ++e) n += String.fromCharCode(t[e]);
1466
- return n;
1470
+ let e = "";
1471
+ for (let n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]);
1472
+ return e;
1467
1473
  }
1468
1474
  /**
1469
1475
  * Helper function to convert a binary string to an Uint8Array.
1470
1476
  */ (t);
1471
- return new It(n);
1477
+ return new It(e);
1472
1478
  }
1473
1479
  [Symbol.iterator]() {
1474
1480
  let t = 0;
@@ -1489,9 +1495,9 @@ class It {
1489
1495
  }
1490
1496
  toUint8Array() {
1491
1497
  return function(t) {
1492
- const n = new Uint8Array(t.length);
1493
- for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
1494
- return n;
1498
+ const e = new Uint8Array(t.length);
1499
+ for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
1500
+ return e;
1495
1501
  }
1496
1502
  /**
1497
1503
  * @license
@@ -1534,22 +1540,22 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1534
1540
  // The json interface (for the browser) will return an iso timestamp string,
1535
1541
  // while the proto js library (for node) will return a
1536
1542
  // google.protobuf.Timestamp instance.
1537
- if (v(!!t), "string" == typeof t) {
1543
+ if (b(!!t), "string" == typeof t) {
1538
1544
  // The date string can have higher precision (nanos) than the Date class
1539
1545
  // (millis), so we do some custom parsing here.
1540
1546
  // Parse the nanos right out of the string.
1541
- let n = 0;
1542
- const e = At.exec(t);
1543
- if (v(!!e), e[1]) {
1547
+ let e = 0;
1548
+ const n = At.exec(t);
1549
+ if (b(!!n), n[1]) {
1544
1550
  // Pad the fraction out to 9 digits (nanos).
1545
- let t = e[1];
1546
- t = (t + "000000000").substr(0, 9), n = Number(t);
1551
+ let t = n[1];
1552
+ t = (t + "000000000").substr(0, 9), e = Number(t);
1547
1553
  }
1548
1554
  // Parse the date to get the seconds.
1549
1555
  const r = new Date(t);
1550
1556
  return {
1551
1557
  seconds: Math.floor(r.getTime() / 1e3),
1552
- nanos: n
1558
+ nanos: e
1553
1559
  };
1554
1560
  }
1555
1561
  return {
@@ -1604,8 +1610,8 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1604
1610
  * - With respect to other ServerTimestampValues, they sort by their
1605
1611
  * localWriteTime.
1606
1612
  */ function Dt(t) {
1607
- var n, e;
1608
- return "server_timestamp" === (null === (e = ((null === (n = null == t ? void 0 : t.mapValue) || void 0 === n ? void 0 : n.fields) || {}).__type__) || void 0 === e ? void 0 : e.stringValue);
1613
+ var e, n;
1614
+ return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
1609
1615
  }
1610
1616
 
1611
1617
  /**
@@ -1614,15 +1620,15 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1614
1620
  * Preserving the previous values allows the user to display the last resoled
1615
1621
  * value until the backend responds with the timestamp.
1616
1622
  */ function Nt(t) {
1617
- const n = t.mapValue.fields.__previous_value__;
1618
- return Dt(n) ? Nt(n) : n;
1623
+ const e = t.mapValue.fields.__previous_value__;
1624
+ return Dt(e) ? Nt(e) : e;
1619
1625
  }
1620
1626
 
1621
1627
  /**
1622
1628
  * Returns the local time at which this timestamp was first set.
1623
1629
  */ function $t(t) {
1624
- const n = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
1625
- return new gt(n.seconds, n.nanos);
1630
+ const e = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
1631
+ return new gt(e.seconds, e.nanos);
1626
1632
  }
1627
1633
 
1628
1634
  /**
@@ -1645,169 +1651,169 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1645
1651
  return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : g();
1646
1652
  }
1647
1653
 
1648
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, n) {
1649
- if (t === n) return !0;
1650
- const e = St(t);
1651
- if (e !== St(n)) return !1;
1652
- switch (e) {
1654
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, e) {
1655
+ if (t === e) return !0;
1656
+ const n = St(t);
1657
+ if (n !== St(e)) return !1;
1658
+ switch (n) {
1653
1659
  case 0 /* NullValue */ :
1654
1660
  return !0;
1655
1661
 
1656
1662
  case 1 /* BooleanValue */ :
1657
- return t.booleanValue === n.booleanValue;
1663
+ return t.booleanValue === e.booleanValue;
1658
1664
 
1659
1665
  case 4 /* ServerTimestampValue */ :
1660
- return $t(t).isEqual($t(n));
1666
+ return $t(t).isEqual($t(e));
1661
1667
 
1662
1668
  case 3 /* TimestampValue */ :
1663
- return function(t, n) {
1664
- if ("string" == typeof t.timestampValue && "string" == typeof n.timestampValue && t.timestampValue.length === n.timestampValue.length)
1669
+ return function(t, e) {
1670
+ if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1665
1671
  // Use string equality for ISO 8601 timestamps
1666
- return t.timestampValue === n.timestampValue;
1667
- const e = Rt(t.timestampValue), r = Rt(n.timestampValue);
1668
- return e.seconds === r.seconds && e.nanos === r.nanos;
1669
- }(t, n);
1672
+ return t.timestampValue === e.timestampValue;
1673
+ const n = Rt(t.timestampValue), r = Rt(e.timestampValue);
1674
+ return n.seconds === r.seconds && n.nanos === r.nanos;
1675
+ }(t, e);
1670
1676
 
1671
1677
  case 5 /* StringValue */ :
1672
- return t.stringValue === n.stringValue;
1678
+ return t.stringValue === e.stringValue;
1673
1679
 
1674
1680
  case 6 /* BlobValue */ :
1675
- return function(t, n) {
1676
- return Vt(t.bytesValue).isEqual(Vt(n.bytesValue));
1677
- }(t, n);
1681
+ return function(t, e) {
1682
+ return Vt(t.bytesValue).isEqual(Vt(e.bytesValue));
1683
+ }(t, e);
1678
1684
 
1679
1685
  case 7 /* RefValue */ :
1680
- return t.referenceValue === n.referenceValue;
1686
+ return t.referenceValue === e.referenceValue;
1681
1687
 
1682
1688
  case 8 /* GeoPointValue */ :
1683
- return function(t, n) {
1684
- return Pt(t.geoPointValue.latitude) === Pt(n.geoPointValue.latitude) && Pt(t.geoPointValue.longitude) === Pt(n.geoPointValue.longitude);
1685
- }(t, n);
1689
+ return function(t, e) {
1690
+ return Pt(t.geoPointValue.latitude) === Pt(e.geoPointValue.latitude) && Pt(t.geoPointValue.longitude) === Pt(e.geoPointValue.longitude);
1691
+ }(t, e);
1686
1692
 
1687
1693
  case 2 /* NumberValue */ :
1688
- return function(t, n) {
1689
- if ("integerValue" in t && "integerValue" in n) return Pt(t.integerValue) === Pt(n.integerValue);
1690
- if ("doubleValue" in t && "doubleValue" in n) {
1691
- const e = Pt(t.doubleValue), r = Pt(n.doubleValue);
1692
- return e === r ? at(e) === at(r) : isNaN(e) && isNaN(r);
1694
+ return function(t, e) {
1695
+ if ("integerValue" in t && "integerValue" in e) return Pt(t.integerValue) === Pt(e.integerValue);
1696
+ if ("doubleValue" in t && "doubleValue" in e) {
1697
+ const n = Pt(t.doubleValue), r = Pt(e.doubleValue);
1698
+ return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);
1693
1699
  }
1694
1700
  return !1;
1695
- }(t, n);
1701
+ }(t, e);
1696
1702
 
1697
1703
  case 9 /* ArrayValue */ :
1698
- return _t(t.arrayValue.values || [], n.arrayValue.values || [], Ft);
1704
+ return _t(t.arrayValue.values || [], e.arrayValue.values || [], Ft);
1699
1705
 
1700
1706
  case 10 /* ObjectValue */ :
1701
- return function(t, n) {
1702
- const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
1703
- if (bt(e) !== bt(r)) return !1;
1704
- for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !Ft(e[t], r[t]))) return !1;
1707
+ return function(t, e) {
1708
+ const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1709
+ if (vt(n) !== vt(r)) return !1;
1710
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ft(n[t], r[t]))) return !1;
1705
1711
  return !0;
1706
1712
  }
1707
- /** Returns true if the ArrayValue contains the specified element. */ (t, n);
1713
+ /** Returns true if the ArrayValue contains the specified element. */ (t, e);
1708
1714
 
1709
1715
  default:
1710
1716
  return g();
1711
1717
  }
1712
1718
  }
1713
1719
 
1714
- function xt(t, n) {
1715
- return void 0 !== (t.values || []).find((t => Ft(t, n)));
1720
+ function xt(t, e) {
1721
+ return void 0 !== (t.values || []).find((t => Ft(t, e)));
1716
1722
  }
1717
1723
 
1718
- function qt(t, n) {
1719
- if (t === n) return 0;
1720
- const e = St(t), r = St(n);
1721
- if (e !== r) return yt(e, r);
1722
- switch (e) {
1724
+ function qt(t, e) {
1725
+ if (t === e) return 0;
1726
+ const n = St(t), r = St(e);
1727
+ if (n !== r) return yt(n, r);
1728
+ switch (n) {
1723
1729
  case 0 /* NullValue */ :
1724
1730
  return 0;
1725
1731
 
1726
1732
  case 1 /* BooleanValue */ :
1727
- return yt(t.booleanValue, n.booleanValue);
1733
+ return yt(t.booleanValue, e.booleanValue);
1728
1734
 
1729
1735
  case 2 /* NumberValue */ :
1730
- return function(t, n) {
1731
- const e = Pt(t.integerValue || t.doubleValue), r = Pt(n.integerValue || n.doubleValue);
1732
- return e < r ? -1 : e > r ? 1 : e === r ? 0 :
1736
+ return function(t, e) {
1737
+ const n = Pt(t.integerValue || t.doubleValue), r = Pt(e.integerValue || e.doubleValue);
1738
+ return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1733
1739
  // one or both are NaN.
1734
- isNaN(e) ? isNaN(r) ? 0 : -1 : 1;
1735
- }(t, n);
1740
+ isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1741
+ }(t, e);
1736
1742
 
1737
1743
  case 3 /* TimestampValue */ :
1738
- return Ot(t.timestampValue, n.timestampValue);
1744
+ return Ot(t.timestampValue, e.timestampValue);
1739
1745
 
1740
1746
  case 4 /* ServerTimestampValue */ :
1741
- return Ot($t(t), $t(n));
1747
+ return Ot($t(t), $t(e));
1742
1748
 
1743
1749
  case 5 /* StringValue */ :
1744
- return yt(t.stringValue, n.stringValue);
1750
+ return yt(t.stringValue, e.stringValue);
1745
1751
 
1746
1752
  case 6 /* BlobValue */ :
1747
- return function(t, n) {
1748
- const e = Vt(t), r = Vt(n);
1749
- return e.compareTo(r);
1750
- }(t.bytesValue, n.bytesValue);
1753
+ return function(t, e) {
1754
+ const n = Vt(t), r = Vt(e);
1755
+ return n.compareTo(r);
1756
+ }(t.bytesValue, e.bytesValue);
1751
1757
 
1752
1758
  case 7 /* RefValue */ :
1753
- return function(t, n) {
1754
- const e = t.split("/"), r = n.split("/");
1755
- for (let t = 0; t < e.length && t < r.length; t++) {
1756
- const n = yt(e[t], r[t]);
1757
- if (0 !== n) return n;
1759
+ return function(t, e) {
1760
+ const n = t.split("/"), r = e.split("/");
1761
+ for (let t = 0; t < n.length && t < r.length; t++) {
1762
+ const e = yt(n[t], r[t]);
1763
+ if (0 !== e) return e;
1758
1764
  }
1759
- return yt(e.length, r.length);
1760
- }(t.referenceValue, n.referenceValue);
1765
+ return yt(n.length, r.length);
1766
+ }(t.referenceValue, e.referenceValue);
1761
1767
 
1762
1768
  case 8 /* GeoPointValue */ :
1763
- return function(t, n) {
1764
- const e = yt(Pt(t.latitude), Pt(n.latitude));
1765
- if (0 !== e) return e;
1766
- return yt(Pt(t.longitude), Pt(n.longitude));
1767
- }(t.geoPointValue, n.geoPointValue);
1769
+ return function(t, e) {
1770
+ const n = yt(Pt(t.latitude), Pt(e.latitude));
1771
+ if (0 !== n) return n;
1772
+ return yt(Pt(t.longitude), Pt(e.longitude));
1773
+ }(t.geoPointValue, e.geoPointValue);
1768
1774
 
1769
1775
  case 9 /* ArrayValue */ :
1770
- return function(t, n) {
1771
- const e = t.values || [], r = n.values || [];
1772
- for (let t = 0; t < e.length && t < r.length; ++t) {
1773
- const n = qt(e[t], r[t]);
1774
- if (n) return n;
1776
+ return function(t, e) {
1777
+ const n = t.values || [], r = e.values || [];
1778
+ for (let t = 0; t < n.length && t < r.length; ++t) {
1779
+ const e = qt(n[t], r[t]);
1780
+ if (e) return e;
1775
1781
  }
1776
- return yt(e.length, r.length);
1777
- }(t.arrayValue, n.arrayValue);
1782
+ return yt(n.length, r.length);
1783
+ }(t.arrayValue, e.arrayValue);
1778
1784
 
1779
1785
  case 10 /* ObjectValue */ :
1780
- return function(t, n) {
1781
- const e = t.fields || {}, r = Object.keys(e), s = n.fields || {}, i = Object.keys(s);
1786
+ return function(t, e) {
1787
+ const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
1782
1788
  // Even though MapValues are likely sorted correctly based on their insertion
1783
1789
  // order (e.g. when received from the backend), local modifications can bring
1784
1790
  // elements out of order. We need to re-sort the elements to ensure that
1785
1791
  // canonical IDs are independent of insertion order.
1786
1792
  r.sort(), i.sort();
1787
1793
  for (let t = 0; t < r.length && t < i.length; ++t) {
1788
- const n = yt(r[t], i[t]);
1789
- if (0 !== n) return n;
1790
- const o = qt(e[r[t]], s[i[t]]);
1794
+ const e = yt(r[t], i[t]);
1795
+ if (0 !== e) return e;
1796
+ const o = qt(n[r[t]], s[i[t]]);
1791
1797
  if (0 !== o) return o;
1792
1798
  }
1793
1799
  return yt(r.length, i.length);
1794
1800
  }
1795
- /** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
1801
+ /** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
1796
1802
 
1797
1803
  default:
1798
1804
  throw g();
1799
1805
  }
1800
1806
  }
1801
1807
 
1802
- function Ot(t, n) {
1803
- if ("string" == typeof t && "string" == typeof n && t.length === n.length) return yt(t, n);
1804
- const e = Rt(t), r = Rt(n), s = yt(e.seconds, r.seconds);
1805
- return 0 !== s ? s : yt(e.nanos, r.nanos);
1808
+ function Ot(t, e) {
1809
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
1810
+ const n = Rt(t), r = Rt(e), s = yt(n.seconds, r.seconds);
1811
+ return 0 !== s ? s : yt(n.nanos, r.nanos);
1806
1812
  }
1807
1813
 
1808
- function Ct(t, n) {
1814
+ function Ct(t, e) {
1809
1815
  return {
1810
- referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${n.path.canonicalString()}`
1816
+ referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
1811
1817
  };
1812
1818
  }
1813
1819
 
@@ -1835,21 +1841,21 @@ function Ct(t, n) {
1835
1841
  timestampValue: Object.assign({}, t.timestampValue)
1836
1842
  };
1837
1843
  if (t.mapValue) {
1838
- const n = {
1844
+ const e = {
1839
1845
  mapValue: {
1840
1846
  fields: {}
1841
1847
  }
1842
1848
  };
1843
- return Et(t.mapValue.fields, ((t, e) => n.mapValue.fields[t] = Mt(e))), n;
1849
+ return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Mt(n))), e;
1844
1850
  }
1845
1851
  if (t.arrayValue) {
1846
- const n = {
1852
+ const e = {
1847
1853
  arrayValue: {
1848
1854
  values: []
1849
1855
  }
1850
1856
  };
1851
- for (let e = 0; e < (t.arrayValue.values || []).length; ++e) n.arrayValue.values[e] = Mt(t.arrayValue.values[e]);
1852
- return n;
1857
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Mt(t.arrayValue.values[n]);
1858
+ return e;
1853
1859
  }
1854
1860
  return Object.assign({}, t);
1855
1861
  }
@@ -1890,10 +1896,10 @@ function Ct(t, n) {
1890
1896
  */ field(t) {
1891
1897
  if (t.isEmpty()) return this.value;
1892
1898
  {
1893
- let n = this.value;
1894
- for (let e = 0; e < t.length - 1; ++e) if (n = (n.mapValue.fields || {})[t.get(e)],
1895
- !jt(n)) return null;
1896
- return n = (n.mapValue.fields || {})[t.lastSegment()], n || null;
1899
+ let e = this.value;
1900
+ for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
1901
+ !jt(e)) return null;
1902
+ return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
1897
1903
  }
1898
1904
  }
1899
1905
  /**
@@ -1901,25 +1907,25 @@ function Ct(t, n) {
1901
1907
  *
1902
1908
  * @param path - The field path to set.
1903
1909
  * @param value - The value to set.
1904
- */ set(t, n) {
1905
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(n);
1910
+ */ set(t, e) {
1911
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(e);
1906
1912
  }
1907
1913
  /**
1908
1914
  * Sets the provided fields to the provided values.
1909
1915
  *
1910
1916
  * @param data - A map of fields to values (or null for deletes).
1911
1917
  */ setAll(t) {
1912
- let n = tt.emptyPath(), e = {}, r = [];
1918
+ let e = tt.emptyPath(), n = {}, r = [];
1913
1919
  t.forEach(((t, s) => {
1914
- if (!n.isImmediateParentOf(s)) {
1920
+ if (!e.isImmediateParentOf(s)) {
1915
1921
  // Insert the accumulated changes at this parent location
1916
- const t = this.getFieldsMap(n);
1917
- this.applyChanges(t, e, r), e = {}, r = [], n = s.popLast();
1922
+ const t = this.getFieldsMap(e);
1923
+ this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
1918
1924
  }
1919
- t ? e[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
1925
+ t ? n[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
1920
1926
  }));
1921
- const s = this.getFieldsMap(n);
1922
- this.applyChanges(s, e, r);
1927
+ const s = this.getFieldsMap(e);
1928
+ this.applyChanges(s, n, r);
1923
1929
  }
1924
1930
  /**
1925
1931
  * Removes the field at the specified path. If there is no field at the
@@ -1927,8 +1933,8 @@ function Ct(t, n) {
1927
1933
  *
1928
1934
  * @param path - The field path to remove.
1929
1935
  */ delete(t) {
1930
- const n = this.field(t.popLast());
1931
- jt(n) && n.mapValue.fields && delete n.mapValue.fields[t.lastSegment()];
1936
+ const e = this.field(t.popLast());
1937
+ jt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1932
1938
  }
1933
1939
  isEqual(t) {
1934
1940
  return Ft(this.value, t.value);
@@ -1937,26 +1943,26 @@ function Ct(t, n) {
1937
1943
  * Returns the map that contains the leaf element of `path`. If the parent
1938
1944
  * entry does not yet exist, or if it is not a map, a new map will be created.
1939
1945
  */ getFieldsMap(t) {
1940
- let n = this.value;
1941
- n.mapValue.fields || (n.mapValue = {
1946
+ let e = this.value;
1947
+ e.mapValue.fields || (e.mapValue = {
1942
1948
  fields: {}
1943
1949
  });
1944
- for (let e = 0; e < t.length; ++e) {
1945
- let r = n.mapValue.fields[t.get(e)];
1950
+ for (let n = 0; n < t.length; ++n) {
1951
+ let r = e.mapValue.fields[t.get(n)];
1946
1952
  jt(r) && r.mapValue.fields || (r = {
1947
1953
  mapValue: {
1948
1954
  fields: {}
1949
1955
  }
1950
- }, n.mapValue.fields[t.get(e)] = r), n = r;
1956
+ }, e.mapValue.fields[t.get(n)] = r), e = r;
1951
1957
  }
1952
- return n.mapValue.fields;
1958
+ return e.mapValue.fields;
1953
1959
  }
1954
1960
  /**
1955
1961
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
1956
1962
  * entries.
1957
- */ applyChanges(t, n, e) {
1958
- Et(n, ((n, e) => t[n] = e));
1959
- for (const n of e) delete t[n];
1963
+ */ applyChanges(t, e, n) {
1964
+ Et(e, ((e, n) => t[e] = n));
1965
+ for (const e of n) delete t[e];
1960
1966
  }
1961
1967
  clone() {
1962
1968
  return new Bt(Mt(this.value));
@@ -1989,36 +1995,37 @@ function Ct(t, n) {
1989
1995
  * applied, `isValidDocument()` returns false and the document should be removed
1990
1996
  * from all views.
1991
1997
  */ class zt {
1992
- constructor(t, n, e, r, s) {
1993
- this.key = t, this.documentType = n, this.version = e, this.data = r, this.documentState = s;
1998
+ constructor(t, e, n, r, s, i) {
1999
+ this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2000
+ this.documentState = i;
1994
2001
  }
1995
2002
  /**
1996
2003
  * Creates a document with no known version or data, but which can serve as
1997
2004
  * base document for mutations.
1998
2005
  */ static newInvalidDocument(t) {
1999
- return new zt(t, 0 /* INVALID */ , vt.min(), Bt.empty(), 0 /* SYNCED */);
2006
+ return new zt(t, 0 /* INVALID */ , bt.min(), bt.min(), Bt.empty(), 0 /* SYNCED */);
2000
2007
  }
2001
2008
  /**
2002
2009
  * Creates a new document that is known to exist with the given data at the
2003
2010
  * given version.
2004
- */ static newFoundDocument(t, n, e) {
2005
- return new zt(t, 1 /* FOUND_DOCUMENT */ , n, e, 0 /* SYNCED */);
2011
+ */ static newFoundDocument(t, e, n) {
2012
+ return new zt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2006
2013
  }
2007
- /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
2008
- return new zt(t, 2 /* NO_DOCUMENT */ , n, Bt.empty(), 0 /* SYNCED */);
2014
+ /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2015
+ return new zt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Bt.empty(), 0 /* SYNCED */);
2009
2016
  }
2010
2017
  /**
2011
2018
  * Creates a new document that is known to exist at the given version but
2012
2019
  * whose data is not known (e.g. a document that was updated without a known
2013
2020
  * base document).
2014
- */ static newUnknownDocument(t, n) {
2015
- return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2021
+ */ static newUnknownDocument(t, e) {
2022
+ return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2016
2023
  }
2017
2024
  /**
2018
2025
  * Changes the document type to indicate that it exists and that its version
2019
2026
  * and data are known.
2020
- */ convertToFoundDocument(t, n) {
2021
- return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = n,
2027
+ */ convertToFoundDocument(t, e) {
2028
+ return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = e,
2022
2029
  this.documentState = 0 /* SYNCED */ , this;
2023
2030
  }
2024
2031
  /**
@@ -2042,6 +2049,9 @@ function Ct(t, n) {
2042
2049
  setHasLocalMutations() {
2043
2050
  return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
2044
2051
  }
2052
+ setReadTime(t) {
2053
+ return this.readTime = t, this;
2054
+ }
2045
2055
  get hasLocalMutations() {
2046
2056
  return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
2047
2057
  }
@@ -2067,7 +2077,7 @@ function Ct(t, n) {
2067
2077
  return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2068
2078
  }
2069
2079
  mutableCopy() {
2070
- return new zt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
2080
+ return new zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2071
2081
  }
2072
2082
  toString() {
2073
2083
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2092,8 +2102,8 @@ function Ct(t, n) {
2092
2102
  */
2093
2103
  // Visible for testing
2094
2104
  class Gt {
2095
- constructor(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2096
- this.path = t, this.collectionGroup = n, this.orderBy = e, this.filters = r, this.limit = s,
2105
+ constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2106
+ this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2097
2107
  this.startAt = i, this.endAt = o, this.P = null;
2098
2108
  }
2099
2109
  }
@@ -2105,26 +2115,26 @@ class Gt {
2105
2115
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2106
2116
  * using this factory method, because `Query` provides an implicit `orderBy`
2107
2117
  * property.
2108
- */ function Qt(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2109
- return new Gt(t, n, e, r, s, i, o);
2118
+ */ function Qt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2119
+ return new Gt(t, e, n, r, s, i, o);
2110
2120
  }
2111
2121
 
2112
2122
  class Wt extends class {} {
2113
- constructor(t, n, e) {
2114
- super(), this.field = t, this.op = n, this.value = e;
2123
+ constructor(t, e, n) {
2124
+ super(), this.field = t, this.op = e, this.value = n;
2115
2125
  }
2116
2126
  /**
2117
2127
  * Creates a filter based on the provided arguments.
2118
- */ static create(t, n, e) {
2119
- return t.isKeyField() ? "in" /* IN */ === n || "not-in" /* NOT_IN */ === n ? this.V(t, n, e) : new Yt(t, n, e) : "array-contains" /* ARRAY_CONTAINS */ === n ? new Xt(t, e) : "in" /* IN */ === n ? new Zt(t, e) : "not-in" /* NOT_IN */ === n ? new tn(t, e) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === n ? new nn(t, e) : new Wt(t, n, e);
2128
+ */ static create(t, e, n) {
2129
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Yt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Xt(t, n) : "in" /* IN */ === e ? new Zt(t, n) : "not-in" /* NOT_IN */ === e ? new te(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ee(t, n) : new Wt(t, e, n);
2120
2130
  }
2121
- static V(t, n, e) {
2122
- return "in" /* IN */ === n ? new Ht(t, e) : new Kt(t, e);
2131
+ static V(t, e, n) {
2132
+ return "in" /* IN */ === e ? new Ht(t, n) : new Kt(t, n);
2123
2133
  }
2124
2134
  matches(t) {
2125
- const n = t.data.field(this.field);
2135
+ const e = t.data.field(this.field);
2126
2136
  // Types do not have to match in NOT_EQUAL filters.
2127
- return "!=" /* NOT_EQUAL */ === this.op ? null !== n && this.D(qt(n, this.value)) : null !== n && St(this.value) === St(n) && this.D(qt(n, this.value));
2137
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(qt(e, this.value)) : null !== e && St(this.value) === St(e) && this.D(qt(e, this.value));
2128
2138
  // Only compare types with matching backend order (such as double and int).
2129
2139
  }
2130
2140
  D(t) {
@@ -2158,78 +2168,78 @@ class Wt extends class {} {
2158
2168
 
2159
2169
  /** Filter that matches on key fields (i.e. '__name__'). */
2160
2170
  class Yt extends Wt {
2161
- constructor(t, n, e) {
2162
- super(t, n, e), this.key = nt.fromName(e.referenceValue);
2171
+ constructor(t, e, n) {
2172
+ super(t, e, n), this.key = et.fromName(n.referenceValue);
2163
2173
  }
2164
2174
  matches(t) {
2165
- const n = nt.comparator(t.key, this.key);
2166
- return this.D(n);
2175
+ const e = et.comparator(t.key, this.key);
2176
+ return this.D(e);
2167
2177
  }
2168
2178
  }
2169
2179
 
2170
2180
  /** Filter that matches on key fields within an array. */ class Ht extends Wt {
2171
- constructor(t, n) {
2172
- super(t, "in" /* IN */ , n), this.keys = Jt("in" /* IN */ , n);
2181
+ constructor(t, e) {
2182
+ super(t, "in" /* IN */ , e), this.keys = Jt("in" /* IN */ , e);
2173
2183
  }
2174
2184
  matches(t) {
2175
- return this.keys.some((n => n.isEqual(t.key)));
2185
+ return this.keys.some((e => e.isEqual(t.key)));
2176
2186
  }
2177
2187
  }
2178
2188
 
2179
2189
  /** Filter that matches on key fields not present within an array. */ class Kt extends Wt {
2180
- constructor(t, n) {
2181
- super(t, "not-in" /* NOT_IN */ , n), this.keys = Jt("not-in" /* NOT_IN */ , n);
2190
+ constructor(t, e) {
2191
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = Jt("not-in" /* NOT_IN */ , e);
2182
2192
  }
2183
2193
  matches(t) {
2184
- return !this.keys.some((n => n.isEqual(t.key)));
2194
+ return !this.keys.some((e => e.isEqual(t.key)));
2185
2195
  }
2186
2196
  }
2187
2197
 
2188
- function Jt(t, n) {
2189
- var e;
2190
- return ((null === (e = n.arrayValue) || void 0 === e ? void 0 : e.values) || []).map((t => nt.fromName(t.referenceValue)));
2198
+ function Jt(t, e) {
2199
+ var n;
2200
+ return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
2191
2201
  }
2192
2202
 
2193
2203
  /** A Filter that implements the array-contains operator. */ class Xt extends Wt {
2194
- constructor(t, n) {
2195
- super(t, "array-contains" /* ARRAY_CONTAINS */ , n);
2204
+ constructor(t, e) {
2205
+ super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2196
2206
  }
2197
2207
  matches(t) {
2198
- const n = t.data.field(this.field);
2199
- return Lt(n) && xt(n.arrayValue, this.value);
2208
+ const e = t.data.field(this.field);
2209
+ return Lt(e) && xt(e.arrayValue, this.value);
2200
2210
  }
2201
2211
  }
2202
2212
 
2203
2213
  /** A Filter that implements the IN operator. */ class Zt extends Wt {
2204
- constructor(t, n) {
2205
- super(t, "in" /* IN */ , n);
2214
+ constructor(t, e) {
2215
+ super(t, "in" /* IN */ , e);
2206
2216
  }
2207
2217
  matches(t) {
2208
- const n = t.data.field(this.field);
2209
- return null !== n && xt(this.value.arrayValue, n);
2218
+ const e = t.data.field(this.field);
2219
+ return null !== e && xt(this.value.arrayValue, e);
2210
2220
  }
2211
2221
  }
2212
2222
 
2213
- /** A Filter that implements the not-in operator. */ class tn extends Wt {
2214
- constructor(t, n) {
2215
- super(t, "not-in" /* NOT_IN */ , n);
2223
+ /** A Filter that implements the not-in operator. */ class te extends Wt {
2224
+ constructor(t, e) {
2225
+ super(t, "not-in" /* NOT_IN */ , e);
2216
2226
  }
2217
2227
  matches(t) {
2218
2228
  if (xt(this.value.arrayValue, {
2219
2229
  nullValue: "NULL_VALUE"
2220
2230
  })) return !1;
2221
- const n = t.data.field(this.field);
2222
- return null !== n && !xt(this.value.arrayValue, n);
2231
+ const e = t.data.field(this.field);
2232
+ return null !== e && !xt(this.value.arrayValue, e);
2223
2233
  }
2224
2234
  }
2225
2235
 
2226
- /** A Filter that implements the array-contains-any operator. */ class nn extends Wt {
2227
- constructor(t, n) {
2228
- super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n);
2236
+ /** A Filter that implements the array-contains-any operator. */ class ee extends Wt {
2237
+ constructor(t, e) {
2238
+ super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2229
2239
  }
2230
2240
  matches(t) {
2231
- const n = t.data.field(this.field);
2232
- return !(!Lt(n) || !n.arrayValue.values) && n.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
2241
+ const e = t.data.field(this.field);
2242
+ return !(!Lt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
2233
2243
  }
2234
2244
  }
2235
2245
 
@@ -2246,30 +2256,30 @@ function Jt(t, n) {
2246
2256
  * Bound provides a function to determine whether a document comes before or
2247
2257
  * after a bound. This is influenced by whether the position is just before or
2248
2258
  * just after the provided values.
2249
- */ class en {
2250
- constructor(t, n) {
2251
- this.position = t, this.before = n;
2259
+ */ class ne {
2260
+ constructor(t, e) {
2261
+ this.position = t, this.inclusive = e;
2252
2262
  }
2253
2263
  }
2254
2264
 
2255
2265
  /**
2256
2266
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2257
- */ class rn {
2258
- constructor(t, n = "asc" /* ASCENDING */) {
2259
- this.field = t, this.dir = n;
2267
+ */ class re {
2268
+ constructor(t, e = "asc" /* ASCENDING */) {
2269
+ this.field = t, this.dir = e;
2260
2270
  }
2261
2271
  }
2262
2272
 
2263
- function sn(t, n) {
2264
- return t.dir === n.dir && t.field.isEqual(n.field);
2273
+ function se(t, e) {
2274
+ return t.dir === e.dir && t.field.isEqual(e.field);
2265
2275
  }
2266
2276
 
2267
- function on(t, n) {
2268
- if (null === t) return null === n;
2269
- if (null === n) return !1;
2270
- if (t.before !== n.before || t.position.length !== n.position.length) return !1;
2271
- for (let e = 0; e < t.position.length; e++) {
2272
- if (!Ft(t.position[e], n.position[e])) return !1;
2277
+ function ie(t, e) {
2278
+ if (null === t) return null === e;
2279
+ if (null === e) return !1;
2280
+ if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2281
+ for (let n = 0; n < t.position.length; n++) {
2282
+ if (!Ft(t.position[n], e.position[n])) return !1;
2273
2283
  }
2274
2284
  return !0;
2275
2285
  }
@@ -2296,29 +2306,29 @@ function on(t, n) {
2296
2306
  * query the RemoteStore results.
2297
2307
  *
2298
2308
  * Visible for testing.
2299
- */ class un {
2309
+ */ class oe {
2300
2310
  /**
2301
2311
  * Initializes a Query with a path and optional additional query constraints.
2302
2312
  * Path must currently be empty if this is a collection group query.
2303
2313
  */
2304
- constructor(t, n = null, e = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2305
- this.path = t, this.collectionGroup = n, this.explicitOrderBy = e, this.filters = r,
2314
+ constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2315
+ this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
2306
2316
  this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
2307
2317
  // The corresponding `Target` of this `Query` instance.
2308
2318
  this.S = null, this.startAt, this.endAt;
2309
2319
  }
2310
2320
  }
2311
2321
 
2312
- /** Creates a new Query for a query that matches all documents at `path` */ function cn(t) {
2322
+ /** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
2313
2323
  return !ct(t.limit) && "L" /* Last */ === t.limitType;
2314
2324
  }
2315
2325
 
2316
- function an(t) {
2326
+ function ce(t) {
2317
2327
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2318
2328
  }
2319
2329
 
2320
- function hn(t) {
2321
- for (const n of t.filters) if (n.N()) return n.field;
2330
+ function ae(t) {
2331
+ for (const e of t.filters) if (e.N()) return e.field;
2322
2332
  return null;
2323
2333
  }
2324
2334
 
@@ -2330,7 +2340,7 @@ function hn(t) {
2330
2340
  * Returns whether the query matches a collection group rather than a specific
2331
2341
  * collection.
2332
2342
  */
2333
- function ln(t) {
2343
+ function he(t) {
2334
2344
  return null !== t.collectionGroup;
2335
2345
  }
2336
2346
 
@@ -2338,59 +2348,59 @@ function ln(t) {
2338
2348
  * Returns the implicit order by constraint that is used to execute the Query,
2339
2349
  * which can be different from the order by constraints the user provided (e.g.
2340
2350
  * the SDK and backend always orders by `__name__`).
2341
- */ function fn(t) {
2342
- const n = b(t);
2343
- if (null === n.$) {
2344
- n.$ = [];
2345
- const t = hn(n), e = an(n);
2346
- if (null !== t && null === e)
2351
+ */ function le(t) {
2352
+ const e = v(t);
2353
+ if (null === e.$) {
2354
+ e.$ = [];
2355
+ const t = ae(e), n = ce(e);
2356
+ if (null !== t && null === n)
2347
2357
  // In order to implicitly add key ordering, we must also add the
2348
2358
  // inequality filter field for it to be a valid query.
2349
2359
  // Note that the default inequality field and key ordering is ascending.
2350
- t.isKeyField() || n.$.push(new rn(t)), n.$.push(new rn(tt.keyField(), "asc" /* ASCENDING */)); else {
2360
+ t.isKeyField() || e.$.push(new re(t)), e.$.push(new re(tt.keyField(), "asc" /* ASCENDING */)); else {
2351
2361
  let t = !1;
2352
- for (const e of n.explicitOrderBy) n.$.push(e), e.field.isKeyField() && (t = !0);
2362
+ for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
2353
2363
  if (!t) {
2354
2364
  // The order of the implicit key ordering always matches the last
2355
2365
  // explicit order by
2356
- const t = n.explicitOrderBy.length > 0 ? n.explicitOrderBy[n.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2357
- n.$.push(new rn(tt.keyField(), t));
2366
+ const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2367
+ e.$.push(new re(tt.keyField(), t));
2358
2368
  }
2359
2369
  }
2360
2370
  }
2361
- return n.$;
2371
+ return e.$;
2362
2372
  }
2363
2373
 
2364
2374
  /**
2365
2375
  * Converts this `Query` instance to it's corresponding `Target` representation.
2366
- */ function dn(t) {
2367
- const n = b(t);
2368
- if (!n.S) if ("F" /* First */ === n.limitType) n.S = Qt(n.path, n.collectionGroup, fn(n), n.filters, n.limit, n.startAt, n.endAt); else {
2376
+ */ function fe(t) {
2377
+ const e = v(t);
2378
+ if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
2369
2379
  // Flip the orderBy directions since we want the last results
2370
2380
  const t = [];
2371
- for (const e of fn(n)) {
2372
- const n = "desc" /* DESCENDING */ === e.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2373
- t.push(new rn(e.field, n));
2381
+ for (const n of le(e)) {
2382
+ const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2383
+ t.push(new re(n.field, e));
2374
2384
  }
2375
2385
  // We need to swap the cursors to match the now-flipped query ordering.
2376
- const e = n.endAt ? new en(n.endAt.position, !n.endAt.before) : null, r = n.startAt ? new en(n.startAt.position, !n.startAt.before) : null;
2386
+ const n = e.endAt ? new ne(e.endAt.position, !e.endAt.inclusive) : null, r = e.startAt ? new ne(e.startAt.position, !e.startAt.inclusive) : null;
2377
2387
  // Now return as a LimitType.First query.
2378
- n.S = Qt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
2388
+ e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2379
2389
  }
2380
- return n.S;
2390
+ return e.S;
2381
2391
  }
2382
2392
 
2383
- function wn(t, n) {
2384
- return function(t, n) {
2385
- if (t.limit !== n.limit) return !1;
2386
- if (t.orderBy.length !== n.orderBy.length) return !1;
2387
- for (let e = 0; e < t.orderBy.length; e++) if (!sn(t.orderBy[e], n.orderBy[e])) return !1;
2388
- if (t.filters.length !== n.filters.length) return !1;
2389
- for (let s = 0; s < t.filters.length; s++) if (e = t.filters[s], r = n.filters[s],
2390
- e.op !== r.op || !e.field.isEqual(r.field) || !Ft(e.value, r.value)) return !1;
2391
- var e, r;
2392
- return t.collectionGroup === n.collectionGroup && !!t.path.isEqual(n.path) && !!on(t.startAt, n.startAt) && on(t.endAt, n.endAt);
2393
- }(dn(t), dn(n)) && t.limitType === n.limitType;
2393
+ function de(t, e) {
2394
+ return function(t, e) {
2395
+ if (t.limit !== e.limit) return !1;
2396
+ if (t.orderBy.length !== e.orderBy.length) return !1;
2397
+ for (let n = 0; n < t.orderBy.length; n++) if (!se(t.orderBy[n], e.orderBy[n])) return !1;
2398
+ if (t.filters.length !== e.filters.length) return !1;
2399
+ for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2400
+ n.op !== r.op || !n.field.isEqual(r.field) || !Ft(n.value, r.value)) return !1;
2401
+ var n, r;
2402
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ie(t.startAt, e.startAt) && ie(t.endAt, e.endAt);
2403
+ }(fe(t), fe(e)) && t.limitType === e.limitType;
2394
2404
  }
2395
2405
 
2396
2406
  /**
@@ -2418,10 +2428,10 @@ function wn(t, n) {
2418
2428
  * The return value is an IntegerValue if it can safely represent the value,
2419
2429
  * otherwise a DoubleValue is returned.
2420
2430
  */
2421
- function mn(t, n) {
2431
+ function we(t, e) {
2422
2432
  return function(t) {
2423
2433
  return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2424
- }(n) ?
2434
+ }(e) ?
2425
2435
  /**
2426
2436
  * Returns an IntegerValue for `value`.
2427
2437
  */
@@ -2429,22 +2439,22 @@ function mn(t, n) {
2429
2439
  return {
2430
2440
  integerValue: "" + t
2431
2441
  };
2432
- }(n) : function(t, n) {
2442
+ }(e) : function(t, e) {
2433
2443
  if (t.F) {
2434
- if (isNaN(n)) return {
2444
+ if (isNaN(e)) return {
2435
2445
  doubleValue: "NaN"
2436
2446
  };
2437
- if (n === 1 / 0) return {
2447
+ if (e === 1 / 0) return {
2438
2448
  doubleValue: "Infinity"
2439
2449
  };
2440
- if (n === -1 / 0) return {
2450
+ if (e === -1 / 0) return {
2441
2451
  doubleValue: "-Infinity"
2442
2452
  };
2443
2453
  }
2444
2454
  return {
2445
- doubleValue: at(n) ? "-0" : n
2455
+ doubleValue: at(e) ? "-0" : e
2446
2456
  };
2447
- }(t, n);
2457
+ }(t, e);
2448
2458
  }
2449
2459
 
2450
2460
  /**
@@ -2463,7 +2473,7 @@ function mn(t, n) {
2463
2473
  * See the License for the specific language governing permissions and
2464
2474
  * limitations under the License.
2465
2475
  */
2466
- /** Used to represent a field transform on a mutation. */ class pn {
2476
+ /** Used to represent a field transform on a mutation. */ class me {
2467
2477
  constructor() {
2468
2478
  // Make sure that the structural type of `TransformOperation` is unique.
2469
2479
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2471,15 +2481,15 @@ function mn(t, n) {
2471
2481
  }
2472
2482
  }
2473
2483
 
2474
- /** Transforms a value into a server-generated timestamp. */ class yn extends pn {}
2484
+ /** Transforms a value into a server-generated timestamp. */ class pe extends me {}
2475
2485
 
2476
- /** Transforms an array value via a union operation. */ class _n extends pn {
2486
+ /** Transforms an array value via a union operation. */ class ye extends me {
2477
2487
  constructor(t) {
2478
2488
  super(), this.elements = t;
2479
2489
  }
2480
2490
  }
2481
2491
 
2482
- /** Transforms an array value via a remove operation. */ class gn extends pn {
2492
+ /** Transforms an array value via a remove operation. */ class _e extends me {
2483
2493
  constructor(t) {
2484
2494
  super(), this.elements = t;
2485
2495
  }
@@ -2490,9 +2500,9 @@ function mn(t, n) {
2490
2500
  * transforms. Converts all field values to integers or doubles, but unlike the
2491
2501
  * backend does not cap integer values at 2^63. Instead, JavaScript number
2492
2502
  * arithmetic is used and precision loss can occur for values greater than 2^53.
2493
- */ class vn extends pn {
2494
- constructor(t, n) {
2495
- super(), this.q = t, this.O = n;
2503
+ */ class ge extends me {
2504
+ constructor(t, e) {
2505
+ super(), this.q = t, this.O = e;
2496
2506
  }
2497
2507
  }
2498
2508
 
@@ -2512,9 +2522,9 @@ function mn(t, n) {
2512
2522
  * See the License for the specific language governing permissions and
2513
2523
  * limitations under the License.
2514
2524
  */
2515
- /** A field path and the TransformOperation to perform upon it. */ class bn {
2516
- constructor(t, n) {
2517
- this.field = t, this.transform = n;
2525
+ /** A field path and the TransformOperation to perform upon it. */ class be {
2526
+ constructor(t, e) {
2527
+ this.field = t, this.transform = e;
2518
2528
  }
2519
2529
  }
2520
2530
 
@@ -2522,18 +2532,18 @@ function mn(t, n) {
2522
2532
  * Encodes a precondition for a mutation. This follows the model that the
2523
2533
  * backend accepts with the special case of an explicit "empty" precondition
2524
2534
  * (meaning no precondition).
2525
- */ class En {
2526
- constructor(t, n) {
2527
- this.updateTime = t, this.exists = n;
2535
+ */ class ve {
2536
+ constructor(t, e) {
2537
+ this.updateTime = t, this.exists = e;
2528
2538
  }
2529
2539
  /** Creates a new empty Precondition. */ static none() {
2530
- return new En;
2540
+ return new ve;
2531
2541
  }
2532
2542
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
2533
- return new En(void 0, t);
2543
+ return new ve(void 0, t);
2534
2544
  }
2535
2545
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
2536
- return new En(t);
2546
+ return new ve(t);
2537
2547
  }
2538
2548
  /** Returns whether this Precondition is empty. */ get isNone() {
2539
2549
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -2586,14 +2596,14 @@ function mn(t, n) {
2586
2596
  * applyToLocalView() to implement the actual behavior of applying the mutation
2587
2597
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
2588
2598
  * example).
2589
- */ class Tn {}
2599
+ */ class Ee {}
2590
2600
 
2591
2601
  /**
2592
2602
  * A mutation that creates or replaces the document at the given key with the
2593
2603
  * object value contents.
2594
- */ class In extends Tn {
2595
- constructor(t, n, e, r = []) {
2596
- super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
2604
+ */ class Te extends Ee {
2605
+ constructor(t, e, n, r = []) {
2606
+ super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
2597
2607
  this.type = 0 /* Set */;
2598
2608
  }
2599
2609
  }
@@ -2610,16 +2620,16 @@ function mn(t, n) {
2610
2620
  * is deleted.
2611
2621
  * * When a field is not in the mask but is in the values, the values map is
2612
2622
  * ignored.
2613
- */ class An extends Tn {
2614
- constructor(t, n, e, r, s = []) {
2615
- super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
2623
+ */ class Ie extends Ee {
2624
+ constructor(t, e, n, r, s = []) {
2625
+ super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
2616
2626
  this.fieldTransforms = s, this.type = 1 /* Patch */;
2617
2627
  }
2618
2628
  }
2619
2629
 
2620
- /** A mutation that deletes the document at the given key. */ class Rn extends Tn {
2621
- constructor(t, n) {
2622
- super(), this.key = t, this.precondition = n, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2630
+ /** A mutation that deletes the document at the given key. */ class Ae extends Ee {
2631
+ constructor(t, e) {
2632
+ super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2623
2633
  }
2624
2634
  }
2625
2635
 
@@ -2629,9 +2639,9 @@ function mn(t, n) {
2629
2639
  *
2630
2640
  * The `verify` operation is only used in Transactions, and this class serves
2631
2641
  * primarily to facilitate serialization into protos.
2632
- */ class Pn extends Tn {
2633
- constructor(t, n) {
2634
- super(), this.key = t, this.precondition = n, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2642
+ */ class Re extends Ee {
2643
+ constructor(t, e) {
2644
+ super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2635
2645
  }
2636
2646
  }
2637
2647
 
@@ -2650,13 +2660,13 @@ function mn(t, n) {
2650
2660
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2651
2661
  * See the License for the specific language governing permissions and
2652
2662
  * limitations under the License.
2653
- */ const Vn = (() => {
2663
+ */ const Pe = (() => {
2654
2664
  const t = {
2655
2665
  asc: "ASCENDING",
2656
2666
  desc: "DESCENDING"
2657
2667
  };
2658
2668
  return t;
2659
- })(), Dn = (() => {
2669
+ })(), Ve = (() => {
2660
2670
  const t = {
2661
2671
  "<": "LESS_THAN",
2662
2672
  "<=": "LESS_THAN_OR_EQUAL",
@@ -2686,9 +2696,9 @@ function mn(t, n) {
2686
2696
  * TODO(klimt): We can remove the databaseId argument if we keep the full
2687
2697
  * resource name in documents.
2688
2698
  */
2689
- class Nn {
2690
- constructor(t, n) {
2691
- this.databaseId = t, this.F = n;
2699
+ class De {
2700
+ constructor(t, e) {
2701
+ this.databaseId = t, this.F = e;
2692
2702
  }
2693
2703
  }
2694
2704
 
@@ -2703,13 +2713,13 @@ class Nn {
2703
2713
  /**
2704
2714
  * Returns a value for a Date that's appropriate to put into a proto.
2705
2715
  */
2706
- function $n(t, n) {
2716
+ function Ne(t, e) {
2707
2717
  if (t.F) {
2708
- return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
2718
+ return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
2709
2719
  }
2710
2720
  return {
2711
- seconds: "" + n.seconds,
2712
- nanos: n.nanoseconds
2721
+ seconds: "" + e.seconds,
2722
+ nanos: e.nanoseconds
2713
2723
  };
2714
2724
  }
2715
2725
 
@@ -2718,232 +2728,234 @@ function $n(t, n) {
2718
2728
  *
2719
2729
  * Visible for testing.
2720
2730
  */
2721
- function Sn(t, n) {
2722
- return t.F ? n.toBase64() : n.toUint8Array();
2731
+ function $e(t, e) {
2732
+ return t.F ? e.toBase64() : e.toUint8Array();
2723
2733
  }
2724
2734
 
2725
- function Fn(t, n) {
2726
- return $n(t, n.toTimestamp());
2735
+ function Se(t, e) {
2736
+ return Ne(t, e.toTimestamp());
2727
2737
  }
2728
2738
 
2729
- function xn(t) {
2730
- return v(!!t), vt.fromTimestamp(function(t) {
2731
- const n = Rt(t);
2732
- return new gt(n.seconds, n.nanos);
2739
+ function Fe(t) {
2740
+ return b(!!t), bt.fromTimestamp(function(t) {
2741
+ const e = Rt(t);
2742
+ return new gt(e.seconds, e.nanos);
2733
2743
  }(t));
2734
2744
  }
2735
2745
 
2736
- function qn(t, n) {
2746
+ function xe(t, e) {
2737
2747
  return function(t) {
2738
2748
  return new X([ "projects", t.projectId, "databases", t.database ]);
2739
- }(t).child("documents").child(n).canonicalString();
2749
+ }(t).child("documents").child(e).canonicalString();
2740
2750
  }
2741
2751
 
2742
- function On(t, n) {
2743
- return qn(t.databaseId, n.path);
2752
+ function qe(t, e) {
2753
+ return xe(t.databaseId, e.path);
2744
2754
  }
2745
2755
 
2746
- function Cn(t, n) {
2747
- const e = function(t) {
2748
- const n = X.fromString(t);
2749
- return v(Hn(n)), n;
2750
- }(n);
2751
- if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
2752
- if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
2753
- return new nt((v((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2756
+ function Oe(t, e) {
2757
+ const n = function(t) {
2758
+ const e = X.fromString(t);
2759
+ return b(We(e)), e;
2760
+ }(e);
2761
+ if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2762
+ if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2763
+ return new et((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2754
2764
  var r;
2755
2765
  /** Creates a Document proto from key and fields (but no create/update time) */}
2756
2766
 
2757
- function Ln(t, n) {
2758
- return qn(t.databaseId, n);
2767
+ function Ce(t, e) {
2768
+ return xe(t.databaseId, e);
2759
2769
  }
2760
2770
 
2761
- function Un(t) {
2771
+ function Le(t) {
2762
2772
  return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2763
2773
  }
2764
2774
 
2765
- function kn(t, n, e) {
2775
+ function Ue(t, e, n) {
2766
2776
  return {
2767
- name: On(t, n),
2768
- fields: e.value.mapValue.fields
2777
+ name: qe(t, e),
2778
+ fields: n.value.mapValue.fields
2769
2779
  };
2770
2780
  }
2771
2781
 
2772
- function jn(t, n) {
2773
- return "found" in n ? function(t, n) {
2774
- v(!!n.found), n.found.name, n.found.updateTime;
2775
- const e = Cn(t, n.found.name), r = xn(n.found.updateTime), s = new Bt({
2782
+ function ke(t, e) {
2783
+ return "found" in e ? function(t, e) {
2784
+ b(!!e.found), e.found.name, e.found.updateTime;
2785
+ const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new Bt({
2776
2786
  mapValue: {
2777
- fields: n.found.fields
2787
+ fields: e.found.fields
2778
2788
  }
2779
2789
  });
2780
- return zt.newFoundDocument(e, r, s);
2781
- }(t, n) : "missing" in n ? function(t, n) {
2782
- v(!!n.missing), v(!!n.readTime);
2783
- const e = Cn(t, n.missing), r = xn(n.readTime);
2784
- return zt.newNoDocument(e, r);
2785
- }(t, n) : g();
2786
- }
2787
-
2788
- function Mn(t, n) {
2789
- let e;
2790
- if (n instanceof In) e = {
2791
- update: kn(t, n.key, n.value)
2792
- }; else if (n instanceof Rn) e = {
2793
- delete: On(t, n.key)
2794
- }; else if (n instanceof An) e = {
2795
- update: kn(t, n.key, n.data),
2796
- updateMask: Yn(n.fieldMask)
2790
+ return zt.newFoundDocument(n, r, s);
2791
+ }(t, e) : "missing" in e ? function(t, e) {
2792
+ b(!!e.missing), b(!!e.readTime);
2793
+ const n = Oe(t, e.missing), r = Fe(e.readTime);
2794
+ return zt.newNoDocument(n, r);
2795
+ }(t, e) : g();
2796
+ }
2797
+
2798
+ function je(t, e) {
2799
+ let n;
2800
+ if (e instanceof Te) n = {
2801
+ update: Ue(t, e.key, e.value)
2802
+ }; else if (e instanceof Ae) n = {
2803
+ delete: qe(t, e.key)
2804
+ }; else if (e instanceof Ie) n = {
2805
+ update: Ue(t, e.key, e.data),
2806
+ updateMask: Qe(e.fieldMask)
2797
2807
  }; else {
2798
- if (!(n instanceof Pn)) return g();
2799
- e = {
2800
- verify: On(t, n.key)
2808
+ if (!(e instanceof Re)) return g();
2809
+ n = {
2810
+ verify: qe(t, e.key)
2801
2811
  };
2802
2812
  }
2803
- return n.fieldTransforms.length > 0 && (e.updateTransforms = n.fieldTransforms.map((t => function(t, n) {
2804
- const e = n.transform;
2805
- if (e instanceof yn) return {
2806
- fieldPath: n.field.canonicalString(),
2813
+ return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
2814
+ const n = e.transform;
2815
+ if (n instanceof pe) return {
2816
+ fieldPath: e.field.canonicalString(),
2807
2817
  setToServerValue: "REQUEST_TIME"
2808
2818
  };
2809
- if (e instanceof _n) return {
2810
- fieldPath: n.field.canonicalString(),
2819
+ if (n instanceof ye) return {
2820
+ fieldPath: e.field.canonicalString(),
2811
2821
  appendMissingElements: {
2812
- values: e.elements
2822
+ values: n.elements
2813
2823
  }
2814
2824
  };
2815
- if (e instanceof gn) return {
2816
- fieldPath: n.field.canonicalString(),
2825
+ if (n instanceof _e) return {
2826
+ fieldPath: e.field.canonicalString(),
2817
2827
  removeAllFromArray: {
2818
- values: e.elements
2828
+ values: n.elements
2819
2829
  }
2820
2830
  };
2821
- if (e instanceof vn) return {
2822
- fieldPath: n.field.canonicalString(),
2823
- increment: e.O
2831
+ if (n instanceof ge) return {
2832
+ fieldPath: e.field.canonicalString(),
2833
+ increment: n.O
2824
2834
  };
2825
2835
  throw g();
2826
- }(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
2827
- return void 0 !== n.updateTime ? {
2828
- updateTime: Fn(t, n.updateTime)
2829
- } : void 0 !== n.exists ? {
2830
- exists: n.exists
2836
+ }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2837
+ return void 0 !== e.updateTime ? {
2838
+ updateTime: Se(t, e.updateTime)
2839
+ } : void 0 !== e.exists ? {
2840
+ exists: e.exists
2831
2841
  } : g();
2832
- }(t, n.precondition)), e;
2842
+ }(t, e.precondition)), n;
2833
2843
  }
2834
2844
 
2835
- function Bn(t, n) {
2845
+ function Me(t, e) {
2836
2846
  // Dissect the path into parent, collectionId, and optional key filter.
2837
- const e = {
2847
+ const n = {
2838
2848
  structuredQuery: {}
2839
- }, r = n.path;
2840
- null !== n.collectionGroup ? (e.parent = Ln(t, r), e.structuredQuery.from = [ {
2841
- collectionId: n.collectionGroup,
2849
+ }, r = e.path;
2850
+ null !== e.collectionGroup ? (n.parent = Ce(t, r), n.structuredQuery.from = [ {
2851
+ collectionId: e.collectionGroup,
2842
2852
  allDescendants: !0
2843
- } ]) : (e.parent = Ln(t, r.popLast()), e.structuredQuery.from = [ {
2853
+ } ]) : (n.parent = Ce(t, r.popLast()), n.structuredQuery.from = [ {
2844
2854
  collectionId: r.lastSegment()
2845
2855
  } ]);
2846
2856
  const s = function(t) {
2847
2857
  if (0 === t.length) return;
2848
- const n = t.map((t =>
2858
+ const e = t.map((t =>
2849
2859
  // visible for testing
2850
2860
  function(t) {
2851
2861
  if ("==" /* EQUAL */ === t.op) {
2852
2862
  if (kt(t.value)) return {
2853
2863
  unaryFilter: {
2854
- field: Wn(t.field),
2864
+ field: Ge(t.field),
2855
2865
  op: "IS_NAN"
2856
2866
  }
2857
2867
  };
2858
2868
  if (Ut(t.value)) return {
2859
2869
  unaryFilter: {
2860
- field: Wn(t.field),
2870
+ field: Ge(t.field),
2861
2871
  op: "IS_NULL"
2862
2872
  }
2863
2873
  };
2864
2874
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
2865
2875
  if (kt(t.value)) return {
2866
2876
  unaryFilter: {
2867
- field: Wn(t.field),
2877
+ field: Ge(t.field),
2868
2878
  op: "IS_NOT_NAN"
2869
2879
  }
2870
2880
  };
2871
2881
  if (Ut(t.value)) return {
2872
2882
  unaryFilter: {
2873
- field: Wn(t.field),
2883
+ field: Ge(t.field),
2874
2884
  op: "IS_NOT_NULL"
2875
2885
  }
2876
2886
  };
2877
2887
  }
2878
2888
  return {
2879
2889
  fieldFilter: {
2880
- field: Wn(t.field),
2881
- op: Qn(t.op),
2890
+ field: Ge(t.field),
2891
+ op: ze(t.op),
2882
2892
  value: t.value
2883
2893
  }
2884
2894
  };
2885
2895
  }(t)));
2886
- if (1 === n.length) return n[0];
2896
+ if (1 === e.length) return e[0];
2887
2897
  return {
2888
2898
  compositeFilter: {
2889
2899
  op: "AND",
2890
- filters: n
2900
+ filters: e
2891
2901
  }
2892
2902
  };
2893
- }(n.filters);
2894
- s && (e.structuredQuery.where = s);
2903
+ }(e.filters);
2904
+ s && (n.structuredQuery.where = s);
2895
2905
  const i = function(t) {
2896
2906
  if (0 === t.length) return;
2897
2907
  return t.map((t =>
2898
2908
  // visible for testing
2899
2909
  function(t) {
2900
2910
  return {
2901
- field: Wn(t.field),
2902
- direction: Gn(t.dir)
2911
+ field: Ge(t.field),
2912
+ direction: Be(t.dir)
2903
2913
  };
2904
2914
  }(t)));
2905
- }(n.orderBy);
2906
- i && (e.structuredQuery.orderBy = i);
2907
- const o = function(t, n) {
2908
- return t.F || ct(n) ? n : {
2909
- value: n
2915
+ }(e.orderBy);
2916
+ i && (n.structuredQuery.orderBy = i);
2917
+ const o = function(t, e) {
2918
+ return t.F || ct(e) ? e : {
2919
+ value: e
2910
2920
  };
2911
- }(t, n.limit);
2912
- return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = zn(n.startAt)),
2913
- n.endAt && (e.structuredQuery.endAt = zn(n.endAt)), e;
2914
- }
2915
-
2916
- function zn(t) {
2917
- return {
2918
- before: t.before,
2919
- values: t.position
2920
- };
2921
+ }(t, e.limit);
2922
+ var u;
2923
+ return null !== o && (n.structuredQuery.limit = o), e.startAt && (n.structuredQuery.startAt = {
2924
+ before: (u = e.startAt).inclusive,
2925
+ values: u.position
2926
+ }), e.endAt && (n.structuredQuery.endAt = function(t) {
2927
+ return {
2928
+ before: !t.inclusive,
2929
+ values: t.position
2930
+ };
2931
+ }
2932
+ // visible for testing
2933
+ (e.endAt)), n;
2921
2934
  }
2922
2935
 
2923
- // visible for testing
2924
- function Gn(t) {
2925
- return Vn[t];
2936
+ function Be(t) {
2937
+ return Pe[t];
2926
2938
  }
2927
2939
 
2928
2940
  // visible for testing
2929
- function Qn(t) {
2930
- return Dn[t];
2941
+ function ze(t) {
2942
+ return Ve[t];
2931
2943
  }
2932
2944
 
2933
- function Wn(t) {
2945
+ function Ge(t) {
2934
2946
  return {
2935
2947
  fieldPath: t.canonicalString()
2936
2948
  };
2937
2949
  }
2938
2950
 
2939
- function Yn(t) {
2940
- const n = [];
2941
- return t.fields.forEach((t => n.push(t.canonicalString()))), {
2942
- fieldPaths: n
2951
+ function Qe(t) {
2952
+ const e = [];
2953
+ return t.fields.forEach((t => e.push(t.canonicalString()))), {
2954
+ fieldPaths: e
2943
2955
  };
2944
2956
  }
2945
2957
 
2946
- function Hn(t) {
2958
+ function We(t) {
2947
2959
  // Resource names have at least 4 components (project ID, database ID)
2948
2960
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2949
2961
  }
@@ -2963,8 +2975,8 @@ function Hn(t) {
2963
2975
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2964
2976
  * See the License for the specific language governing permissions and
2965
2977
  * limitations under the License.
2966
- */ function Kn(t) {
2967
- return new Nn(t, /* useProto3Json= */ !0);
2978
+ */ function Ye(t) {
2979
+ return new De(t, /* useProto3Json= */ !0);
2968
2980
  }
2969
2981
 
2970
2982
  /**
@@ -2992,7 +3004,7 @@ function Hn(t) {
2992
3004
  * base delay. This prevents clients from accidentally synchronizing their
2993
3005
  * delays causing spikes of load to the backend.
2994
3006
  */
2995
- class Jn {
3007
+ class He {
2996
3008
  constructor(
2997
3009
  /**
2998
3010
  * The AsyncQueue to run backoff operations on.
@@ -3001,13 +3013,13 @@ class Jn {
3001
3013
  /**
3002
3014
  * The ID to use when scheduling backoff operations on the AsyncQueue.
3003
3015
  */
3004
- n,
3016
+ e,
3005
3017
  /**
3006
3018
  * The initial delay (used as the base delay on the first retry attempt).
3007
3019
  * Note that jitter will still be applied, so the actual delay could be as
3008
3020
  * little as 0.5*initialDelayMs.
3009
3021
  */
3010
- e = 1e3
3022
+ n = 1e3
3011
3023
  /**
3012
3024
  * The multiplier to use to determine the extended base delay after each
3013
3025
  * attempt.
@@ -3017,7 +3029,7 @@ class Jn {
3017
3029
  * Note that jitter will still be applied, so the actual delay could be as
3018
3030
  * much as 1.5*maxDelayMs.
3019
3031
  */ , s = 6e4) {
3020
- this.C = t, this.timerId = n, this.L = e, this.U = r, this.k = s, this.j = 0, this.M = null,
3032
+ this.C = t, this.timerId = e, this.L = n, this.U = r, this.k = s, this.j = 0, this.M = null,
3021
3033
  /** The last backoff attempt, as epoch milliseconds. */
3022
3034
  this.B = Date.now(), this.reset();
3023
3035
  }
@@ -3045,9 +3057,9 @@ class Jn {
3045
3057
  this.cancel();
3046
3058
  // First schedule using the current base (which may be 0 and should be
3047
3059
  // honored as such).
3048
- const n = Math.floor(this.j + this.Y()), e = Math.max(0, Date.now() - this.B), r = Math.max(0, n - e);
3060
+ const e = Math.floor(this.j + this.Y()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
3049
3061
  // Guard against lastAttemptTime being in the future due to a clock change.
3050
- r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${n} ms, last attempt: ${e} ms ago)`),
3062
+ r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3051
3063
  this.M = this.C.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
3052
3064
  t()))),
3053
3065
  // Apply backoff factor to determine next delay and ensure it is within
@@ -3090,22 +3102,22 @@ class Jn {
3090
3102
  * An implementation of Datastore that exposes additional state for internal
3091
3103
  * consumption.
3092
3104
  */
3093
- class Xn extends class {} {
3094
- constructor(t, n, e, r) {
3095
- super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
3105
+ class Ke extends class {} {
3106
+ constructor(t, e, n, r) {
3107
+ super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
3096
3108
  this.J = !1;
3097
3109
  }
3098
3110
  X() {
3099
3111
  if (this.J) throw new U(S, "The client has already been terminated.");
3100
3112
  }
3101
- /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, n, e) {
3102
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, n, e, r, s))).catch((t => {
3113
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
3114
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
3103
3115
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3104
3116
  this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3105
3117
  }));
3106
3118
  }
3107
- /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, n, e) {
3108
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, n, e, r, s))).catch((t => {
3119
+ /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
3120
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
3109
3121
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3110
3122
  this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3111
3123
  }));
@@ -3117,40 +3129,40 @@ class Xn extends class {} {
3117
3129
 
3118
3130
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3119
3131
  // firestore-exp client.
3120
- async function Zn(t, n) {
3121
- const e = b(t), r = Un(e.q) + "/documents", s = {
3122
- writes: n.map((t => Mn(e.q, t)))
3132
+ async function Je(t, e) {
3133
+ const n = v(t), r = Le(n.q) + "/documents", s = {
3134
+ writes: e.map((t => je(n.q, t)))
3123
3135
  };
3124
- await e.m("Commit", r, s);
3136
+ await n.m("Commit", r, s);
3125
3137
  }
3126
3138
 
3127
- async function te(t, n) {
3128
- const e = b(t), r = Un(e.q) + "/documents", s = {
3129
- documents: n.map((t => On(e.q, t)))
3130
- }, i = await e.T("BatchGetDocuments", r, s), o = new Map;
3139
+ async function Xe(t, e) {
3140
+ const n = v(t), r = Le(n.q) + "/documents", s = {
3141
+ documents: e.map((t => qe(n.q, t)))
3142
+ }, i = await n.T("BatchGetDocuments", r, s), o = new Map;
3131
3143
  i.forEach((t => {
3132
- const n = jn(e.q, t);
3133
- o.set(n.key.toString(), n);
3144
+ const e = ke(n.q, t);
3145
+ o.set(e.key.toString(), e);
3134
3146
  }));
3135
3147
  const u = [];
3136
- return n.forEach((t => {
3137
- const n = o.get(t.toString());
3138
- v(!!n), u.push(n);
3148
+ return e.forEach((t => {
3149
+ const e = o.get(t.toString());
3150
+ b(!!e), u.push(e);
3139
3151
  })), u;
3140
3152
  }
3141
3153
 
3142
- async function ne(t, n) {
3143
- const e = b(t), r = Bn(e.q, dn(n));
3144
- return (await e.T("RunQuery", r.parent, {
3154
+ async function Ze(t, e) {
3155
+ const n = v(t), r = Me(n.q, fe(e));
3156
+ return (await n.T("RunQuery", r.parent, {
3145
3157
  structuredQuery: r.structuredQuery
3146
- })).filter((t => !!t.document)).map((t => function(t, n, e) {
3147
- const r = Cn(t, n.name), s = xn(n.updateTime), i = new Bt({
3158
+ })).filter((t => !!t.document)).map((t => function(t, e, n) {
3159
+ const r = Oe(t, e.name), s = Fe(e.updateTime), i = new Bt({
3148
3160
  mapValue: {
3149
- fields: n.fields
3161
+ fields: e.fields
3150
3162
  }
3151
3163
  }), o = zt.newFoundDocument(r, s, i);
3152
- return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
3153
- }(e.q, t.document, void 0)));
3164
+ return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3165
+ }(n.q, t.document, void 0)));
3154
3166
  }
3155
3167
 
3156
3168
  /**
@@ -3168,7 +3180,7 @@ async function ne(t, n) {
3168
3180
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3169
3181
  * See the License for the specific language governing permissions and
3170
3182
  * limitations under the License.
3171
- */ const ee = new Map;
3183
+ */ const tn = new Map;
3172
3184
 
3173
3185
  /**
3174
3186
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3179,19 +3191,19 @@ async function ne(t, n) {
3179
3191
  * instance. Callers must invoke removeComponents() when the Firestore
3180
3192
  * instance is terminated.
3181
3193
  */
3182
- function re(t) {
3194
+ function en(t) {
3183
3195
  if (t._terminated) throw new U(S, "The client has already been terminated.");
3184
- if (!ee.has(t)) {
3196
+ if (!tn.has(t)) {
3185
3197
  m("ComponentProvider", "Initializing Datastore");
3186
3198
  const i = function(t) {
3187
3199
  return new wt(t, fetch.bind(null));
3188
- }((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3189
- new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Kn(t._databaseId), u = function(t, n, e, r) {
3190
- return new Xn(t, n, e, r);
3200
+ }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3201
+ new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ye(t._databaseId), u = function(t, e, n, r) {
3202
+ return new Ke(t, e, n, r);
3191
3203
  }(t._authCredentials, t._appCheckCredentials, i, o);
3192
- ee.set(t, u);
3204
+ tn.set(t, u);
3193
3205
  }
3194
- var n, e, r, s;
3206
+ var e, n, r, s;
3195
3207
  /**
3196
3208
  * @license
3197
3209
  * Copyright 2018 Google LLC
@@ -3207,7 +3219,7 @@ function re(t) {
3207
3219
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3208
3220
  * See the License for the specific language governing permissions and
3209
3221
  * limitations under the License.
3210
- */ return ee.get(t);
3222
+ */ return tn.get(t);
3211
3223
  }
3212
3224
 
3213
3225
  /**
@@ -3219,21 +3231,21 @@ function re(t) {
3219
3231
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3220
3232
  * defaults can be supplied and the value can be checked for equality.
3221
3233
  */
3222
- class se {
3234
+ class nn {
3223
3235
  constructor(t) {
3224
- var n;
3236
+ var e;
3225
3237
  if (void 0 === t.host) {
3226
3238
  if (void 0 !== t.ssl) throw new U(A, "Can't provide ssl option if host option is not set");
3227
3239
  this.host = "firestore.googleapis.com", this.ssl = true;
3228
- } else this.host = t.host, this.ssl = null === (n = t.ssl) || void 0 === n || n;
3240
+ } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3229
3241
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3230
3242
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3231
3243
  if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(A, "cacheSizeBytes must be at least 1048576");
3232
3244
  this.cacheSizeBytes = t.cacheSizeBytes;
3233
3245
  }
3234
3246
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3235
- this.useFetchStreams = !!t.useFetchStreams, function(t, n, e, r) {
3236
- if (!0 === n && !0 === r) throw new U(A, `${t} and ${e} cannot be used together.`);
3247
+ this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3248
+ if (!0 === e && !0 === r) throw new U(A, `${t} and ${n} cannot be used together.`);
3237
3249
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3238
3250
  }
3239
3251
  isEqual(t) {
@@ -3261,14 +3273,14 @@ class se {
3261
3273
  * The Cloud Firestore service interface.
3262
3274
  *
3263
3275
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3264
- */ class ie {
3276
+ */ class rn {
3265
3277
  /** @hideconstructor */
3266
- constructor(t, n, e) {
3267
- this._authCredentials = n, this._appCheckCredentials = e,
3278
+ constructor(t, e, n) {
3279
+ this._authCredentials = e, this._appCheckCredentials = n,
3268
3280
  /**
3269
3281
  * Whether it's a Firestore or Firestore Lite instance.
3270
3282
  */
3271
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new se({}),
3283
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new nn({}),
3272
3284
  this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
3273
3285
  this._databaseId = function(t) {
3274
3286
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
@@ -3301,14 +3313,14 @@ class se {
3301
3313
  }
3302
3314
  _setSettings(t) {
3303
3315
  if (this._settingsFrozen) throw new U(S, "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.");
3304
- this._settings = new se(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3316
+ this._settings = new nn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3305
3317
  if (!t) return new M;
3306
3318
  switch (t.type) {
3307
3319
  case "gapi":
3308
- const n = t.client;
3320
+ const e = t.client;
3309
3321
  // Make sure this really is a Gapi client.
3310
- return v(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
3311
- new Q(n, t.sessionIndex || "0", t.iamToken || null);
3322
+ return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3323
+ new Q(e, t.sessionIndex || "0", t.iamToken || null);
3312
3324
 
3313
3325
  case "provider":
3314
3326
  return t.client;
@@ -3342,17 +3354,17 @@ class se {
3342
3354
  * Only ever called once.
3343
3355
  */ _terminate() {
3344
3356
  return function(t) {
3345
- const n = ee.get(t);
3346
- n && (m("ComponentProvider", "Removing Datastore"), ee.delete(t), n.terminate());
3357
+ const e = tn.get(t);
3358
+ e && (m("ComponentProvider", "Removing Datastore"), tn.delete(t), e.terminate());
3347
3359
  }(this), Promise.resolve();
3348
3360
  }
3349
3361
  }
3350
3362
 
3351
- function oe(t, n) {
3352
- const e = _getProvider(t, "firestore/lite");
3353
- if (e.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
3354
- return e.initialize({
3355
- options: n
3363
+ function sn(t, e) {
3364
+ const n = _getProvider(t, "firestore/lite");
3365
+ if (n.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
3366
+ return n.initialize({
3367
+ options: e
3356
3368
  });
3357
3369
  }
3358
3370
 
@@ -3364,8 +3376,8 @@ function oe(t, n) {
3364
3376
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3365
3377
  * instance is associated with.
3366
3378
  * @returns The `Firestore` instance of the provided app.
3367
- */ function ue(n = getApp()) {
3368
- return _getProvider(n, "firestore/lite").getImmediate();
3379
+ */ function on(e = getApp()) {
3380
+ return _getProvider(e, "firestore/lite").getImmediate();
3369
3381
  }
3370
3382
 
3371
3383
  /**
@@ -3380,24 +3392,24 @@ function oe(t, n) {
3380
3392
  * @param port - the emulator port (ex: 9000).
3381
3393
  * @param options.mockUserToken - the mock auth token to use for unit testing
3382
3394
  * Security Rules.
3383
- */ function ce(t, n, e, r = {}) {
3395
+ */ function un(t, e, n, r = {}) {
3384
3396
  var s;
3385
- const i = (t = ot(t, ie))._getSettings();
3386
- if ("firestore.googleapis.com" !== i.host && i.host !== n && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3397
+ const i = (t = ot(t, rn))._getSettings();
3398
+ if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3387
3399
  t._setSettings(Object.assign(Object.assign({}, i), {
3388
- host: `${n}:${e}`,
3400
+ host: `${e}:${n}`,
3389
3401
  ssl: !1
3390
3402
  })), r.mockUserToken) {
3391
- let n, e;
3392
- if ("string" == typeof r.mockUserToken) n = r.mockUserToken, e = l.MOCK_USER; else {
3403
+ let e, n;
3404
+ if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = l.MOCK_USER; else {
3393
3405
  // Let createMockUserToken validate first (catches common mistakes like
3394
3406
  // invalid field "uid" and missing field "sub" / "user_id".)
3395
- n = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3407
+ e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3396
3408
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3397
3409
  if (!i) throw new U(A, "mockUserToken must contain 'sub' or 'user_id' field!");
3398
- e = new l(i);
3410
+ n = new l(i);
3399
3411
  }
3400
- t._authCredentials = new B(new j(n, e));
3412
+ t._authCredentials = new B(new j(e, n));
3401
3413
  }
3402
3414
  }
3403
3415
 
@@ -3420,8 +3432,8 @@ function oe(t, n) {
3420
3432
  * @param firestore - The `Firestore` instance to terminate.
3421
3433
  * @returns A `Promise` that is resolved when the instance has been successfully
3422
3434
  * terminated.
3423
- */ function ae(t) {
3424
- return t = ot(t, ie), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3435
+ */ function cn(t) {
3436
+ return t = ot(t, rn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3425
3437
  }
3426
3438
 
3427
3439
  /**
@@ -3461,14 +3473,14 @@ function oe(t, n) {
3461
3473
  * and can be used to write, read, or listen to the location. The document at
3462
3474
  * the referenced location may or may not exist.
3463
3475
  */
3464
- class he {
3476
+ class an {
3465
3477
  /** @hideconstructor */
3466
3478
  constructor(t,
3467
3479
  /**
3468
3480
  * If provided, the `FirestoreDataConverter` associated with this instance.
3469
3481
  */
3470
- n, e) {
3471
- this.converter = n, this._key = e,
3482
+ e, n) {
3483
+ this.converter = e, this._key = n,
3472
3484
  /** The type of this Firestore reference. */
3473
3485
  this.type = "document", this.firestore = t;
3474
3486
  }
@@ -3489,40 +3501,40 @@ class he {
3489
3501
  /**
3490
3502
  * The collection this `DocumentReference` belongs to.
3491
3503
  */ get parent() {
3492
- return new fe(this.firestore, this.converter, this._key.path.popLast());
3504
+ return new ln(this.firestore, this.converter, this._key.path.popLast());
3493
3505
  }
3494
3506
  withConverter(t) {
3495
- return new he(this.firestore, t, this._key);
3507
+ return new an(this.firestore, t, this._key);
3496
3508
  }
3497
3509
  }
3498
3510
 
3499
3511
  /**
3500
3512
  * A `Query` refers to a query which you can read or listen to. You can also
3501
3513
  * construct refined `Query` objects by adding filters and ordering.
3502
- */ class le {
3514
+ */ class hn {
3503
3515
  // This is the lite version of the Query class in the main SDK.
3504
3516
  /** @hideconstructor protected */
3505
3517
  constructor(t,
3506
3518
  /**
3507
3519
  * If provided, the `FirestoreDataConverter` associated with this instance.
3508
3520
  */
3509
- n, e) {
3510
- this.converter = n, this._query = e,
3521
+ e, n) {
3522
+ this.converter = e, this._query = n,
3511
3523
  /** The type of this Firestore reference. */
3512
3524
  this.type = "query", this.firestore = t;
3513
3525
  }
3514
3526
  withConverter(t) {
3515
- return new le(this.firestore, t, this._query);
3527
+ return new hn(this.firestore, t, this._query);
3516
3528
  }
3517
3529
  }
3518
3530
 
3519
3531
  /**
3520
3532
  * A `CollectionReference` object can be used for adding documents, getting
3521
3533
  * document references, and querying for documents (using {@link query}).
3522
- */ class fe extends le {
3534
+ */ class ln extends hn {
3523
3535
  /** @hideconstructor */
3524
- constructor(t, n, e) {
3525
- super(t, n, new un(e)), this._path = e,
3536
+ constructor(t, e, n) {
3537
+ super(t, e, new oe(n)), this._path = n,
3526
3538
  /** The type of this Firestore reference. */
3527
3539
  this.type = "collection";
3528
3540
  }
@@ -3540,23 +3552,23 @@ class he {
3540
3552
  * subcollection. If this isn't a subcollection, the reference is null.
3541
3553
  */ get parent() {
3542
3554
  const t = this._path.popLast();
3543
- return t.isEmpty() ? null : new he(this.firestore,
3544
- /* converter= */ null, new nt(t));
3555
+ return t.isEmpty() ? null : new an(this.firestore,
3556
+ /* converter= */ null, new et(t));
3545
3557
  }
3546
3558
  withConverter(t) {
3547
- return new fe(this.firestore, t, this._path);
3559
+ return new ln(this.firestore, t, this._path);
3548
3560
  }
3549
3561
  }
3550
3562
 
3551
- function de(t, n, ...e) {
3552
- if (t = getModularInstance(t), et("collection", "path", n), t instanceof ie) {
3553
- const r = X.fromString(n, ...e);
3554
- return st(r), new fe(t, /* converter= */ null, r);
3563
+ function fn(t, e, ...n) {
3564
+ if (t = getModularInstance(t), nt("collection", "path", e), t instanceof rn) {
3565
+ const r = X.fromString(e, ...n);
3566
+ return st(r), new ln(t, /* converter= */ null, r);
3555
3567
  }
3556
3568
  {
3557
- if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3558
- const r = t._path.child(X.fromString(n, ...e));
3559
- return st(r), new fe(t.firestore,
3569
+ if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3570
+ const r = t._path.child(X.fromString(e, ...n));
3571
+ return st(r), new ln(t.firestore,
3560
3572
  /* converter= */ null, r);
3561
3573
  }
3562
3574
  }
@@ -3573,32 +3585,32 @@ function de(t, n, ...e) {
3573
3585
  * collection or subcollection with this ID as the last segment of its path
3574
3586
  * will be included. Cannot contain a slash.
3575
3587
  * @returns The created `Query`.
3576
- */ function we(t, n) {
3577
- if (t = ot(t, ie), et("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3578
- return new le(t,
3588
+ */ function dn(t, e) {
3589
+ if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3590
+ return new hn(t,
3579
3591
  /* converter= */ null,
3580
3592
  /**
3581
3593
  * Creates a new Query for a collection group query that matches all documents
3582
3594
  * within the provided collection group.
3583
3595
  */
3584
3596
  function(t) {
3585
- return new un(X.emptyPath(), t);
3586
- }(n));
3597
+ return new oe(X.emptyPath(), t);
3598
+ }(e));
3587
3599
  }
3588
3600
 
3589
- function me(t, n, ...e) {
3601
+ function wn(t, e, ...n) {
3590
3602
  if (t = getModularInstance(t),
3591
3603
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3592
3604
  // 'undefined' and 'null'.
3593
- 1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof ie) {
3594
- const r = X.fromString(n, ...e);
3595
- return rt(r), new he(t,
3596
- /* converter= */ null, new nt(r));
3605
+ 1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof rn) {
3606
+ const r = X.fromString(e, ...n);
3607
+ return rt(r), new an(t,
3608
+ /* converter= */ null, new et(r));
3597
3609
  }
3598
3610
  {
3599
- if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3600
- const r = t._path.child(X.fromString(n, ...e));
3601
- return rt(r), new he(t.firestore, t instanceof fe ? t.converter : null, new nt(r));
3611
+ if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3612
+ const r = t._path.child(X.fromString(e, ...n));
3613
+ return rt(r), new an(t.firestore, t instanceof ln ? t.converter : null, new et(r));
3602
3614
  }
3603
3615
  }
3604
3616
 
@@ -3609,8 +3621,8 @@ function me(t, n, ...e) {
3609
3621
  * @param right - A reference to compare.
3610
3622
  * @returns true if the references point to the same location in the same
3611
3623
  * Firestore database.
3612
- */ function pe(t, n) {
3613
- return t = getModularInstance(t), n = getModularInstance(n), (t instanceof he || t instanceof fe) && (n instanceof he || n instanceof fe) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
3624
+ */ function mn(t, e) {
3625
+ return t = getModularInstance(t), e = getModularInstance(e), (t instanceof an || t instanceof ln) && (e instanceof an || e instanceof ln) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3614
3626
  }
3615
3627
 
3616
3628
  /**
@@ -3621,8 +3633,8 @@ function me(t, n, ...e) {
3621
3633
  * @param right - A `Query` to compare.
3622
3634
  * @returns true if the references point to the same location in the same
3623
3635
  * Firestore database.
3624
- */ function ye(t, n) {
3625
- return t = getModularInstance(t), n = getModularInstance(n), t instanceof le && n instanceof le && (t.firestore === n.firestore && wn(t._query, n._query) && t.converter === n.converter);
3636
+ */ function pn(t, e) {
3637
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof hn && e instanceof hn && (t.firestore === e.firestore && de(t._query, e._query) && t.converter === e.converter);
3626
3638
  }
3627
3639
 
3628
3640
  /**
@@ -3648,7 +3660,7 @@ function me(t, n, ...e) {
3648
3660
  *
3649
3661
  * Create a `FieldPath` by providing field names. If more than one field
3650
3662
  * name is provided, the path will point to a nested field in a document.
3651
- */ class _e {
3663
+ */ class yn {
3652
3664
  /**
3653
3665
  * Creates a `FieldPath` from the provided field names. If more than one field
3654
3666
  * name is provided, the path will point to a nested field in a document.
@@ -3656,7 +3668,7 @@ function me(t, n, ...e) {
3656
3668
  * @param fieldNames - A list of field names.
3657
3669
  */
3658
3670
  constructor(...t) {
3659
- for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3671
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3660
3672
  this._internalPath = new tt(t);
3661
3673
  }
3662
3674
  /**
@@ -3672,8 +3684,8 @@ function me(t, n, ...e) {
3672
3684
  /**
3673
3685
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3674
3686
  * It can be used in queries to sort or filter by the document ID.
3675
- */ function ge() {
3676
- return new _e("__name__");
3687
+ */ function _n() {
3688
+ return new yn("__name__");
3677
3689
  }
3678
3690
 
3679
3691
  /**
@@ -3694,7 +3706,7 @@ function me(t, n, ...e) {
3694
3706
  */
3695
3707
  /**
3696
3708
  * An immutable object representing an array of bytes.
3697
- */ class ve {
3709
+ */ class gn {
3698
3710
  /** @hideconstructor */
3699
3711
  constructor(t) {
3700
3712
  this._byteString = t;
@@ -3706,7 +3718,7 @@ function me(t, n, ...e) {
3706
3718
  * @param base64 - The Base64 string used to create the `Bytes` object.
3707
3719
  */ static fromBase64String(t) {
3708
3720
  try {
3709
- return new ve(It.fromBase64String(t));
3721
+ return new gn(It.fromBase64String(t));
3710
3722
  } catch (t) {
3711
3723
  throw new U(A, "Failed to construct data from Base64 string: " + t);
3712
3724
  }
@@ -3716,7 +3728,7 @@ function me(t, n, ...e) {
3716
3728
  *
3717
3729
  * @param array - The Uint8Array used to create the `Bytes` object.
3718
3730
  */ static fromUint8Array(t) {
3719
- return new ve(It.fromUint8Array(t));
3731
+ return new gn(It.fromUint8Array(t));
3720
3732
  }
3721
3733
  /**
3722
3734
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3768,7 +3780,7 @@ function me(t, n, ...e) {
3768
3780
  /**
3769
3781
  * Sentinel values that can be used when writing document fields with `set()`
3770
3782
  * or `update()`.
3771
- */ class be {
3783
+ */ class bn {
3772
3784
  /**
3773
3785
  * @param _methodName - The public API endpoint that returns this class.
3774
3786
  * @hideconstructor
@@ -3800,17 +3812,17 @@ function me(t, n, ...e) {
3800
3812
  *
3801
3813
  * Latitude values are in the range of [-90, 90].
3802
3814
  * Longitude values are in the range of [-180, 180].
3803
- */ class Ee {
3815
+ */ class vn {
3804
3816
  /**
3805
3817
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3806
3818
  * longitude values.
3807
3819
  * @param latitude - The latitude as number between -90 and 90.
3808
3820
  * @param longitude - The longitude as number between -180 and 180.
3809
3821
  */
3810
- constructor(t, n) {
3822
+ constructor(t, e) {
3811
3823
  if (!isFinite(t) || t < -90 || t > 90) throw new U(A, "Latitude must be a number between -90 and 90, but was: " + t);
3812
- if (!isFinite(n) || n < -180 || n > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + n);
3813
- this._lat = t, this._long = n;
3824
+ if (!isFinite(e) || e < -180 || e > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + e);
3825
+ this._lat = t, this._long = e;
3814
3826
  }
3815
3827
  /**
3816
3828
  * The latitude of this `GeoPoint` instance.
@@ -3859,29 +3871,29 @@ function me(t, n, ...e) {
3859
3871
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3860
3872
  * See the License for the specific language governing permissions and
3861
3873
  * limitations under the License.
3862
- */ const Te = /^__.*__$/;
3874
+ */ const En = /^__.*__$/;
3863
3875
 
3864
- /** The result of parsing document data (e.g. for a setData call). */ class Ie {
3865
- constructor(t, n, e) {
3866
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3876
+ /** The result of parsing document data (e.g. for a setData call). */ class Tn {
3877
+ constructor(t, e, n) {
3878
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3867
3879
  }
3868
- toMutation(t, n) {
3869
- return null !== this.fieldMask ? new An(t, this.data, this.fieldMask, n, this.fieldTransforms) : new In(t, this.data, n, this.fieldTransforms);
3880
+ toMutation(t, e) {
3881
+ return null !== this.fieldMask ? new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
3870
3882
  }
3871
3883
  }
3872
3884
 
3873
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Ae {
3885
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class In {
3874
3886
  constructor(t,
3875
3887
  // The fieldMask does not include document transforms.
3876
- n, e) {
3877
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3888
+ e, n) {
3889
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3878
3890
  }
3879
- toMutation(t, n) {
3880
- return new An(t, this.data, this.fieldMask, n, this.fieldTransforms);
3891
+ toMutation(t, e) {
3892
+ return new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms);
3881
3893
  }
3882
3894
  }
3883
3895
 
3884
- function Re(t) {
3896
+ function An(t) {
3885
3897
  switch (t) {
3886
3898
  case 0 /* Set */ :
3887
3899
  // fall through
@@ -3899,7 +3911,7 @@ function Re(t) {
3899
3911
  }
3900
3912
  }
3901
3913
 
3902
- /** A "context" object passed around while parsing user data. */ class Pe {
3914
+ /** A "context" object passed around while parsing user data. */ class Rn {
3903
3915
  /**
3904
3916
  * Initializes a ParseContext with the given source and path.
3905
3917
  *
@@ -3918,8 +3930,8 @@ function Re(t) {
3918
3930
  * which case certain features will not work and errors will be somewhat
3919
3931
  * compromised).
3920
3932
  */
3921
- constructor(t, n, e, r, s, i) {
3922
- this.settings = t, this.databaseId = n, this.q = e, this.ignoreUndefinedProperties = r,
3933
+ constructor(t, e, n, r, s, i) {
3934
+ this.settings = t, this.databaseId = e, this.q = n, this.ignoreUndefinedProperties = r,
3923
3935
  // Minor hack: If fieldTransforms is undefined, we assume this is an
3924
3936
  // external call and we need to validate the entire path.
3925
3937
  void 0 === s && this.Z(), this.fieldTransforms = s || [], this.fieldMask = i || [];
@@ -3930,21 +3942,21 @@ function Re(t) {
3930
3942
  get tt() {
3931
3943
  return this.settings.tt;
3932
3944
  }
3933
- /** Returns a new context with the specified settings overwritten. */ nt(t) {
3934
- return new Pe(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3945
+ /** Returns a new context with the specified settings overwritten. */ et(t) {
3946
+ return new Rn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3935
3947
  }
3936
- et(t) {
3937
- var n;
3938
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3939
- path: e,
3948
+ nt(t) {
3949
+ var e;
3950
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3951
+ path: n,
3940
3952
  rt: !1
3941
3953
  });
3942
3954
  return r.st(t), r;
3943
3955
  }
3944
3956
  it(t) {
3945
- var n;
3946
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3947
- path: e,
3957
+ var e;
3958
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3959
+ path: n,
3948
3960
  rt: !1
3949
3961
  });
3950
3962
  return r.Z(), r;
@@ -3952,16 +3964,16 @@ function Re(t) {
3952
3964
  ot(t) {
3953
3965
  // TODO(b/34871131): We don't support array paths right now; so make path
3954
3966
  // undefined.
3955
- return this.nt({
3967
+ return this.et({
3956
3968
  path: void 0,
3957
3969
  rt: !0
3958
3970
  });
3959
3971
  }
3960
3972
  ut(t) {
3961
- return We(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3973
+ return Qn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3962
3974
  }
3963
3975
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
3964
- return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
3976
+ return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
3965
3977
  }
3966
3978
  Z() {
3967
3979
  // TODO(b/34871131): Remove null check once we have proper paths for fields
@@ -3970,22 +3982,22 @@ function Re(t) {
3970
3982
  }
3971
3983
  st(t) {
3972
3984
  if (0 === t.length) throw this.ut("Document fields must not be empty");
3973
- if (Re(this.tt) && Te.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
3985
+ if (An(this.tt) && En.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
3974
3986
  }
3975
3987
  }
3976
3988
 
3977
3989
  /**
3978
3990
  * Helper for parsing raw user input (provided via the API) into internal model
3979
3991
  * classes.
3980
- */ class Ve {
3981
- constructor(t, n, e) {
3982
- this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Kn(t);
3992
+ */ class Pn {
3993
+ constructor(t, e, n) {
3994
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ye(t);
3983
3995
  }
3984
- /** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
3985
- return new Pe({
3996
+ /** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
3997
+ return new Rn({
3986
3998
  tt: t,
3987
- methodName: n,
3988
- at: e,
3999
+ methodName: e,
4000
+ at: n,
3989
4001
  path: tt.emptyPath(),
3990
4002
  rt: !1,
3991
4003
  ct: r
@@ -3993,29 +4005,29 @@ function Re(t) {
3993
4005
  }
3994
4006
  }
3995
4007
 
3996
- function De(t) {
3997
- const n = t._freezeSettings(), e = Kn(t._databaseId);
3998
- return new Ve(t._databaseId, !!n.ignoreUndefinedProperties, e);
4008
+ function Vn(t) {
4009
+ const e = t._freezeSettings(), n = Ye(t._databaseId);
4010
+ return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
3999
4011
  }
4000
4012
 
4001
- /** Parse document data from a set() call. */ function Ne(t, n, e, r, s, i = {}) {
4002
- const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
4003
- Be("Data must be an object, but it was:", o, r);
4004
- const u = je(r, o);
4013
+ /** Parse document data from a set() call. */ function Dn(t, e, n, r, s, i = {}) {
4014
+ const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4015
+ Mn("Data must be an object, but it was:", o, r);
4016
+ const u = kn(r, o);
4005
4017
  let c, a;
4006
4018
  if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4007
4019
  const t = [];
4008
4020
  for (const r of i.mergeFields) {
4009
- const s = ze(n, r, e);
4021
+ const s = Bn(e, r, n);
4010
4022
  if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
4011
- Ye(t, s) || t.push(s);
4023
+ Wn(t, s) || t.push(s);
4012
4024
  }
4013
4025
  c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4014
4026
  } else c = null, a = o.fieldTransforms;
4015
- return new Ie(new Bt(u), c, a);
4027
+ return new Tn(new Bt(u), c, a);
4016
4028
  }
4017
4029
 
4018
- class $e extends be {
4030
+ class Nn extends bn {
4019
4031
  _toFieldTransform(t) {
4020
4032
  if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
4021
4033
  // No transform to add for a delete, but we need to add it to our
@@ -4023,7 +4035,7 @@ class $e extends be {
4023
4035
  return t.fieldMask.push(t.path), null;
4024
4036
  }
4025
4037
  isEqual(t) {
4026
- return t instanceof $e;
4038
+ return t instanceof Nn;
4027
4039
  }
4028
4040
  }
4029
4041
 
@@ -4042,32 +4054,32 @@ class $e extends be {
4042
4054
  * context.
4043
4055
  * @param context - The parent context.
4044
4056
  * @param arrayElement - Whether or not the FieldValue has an array.
4045
- */ function Se(t, n, e) {
4046
- return new Pe({
4057
+ */ function $n(t, e, n) {
4058
+ return new Rn({
4047
4059
  tt: 3 /* Argument */ ,
4048
- at: n.settings.at,
4060
+ at: e.settings.at,
4049
4061
  methodName: t._methodName,
4050
- rt: e
4051
- }, n.databaseId, n.q, n.ignoreUndefinedProperties);
4062
+ rt: n
4063
+ }, e.databaseId, e.q, e.ignoreUndefinedProperties);
4052
4064
  }
4053
4065
 
4054
- class Fe extends be {
4066
+ class Sn extends bn {
4055
4067
  _toFieldTransform(t) {
4056
- return new bn(t.path, new yn);
4068
+ return new be(t.path, new pe);
4057
4069
  }
4058
4070
  isEqual(t) {
4059
- return t instanceof Fe;
4071
+ return t instanceof Sn;
4060
4072
  }
4061
4073
  }
4062
4074
 
4063
- class xe extends be {
4064
- constructor(t, n) {
4065
- super(t), this.lt = n;
4075
+ class Fn extends bn {
4076
+ constructor(t, e) {
4077
+ super(t), this.lt = e;
4066
4078
  }
4067
4079
  _toFieldTransform(t) {
4068
- const n = Se(this, t,
4069
- /*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new _n(e);
4070
- return new bn(t.path, r);
4080
+ const e = $n(this, t,
4081
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
4082
+ return new be(t.path, r);
4071
4083
  }
4072
4084
  isEqual(t) {
4073
4085
  // TODO(mrschmidt): Implement isEquals
@@ -4075,14 +4087,14 @@ class xe extends be {
4075
4087
  }
4076
4088
  }
4077
4089
 
4078
- class qe extends be {
4079
- constructor(t, n) {
4080
- super(t), this.lt = n;
4090
+ class xn extends bn {
4091
+ constructor(t, e) {
4092
+ super(t), this.lt = e;
4081
4093
  }
4082
4094
  _toFieldTransform(t) {
4083
- const n = Se(this, t,
4084
- /*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new gn(e);
4085
- return new bn(t.path, r);
4095
+ const e = $n(this, t,
4096
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
4097
+ return new be(t.path, r);
4086
4098
  }
4087
4099
  isEqual(t) {
4088
4100
  // TODO(mrschmidt): Implement isEquals
@@ -4090,13 +4102,13 @@ class qe extends be {
4090
4102
  }
4091
4103
  }
4092
4104
 
4093
- class Oe extends be {
4094
- constructor(t, n) {
4095
- super(t), this.ft = n;
4105
+ class qn extends bn {
4106
+ constructor(t, e) {
4107
+ super(t), this.ft = e;
4096
4108
  }
4097
4109
  _toFieldTransform(t) {
4098
- const n = new vn(t.q, mn(t.q, this.ft));
4099
- return new bn(t.path, n);
4110
+ const e = new ge(t.q, we(t.q, this.ft));
4111
+ return new be(t.path, e);
4100
4112
  }
4101
4113
  isEqual(t) {
4102
4114
  // TODO(mrschmidt): Implement isEquals
@@ -4104,50 +4116,50 @@ class Oe extends be {
4104
4116
  }
4105
4117
  }
4106
4118
 
4107
- /** Parse update data from an update() call. */ function Ce(t, n, e, r) {
4108
- const s = t.ht(1 /* Update */ , n, e);
4109
- Be("Data must be an object, but it was:", s, r);
4119
+ /** Parse update data from an update() call. */ function On(t, e, n, r) {
4120
+ const s = t.ht(1 /* Update */ , e, n);
4121
+ Mn("Data must be an object, but it was:", s, r);
4110
4122
  const i = [], o = Bt.empty();
4111
4123
  Et(r, ((t, r) => {
4112
- const u = Qe(n, t, e);
4124
+ const u = Gn(e, t, n);
4113
4125
  // For Compat types, we have to "extract" the underlying types before
4114
4126
  // performing validation.
4115
4127
  r = getModularInstance(r);
4116
4128
  const c = s.it(u);
4117
- if (r instanceof $e)
4129
+ if (r instanceof Nn)
4118
4130
  // Add it to the field mask, but don't add anything to updateData.
4119
4131
  i.push(u); else {
4120
- const t = ke(r, c);
4132
+ const t = Un(r, c);
4121
4133
  null != t && (i.push(u), o.set(u, t));
4122
4134
  }
4123
4135
  }));
4124
4136
  const u = new Tt(i);
4125
- return new Ae(o, u, s.fieldTransforms);
4137
+ return new In(o, u, s.fieldTransforms);
4126
4138
  }
4127
4139
 
4128
- /** Parse update data from a list of field/value arguments. */ function Le(t, n, e, r, s, i) {
4129
- const o = t.ht(1 /* Update */ , n, e), u = [ ze(n, r, e) ], c = [ s ];
4130
- if (i.length % 2 != 0) throw new U(A, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
4131
- for (let t = 0; t < i.length; t += 2) u.push(ze(n, i[t])), c.push(i[t + 1]);
4140
+ /** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, s, i) {
4141
+ const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], c = [ s ];
4142
+ if (i.length % 2 != 0) throw new U(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4143
+ for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), c.push(i[t + 1]);
4132
4144
  const a = [], l = Bt.empty();
4133
4145
  // We iterate in reverse order to pick the last value for a field if the
4134
4146
  // user specified the field multiple times.
4135
- for (let t = u.length - 1; t >= 0; --t) if (!Ye(a, u[t])) {
4136
- const n = u[t];
4137
- let e = c[t];
4147
+ for (let t = u.length - 1; t >= 0; --t) if (!Wn(a, u[t])) {
4148
+ const e = u[t];
4149
+ let n = c[t];
4138
4150
  // For Compat types, we have to "extract" the underlying types before
4139
4151
  // performing validation.
4140
- e = getModularInstance(e);
4141
- const r = o.it(n);
4142
- if (e instanceof $e)
4152
+ n = getModularInstance(n);
4153
+ const r = o.it(e);
4154
+ if (n instanceof Nn)
4143
4155
  // Add it to the field mask, but don't add anything to updateData.
4144
- a.push(n); else {
4145
- const t = ke(e, r);
4146
- null != t && (a.push(n), l.set(n, t));
4156
+ a.push(e); else {
4157
+ const t = Un(n, r);
4158
+ null != t && (a.push(e), l.set(e, t));
4147
4159
  }
4148
4160
  }
4149
4161
  const f = new Tt(a);
4150
- return new Ae(l, f, o.fieldTransforms);
4162
+ return new In(l, f, o.fieldTransforms);
4151
4163
  }
4152
4164
 
4153
4165
  /**
@@ -4156,8 +4168,8 @@ class Oe extends be {
4156
4168
  *
4157
4169
  * @param allowArrays - Whether the query value is an array that may directly
4158
4170
  * contain additional arrays (e.g. the operand of an `in` query).
4159
- */ function Ue(t, n, e, r = !1) {
4160
- return ke(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
4171
+ */ function Ln(t, e, n, r = !1) {
4172
+ return Un(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4161
4173
  }
4162
4174
 
4163
4175
  /**
@@ -4168,12 +4180,12 @@ class Oe extends be {
4168
4180
  * the source of the data being parsed, etc.
4169
4181
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4170
4182
  * that should not be included in the resulting parsed data.
4171
- */ function ke(t, n) {
4172
- if (Me(
4183
+ */ function Un(t, e) {
4184
+ if (jn(
4173
4185
  // Unwrap the API type from the Compat SDK. This will return the API type
4174
4186
  // from firestore-exp.
4175
- t = getModularInstance(t))) return Be("Unsupported field value:", n, t), je(t, n);
4176
- if (t instanceof be)
4187
+ t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
4188
+ if (t instanceof bn)
4177
4189
  // FieldValues usually parse into transforms (except deleteField())
4178
4190
  // in which case we do not want to include this field in our parsed data
4179
4191
  // (as doing so will overwrite the field directly prior to the transform
@@ -4183,19 +4195,19 @@ class Oe extends be {
4183
4195
  * "Parses" the provided FieldValueImpl, adding any necessary transforms to
4184
4196
  * context.fieldTransforms.
4185
4197
  */
4186
- return function(t, n) {
4198
+ return function(t, e) {
4187
4199
  // Sentinels are only supported with writes, and not within arrays.
4188
- if (!Re(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
4189
- if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
4190
- const e = t._toFieldTransform(n);
4191
- e && n.fieldTransforms.push(e);
4200
+ if (!An(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
4201
+ if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
4202
+ const n = t._toFieldTransform(e);
4203
+ n && e.fieldTransforms.push(n);
4192
4204
  }
4193
4205
  /**
4194
4206
  * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue)
4195
4207
  *
4196
4208
  * @returns The parsed value
4197
- */ (t, n), null;
4198
- if (void 0 === t && n.ignoreUndefinedProperties)
4209
+ */ (t, e), null;
4210
+ if (void 0 === t && e.ignoreUndefinedProperties)
4199
4211
  // If the input is undefined it can never participate in the fieldMask, so
4200
4212
  // don't handle this below. If `ignoreUndefinedProperties` is false,
4201
4213
  // `parseScalarValue` will reject an undefined value.
@@ -4203,38 +4215,38 @@ class Oe extends be {
4203
4215
  if (
4204
4216
  // If context.path is null we are inside an array and we don't support
4205
4217
  // field mask paths more granular than the top-level array.
4206
- n.path && n.fieldMask.push(n.path), t instanceof Array) {
4218
+ e.path && e.fieldMask.push(e.path), t instanceof Array) {
4207
4219
  // TODO(b/34871131): Include the path containing the array in the error
4208
4220
  // message.
4209
4221
  // In the case of IN queries, the parsed data is an array (representing
4210
4222
  // the set of values to be included for the IN query) that may directly
4211
4223
  // contain additional arrays (each representing an individual field
4212
4224
  // value), so we disable this validation.
4213
- if (n.settings.rt && 4 /* ArrayArgument */ !== n.tt) throw n.ut("Nested arrays are not supported");
4214
- return function(t, n) {
4215
- const e = [];
4225
+ if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
4226
+ return function(t, e) {
4227
+ const n = [];
4216
4228
  let r = 0;
4217
4229
  for (const s of t) {
4218
- let t = ke(s, n.ot(r));
4230
+ let t = Un(s, e.ot(r));
4219
4231
  null == t && (
4220
4232
  // Just include nulls in the array for fields being replaced with a
4221
4233
  // sentinel.
4222
4234
  t = {
4223
4235
  nullValue: "NULL_VALUE"
4224
- }), e.push(t), r++;
4236
+ }), n.push(t), r++;
4225
4237
  }
4226
4238
  return {
4227
4239
  arrayValue: {
4228
- values: e
4240
+ values: n
4229
4241
  }
4230
4242
  };
4231
- }(t, n);
4243
+ }(t, e);
4232
4244
  }
4233
- return function(t, n) {
4245
+ return function(t, e) {
4234
4246
  if (null === (t = getModularInstance(t))) return {
4235
4247
  nullValue: "NULL_VALUE"
4236
4248
  };
4237
- if ("number" == typeof t) return mn(n.q, t);
4249
+ if ("number" == typeof t) return we(e.q, t);
4238
4250
  if ("boolean" == typeof t) return {
4239
4251
  booleanValue: t
4240
4252
  };
@@ -4242,37 +4254,37 @@ class Oe extends be {
4242
4254
  stringValue: t
4243
4255
  };
4244
4256
  if (t instanceof Date) {
4245
- const e = gt.fromDate(t);
4257
+ const n = gt.fromDate(t);
4246
4258
  return {
4247
- timestampValue: $n(n.q, e)
4259
+ timestampValue: Ne(e.q, n)
4248
4260
  };
4249
4261
  }
4250
4262
  if (t instanceof gt) {
4251
4263
  // Firestore backend truncates precision down to microseconds. To ensure
4252
4264
  // offline mode works the same with regards to truncation, perform the
4253
4265
  // truncation immediately without waiting for the backend to do that.
4254
- const e = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4266
+ const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4255
4267
  return {
4256
- timestampValue: $n(n.q, e)
4268
+ timestampValue: Ne(e.q, n)
4257
4269
  };
4258
4270
  }
4259
- if (t instanceof Ee) return {
4271
+ if (t instanceof vn) return {
4260
4272
  geoPointValue: {
4261
4273
  latitude: t.latitude,
4262
4274
  longitude: t.longitude
4263
4275
  }
4264
4276
  };
4265
- if (t instanceof ve) return {
4266
- bytesValue: Sn(n.q, t._byteString)
4277
+ if (t instanceof gn) return {
4278
+ bytesValue: $e(e.q, t._byteString)
4267
4279
  };
4268
- if (t instanceof he) {
4269
- const e = n.databaseId, r = t.firestore._databaseId;
4270
- if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
4280
+ if (t instanceof an) {
4281
+ const n = e.databaseId, r = t.firestore._databaseId;
4282
+ if (!r.isEqual(n)) throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
4271
4283
  return {
4272
- referenceValue: qn(t.firestore._databaseId || n.databaseId, t._key.path)
4284
+ referenceValue: xe(t.firestore._databaseId || e.databaseId, t._key.path)
4273
4285
  };
4274
4286
  }
4275
- throw n.ut(`Unsupported field value: ${it(t)}`);
4287
+ throw e.ut(`Unsupported field value: ${it(t)}`);
4276
4288
  }
4277
4289
  /**
4278
4290
  * Checks whether an object looks like a JSON object that should be converted
@@ -4280,56 +4292,56 @@ class Oe extends be {
4280
4292
  * JSON objects since they should be converted to a struct value. Arrays, Dates,
4281
4293
  * GeoPoints, etc. are not considered to look like JSON objects since they map
4282
4294
  * to specific FieldValue types other than ObjectValue.
4283
- */ (t, n);
4295
+ */ (t, e);
4284
4296
  }
4285
4297
 
4286
- function je(t, n) {
4287
- const e = {};
4298
+ function kn(t, e) {
4299
+ const n = {};
4288
4300
  return !function(t) {
4289
- for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
4301
+ for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4290
4302
  return !0;
4291
4303
  }(t) ? Et(t, ((t, r) => {
4292
- const s = ke(r, n.et(t));
4293
- null != s && (e[t] = s);
4304
+ const s = Un(r, e.nt(t));
4305
+ null != s && (n[t] = s);
4294
4306
  })) :
4295
4307
  // If we encounter an empty object, we explicitly add it to the update
4296
4308
  // mask to ensure that the server creates a map entry.
4297
- n.path && n.path.length > 0 && n.fieldMask.push(n.path), {
4309
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path), {
4298
4310
  mapValue: {
4299
- fields: e
4311
+ fields: n
4300
4312
  }
4301
4313
  };
4302
4314
  }
4303
4315
 
4304
- function Me(t) {
4305
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Ee || t instanceof ve || t instanceof he || t instanceof be);
4316
+ function jn(t) {
4317
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof gn || t instanceof an || t instanceof bn);
4306
4318
  }
4307
4319
 
4308
- function Be(t, n, e) {
4309
- if (!Me(e) || !function(t) {
4320
+ function Mn(t, e, n) {
4321
+ if (!jn(n) || !function(t) {
4310
4322
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4311
- }(e)) {
4312
- const r = it(e);
4313
- throw "an object" === r ? n.ut(t + " a custom object") : n.ut(t + " " + r);
4323
+ }(n)) {
4324
+ const r = it(n);
4325
+ throw "an object" === r ? e.ut(t + " a custom object") : e.ut(t + " " + r);
4314
4326
  }
4315
4327
  }
4316
4328
 
4317
4329
  /**
4318
4330
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4319
- */ function ze(t, n, e) {
4331
+ */ function Bn(t, e, n) {
4320
4332
  if ((
4321
4333
  // If required, replace the FieldPath Compat class with with the firestore-exp
4322
4334
  // FieldPath.
4323
- n = getModularInstance(n)) instanceof _e) return n._internalPath;
4324
- if ("string" == typeof n) return Qe(t, n);
4325
- throw We("Field path arguments must be of type string or ", t,
4335
+ e = getModularInstance(e)) instanceof yn) return e._internalPath;
4336
+ if ("string" == typeof e) return Gn(t, e);
4337
+ throw Qn("Field path arguments must be of type string or ", t,
4326
4338
  /* hasConverter= */ !1,
4327
- /* path= */ void 0, e);
4339
+ /* path= */ void 0, n);
4328
4340
  }
4329
4341
 
4330
4342
  /**
4331
4343
  * Matches any characters in a field path string that are reserved.
4332
- */ const Ge = new RegExp("[~\\*/\\[\\]]");
4344
+ */ const zn = new RegExp("[~\\*/\\[\\]]");
4333
4345
 
4334
4346
  /**
4335
4347
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4339,30 +4351,30 @@ function Be(t, n, e) {
4339
4351
  * split on dots.
4340
4352
  * @param targetDoc - The document against which the field path will be
4341
4353
  * evaluated.
4342
- */ function Qe(t, n, e) {
4343
- if (n.search(Ge) >= 0) throw We(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4354
+ */ function Gn(t, e, n) {
4355
+ if (e.search(zn) >= 0) throw Qn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4344
4356
  /* hasConverter= */ !1,
4345
- /* path= */ void 0, e);
4357
+ /* path= */ void 0, n);
4346
4358
  try {
4347
- return new _e(...n.split("."))._internalPath;
4359
+ return new yn(...e.split("."))._internalPath;
4348
4360
  } catch (r) {
4349
- throw We(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4361
+ throw Qn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4350
4362
  /* hasConverter= */ !1,
4351
- /* path= */ void 0, e);
4363
+ /* path= */ void 0, n);
4352
4364
  }
4353
4365
  }
4354
4366
 
4355
- function We(t, n, e, r, s) {
4367
+ function Qn(t, e, n, r, s) {
4356
4368
  const i = r && !r.isEmpty(), o = void 0 !== s;
4357
- let u = `Function ${n}() called with invalid data`;
4358
- e && (u += " (via `toFirestore()`)"), u += ". ";
4369
+ let u = `Function ${e}() called with invalid data`;
4370
+ n && (u += " (via `toFirestore()`)"), u += ". ";
4359
4371
  let c = "";
4360
4372
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4361
4373
  c += ")"), new U(A, u + t + c);
4362
4374
  }
4363
4375
 
4364
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ye(t, n) {
4365
- return t.some((t => t.isEqual(n)));
4376
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Wn(t, e) {
4377
+ return t.some((t => t.isEqual(e)));
4366
4378
  }
4367
4379
 
4368
4380
  /**
@@ -4389,14 +4401,14 @@ function We(t, n, e, r, s) {
4389
4401
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4390
4402
  * access will return 'undefined'. You can use the `exists()` method to
4391
4403
  * explicitly verify a document's existence.
4392
- */ class He {
4404
+ */ class Yn {
4393
4405
  // Note: This class is stripped down version of the DocumentSnapshot in
4394
4406
  // the legacy SDK. The changes are:
4395
4407
  // - No support for SnapshotMetadata.
4396
4408
  // - No support for SnapshotOptions.
4397
4409
  /** @hideconstructor protected */
4398
- constructor(t, n, e, r, s) {
4399
- this._firestore = t, this._userDataWriter = n, this._key = e, this._document = r,
4410
+ constructor(t, e, n, r, s) {
4411
+ this._firestore = t, this._userDataWriter = e, this._key = n, this._document = r,
4400
4412
  this._converter = s;
4401
4413
  }
4402
4414
  /** Property of the `DocumentSnapshot` that provides the document's ID. */ get id() {
@@ -4405,7 +4417,7 @@ function We(t, n, e, r, s) {
4405
4417
  /**
4406
4418
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4407
4419
  */ get ref() {
4408
- return new he(this._firestore, this._converter, this._key);
4420
+ return new an(this._firestore, this._converter, this._key);
4409
4421
  }
4410
4422
  /**
4411
4423
  * Signals whether or not the document at the snapshot's location exists.
@@ -4425,7 +4437,7 @@ function We(t, n, e, r, s) {
4425
4437
  if (this._converter) {
4426
4438
  // We only want to use the converter and create a new DocumentSnapshot
4427
4439
  // if a converter has been provided.
4428
- const t = new Ke(this._firestore, this._userDataWriter, this._key, this._document,
4440
+ const t = new Hn(this._firestore, this._userDataWriter, this._key, this._document,
4429
4441
  /* converter= */ null);
4430
4442
  return this._converter.fromFirestore(t);
4431
4443
  }
@@ -4445,8 +4457,8 @@ function We(t, n, e, r, s) {
4445
4457
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4446
4458
  get(t) {
4447
4459
  if (this._document) {
4448
- const n = this._document.data.field(Ze("DocumentSnapshot.get", t));
4449
- if (null !== n) return this._userDataWriter.convertValue(n);
4460
+ const e = this._document.data.field(Xn("DocumentSnapshot.get", t));
4461
+ if (null !== e) return this._userDataWriter.convertValue(e);
4450
4462
  }
4451
4463
  }
4452
4464
  }
@@ -4461,7 +4473,7 @@ function We(t, n, e, r, s) {
4461
4473
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4462
4474
  * `exists` property will always be true and `data()` will never return
4463
4475
  * 'undefined'.
4464
- */ class Ke extends He {
4476
+ */ class Hn extends Yn {
4465
4477
  /**
4466
4478
  * Retrieves all fields in the document as an `Object`.
4467
4479
  *
@@ -4479,10 +4491,10 @@ function We(t, n, e, r, s) {
4479
4491
  * array via the `docs` property or enumerated using the `forEach` method. The
4480
4492
  * number of documents can be determined via the `empty` and `size`
4481
4493
  * properties.
4482
- */ class Je {
4494
+ */ class Kn {
4483
4495
  /** @hideconstructor */
4484
- constructor(t, n) {
4485
- this._docs = n, this.query = t;
4496
+ constructor(t, e) {
4497
+ this._docs = e, this.query = t;
4486
4498
  }
4487
4499
  /** An array of all the documents in the `QuerySnapshot`. */ get docs() {
4488
4500
  return [ ...this._docs ];
@@ -4499,8 +4511,8 @@ function We(t, n, e, r, s) {
4499
4511
  * @param callback - A callback to be called with a `QueryDocumentSnapshot` for
4500
4512
  * each document in the snapshot.
4501
4513
  * @param thisArg - The `this` binding for the callback.
4502
- */ forEach(t, n) {
4503
- this._docs.forEach(t, n);
4514
+ */ forEach(t, e) {
4515
+ this._docs.forEach(t, e);
4504
4516
  }
4505
4517
  }
4506
4518
 
@@ -4510,14 +4522,14 @@ function We(t, n, e, r, s) {
4510
4522
  * @param left - A snapshot to compare.
4511
4523
  * @param right - A snapshot to compare.
4512
4524
  * @returns true if the snapshots are equal.
4513
- */ function Xe(t, n) {
4514
- return t = getModularInstance(t), n = getModularInstance(n), t instanceof He && n instanceof He ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Je && n instanceof Je && (ye(t.query, n.query) && _t(t.docs, n.docs, Xe));
4525
+ */ function Jn(t, e) {
4526
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof Yn && e instanceof Yn ? 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 Kn && e instanceof Kn && (pn(t.query, e.query) && _t(t.docs, e.docs, Jn));
4515
4527
  }
4516
4528
 
4517
4529
  /**
4518
4530
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4519
- */ function Ze(t, n) {
4520
- return "string" == typeof n ? Qe(t, n) : n instanceof _e ? n._internalPath : n._delegate._internalPath;
4531
+ */ function Xn(t, e) {
4532
+ return "string" == typeof e ? Gn(t, e) : e instanceof yn ? e._internalPath : e._delegate._internalPath;
4521
4533
  }
4522
4534
 
4523
4535
  /**
@@ -4544,7 +4556,7 @@ function We(t, n, e, r, s) {
4544
4556
  * can then be passed to {@link query} to create a new query instance that
4545
4557
  * also contains this `QueryConstraint`.
4546
4558
  */
4547
- class tr {}
4559
+ class Zn {}
4548
4560
 
4549
4561
  /**
4550
4562
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4554,43 +4566,43 @@ class tr {}
4554
4566
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4555
4567
  * @throws if any of the provided query constraints cannot be combined with the
4556
4568
  * existing or new constraints.
4557
- */ function nr(t, ...n) {
4558
- for (const e of n) t = e._apply(t);
4569
+ */ function tr(t, ...e) {
4570
+ for (const n of e) t = n._apply(t);
4559
4571
  return t;
4560
4572
  }
4561
4573
 
4562
- class er extends tr {
4563
- constructor(t, n, e) {
4564
- super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
4574
+ class er extends Zn {
4575
+ constructor(t, e, n) {
4576
+ super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
4565
4577
  }
4566
4578
  _apply(t) {
4567
- const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
4579
+ const e = Vn(t.firestore), n = function(t, e, n, r, s, i, o) {
4568
4580
  let u;
4569
4581
  if (s.isKeyField()) {
4570
4582
  if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4571
4583
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
4572
- yr(o, i);
4573
- const n = [];
4574
- for (const e of o) n.push(pr(r, t, e));
4584
+ pr(o, i);
4585
+ const e = [];
4586
+ for (const n of o) e.push(mr(r, t, n));
4575
4587
  u = {
4576
4588
  arrayValue: {
4577
- values: n
4589
+ values: e
4578
4590
  }
4579
4591
  };
4580
- } else u = pr(r, t, o);
4581
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || yr(o, i),
4582
- u = Ue(e, n, o,
4592
+ } else u = mr(r, t, o);
4593
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
4594
+ u = Ln(n, e, o,
4583
4595
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
4584
4596
  const c = Wt.create(s, i, u);
4585
- return function(t, n) {
4586
- if (n.N()) {
4587
- const e = hn(t);
4588
- if (null !== e && !e.isEqual(n.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
4589
- const r = an(t);
4590
- null !== r && _r(t, n.field, r);
4597
+ return function(t, e) {
4598
+ if (e.N()) {
4599
+ const n = ae(t);
4600
+ if (null !== n && !n.isEqual(e.field)) throw new U(A, `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()}'`);
4601
+ const r = ce(t);
4602
+ null !== r && yr(t, e.field, r);
4591
4603
  }
4592
- const e = function(t, n) {
4593
- for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
4604
+ const n = function(t, e) {
4605
+ for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
4594
4606
  return null;
4595
4607
  }(t,
4596
4608
  /**
@@ -4625,16 +4637,16 @@ class er extends tr {
4625
4637
  default:
4626
4638
  return [];
4627
4639
  }
4628
- }(n.op));
4629
- if (null !== e)
4640
+ }(e.op));
4641
+ if (null !== n)
4630
4642
  // Special case when it's a duplicate op to give a slightly clearer error message.
4631
- throw e === n.op ? new U(A, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
4643
+ throw n === e.op ? new U(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4632
4644
  }(t, c), c;
4633
- }(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
4634
- return new le(t.firestore, t.converter, function(t, n) {
4635
- const e = t.filters.concat([ n ]);
4636
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
4637
- }(t._query, e));
4645
+ }(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4646
+ return new hn(t.firestore, t.converter, function(t, e) {
4647
+ const n = t.filters.concat([ e ]);
4648
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4649
+ }(t._query, n));
4638
4650
  }
4639
4651
  }
4640
4652
 
@@ -4648,25 +4660,25 @@ class er extends tr {
4648
4660
  * "&lt;=", "!=").
4649
4661
  * @param value - The value for comparison
4650
4662
  * @returns The created {@link Query}.
4651
- */ function rr(t, n, e) {
4652
- const r = n, s = Ze("where", t);
4653
- return new er(s, r, e);
4663
+ */ function nr(t, e, n) {
4664
+ const r = e, s = Xn("where", t);
4665
+ return new er(s, r, n);
4654
4666
  }
4655
4667
 
4656
- class sr extends tr {
4657
- constructor(t, n) {
4658
- super(), this.dt = t, this._t = n, this.type = "orderBy";
4668
+ class rr extends Zn {
4669
+ constructor(t, e) {
4670
+ super(), this.dt = t, this._t = e, this.type = "orderBy";
4659
4671
  }
4660
4672
  _apply(t) {
4661
- const n = function(t, n, e) {
4673
+ const e = function(t, e, n) {
4662
4674
  if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4663
4675
  if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4664
- const r = new rn(n, e);
4665
- return function(t, n) {
4666
- if (null === an(t)) {
4676
+ const r = new re(e, n);
4677
+ return function(t, e) {
4678
+ if (null === ce(t)) {
4667
4679
  // This is the first order by. It must match any inequality.
4668
- const e = hn(t);
4669
- null !== e && _r(t, e, n.field);
4680
+ const n = ae(t);
4681
+ null !== n && yr(t, n, e.field);
4670
4682
  }
4671
4683
  }(t, r), r;
4672
4684
  }
@@ -4681,11 +4693,11 @@ class sr extends tr {
4681
4693
  * of the query or if any of the fields in the order by are an uncommitted
4682
4694
  * server timestamp.
4683
4695
  */ (t._query, this.dt, this._t);
4684
- return new le(t.firestore, t.converter, function(t, n) {
4696
+ return new hn(t.firestore, t.converter, function(t, e) {
4685
4697
  // TODO(dimond): validate that orderBy does not list the same key twice.
4686
- const e = t.explicitOrderBy.concat([ n ]);
4687
- return new un(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4688
- }(t._query, n));
4698
+ const n = t.explicitOrderBy.concat([ e ]);
4699
+ return new oe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4700
+ }(t._query, e));
4689
4701
  }
4690
4702
  }
4691
4703
 
@@ -4697,19 +4709,19 @@ class sr extends tr {
4697
4709
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4698
4710
  * not specified, order will be ascending.
4699
4711
  * @returns The created {@link Query}.
4700
- */ function ir(t, n = "asc") {
4701
- const e = n, r = Ze("orderBy", t);
4702
- return new sr(r, e);
4712
+ */ function sr(t, e = "asc") {
4713
+ const n = e, r = Xn("orderBy", t);
4714
+ return new rr(r, n);
4703
4715
  }
4704
4716
 
4705
- class or extends tr {
4706
- constructor(t, n, e) {
4707
- super(), this.type = t, this.gt = n, this.vt = e;
4717
+ class ir extends Zn {
4718
+ constructor(t, e, n) {
4719
+ super(), this.type = t, this.gt = e, this.bt = n;
4708
4720
  }
4709
4721
  _apply(t) {
4710
- return new le(t.firestore, t.converter, function(t, n, e) {
4711
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
4712
- }(t._query, this.gt, this.vt));
4722
+ return new hn(t.firestore, t.converter, function(t, e, n) {
4723
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4724
+ }(t._query, this.gt, this.bt));
4713
4725
  }
4714
4726
  }
4715
4727
 
@@ -4718,8 +4730,8 @@ class or extends tr {
4718
4730
  *
4719
4731
  * @param limit - The maximum number of items to return.
4720
4732
  * @returns The created {@link Query}.
4721
- */ function ur(t) {
4722
- return ut("limit", t), new or("limit", t, "F" /* First */);
4733
+ */ function or(t) {
4734
+ return ut("limit", t), new ir("limit", t, "F" /* First */);
4723
4735
  }
4724
4736
 
4725
4737
  /**
@@ -4730,54 +4742,56 @@ class or extends tr {
4730
4742
  *
4731
4743
  * @param limit - The maximum number of items to return.
4732
4744
  * @returns The created {@link Query}.
4733
- */ function cr(t) {
4734
- return ut("limitToLast", t), new or("limitToLast", t, "L" /* Last */);
4745
+ */ function ur(t) {
4746
+ return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
4735
4747
  }
4736
4748
 
4737
- class ar extends tr {
4738
- constructor(t, n, e) {
4739
- super(), this.type = t, this.bt = n, this.Et = e;
4749
+ class cr extends Zn {
4750
+ constructor(t, e, n) {
4751
+ super(), this.type = t, this.vt = e, this.Et = n;
4740
4752
  }
4741
4753
  _apply(t) {
4742
- const n = mr(t, this.type, this.bt, this.Et);
4743
- return new le(t.firestore, t.converter, function(t, n) {
4744
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
4745
- }(t._query, n));
4754
+ const e = wr(t, this.type, this.vt, this.Et);
4755
+ return new hn(t.firestore, t.converter, function(t, e) {
4756
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4757
+ }(t._query, e));
4746
4758
  }
4747
4759
  }
4748
4760
 
4749
- function hr(...t) {
4750
- return new ar("startAt", t, /*before=*/ !0);
4761
+ function ar(...t) {
4762
+ return new cr("startAt", t,
4763
+ /*inclusive=*/ !0);
4751
4764
  }
4752
4765
 
4753
- function lr(...t) {
4754
- return new ar("startAfter", t,
4755
- /*before=*/ !1);
4766
+ function hr(...t) {
4767
+ return new cr("startAfter", t,
4768
+ /*inclusive=*/ !1);
4756
4769
  }
4757
4770
 
4758
- class fr extends tr {
4759
- constructor(t, n, e) {
4760
- super(), this.type = t, this.bt = n, this.Et = e;
4771
+ class lr extends Zn {
4772
+ constructor(t, e, n) {
4773
+ super(), this.type = t, this.vt = e, this.Et = n;
4761
4774
  }
4762
4775
  _apply(t) {
4763
- const n = mr(t, this.type, this.bt, this.Et);
4764
- return new le(t.firestore, t.converter, function(t, n) {
4765
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
4766
- }(t._query, n));
4776
+ const e = wr(t, this.type, this.vt, this.Et);
4777
+ return new hn(t.firestore, t.converter, function(t, e) {
4778
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4779
+ }(t._query, e));
4767
4780
  }
4768
4781
  }
4769
4782
 
4770
- function dr(...t) {
4771
- return new fr("endBefore", t, /*before=*/ !0);
4783
+ function fr(...t) {
4784
+ return new lr("endBefore", t,
4785
+ /*inclusive=*/ !1);
4772
4786
  }
4773
4787
 
4774
- function wr(...t) {
4775
- return new fr("endAt", t, /*before=*/ !1);
4788
+ function dr(...t) {
4789
+ return new lr("endAt", t, /*inclusive=*/ !0);
4776
4790
  }
4777
4791
 
4778
- /** Helper function to create a bound from a document or fields */ function mr(t, n, e, r) {
4779
- if (e[0] = getModularInstance(e[0]), e[0] instanceof He) return function(t, n, e, r, s) {
4780
- if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
4792
+ /** Helper function to create a bound from a document or fields */ function wr(t, e, n, r) {
4793
+ if (n[0] = getModularInstance(n[0]), n[0] instanceof Yn) return function(t, e, n, r, s) {
4794
+ if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
4781
4795
  const i = [];
4782
4796
  // Because people expect to continue/end a query at the exact document
4783
4797
  // provided, we need to use the implicit sort order rather than the explicit
@@ -4786,23 +4800,23 @@ function wr(...t) {
4786
4800
  // the provided document. Without the key (by using the explicit sort
4787
4801
  // orders), multiple documents could match the position, yielding duplicate
4788
4802
  // results.
4789
- for (const e of fn(t)) if (e.field.isKeyField()) i.push(Ct(n, r.key)); else {
4790
- const t = r.data.field(e.field);
4791
- if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4803
+ for (const n of le(t)) if (n.field.isKeyField()) i.push(Ct(e, r.key)); else {
4804
+ const t = r.data.field(n.field);
4805
+ if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4792
4806
  if (null === t) {
4793
- const t = e.field.canonicalString();
4807
+ const t = n.field.canonicalString();
4794
4808
  throw new U(A, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
4795
4809
  }
4796
4810
  i.push(t);
4797
4811
  }
4798
- return new en(i, s);
4812
+ return new ne(i, s);
4799
4813
  }
4800
4814
  /**
4801
4815
  * Converts a list of field values to a `Bound` for the given query.
4802
- */ (t._query, t.firestore._databaseId, n, e[0]._document, r);
4816
+ */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
4803
4817
  {
4804
- const s = De(t.firestore);
4805
- return function(t, n, e, r, s, i) {
4818
+ const s = Vn(t.firestore);
4819
+ return function(t, e, n, r, s, i) {
4806
4820
  // Use explicit order by's because it has to match the query the user made
4807
4821
  const o = t.explicitOrderBy;
4808
4822
  if (s.length > o.length) throw new U(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
@@ -4811,48 +4825,48 @@ function wr(...t) {
4811
4825
  const c = s[i];
4812
4826
  if (o[i].field.isKeyField()) {
4813
4827
  if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
4814
- if (!ln(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4815
- const e = t.path.child(X.fromString(c));
4816
- if (!nt.isDocumentKey(e)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
4817
- const s = new nt(e);
4818
- u.push(Ct(n, s));
4828
+ if (!he(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4829
+ const n = t.path.child(X.fromString(c));
4830
+ if (!et.isDocumentKey(n)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
4831
+ const s = new et(n);
4832
+ u.push(Ct(e, s));
4819
4833
  } else {
4820
- const t = Ue(e, r, c);
4834
+ const t = Ln(n, r, c);
4821
4835
  u.push(t);
4822
4836
  }
4823
4837
  }
4824
- return new en(u, i);
4838
+ return new ne(u, i);
4825
4839
  }
4826
4840
  /**
4827
4841
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
4828
4842
  * appropriate errors if the value is anything other than a `DocumentReference`
4829
4843
  * or `string`, or if the string is malformed.
4830
- */ (t._query, t.firestore._databaseId, s, n, e, r);
4844
+ */ (t._query, t.firestore._databaseId, s, e, n, r);
4831
4845
  }
4832
4846
  }
4833
4847
 
4834
- function pr(t, n, e) {
4835
- if ("string" == typeof (e = getModularInstance(e))) {
4836
- if ("" === e) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4837
- if (!ln(n) && -1 !== e.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
4838
- const r = n.path.child(X.fromString(e));
4839
- if (!nt.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4840
- return Ct(t, new nt(r));
4848
+ function mr(t, e, n) {
4849
+ if ("string" == typeof (n = getModularInstance(n))) {
4850
+ if ("" === n) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4851
+ if (!he(e) && -1 !== n.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4852
+ const r = e.path.child(X.fromString(n));
4853
+ if (!et.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4854
+ return Ct(t, new et(r));
4841
4855
  }
4842
- if (e instanceof he) return Ct(t, e._key);
4843
- throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(e)}.`);
4856
+ if (n instanceof an) return Ct(t, n._key);
4857
+ throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
4844
4858
  }
4845
4859
 
4846
4860
  /**
4847
4861
  * Validates that the value passed into a disjunctive filter satisfies all
4848
4862
  * array requirements.
4849
- */ function yr(t, n) {
4850
- if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
4851
- if (t.length > 10) throw new U(A, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
4863
+ */ function pr(t, e) {
4864
+ if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4865
+ if (t.length > 10) throw new U(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4852
4866
  }
4853
4867
 
4854
- function _r(t, n, e) {
4855
- if (!e.isEqual(n)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
4868
+ function yr(t, e, n) {
4869
+ if (!n.isEqual(e)) throw new U(A, `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.`);
4856
4870
  }
4857
4871
 
4858
4872
  /**
@@ -4902,17 +4916,17 @@ function _r(t, n, e) {
4902
4916
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4903
4917
  * call.
4904
4918
  */
4905
- function gr(t, n, e) {
4919
+ function _r(t, e, n) {
4906
4920
  let r;
4907
4921
  // Cast to `any` in order to satisfy the union type constraint on
4908
4922
  // toFirestore().
4909
4923
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4910
- return r = t ? e && (e.merge || e.mergeFields) ? t.toFirestore(n, e) : t.toFirestore(n) : n,
4924
+ return r = t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e,
4911
4925
  r;
4912
4926
  }
4913
4927
 
4914
- class vr extends class {
4915
- convertValue(t, n = "none") {
4928
+ class gr extends class {
4929
+ convertValue(t, e = "none") {
4916
4930
  switch (St(t)) {
4917
4931
  case 0 /* NullValue */ :
4918
4932
  return null;
@@ -4927,7 +4941,7 @@ class vr extends class {
4927
4941
  return this.convertTimestamp(t.timestampValue);
4928
4942
 
4929
4943
  case 4 /* ServerTimestampValue */ :
4930
- return this.convertServerTimestamp(t, n);
4944
+ return this.convertServerTimestamp(t, e);
4931
4945
 
4932
4946
  case 5 /* StringValue */ :
4933
4947
  return t.stringValue;
@@ -4942,32 +4956,32 @@ class vr extends class {
4942
4956
  return this.convertGeoPoint(t.geoPointValue);
4943
4957
 
4944
4958
  case 9 /* ArrayValue */ :
4945
- return this.convertArray(t.arrayValue, n);
4959
+ return this.convertArray(t.arrayValue, e);
4946
4960
 
4947
4961
  case 10 /* ObjectValue */ :
4948
- return this.convertObject(t.mapValue, n);
4962
+ return this.convertObject(t.mapValue, e);
4949
4963
 
4950
4964
  default:
4951
4965
  throw g();
4952
4966
  }
4953
4967
  }
4954
- convertObject(t, n) {
4955
- const e = {};
4968
+ convertObject(t, e) {
4969
+ const n = {};
4956
4970
  return Et(t.fields, ((t, r) => {
4957
- e[t] = this.convertValue(r, n);
4958
- })), e;
4971
+ n[t] = this.convertValue(r, e);
4972
+ })), n;
4959
4973
  }
4960
4974
  convertGeoPoint(t) {
4961
- return new Ee(Pt(t.latitude), Pt(t.longitude));
4975
+ return new vn(Pt(t.latitude), Pt(t.longitude));
4962
4976
  }
4963
- convertArray(t, n) {
4964
- return (t.values || []).map((t => this.convertValue(t, n)));
4977
+ convertArray(t, e) {
4978
+ return (t.values || []).map((t => this.convertValue(t, e)));
4965
4979
  }
4966
- convertServerTimestamp(t, n) {
4967
- switch (n) {
4980
+ convertServerTimestamp(t, e) {
4981
+ switch (e) {
4968
4982
  case "previous":
4969
- const e = Nt(t);
4970
- return null == e ? null : this.convertValue(e, n);
4983
+ const n = Nt(t);
4984
+ return null == n ? null : this.convertValue(n, e);
4971
4985
 
4972
4986
  case "estimate":
4973
4987
  return this.convertTimestamp($t(t));
@@ -4977,16 +4991,16 @@ class vr extends class {
4977
4991
  }
4978
4992
  }
4979
4993
  convertTimestamp(t) {
4980
- const n = Rt(t);
4981
- return new gt(n.seconds, n.nanos);
4994
+ const e = Rt(t);
4995
+ return new gt(e.seconds, e.nanos);
4982
4996
  }
4983
- convertDocumentKey(t, n) {
4984
- const e = X.fromString(t);
4985
- v(Hn(e));
4986
- const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
4987
- return r.isEqual(n) ||
4997
+ convertDocumentKey(t, e) {
4998
+ const n = X.fromString(t);
4999
+ b(We(n));
5000
+ const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
5001
+ return r.isEqual(e) ||
4988
5002
  // TODO(b/64130202): Somehow support foreign references.
4989
- p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),
5003
+ p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
4990
5004
  s;
4991
5005
  }
4992
5006
  } {
@@ -4994,11 +5008,11 @@ class vr extends class {
4994
5008
  super(), this.firestore = t;
4995
5009
  }
4996
5010
  convertBytes(t) {
4997
- return new ve(t);
5011
+ return new gn(t);
4998
5012
  }
4999
5013
  convertReference(t) {
5000
- const n = this.convertDocumentKey(t, this.firestore._databaseId);
5001
- return new he(this.firestore, /* converter= */ null, n);
5014
+ const e = this.convertDocumentKey(t, this.firestore._databaseId);
5015
+ return new an(this.firestore, /* converter= */ null, e);
5002
5016
  }
5003
5017
  }
5004
5018
 
@@ -5015,11 +5029,11 @@ class vr extends class {
5015
5029
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5016
5030
  * document contents.
5017
5031
  */ function br(t) {
5018
- const n = re((t = ot(t, he)).firestore), e = new vr(t.firestore);
5019
- return te(n, [ t._key ]).then((n => {
5020
- v(1 === n.length);
5021
- const r = n[0];
5022
- return new He(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
5032
+ const e = en((t = ot(t, an)).firestore), n = new gr(t.firestore);
5033
+ return Xe(e, [ t._key ]).then((e => {
5034
+ b(1 === e.length);
5035
+ const r = e[0];
5036
+ return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5023
5037
  }));
5024
5038
  }
5025
5039
 
@@ -5034,33 +5048,33 @@ class vr extends class {
5034
5048
  *
5035
5049
  * @param query - The `Query` to execute.
5036
5050
  * @returns A Promise that will be resolved with the results of the query.
5037
- */ function Er(t) {
5051
+ */ function vr(t) {
5038
5052
  !function(t) {
5039
- if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
5040
- }((t = ot(t, le))._query);
5041
- const n = re(t.firestore), e = new vr(t.firestore);
5042
- return ne(n, t._query).then((n => {
5043
- const r = n.map((n => new Ke(t.firestore, e, n.key, n, t.converter)));
5044
- return cn(t._query) &&
5053
+ if (ue(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
5054
+ }((t = ot(t, hn))._query);
5055
+ const e = en(t.firestore), n = new gr(t.firestore);
5056
+ return Ze(e, t._query).then((e => {
5057
+ const r = e.map((e => new Hn(t.firestore, n, e.key, e, t.converter)));
5058
+ return ue(t._query) &&
5045
5059
  // Limit to last queries reverse the orderBy constraint that was
5046
5060
  // specified by the user. As such, we need to reverse the order of the
5047
5061
  // results to return the documents in the expected order.
5048
- r.reverse(), new Je(t, r);
5062
+ r.reverse(), new Kn(t, r);
5049
5063
  }));
5050
5064
  }
5051
5065
 
5052
- function Tr(t, n, e) {
5053
- const r = gr((t = ot(t, he)).converter, n, e), s = Ne(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
5054
- return Zn(re(t.firestore), [ s.toMutation(t._key, En.none()) ]);
5066
+ function Er(t, e, n) {
5067
+ const r = _r((t = ot(t, an)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5068
+ return Je(en(t.firestore), [ s.toMutation(t._key, ve.none()) ]);
5055
5069
  }
5056
5070
 
5057
- function Ir(t, n, e, ...r) {
5058
- const s = De((t = ot(t, he)).firestore);
5071
+ function Tr(t, e, n, ...r) {
5072
+ const s = Vn((t = ot(t, an)).firestore);
5059
5073
  // For Compat types, we have to "extract" the underlying types before
5060
5074
  // performing validation.
5061
5075
  let i;
5062
- i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(s, "updateDoc", t._key, n, e, r) : Ce(s, "updateDoc", t._key, n);
5063
- return Zn(re(t.firestore), [ i.toMutation(t._key, En.exists(!0)) ]);
5076
+ i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
5077
+ return Je(en(t.firestore), [ i.toMutation(t._key, ve.exists(!0)) ]);
5064
5078
  }
5065
5079
 
5066
5080
  /**
@@ -5074,8 +5088,8 @@ function Ir(t, n, e, ...r) {
5074
5088
  * @param reference - A reference to the document to delete.
5075
5089
  * @returns A `Promise` resolved once the document has been successfully
5076
5090
  * deleted from the backend.
5077
- */ function Ar(t) {
5078
- return Zn(re((t = ot(t, he)).firestore), [ new Rn(t._key, En.none()) ]);
5091
+ */ function Ir(t) {
5092
+ return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key, ve.none()) ]);
5079
5093
  }
5080
5094
 
5081
5095
  /**
@@ -5092,9 +5106,9 @@ function Ir(t, n, e, ...r) {
5092
5106
  * @throws Error - If the provided input is not a valid Firestore document.
5093
5107
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5094
5108
  * newly created document after it has been written to the backend.
5095
- */ function Rr(t, n) {
5096
- const e = me(t = ot(t, fe)), r = gr(t.converter, n), s = Ne(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
5097
- return Zn(re(t.firestore), [ s.toMutation(e._key, En.exists(!1)) ]).then((() => e));
5109
+ */ function Ar(t, e) {
5110
+ const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5111
+ return Je(en(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
5098
5112
  }
5099
5113
 
5100
5114
  /**
@@ -5116,15 +5130,15 @@ function Ir(t, n, e, ...r) {
5116
5130
  /**
5117
5131
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5118
5132
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5119
- */ function Pr() {
5120
- return new $e("deleteField");
5133
+ */ function Rr() {
5134
+ return new Nn("deleteField");
5121
5135
  }
5122
5136
 
5123
5137
  /**
5124
5138
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5125
5139
  * include a server-generated timestamp in the written data.
5126
- */ function Vr() {
5127
- return new Fe("serverTimestamp");
5140
+ */ function Pr() {
5141
+ return new Sn("serverTimestamp");
5128
5142
  }
5129
5143
 
5130
5144
  /**
@@ -5138,10 +5152,10 @@ function Ir(t, n, e, ...r) {
5138
5152
  * @param elements - The elements to union into the array.
5139
5153
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5140
5154
  * `updateDoc()`.
5141
- */ function Dr(...t) {
5155
+ */ function Vr(...t) {
5142
5156
  // NOTE: We don't actually parse the data until it's used in set() or
5143
5157
  // update() since we'd need the Firestore instance to do this.
5144
- return new xe("arrayUnion", t);
5158
+ return new Fn("arrayUnion", t);
5145
5159
  }
5146
5160
 
5147
5161
  /**
@@ -5154,10 +5168,10 @@ function Ir(t, n, e, ...r) {
5154
5168
  * @param elements - The elements to remove from the array.
5155
5169
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5156
5170
  * `updateDoc()`
5157
- */ function Nr(...t) {
5171
+ */ function Dr(...t) {
5158
5172
  // NOTE: We don't actually parse the data until it's used in set() or
5159
5173
  // update() since we'd need the Firestore instance to do this.
5160
- return new qe("arrayRemove", t);
5174
+ return new xn("arrayRemove", t);
5161
5175
  }
5162
5176
 
5163
5177
  /**
@@ -5178,8 +5192,8 @@ function Ir(t, n, e, ...r) {
5178
5192
  * @param n - The value to increment by.
5179
5193
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5180
5194
  * `updateDoc()`
5181
- */ function $r(t) {
5182
- return new Oe("increment", t);
5195
+ */ function Nr(t) {
5196
+ return new qn("increment", t);
5183
5197
  }
5184
5198
 
5185
5199
  /**
@@ -5205,25 +5219,25 @@ function Ir(t, n, e, ...r) {
5205
5219
  * provides methods for adding writes to the write batch. None of the writes
5206
5220
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5207
5221
  * called.
5208
- */ class Sr {
5222
+ */ class $r {
5209
5223
  /** @hideconstructor */
5210
- constructor(t, n) {
5211
- this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
5212
- this._dataReader = De(t);
5224
+ constructor(t, e) {
5225
+ this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5226
+ this._dataReader = Vn(t);
5213
5227
  }
5214
- set(t, n, e) {
5228
+ set(t, e, n) {
5215
5229
  this._verifyNotCommitted();
5216
- const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
5217
- return this._mutations.push(i.toMutation(r._key, En.none())), this;
5230
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5231
+ return this._mutations.push(i.toMutation(r._key, ve.none())), this;
5218
5232
  }
5219
- update(t, n, e, ...r) {
5233
+ update(t, e, n, ...r) {
5220
5234
  this._verifyNotCommitted();
5221
- const s = Fr(t, this._firestore);
5235
+ const s = Sr(t, this._firestore);
5222
5236
  // For Compat types, we have to "extract" the underlying types before
5223
5237
  // performing validation.
5224
5238
  let i;
5225
- return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Ce(this._dataReader, "WriteBatch.update", s._key, n),
5226
- this._mutations.push(i.toMutation(s._key, En.exists(!0))), this;
5239
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
5240
+ this._mutations.push(i.toMutation(s._key, ve.exists(!0))), this;
5227
5241
  }
5228
5242
  /**
5229
5243
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5232,8 +5246,8 @@ function Ir(t, n, e, ...r) {
5232
5246
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5233
5247
  */ delete(t) {
5234
5248
  this._verifyNotCommitted();
5235
- const n = Fr(t, this._firestore);
5236
- return this._mutations = this._mutations.concat(new Rn(n._key, En.none())), this;
5249
+ const e = Sr(t, this._firestore);
5250
+ return this._mutations = this._mutations.concat(new Ae(e._key, ve.none())), this;
5237
5251
  }
5238
5252
  /**
5239
5253
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5254,8 +5268,8 @@ function Ir(t, n, e, ...r) {
5254
5268
  }
5255
5269
  }
5256
5270
 
5257
- function Fr(t, n) {
5258
- if ((t = getModularInstance(t)).firestore !== n) throw new U(A, "Provided document reference is from a different Firestore instance.");
5271
+ function Sr(t, e) {
5272
+ if ((t = getModularInstance(t)).firestore !== e) throw new U(A, "Provided document reference is from a different Firestore instance.");
5259
5273
  return t;
5260
5274
  }
5261
5275
 
@@ -5271,9 +5285,9 @@ function Fr(t, n) {
5271
5285
  *
5272
5286
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5273
5287
  * writes.
5274
- */ function xr(t) {
5275
- const n = re(t = ot(t, ie));
5276
- return new Sr(t, (t => Zn(n, t)));
5288
+ */ function Fr(t) {
5289
+ const e = en(t = ot(t, rn));
5290
+ return new $r(t, (t => Je(e, t)));
5277
5291
  }
5278
5292
 
5279
5293
  /**
@@ -5295,7 +5309,7 @@ function Fr(t, n) {
5295
5309
  /**
5296
5310
  * Internal transaction object responsible for accumulating the mutations to
5297
5311
  * perform and the base versions for any documents read.
5298
- */ class qr {
5312
+ */ class xr {
5299
5313
  constructor(t) {
5300
5314
  this.datastore = t,
5301
5315
  // The version of each document that was read during this transaction.
@@ -5315,66 +5329,66 @@ function Fr(t, n) {
5315
5329
  }
5316
5330
  async lookup(t) {
5317
5331
  if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
5318
- const n = await te(this.datastore, t);
5319
- return n.forEach((t => this.recordVersion(t))), n;
5332
+ const e = await Xe(this.datastore, t);
5333
+ return e.forEach((t => this.recordVersion(t))), e;
5320
5334
  }
5321
- set(t, n) {
5322
- this.write(n.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5335
+ set(t, e) {
5336
+ this.write(e.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5323
5337
  }
5324
- update(t, n) {
5338
+ update(t, e) {
5325
5339
  try {
5326
- this.write(n.toMutation(t, this.preconditionForUpdate(t)));
5340
+ this.write(e.toMutation(t, this.preconditionForUpdate(t)));
5327
5341
  } catch (t) {
5328
5342
  this.lastWriteError = t;
5329
5343
  }
5330
5344
  this.writtenDocs.add(t.toString());
5331
5345
  }
5332
5346
  delete(t) {
5333
- this.write(new Rn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5347
+ this.write(new Ae(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5334
5348
  }
5335
5349
  async commit() {
5336
5350
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
5337
5351
  const t = this.readVersions;
5338
5352
  // For each mutation, note that the doc was written.
5339
- this.mutations.forEach((n => {
5340
- t.delete(n.key.toString());
5353
+ this.mutations.forEach((e => {
5354
+ t.delete(e.key.toString());
5341
5355
  })),
5342
5356
  // For each document that was read but not written to, we want to perform
5343
5357
  // a `verify` operation.
5344
- t.forEach(((t, n) => {
5345
- const e = nt.fromPath(n);
5346
- this.mutations.push(new Pn(e, this.precondition(e)));
5347
- })), await Zn(this.datastore, this.mutations), this.committed = !0;
5358
+ t.forEach(((t, e) => {
5359
+ const n = et.fromPath(e);
5360
+ this.mutations.push(new Re(n, this.precondition(n)));
5361
+ })), await Je(this.datastore, this.mutations), this.committed = !0;
5348
5362
  }
5349
5363
  recordVersion(t) {
5350
- let n;
5351
- if (t.isFoundDocument()) n = t.version; else {
5364
+ let e;
5365
+ if (t.isFoundDocument()) e = t.version; else {
5352
5366
  if (!t.isNoDocument()) throw g();
5353
5367
  // For deleted docs, we must use baseVersion 0 when we overwrite them.
5354
- n = vt.min();
5368
+ e = bt.min();
5355
5369
  }
5356
- const e = this.readVersions.get(t.key.toString());
5357
- if (e) {
5358
- if (!n.isEqual(e))
5370
+ const n = this.readVersions.get(t.key.toString());
5371
+ if (n) {
5372
+ if (!e.isEqual(n))
5359
5373
  // This transaction will fail no matter what.
5360
5374
  throw new U(F, "Document version changed between two reads.");
5361
- } else this.readVersions.set(t.key.toString(), n);
5375
+ } else this.readVersions.set(t.key.toString(), e);
5362
5376
  }
5363
5377
  /**
5364
5378
  * Returns the version of this document when it was read in this transaction,
5365
5379
  * as a precondition, or no precondition if it was not read.
5366
5380
  */ precondition(t) {
5367
- const n = this.readVersions.get(t.toString());
5368
- return !this.writtenDocs.has(t.toString()) && n ? En.updateTime(n) : En.none();
5381
+ const e = this.readVersions.get(t.toString());
5382
+ return !this.writtenDocs.has(t.toString()) && e ? ve.updateTime(e) : ve.none();
5369
5383
  }
5370
5384
  /**
5371
5385
  * Returns the precondition for a document if the operation is an update.
5372
5386
  */ preconditionForUpdate(t) {
5373
- const n = this.readVersions.get(t.toString());
5387
+ const e = this.readVersions.get(t.toString());
5374
5388
  // The first time a document is written, we want to take into account the
5375
5389
  // read time and existence
5376
- if (!this.writtenDocs.has(t.toString()) && n) {
5377
- if (n.isEqual(vt.min()))
5390
+ if (!this.writtenDocs.has(t.toString()) && e) {
5391
+ if (e.isEqual(bt.min()))
5378
5392
  // The document doesn't exist, so fail the transaction.
5379
5393
  // This has to be validated locally because you can't send a
5380
5394
  // precondition that a document does not exist without changing the
@@ -5386,11 +5400,11 @@ function Fr(t, n) {
5386
5400
  // transaction.
5387
5401
  throw new U(A, "Can't update a document that doesn't exist.");
5388
5402
  // Document exists, base precondition on document update time.
5389
- return En.updateTime(n);
5403
+ return ve.updateTime(e);
5390
5404
  }
5391
5405
  // Document was not read, so we just use the preconditions for a blind
5392
5406
  // update.
5393
- return En.exists(!0);
5407
+ return ve.exists(!0);
5394
5408
  }
5395
5409
  write(t) {
5396
5410
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5418,20 +5432,20 @@ function Fr(t, n) {
5418
5432
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5419
5433
  * with backoff.
5420
5434
  */
5421
- class Or {
5422
- constructor(t, n, e, r) {
5423
- this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
5424
- this.Tt = 5, this.It = new Jn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5435
+ class qr {
5436
+ constructor(t, e, n, r) {
5437
+ this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
5438
+ this.Tt = 5, this.It = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5425
5439
  }
5426
5440
  /** Runs the transaction and sets the result on deferred. */ run() {
5427
5441
  this.Tt -= 1, this.At();
5428
5442
  }
5429
5443
  At() {
5430
5444
  this.It.W((async () => {
5431
- const t = new qr(this.datastore), n = this.Rt(t);
5432
- n && n.then((n => {
5445
+ const t = new xr(this.datastore), e = this.Rt(t);
5446
+ e && e.then((e => {
5433
5447
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5434
- this.deferred.resolve(n);
5448
+ this.deferred.resolve(e);
5435
5449
  })).catch((t => {
5436
5450
  this.Pt(t);
5437
5451
  }))));
@@ -5442,8 +5456,8 @@ class Or {
5442
5456
  }
5443
5457
  Rt(t) {
5444
5458
  try {
5445
- const n = this.updateFunction(t);
5446
- return !ct(n) && n.catch && n.then ? n : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5459
+ const e = this.updateFunction(t);
5460
+ return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5447
5461
  null);
5448
5462
  } catch (t) {
5449
5463
  // Do not retry errors thrown by user provided updateFunction.
@@ -5458,8 +5472,8 @@ class Or {
5458
5472
  if ("FirebaseError" === t.name) {
5459
5473
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
5460
5474
  // non-matching document versions with ABORTED. These errors should be retried.
5461
- const n = t.code;
5462
- return "aborted" === n || "failed-precondition" === n || !
5475
+ const e = t.code;
5476
+ return "aborted" === e || "failed-precondition" === e || !
5463
5477
  /**
5464
5478
  * Determines whether an error code represents a permanent error when received
5465
5479
  * in response to a non-write operation.
@@ -5496,7 +5510,7 @@ class Or {
5496
5510
  case L:
5497
5511
  return !0;
5498
5512
  }
5499
- }(n);
5513
+ }(e);
5500
5514
  }
5501
5515
  return !1;
5502
5516
  }
@@ -5518,7 +5532,7 @@ class Or {
5518
5532
  * See the License for the specific language governing permissions and
5519
5533
  * limitations under the License.
5520
5534
  */
5521
- /** The Platform's 'document' implementation or null if not available. */ function Cr() {
5535
+ /** The Platform's 'document' implementation or null if not available. */ function Or() {
5522
5536
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5523
5537
  // eslint-disable-next-line no-restricted-globals
5524
5538
  return "undefined" != typeof document ? document : null;
@@ -5550,9 +5564,9 @@ class Or {
5550
5564
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5551
5565
  * in newer versions of TypeScript defines `finally`, which is not available in
5552
5566
  * IE.
5553
- */ class Lr {
5554
- constructor(t, n, e, r, s) {
5555
- this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
5567
+ */ class Cr {
5568
+ constructor(t, e, n, r, s) {
5569
+ this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
5556
5570
  this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5557
5571
  // It's normal for the deferred promise to be canceled (due to cancellation)
5558
5572
  // and so we attach a dummy catch callback to avoid
@@ -5572,9 +5586,9 @@ class Or {
5572
5586
  * from its delayedOperations list.
5573
5587
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
5574
5588
  * the DelayedOperation class public.
5575
- */ static createAndSchedule(t, n, e, r, s) {
5576
- const i = Date.now() + e, o = new Lr(t, n, i, r, s);
5577
- return o.start(e), o;
5589
+ */ static createAndSchedule(t, e, n, r, s) {
5590
+ const i = Date.now() + n, o = new Cr(t, e, i, r, s);
5591
+ return o.start(n), o;
5578
5592
  }
5579
5593
  /**
5580
5594
  * Starts the timer. This is called immediately after construction by
@@ -5622,7 +5636,7 @@ class Or {
5622
5636
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5623
5637
  * See the License for the specific language governing permissions and
5624
5638
  * limitations under the License.
5625
- */ class Ur {
5639
+ */ class Lr {
5626
5640
  constructor() {
5627
5641
  // The last promise in the queue.
5628
5642
  this.Dt = Promise.resolve(),
@@ -5645,15 +5659,15 @@ class Or {
5645
5659
  // List of TimerIds to fast-forward delays for.
5646
5660
  this.Ot = [],
5647
5661
  // Backoff timer used to schedule retries for retryable operations
5648
- this.It = new Jn(this, "async_queue_retry" /* AsyncQueueRetry */),
5662
+ this.It = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
5649
5663
  // Visibility handler that triggers an immediate retry of all retryable
5650
5664
  // operations. Meant to speed up recovery when we regain file system access
5651
5665
  // after page comes into foreground.
5652
5666
  this.Ct = () => {
5653
- const t = Cr();
5667
+ const t = Or();
5654
5668
  t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
5655
5669
  };
5656
- const t = Cr();
5670
+ const t = Or();
5657
5671
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
5658
5672
  }
5659
5673
  get isShuttingDown() {
@@ -5674,8 +5688,8 @@ class Or {
5674
5688
  enterRestrictedMode(t) {
5675
5689
  if (!this.$t) {
5676
5690
  this.$t = !0, this.qt = t || !1;
5677
- const n = Cr();
5678
- n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
5691
+ const e = Or();
5692
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
5679
5693
  }
5680
5694
  }
5681
5695
  enqueue(t) {
@@ -5685,9 +5699,9 @@ class Or {
5685
5699
  // Create a deferred Promise that we can return to the callee. This
5686
5700
  // allows us to return a "hanging Promise" only to the callee and still
5687
5701
  // advance the queue even when the operation is not run.
5688
- const n = new k;
5689
- return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(n.resolve, n.reject),
5690
- n.promise))).then((() => n.promise));
5702
+ const e = new k;
5703
+ return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
5704
+ e.promise))).then((() => e.promise));
5691
5705
  }
5692
5706
  enqueueRetryable(t) {
5693
5707
  this.enqueueAndForget((() => (this.Nt.push(t), this.kt())));
@@ -5757,18 +5771,18 @@ class Or {
5757
5771
  }
5758
5772
  }
5759
5773
  Ut(t) {
5760
- const n = this.Dt.then((() => (this.xt = !0, t().catch((t => {
5774
+ const e = this.Dt.then((() => (this.xt = !0, t().catch((t => {
5761
5775
  this.Ft = t, this.xt = !1;
5762
- const n =
5776
+ const e =
5763
5777
  /**
5764
5778
  * Chrome includes Error.message in Error.stack. Other browsers do not.
5765
5779
  * This returns expected output of message + stack when available.
5766
5780
  * @param error - Error or FirestoreError
5767
5781
  */
5768
5782
  function(t) {
5769
- let n = t.message || "";
5770
- t.stack && (n = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5771
- return n;
5783
+ let e = t.message || "";
5784
+ t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5785
+ return e;
5772
5786
  }
5773
5787
  /**
5774
5788
  * @license
@@ -5798,15 +5812,15 @@ class Or {
5798
5812
  // Re-throw the error so that this.tail becomes a rejected Promise and
5799
5813
  // all further attempts to chain (via .then) will just short-circuit
5800
5814
  // and return the rejected Promise.
5801
- throw p("INTERNAL UNHANDLED ERROR: ", n), t;
5815
+ throw p("INTERNAL UNHANDLED ERROR: ", e), t;
5802
5816
  })).then((t => (this.xt = !1, t))))));
5803
- return this.Dt = n, n;
5817
+ return this.Dt = e, e;
5804
5818
  }
5805
- enqueueAfterDelay(t, n, e) {
5819
+ enqueueAfterDelay(t, e, n) {
5806
5820
  this.Lt(),
5807
5821
  // Fast-forward delays for timerIds that have been overriden.
5808
- this.Ot.indexOf(t) > -1 && (n = 0);
5809
- const r = Lr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
5822
+ this.Ot.indexOf(t) > -1 && (e = 0);
5823
+ const r = Cr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5810
5824
  return this.St.push(r), r;
5811
5825
  }
5812
5826
  Lt() {
@@ -5830,7 +5844,7 @@ class Or {
5830
5844
  * For Tests: Determine if a delayed operation with a particular TimerId
5831
5845
  * exists.
5832
5846
  */ Bt(t) {
5833
- for (const n of this.St) if (n.timerId === t) return !0;
5847
+ for (const e of this.St) if (e.timerId === t) return !0;
5834
5848
  return !1;
5835
5849
  }
5836
5850
  /**
@@ -5843,8 +5857,8 @@ class Or {
5843
5857
  // Note that draining may generate more delayed ops, so we do that first.
5844
5858
  return this.Mt().then((() => {
5845
5859
  // Run ops in the same order they'd run if they ran naturally.
5846
- this.St.sort(((t, n) => t.targetTimeMs - n.targetTimeMs));
5847
- for (const n of this.St) if (n.skipDelay(), "all" /* All */ !== t && n.timerId === t) break;
5860
+ this.St.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
5861
+ for (const e of this.St) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
5848
5862
  return this.Mt();
5849
5863
  }));
5850
5864
  }
@@ -5855,15 +5869,15 @@ class Or {
5855
5869
  }
5856
5870
  /** Called once a DelayedOperation is run or canceled. */ jt(t) {
5857
5871
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5858
- const n = this.St.indexOf(t);
5859
- this.St.splice(n, 1);
5872
+ const e = this.St.indexOf(t);
5873
+ this.St.splice(e, 1);
5860
5874
  }
5861
5875
  }
5862
5876
 
5863
- class kr {
5877
+ class Ur {
5864
5878
  /** @hideconstructor */
5865
- constructor(t, n) {
5866
- this._firestore = t, this._transaction = n, this._dataReader = De(t);
5879
+ constructor(t, e) {
5880
+ this._firestore = t, this._transaction = e, this._dataReader = Vn(t);
5867
5881
  }
5868
5882
  /**
5869
5883
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -5871,25 +5885,25 @@ class kr {
5871
5885
  * @param documentRef - A reference to the document to be read.
5872
5886
  * @returns A `DocumentSnapshot` with the read data.
5873
5887
  */ get(t) {
5874
- const n = Fr(t, this._firestore), e = new vr(this._firestore);
5875
- return this._transaction.lookup([ n._key ]).then((t => {
5888
+ const e = Sr(t, this._firestore), n = new gr(this._firestore);
5889
+ return this._transaction.lookup([ e._key ]).then((t => {
5876
5890
  if (!t || 1 !== t.length) return g();
5877
5891
  const r = t[0];
5878
- if (r.isFoundDocument()) return new He(this._firestore, e, r.key, r, n.converter);
5879
- if (r.isNoDocument()) return new He(this._firestore, e, n._key, null, n.converter);
5892
+ if (r.isFoundDocument()) return new Yn(this._firestore, n, r.key, r, e.converter);
5893
+ if (r.isNoDocument()) return new Yn(this._firestore, n, e._key, null, e.converter);
5880
5894
  throw g();
5881
5895
  }));
5882
5896
  }
5883
- set(t, n, e) {
5884
- const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
5897
+ set(t, e, n) {
5898
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5885
5899
  return this._transaction.set(r._key, i), this;
5886
5900
  }
5887
- update(t, n, e, ...r) {
5888
- const s = Fr(t, this._firestore);
5901
+ update(t, e, n, ...r) {
5902
+ const s = Sr(t, this._firestore);
5889
5903
  // For Compat types, we have to "extract" the underlying types before
5890
5904
  // performing validation.
5891
5905
  let i;
5892
- return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "Transaction.update", s._key, n, e, r) : Ce(this._dataReader, "Transaction.update", s._key, n),
5906
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "Transaction.update", s._key, e, n, r) : On(this._dataReader, "Transaction.update", s._key, e),
5893
5907
  this._transaction.update(s._key, i), this;
5894
5908
  }
5895
5909
  /**
@@ -5898,8 +5912,8 @@ class kr {
5898
5912
  * @param documentRef - A reference to the document to be deleted.
5899
5913
  * @returns This `Transaction` instance. Used for chaining method calls.
5900
5914
  */ delete(t) {
5901
- const n = Fr(t, this._firestore);
5902
- return this._transaction.delete(n._key), this;
5915
+ const e = Sr(t, this._firestore);
5916
+ return this._transaction.delete(e._key), this;
5903
5917
  }
5904
5918
  }
5905
5919
 
@@ -5919,9 +5933,9 @@ class kr {
5919
5933
  * (the `updateFunction` returned a failed promise), the promise returned by the
5920
5934
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5921
5935
  * rejected promise with the corresponding failure error is returned.
5922
- */ function jr(t, n) {
5923
- const e = re(t = ot(t, ie)), r = new k;
5924
- return new Or(new Ur, e, (e => n(new kr(t, e))), r).run(), r.promise;
5936
+ */ function kr(t, e) {
5937
+ const n = en(t = ot(t, rn)), r = new k;
5938
+ return new qr(new Lr, n, (n => e(new Ur(t, n))), r).run(), r.promise;
5925
5939
  }
5926
5940
 
5927
5941
  /**
@@ -5933,12 +5947,12 @@ class kr {
5933
5947
  * @packageDocumentation
5934
5948
  */ !function(t) {
5935
5949
  f = t;
5936
- }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: n}) => {
5937
- const e = t.getProvider("app").getImmediate(), r = new ie(e, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
5938
- return n && r._setSettings(n), r;
5950
+ }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
5951
+ const n = t.getProvider("app").getImmediate(), r = new rn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
5952
+ return e && r._setSettings(e), r;
5939
5953
  }), "PUBLIC")),
5940
5954
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5941
- registerVersion("firestore-lite", "3.4.4-canary.222f264ff", ""), registerVersion("firestore-lite", "3.4.4-canary.222f264ff", "esm2017");
5955
+ registerVersion("firestore-lite", "3.4.4-canary.6c8eabfc5", ""), registerVersion("firestore-lite", "3.4.4-canary.6c8eabfc5", "esm2017");
5942
5956
 
5943
- export { ve as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, be as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, gt as Timestamp, kr as Transaction, Sr as WriteBatch, Rr as addDoc, Nr as arrayRemove, Dr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, br as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, w as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
5957
+ export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, bn as FieldValue, rn as Firestore, U as FirestoreError, vn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, br as getDoc, vr as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, Fr as writeBatch };
5944
5958
  //# sourceMappingURL=index.browser.esm2017.js.map