@firebase/firestore 3.4.9 → 3.4.10-canary.8e952e2ee

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 (147) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/firestore/src/api/transaction.d.ts +2 -0
  3. package/dist/firestore/src/core/component_provider.d.ts +11 -6
  4. package/dist/firestore/src/lite-api/transaction.d.ts +2 -0
  5. package/dist/firestore/src/local/document_overlay_cache.d.ts +5 -0
  6. package/dist/firestore/src/local/index_backfiller.d.ts +44 -0
  7. package/dist/firestore/src/local/index_manager.d.ts +2 -0
  8. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  9. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +1 -0
  10. package/dist/firestore/src/local/indexeddb_schema.d.ts +3 -2
  11. package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  12. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  13. package/dist/firestore/src/local/local_documents_view.d.ts +64 -9
  14. package/dist/firestore/src/local/local_store.d.ts +9 -0
  15. package/dist/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
  16. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  17. package/dist/firestore/src/local/memory_index_manager.d.ts +1 -0
  18. package/dist/firestore/src/local/overlayed_document.d.ts +36 -0
  19. package/dist/firestore/src/local/persistence.d.ts +3 -5
  20. package/dist/firestore/src/local/persistence_promise.d.ts +11 -0
  21. package/dist/firestore/src/local/query_engine.d.ts +1 -1
  22. package/dist/firestore/src/model/collections.d.ts +8 -2
  23. package/dist/firestore/src/model/field_mask.d.ts +6 -0
  24. package/dist/firestore/src/model/mutation.d.ts +19 -1
  25. package/dist/firestore/src/model/mutation_batch.d.ts +8 -4
  26. package/dist/firestore/src/tsdoc-metadata.json +11 -11
  27. package/dist/firestore/src/util/async_queue.d.ts +5 -1
  28. package/dist/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
  29. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  30. package/dist/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
  31. package/dist/firestore/test/util/helpers.d.ts +13 -0
  32. package/dist/index.d.ts +4 -2
  33. package/dist/index.esm2017.js +10698 -10303
  34. package/dist/index.esm2017.js.map +1 -1
  35. package/dist/index.esm5.js +10986 -10471
  36. package/dist/index.esm5.js.map +1 -1
  37. package/dist/index.node.cjs.js +6349 -5731
  38. package/dist/index.node.cjs.js.map +1 -1
  39. package/dist/index.node.mjs +6349 -5731
  40. package/dist/index.node.mjs.map +1 -1
  41. package/dist/index.rn.js +10687 -10291
  42. package/dist/index.rn.js.map +1 -1
  43. package/dist/internal.d.ts +6137 -5964
  44. package/dist/lite/firestore/src/api/transaction.d.ts +2 -0
  45. package/dist/lite/firestore/src/core/component_provider.d.ts +11 -6
  46. package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -0
  47. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +5 -0
  48. package/dist/lite/firestore/src/local/index_backfiller.d.ts +44 -0
  49. package/dist/lite/firestore/src/local/index_manager.d.ts +2 -0
  50. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  51. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +1 -0
  52. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +3 -2
  53. package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  54. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  55. package/dist/lite/firestore/src/local/local_documents_view.d.ts +64 -9
  56. package/dist/lite/firestore/src/local/local_store.d.ts +9 -0
  57. package/dist/lite/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
  58. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  59. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -0
  60. package/dist/lite/firestore/src/local/overlayed_document.d.ts +36 -0
  61. package/dist/lite/firestore/src/local/persistence.d.ts +3 -5
  62. package/dist/lite/firestore/src/local/persistence_promise.d.ts +11 -0
  63. package/dist/lite/firestore/src/local/query_engine.d.ts +1 -1
  64. package/dist/lite/firestore/src/model/collections.d.ts +8 -2
  65. package/dist/lite/firestore/src/model/field_mask.d.ts +6 -0
  66. package/dist/lite/firestore/src/model/mutation.d.ts +19 -1
  67. package/dist/lite/firestore/src/model/mutation_batch.d.ts +8 -4
  68. package/dist/lite/firestore/src/util/async_queue.d.ts +5 -1
  69. package/dist/lite/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
  70. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  71. package/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
  72. package/dist/lite/firestore/test/util/helpers.d.ts +13 -0
  73. package/dist/lite/index.browser.esm2017.js +1220 -738
  74. package/dist/lite/index.browser.esm2017.js.map +1 -1
  75. package/dist/lite/index.browser.esm5.js +1156 -764
  76. package/dist/lite/index.browser.esm5.js.map +1 -1
  77. package/dist/lite/index.d.ts +2 -0
  78. package/dist/lite/index.node.cjs.js +655 -2
  79. package/dist/lite/index.node.cjs.js.map +1 -1
  80. package/dist/lite/index.node.mjs +655 -2
  81. package/dist/lite/index.node.mjs.map +1 -1
  82. package/dist/lite/index.rn.esm2017.js +1184 -702
  83. package/dist/lite/index.rn.esm2017.js.map +1 -1
  84. package/dist/lite/internal.d.ts +2916 -2898
  85. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +106 -104
  86. package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -0
  87. package/dist/lite/packages/firestore/src/core/component_provider.d.ts +11 -6
  88. package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -0
  89. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
  90. package/dist/lite/packages/firestore/src/local/index_backfiller.d.ts +44 -0
  91. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -0
  92. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  93. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +1 -0
  94. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +3 -2
  95. package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  96. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  97. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +64 -9
  98. package/dist/lite/packages/firestore/src/local/local_store.d.ts +9 -0
  99. package/dist/lite/packages/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
  100. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  101. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -0
  102. package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +36 -0
  103. package/dist/lite/packages/firestore/src/local/persistence.d.ts +3 -5
  104. package/dist/lite/packages/firestore/src/local/persistence_promise.d.ts +11 -0
  105. package/dist/lite/packages/firestore/src/local/query_engine.d.ts +1 -1
  106. package/dist/lite/packages/firestore/src/model/collections.d.ts +8 -2
  107. package/dist/lite/packages/firestore/src/model/field_mask.d.ts +6 -0
  108. package/dist/lite/packages/firestore/src/model/mutation.d.ts +19 -1
  109. package/dist/lite/packages/firestore/src/model/mutation_batch.d.ts +8 -4
  110. package/dist/lite/packages/firestore/src/util/async_queue.d.ts +5 -1
  111. package/dist/lite/packages/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
  112. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  113. package/dist/lite/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
  114. package/dist/lite/packages/firestore/test/util/helpers.d.ts +13 -0
  115. package/dist/lite/private.d.ts +2776 -2758
  116. package/dist/packages/firestore/dist/index.esm2017.d.ts +203 -201
  117. package/dist/packages/firestore/src/api/transaction.d.ts +2 -0
  118. package/dist/packages/firestore/src/core/component_provider.d.ts +11 -6
  119. package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -0
  120. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
  121. package/dist/packages/firestore/src/local/index_backfiller.d.ts +44 -0
  122. package/dist/packages/firestore/src/local/index_manager.d.ts +2 -0
  123. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
  124. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +1 -0
  125. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +3 -2
  126. package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
  127. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
  128. package/dist/packages/firestore/src/local/local_documents_view.d.ts +64 -9
  129. package/dist/packages/firestore/src/local/local_store.d.ts +9 -0
  130. package/dist/packages/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
  131. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
  132. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -0
  133. package/dist/packages/firestore/src/local/overlayed_document.d.ts +36 -0
  134. package/dist/packages/firestore/src/local/persistence.d.ts +3 -5
  135. package/dist/packages/firestore/src/local/persistence_promise.d.ts +11 -0
  136. package/dist/packages/firestore/src/local/query_engine.d.ts +1 -1
  137. package/dist/packages/firestore/src/model/collections.d.ts +8 -2
  138. package/dist/packages/firestore/src/model/field_mask.d.ts +6 -0
  139. package/dist/packages/firestore/src/model/mutation.d.ts +19 -1
  140. package/dist/packages/firestore/src/model/mutation_batch.d.ts +8 -4
  141. package/dist/packages/firestore/src/util/async_queue.d.ts +5 -1
  142. package/dist/packages/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
  143. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
  144. package/dist/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
  145. package/dist/packages/firestore/test/util/helpers.d.ts +13 -0
  146. package/dist/private.d.ts +5845 -5672
  147. package/package.json +19 -17
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let d = "9.8.0";
69
+ let d = "9.8.3-canary.8e952e2ee";
70
70
 
71
71
  /**
72
72
  * @license
@@ -221,9 +221,9 @@ e) {
221
221
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
222
222
  * See the License for the specific language governing permissions and
223
223
  * limitations under the License.
224
- */ const T = "ok", A = "cancelled", I = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", D = "permission-denied", $ = "unauthenticated", S = "resource-exhausted", x = "failed-precondition", F = "aborted", q = "out-of-range", O = "unimplemented", C = "internal", L = "unavailable", k = "data-loss";
224
+ */ const T = "ok", I = "cancelled", A = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", $ = "permission-denied", D = "unauthenticated", x = "resource-exhausted", S = "failed-precondition", F = "aborted", q = "out-of-range", O = "unimplemented", k = "internal", C = "unavailable", L = "data-loss";
225
225
 
226
- /** An error returned by a Firestore operation. */ class U extends c {
226
+ /** An error returned by a Firestore operation. */ class M extends c {
227
227
  /** @hideconstructor */
228
228
  constructor(
229
229
  /**
@@ -257,7 +257,7 @@ e) {
257
257
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258
258
  * See the License for the specific language governing permissions and
259
259
  * limitations under the License.
260
- */ class j {
260
+ */ class U {
261
261
  constructor() {
262
262
  this.promise = new Promise(((t, e) => {
263
263
  this.resolve = t, this.reject = e;
@@ -280,7 +280,7 @@ e) {
280
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
- */ class M {
283
+ */ class j {
284
284
  constructor(t, e) {
285
285
  this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
286
286
  }
@@ -328,7 +328,7 @@ e) {
328
328
  }
329
329
  }
330
330
 
331
- /** Credential provider for the Lite SDK. */ class G {
331
+ /** Credential provider for the Lite SDK. */ class W {
332
332
  constructor(t) {
333
333
  this.auth = null, t.onInit((t => {
334
334
  this.auth = t;
@@ -336,7 +336,7 @@ e) {
336
336
  }
337
337
  getToken() {
338
338
  return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
339
- new M(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
339
+ new j(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
340
340
  }
341
341
  invalidateToken() {}
342
342
  start(t, e) {}
@@ -349,7 +349,7 @@ e) {
349
349
  * Technically this may no longer be necessary since the SDK should gracefully
350
350
  * recover from unauthenticated errors (see b/33147818 for context), but it's
351
351
  * safer to keep the implementation as-is.
352
- */ class Q {
352
+ */ class G {
353
353
  constructor(t, e, n) {
354
354
  this.type = "FirstParty", this.user = f.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
355
355
  const r = t.auth.getAuthHeaderValueForFirstParty([]);
@@ -361,12 +361,12 @@ e) {
361
361
  * Provides user credentials required for the Firestore JavaScript SDK
362
362
  * to authenticate the user, using technique that is only available
363
363
  * to applications hosted by Google.
364
- */ class W {
364
+ */ class K {
365
365
  constructor(t, e, n) {
366
366
  this.t = t, this.i = e, this.o = n;
367
367
  }
368
368
  getToken() {
369
- return Promise.resolve(new Q(this.t, this.i, this.o));
369
+ return Promise.resolve(new G(this.t, this.i, this.o));
370
370
  }
371
371
  start(t, e) {
372
372
  // Fire with initial uid.
@@ -376,13 +376,13 @@ e) {
376
376
  invalidateToken() {}
377
377
  }
378
378
 
379
- class Y {
379
+ class Q {
380
380
  constructor(t) {
381
381
  this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
382
382
  }
383
383
  }
384
384
 
385
- /** AppCheck token provider for the Lite SDK. */ class H {
385
+ /** AppCheck token provider for the Lite SDK. */ class Y {
386
386
  constructor(t) {
387
387
  this.u = t, this.appCheck = null, t.onInit((t => {
388
388
  this.appCheck = t;
@@ -390,7 +390,7 @@ class Y {
390
390
  }
391
391
  getToken() {
392
392
  return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
393
- new Y(t.token)) : null)) : Promise.resolve(null);
393
+ new Q(t.token)) : null)) : Promise.resolve(null);
394
394
  }
395
395
  invalidateToken() {}
396
396
  start(t, e) {}
@@ -417,7 +417,7 @@ class Y {
417
417
  * See the License for the specific language governing permissions and
418
418
  * limitations under the License.
419
419
  */
420
- class K {
420
+ class H {
421
421
  /**
422
422
  * Constructs a DatabaseInfo using the provided host, databaseId and
423
423
  * persistenceKey.
@@ -573,7 +573,7 @@ class X {
573
573
  // for legacy reasons and should not be used frequently).
574
574
  const e = [];
575
575
  for (const n of t) {
576
- if (n.indexOf("//") >= 0) throw new U(R, `Invalid segment (${n}). Paths must not contain // in them.`);
576
+ if (n.indexOf("//") >= 0) throw new M(R, `Invalid segment (${n}). Paths must not contain // in them.`);
577
577
  // Strip leading and traling slashed.
578
578
  e.push(...n.split("/").filter((t => t.length > 0)));
579
579
  }
@@ -629,20 +629,20 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
629
629
  const e = [];
630
630
  let n = "", r = 0;
631
631
  const s = () => {
632
- if (0 === n.length) throw new U(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
632
+ if (0 === n.length) throw new M(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
633
633
  e.push(n), n = "";
634
634
  };
635
635
  let i = !1;
636
636
  for (;r < t.length; ) {
637
637
  const e = t[r];
638
638
  if ("\\" === e) {
639
- if (r + 1 === t.length) throw new U(R, "Path has trailing escape character: " + t);
639
+ if (r + 1 === t.length) throw new M(R, "Path has trailing escape character: " + t);
640
640
  const e = t[r + 1];
641
- if ("\\" !== e && "." !== e && "`" !== e) throw new U(R, "Path has invalid escape sequence: " + t);
641
+ if ("\\" !== e && "." !== e && "`" !== e) throw new M(R, "Path has invalid escape sequence: " + t);
642
642
  n += e, r += 2;
643
643
  } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
644
644
  }
645
- if (s(), i) throw new U(R, "Unterminated ` in path: " + t);
645
+ if (s(), i) throw new M(R, "Unterminated ` in path: " + t);
646
646
  return new et(e);
647
647
  }
648
648
  static emptyPath() {
@@ -731,7 +731,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
731
731
  * See the License for the specific language governing permissions and
732
732
  * limitations under the License.
733
733
  */ function rt(t, e, n) {
734
- if (!n) throw new U(R, `Function ${t}() cannot be called with an empty ${e}.`);
734
+ if (!n) throw new M(R, `Function ${t}() cannot be called with an empty ${e}.`);
735
735
  }
736
736
 
737
737
  /**
@@ -743,14 +743,14 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
743
743
  * an even numbers of segments).
744
744
  */
745
745
  function st(t) {
746
- if (!nt.isDocumentKey(t)) throw new U(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
746
+ if (!nt.isDocumentKey(t)) throw new M(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
747
747
  }
748
748
 
749
749
  /**
750
750
  * Validates that `path` refers to a collection (indicated by the fact it
751
751
  * contains an odd numbers of segments).
752
752
  */ function it(t) {
753
- if (nt.isDocumentKey(t)) throw new U(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
753
+ if (nt.isDocumentKey(t)) throw new M(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
754
754
  }
755
755
 
756
756
  /**
@@ -794,17 +794,17 @@ e) {
794
794
  // Unwrap Compat types
795
795
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
796
796
  t = t._delegate), !(t instanceof e)) {
797
- if (e.name === t.constructor.name) throw new U(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
797
+ if (e.name === t.constructor.name) throw new M(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
798
798
  {
799
799
  const n = ot(t);
800
- throw new U(R, `Expected type '${e.name}', but it was: ${n}`);
800
+ throw new M(R, `Expected type '${e.name}', but it was: ${n}`);
801
801
  }
802
802
  }
803
803
  return t;
804
804
  }
805
805
 
806
806
  function ct(t, e) {
807
- if (e <= 0) throw new U(R, `Function ${t}() requires a positive number, but it was: ${e}.`);
807
+ if (e <= 0) throw new M(R, `Function ${t}() requires a positive number, but it was: ${e}.`);
808
808
  }
809
809
 
810
810
  /**
@@ -902,7 +902,7 @@ var ft, dt;
902
902
  * Code.UNKNOWN.
903
903
  */
904
904
  function wt(t) {
905
- if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"), I;
905
+ if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"), A;
906
906
  // The canonical error codes for Google APIs [1] specify mapping onto HTTP
907
907
  // status codes but the mapping is not bijective. In each case of ambiguity
908
908
  // this function chooses a primary error.
@@ -916,18 +916,18 @@ function wt(t) {
916
916
 
917
917
  case 400:
918
918
  // Bad Request
919
- return x;
919
+ return S;
920
920
 
921
921
  // Other possibilities based on the forward mapping
922
922
  // return Code.INVALID_ARGUMENT;
923
923
  // return Code.OUT_OF_RANGE;
924
924
  case 401:
925
925
  // Unauthorized
926
- return $;
926
+ return D;
927
927
 
928
928
  case 403:
929
929
  // Forbidden
930
- return D;
930
+ return $;
931
931
 
932
932
  case 404:
933
933
  // Not Found
@@ -945,15 +945,15 @@ function wt(t) {
945
945
 
946
946
  case 429:
947
947
  // Too Many Requests
948
- return S;
948
+ return x;
949
949
 
950
950
  case 499:
951
951
  // Client Closed Request
952
- return A;
952
+ return I;
953
953
 
954
954
  case 500:
955
955
  // Internal Server Error
956
- return I;
956
+ return A;
957
957
 
958
958
  // Other possibilities:
959
959
  // return Code.INTERNAL;
@@ -964,14 +964,14 @@ function wt(t) {
964
964
 
965
965
  case 503:
966
966
  // Service Unavailable
967
- return L;
967
+ return C;
968
968
 
969
969
  case 504:
970
970
  // Gateway Timeout
971
971
  return P;
972
972
 
973
973
  default:
974
- return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? x : t >= 500 && t < 600 ? C : I;
974
+ return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? k : A;
975
975
  }
976
976
  }
977
977
 
@@ -1051,24 +1051,24 @@ class {
1051
1051
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
1052
1052
  */
1053
1053
  constructor(t, e) {
1054
- super(t), this.A = e;
1054
+ super(t), this.I = e;
1055
1055
  }
1056
- I(t, e) {
1056
+ A(t, e) {
1057
1057
  throw new Error("Not supported by FetchConnection");
1058
1058
  }
1059
1059
  async v(t, e, n, r) {
1060
1060
  const s = JSON.stringify(r);
1061
1061
  let i;
1062
1062
  try {
1063
- i = await this.A(e, {
1063
+ i = await this.I(e, {
1064
1064
  method: "POST",
1065
1065
  headers: n,
1066
1066
  body: s
1067
1067
  });
1068
1068
  } catch (t) {
1069
- throw new U(wt(t.status), "Request failed with error: " + t.statusText);
1069
+ throw new M(wt(t.status), "Request failed with error: " + t.statusText);
1070
1070
  }
1071
- if (!i.ok) throw new U(wt(i.status), "Request failed with error: " + i.statusText);
1071
+ if (!i.ok) throw new M(wt(i.status), "Request failed with error: " + i.statusText);
1072
1072
  return i.json();
1073
1073
  }
1074
1074
  }
@@ -1214,11 +1214,11 @@ class vt {
1214
1214
  * The fractions of a second at nanosecond resolution.*
1215
1215
  */
1216
1216
  e) {
1217
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(R, "Timestamp nanoseconds out of range: " + e);
1218
- if (e >= 1e9) throw new U(R, "Timestamp nanoseconds out of range: " + e);
1219
- if (t < -62135596800) throw new U(R, "Timestamp seconds out of range: " + t);
1217
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1218
+ if (e >= 1e9) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1219
+ if (t < -62135596800) throw new M(R, "Timestamp seconds out of range: " + t);
1220
1220
  // This will break in the year 10,000.
1221
- if (t >= 253402300800) throw new U(R, "Timestamp seconds out of range: " + t);
1221
+ if (t >= 253402300800) throw new M(R, "Timestamp seconds out of range: " + t);
1222
1222
  }
1223
1223
  /**
1224
1224
  * Creates a new timestamp with the current date, with millisecond precision.
@@ -1379,6 +1379,462 @@ function Tt(t, e) {
1379
1379
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1380
1380
  }
1381
1381
 
1382
+ /**
1383
+ * @license
1384
+ * Copyright 2017 Google LLC
1385
+ *
1386
+ * Licensed under the Apache License, Version 2.0 (the "License");
1387
+ * you may not use this file except in compliance with the License.
1388
+ * You may obtain a copy of the License at
1389
+ *
1390
+ * http://www.apache.org/licenses/LICENSE-2.0
1391
+ *
1392
+ * Unless required by applicable law or agreed to in writing, software
1393
+ * distributed under the License is distributed on an "AS IS" BASIS,
1394
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395
+ * See the License for the specific language governing permissions and
1396
+ * limitations under the License.
1397
+ */
1398
+ // An immutable sorted map implementation, based on a Left-leaning Red-Black
1399
+ // tree.
1400
+ class It {
1401
+ constructor(t, e) {
1402
+ this.comparator = t, this.root = e || Rt.EMPTY;
1403
+ }
1404
+ // Returns a copy of the map, with the specified key/value added or replaced.
1405
+ insert(t, e) {
1406
+ return new It(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, Rt.BLACK, null, null));
1407
+ }
1408
+ // Returns a copy of the map, with the specified key removed.
1409
+ remove(t) {
1410
+ return new It(this.comparator, this.root.remove(t, this.comparator).copy(null, null, Rt.BLACK, null, null));
1411
+ }
1412
+ // Returns the value of the node with the given key, or null.
1413
+ get(t) {
1414
+ let e = this.root;
1415
+ for (;!e.isEmpty(); ) {
1416
+ const n = this.comparator(t, e.key);
1417
+ if (0 === n) return e.value;
1418
+ n < 0 ? e = e.left : n > 0 && (e = e.right);
1419
+ }
1420
+ return null;
1421
+ }
1422
+ // Returns the index of the element in this sorted map, or -1 if it doesn't
1423
+ // exist.
1424
+ indexOf(t) {
1425
+ // Number of nodes that were pruned when descending right
1426
+ let e = 0, n = this.root;
1427
+ for (;!n.isEmpty(); ) {
1428
+ const r = this.comparator(t, n.key);
1429
+ if (0 === r) return e + n.left.size;
1430
+ r < 0 ? n = n.left : (
1431
+ // Count all nodes left of the node plus the node itself
1432
+ e += n.left.size + 1, n = n.right);
1433
+ }
1434
+ // Node not found
1435
+ return -1;
1436
+ }
1437
+ isEmpty() {
1438
+ return this.root.isEmpty();
1439
+ }
1440
+ // Returns the total number of nodes in the map.
1441
+ get size() {
1442
+ return this.root.size;
1443
+ }
1444
+ // Returns the minimum key in the map.
1445
+ minKey() {
1446
+ return this.root.minKey();
1447
+ }
1448
+ // Returns the maximum key in the map.
1449
+ maxKey() {
1450
+ return this.root.maxKey();
1451
+ }
1452
+ // Traverses the map in key order and calls the specified action function
1453
+ // for each key/value pair. If action returns true, traversal is aborted.
1454
+ // Returns the first truthy value returned by action, or the last falsey
1455
+ // value returned by action.
1456
+ inorderTraversal(t) {
1457
+ return this.root.inorderTraversal(t);
1458
+ }
1459
+ forEach(t) {
1460
+ this.inorderTraversal(((e, n) => (t(e, n), !1)));
1461
+ }
1462
+ toString() {
1463
+ const t = [];
1464
+ return this.inorderTraversal(((e, n) => (t.push(`${e}:${n}`), !1))), `{${t.join(", ")}}`;
1465
+ }
1466
+ // Traverses the map in reverse key order and calls the specified action
1467
+ // function for each key/value pair. If action returns true, traversal is
1468
+ // aborted.
1469
+ // Returns the first truthy value returned by action, or the last falsey
1470
+ // value returned by action.
1471
+ reverseTraversal(t) {
1472
+ return this.root.reverseTraversal(t);
1473
+ }
1474
+ // Returns an iterator over the SortedMap.
1475
+ getIterator() {
1476
+ return new At(this.root, null, this.comparator, !1);
1477
+ }
1478
+ getIteratorFrom(t) {
1479
+ return new At(this.root, t, this.comparator, !1);
1480
+ }
1481
+ getReverseIterator() {
1482
+ return new At(this.root, null, this.comparator, !0);
1483
+ }
1484
+ getReverseIteratorFrom(t) {
1485
+ return new At(this.root, t, this.comparator, !0);
1486
+ }
1487
+ }
1488
+
1489
+ // end SortedMap
1490
+ // An iterator over an LLRBNode.
1491
+ class At {
1492
+ constructor(t, e, n, r) {
1493
+ this.isReverse = r, this.nodeStack = [];
1494
+ let s = 1;
1495
+ for (;!t.isEmpty(); ) if (s = e ? n(t.key, e) : 1,
1496
+ // flip the comparison if we're going in reverse
1497
+ e && r && (s *= -1), s < 0)
1498
+ // This node is less than our start key. ignore it
1499
+ t = this.isReverse ? t.left : t.right; else {
1500
+ if (0 === s) {
1501
+ // This node is exactly equal to our start key. Push it on the stack,
1502
+ // but stop iterating;
1503
+ this.nodeStack.push(t);
1504
+ break;
1505
+ }
1506
+ // This node is greater than our start key, add it to the stack and move
1507
+ // to the next one
1508
+ this.nodeStack.push(t), t = this.isReverse ? t.right : t.left;
1509
+ }
1510
+ }
1511
+ getNext() {
1512
+ let t = this.nodeStack.pop();
1513
+ const e = {
1514
+ key: t.key,
1515
+ value: t.value
1516
+ };
1517
+ if (this.isReverse) for (t = t.left; !t.isEmpty(); ) this.nodeStack.push(t), t = t.right; else for (t = t.right; !t.isEmpty(); ) this.nodeStack.push(t),
1518
+ t = t.left;
1519
+ return e;
1520
+ }
1521
+ hasNext() {
1522
+ return this.nodeStack.length > 0;
1523
+ }
1524
+ peek() {
1525
+ if (0 === this.nodeStack.length) return null;
1526
+ const t = this.nodeStack[this.nodeStack.length - 1];
1527
+ return {
1528
+ key: t.key,
1529
+ value: t.value
1530
+ };
1531
+ }
1532
+ }
1533
+
1534
+ // end SortedMapIterator
1535
+ // Represents a node in a Left-leaning Red-Black tree.
1536
+ class Rt {
1537
+ constructor(t, e, n, r, s) {
1538
+ this.key = t, this.value = e, this.color = null != n ? n : Rt.RED, this.left = null != r ? r : Rt.EMPTY,
1539
+ this.right = null != s ? s : Rt.EMPTY, this.size = this.left.size + 1 + this.right.size;
1540
+ }
1541
+ // Returns a copy of the current node, optionally replacing pieces of it.
1542
+ copy(t, e, n, r, s) {
1543
+ return new Rt(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != r ? r : this.left, null != s ? s : this.right);
1544
+ }
1545
+ isEmpty() {
1546
+ return !1;
1547
+ }
1548
+ // Traverses the tree in key order and calls the specified action function
1549
+ // for each node. If action returns true, traversal is aborted.
1550
+ // Returns the first truthy value returned by action, or the last falsey
1551
+ // value returned by action.
1552
+ inorderTraversal(t) {
1553
+ return this.left.inorderTraversal(t) || t(this.key, this.value) || this.right.inorderTraversal(t);
1554
+ }
1555
+ // Traverses the tree in reverse key order and calls the specified action
1556
+ // function for each node. If action returns true, traversal is aborted.
1557
+ // Returns the first truthy value returned by action, or the last falsey
1558
+ // value returned by action.
1559
+ reverseTraversal(t) {
1560
+ return this.right.reverseTraversal(t) || t(this.key, this.value) || this.left.reverseTraversal(t);
1561
+ }
1562
+ // Returns the minimum node in the tree.
1563
+ min() {
1564
+ return this.left.isEmpty() ? this : this.left.min();
1565
+ }
1566
+ // Returns the maximum key in the tree.
1567
+ minKey() {
1568
+ return this.min().key;
1569
+ }
1570
+ // Returns the maximum key in the tree.
1571
+ maxKey() {
1572
+ return this.right.isEmpty() ? this.key : this.right.maxKey();
1573
+ }
1574
+ // Returns new tree, with the key/value added.
1575
+ insert(t, e, n) {
1576
+ let r = this;
1577
+ const s = n(t, r.key);
1578
+ return r = s < 0 ? r.copy(null, null, null, r.left.insert(t, e, n), null) : 0 === s ? r.copy(null, e, null, null, null) : r.copy(null, null, null, null, r.right.insert(t, e, n)),
1579
+ r.fixUp();
1580
+ }
1581
+ removeMin() {
1582
+ if (this.left.isEmpty()) return Rt.EMPTY;
1583
+ let t = this;
1584
+ return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
1585
+ t.fixUp();
1586
+ }
1587
+ // Returns new tree, with the specified item removed.
1588
+ remove(t, e) {
1589
+ let n, r = this;
1590
+ if (e(t, r.key) < 0) r.left.isEmpty() || r.left.isRed() || r.left.left.isRed() || (r = r.moveRedLeft()),
1591
+ r = r.copy(null, null, null, r.left.remove(t, e), null); else {
1592
+ if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
1593
+ 0 === e(t, r.key)) {
1594
+ if (r.right.isEmpty()) return Rt.EMPTY;
1595
+ n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
1596
+ }
1597
+ r = r.copy(null, null, null, null, r.right.remove(t, e));
1598
+ }
1599
+ return r.fixUp();
1600
+ }
1601
+ isRed() {
1602
+ return this.color;
1603
+ }
1604
+ // Returns new tree after performing any needed rotations.
1605
+ fixUp() {
1606
+ let t = this;
1607
+ return t.right.isRed() && !t.left.isRed() && (t = t.rotateLeft()), t.left.isRed() && t.left.left.isRed() && (t = t.rotateRight()),
1608
+ t.left.isRed() && t.right.isRed() && (t = t.colorFlip()), t;
1609
+ }
1610
+ moveRedLeft() {
1611
+ let t = this.colorFlip();
1612
+ return t.right.left.isRed() && (t = t.copy(null, null, null, null, t.right.rotateRight()),
1613
+ t = t.rotateLeft(), t = t.colorFlip()), t;
1614
+ }
1615
+ moveRedRight() {
1616
+ let t = this.colorFlip();
1617
+ return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
1618
+ }
1619
+ rotateLeft() {
1620
+ const t = this.copy(null, null, Rt.RED, null, this.right.left);
1621
+ return this.right.copy(null, null, this.color, t, null);
1622
+ }
1623
+ rotateRight() {
1624
+ const t = this.copy(null, null, Rt.RED, this.left.right, null);
1625
+ return this.left.copy(null, null, this.color, null, t);
1626
+ }
1627
+ colorFlip() {
1628
+ const t = this.left.copy(null, null, !this.left.color, null, null), e = this.right.copy(null, null, !this.right.color, null, null);
1629
+ return this.copy(null, null, !this.color, t, e);
1630
+ }
1631
+ // For testing.
1632
+ checkMaxDepth() {
1633
+ const t = this.check();
1634
+ return Math.pow(2, t) <= this.size + 1;
1635
+ }
1636
+ // In a balanced RB tree, the black-depth (number of black nodes) from root to
1637
+ // leaves is equal on both sides. This function verifies that or asserts.
1638
+ check() {
1639
+ if (this.isRed() && this.left.isRed()) throw v();
1640
+ if (this.right.isRed()) throw v();
1641
+ const t = this.left.check();
1642
+ if (t !== this.right.check()) throw v();
1643
+ return t + (this.isRed() ? 0 : 1);
1644
+ }
1645
+ }
1646
+
1647
+ // end LLRBNode
1648
+ // Empty node is shared between all LLRB trees.
1649
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1650
+ Rt.EMPTY = null, Rt.RED = !0, Rt.BLACK = !1;
1651
+
1652
+ // end LLRBEmptyNode
1653
+ Rt.EMPTY = new
1654
+ // Represents an empty node (a leaf node in the Red-Black Tree).
1655
+ class {
1656
+ constructor() {
1657
+ this.size = 0;
1658
+ }
1659
+ get key() {
1660
+ throw v();
1661
+ }
1662
+ get value() {
1663
+ throw v();
1664
+ }
1665
+ get color() {
1666
+ throw v();
1667
+ }
1668
+ get left() {
1669
+ throw v();
1670
+ }
1671
+ get right() {
1672
+ throw v();
1673
+ }
1674
+ // Returns a copy of the current node.
1675
+ copy(t, e, n, r, s) {
1676
+ return this;
1677
+ }
1678
+ // Returns a copy of the tree, with the specified key/value added.
1679
+ insert(t, e, n) {
1680
+ return new Rt(t, e);
1681
+ }
1682
+ // Returns a copy of the tree, with the specified key removed.
1683
+ remove(t, e) {
1684
+ return this;
1685
+ }
1686
+ isEmpty() {
1687
+ return !0;
1688
+ }
1689
+ inorderTraversal(t) {
1690
+ return !1;
1691
+ }
1692
+ reverseTraversal(t) {
1693
+ return !1;
1694
+ }
1695
+ minKey() {
1696
+ return null;
1697
+ }
1698
+ maxKey() {
1699
+ return null;
1700
+ }
1701
+ isRed() {
1702
+ return !1;
1703
+ }
1704
+ // For testing.
1705
+ checkMaxDepth() {
1706
+ return !0;
1707
+ }
1708
+ check() {
1709
+ return 0;
1710
+ }
1711
+ };
1712
+
1713
+ /**
1714
+ * @license
1715
+ * Copyright 2017 Google LLC
1716
+ *
1717
+ * Licensed under the Apache License, Version 2.0 (the "License");
1718
+ * you may not use this file except in compliance with the License.
1719
+ * You may obtain a copy of the License at
1720
+ *
1721
+ * http://www.apache.org/licenses/LICENSE-2.0
1722
+ *
1723
+ * Unless required by applicable law or agreed to in writing, software
1724
+ * distributed under the License is distributed on an "AS IS" BASIS,
1725
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1726
+ * See the License for the specific language governing permissions and
1727
+ * limitations under the License.
1728
+ */
1729
+ /**
1730
+ * SortedSet is an immutable (copy-on-write) collection that holds elements
1731
+ * in order specified by the provided comparator.
1732
+ *
1733
+ * NOTE: if provided comparator returns 0 for two elements, we consider them to
1734
+ * be equal!
1735
+ */
1736
+ class Pt {
1737
+ constructor(t) {
1738
+ this.comparator = t, this.data = new It(this.comparator);
1739
+ }
1740
+ has(t) {
1741
+ return null !== this.data.get(t);
1742
+ }
1743
+ first() {
1744
+ return this.data.minKey();
1745
+ }
1746
+ last() {
1747
+ return this.data.maxKey();
1748
+ }
1749
+ get size() {
1750
+ return this.data.size;
1751
+ }
1752
+ indexOf(t) {
1753
+ return this.data.indexOf(t);
1754
+ }
1755
+ /** Iterates elements in order defined by "comparator" */ forEach(t) {
1756
+ this.data.inorderTraversal(((e, n) => (t(e), !1)));
1757
+ }
1758
+ /** Iterates over `elem`s such that: range[0] &lt;= elem &lt; range[1]. */ forEachInRange(t, e) {
1759
+ const n = this.data.getIteratorFrom(t[0]);
1760
+ for (;n.hasNext(); ) {
1761
+ const r = n.getNext();
1762
+ if (this.comparator(r.key, t[1]) >= 0) return;
1763
+ e(r.key);
1764
+ }
1765
+ }
1766
+ /**
1767
+ * Iterates over `elem`s such that: start &lt;= elem until false is returned.
1768
+ */ forEachWhile(t, e) {
1769
+ let n;
1770
+ for (n = void 0 !== e ? this.data.getIteratorFrom(e) : this.data.getIterator(); n.hasNext(); ) {
1771
+ if (!t(n.getNext().key)) return;
1772
+ }
1773
+ }
1774
+ /** Finds the least element greater than or equal to `elem`. */ firstAfterOrEqual(t) {
1775
+ const e = this.data.getIteratorFrom(t);
1776
+ return e.hasNext() ? e.getNext().key : null;
1777
+ }
1778
+ getIterator() {
1779
+ return new Vt(this.data.getIterator());
1780
+ }
1781
+ getIteratorFrom(t) {
1782
+ return new Vt(this.data.getIteratorFrom(t));
1783
+ }
1784
+ /** Inserts or updates an element */ add(t) {
1785
+ return this.copy(this.data.remove(t).insert(t, !0));
1786
+ }
1787
+ /** Deletes an element */ delete(t) {
1788
+ return this.has(t) ? this.copy(this.data.remove(t)) : this;
1789
+ }
1790
+ isEmpty() {
1791
+ return this.data.isEmpty();
1792
+ }
1793
+ unionWith(t) {
1794
+ let e = this;
1795
+ // Make sure `result` always refers to the larger one of the two sets.
1796
+ return e.size < t.size && (e = t, t = this), t.forEach((t => {
1797
+ e = e.add(t);
1798
+ })), e;
1799
+ }
1800
+ isEqual(t) {
1801
+ if (!(t instanceof Pt)) return !1;
1802
+ if (this.size !== t.size) return !1;
1803
+ const e = this.data.getIterator(), n = t.data.getIterator();
1804
+ for (;e.hasNext(); ) {
1805
+ const t = e.getNext().key, r = n.getNext().key;
1806
+ if (0 !== this.comparator(t, r)) return !1;
1807
+ }
1808
+ return !0;
1809
+ }
1810
+ toArray() {
1811
+ const t = [];
1812
+ return this.forEach((e => {
1813
+ t.push(e);
1814
+ })), t;
1815
+ }
1816
+ toString() {
1817
+ const t = [];
1818
+ return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
1819
+ }
1820
+ copy(t) {
1821
+ const e = new Pt(this.comparator);
1822
+ return e.data = t, e;
1823
+ }
1824
+ }
1825
+
1826
+ class Vt {
1827
+ constructor(t) {
1828
+ this.iter = t;
1829
+ }
1830
+ getNext() {
1831
+ return this.iter.getNext().key;
1832
+ }
1833
+ hasNext() {
1834
+ return this.iter.hasNext();
1835
+ }
1836
+ }
1837
+
1382
1838
  /**
1383
1839
  * @license
1384
1840
  * Copyright 2020 Google LLC
@@ -1404,14 +1860,25 @@ function Tt(t, e) {
1404
1860
  * foo.bar - Overwrites only the field bar of the object foo.
1405
1861
  * If foo is not an object, foo is replaced with an object
1406
1862
  * containing foo
1407
- */
1408
- class At {
1863
+ */ class Nt {
1409
1864
  constructor(t) {
1410
1865
  this.fields = t,
1411
1866
  // TODO(dimond): validation of FieldMask
1412
1867
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1413
1868
  t.sort(et.comparator);
1414
1869
  }
1870
+ static empty() {
1871
+ return new Nt([]);
1872
+ }
1873
+ /**
1874
+ * Returns a new FieldMask object that is the result of adding all the given
1875
+ * fields paths to this field mask.
1876
+ */ unionWith(t) {
1877
+ let e = new Pt(et.comparator);
1878
+ for (const t of this.fields) e = e.add(t);
1879
+ for (const n of t) e = e.add(n);
1880
+ return new Nt(e.toArray());
1881
+ }
1415
1882
  /**
1416
1883
  * Verifies that `fieldPath` is included by at least one field in this field
1417
1884
  * mask.
@@ -1445,7 +1912,7 @@ class At {
1445
1912
  // WebSafe uses a different URL-encoding safe alphabet that doesn't match
1446
1913
  // the encoding used on the backend.
1447
1914
  /** Converts a Base64 encoded string to a binary string. */
1448
- function It(t) {
1915
+ function $t(t) {
1449
1916
  return String.fromCharCode.apply(null,
1450
1917
  // We use `decodeStringToByteArray()` instead of `decodeString()` since
1451
1918
  // `decodeString()` returns Unicode strings, which doesn't match the values
@@ -1479,13 +1946,13 @@ function It(t) {
1479
1946
  * before being sent as a proto.
1480
1947
  * @internal
1481
1948
  */
1482
- class Rt {
1949
+ class Dt {
1483
1950
  constructor(t) {
1484
1951
  this.binaryString = t;
1485
1952
  }
1486
1953
  static fromBase64String(t) {
1487
- const e = It(t);
1488
- return new Rt(e);
1954
+ const e = $t(t);
1955
+ return new Dt(e);
1489
1956
  }
1490
1957
  static fromUint8Array(t) {
1491
1958
  // TODO(indexing); Remove the copy of the byte string here as this method
@@ -1502,7 +1969,7 @@ class Rt {
1502
1969
  /**
1503
1970
  * Helper function to convert a binary string to an Uint8Array.
1504
1971
  */ (t);
1505
- return new Rt(e);
1972
+ return new Dt(e);
1506
1973
  }
1507
1974
  [Symbol.iterator]() {
1508
1975
  let t = 0;
@@ -1559,14 +2026,14 @@ class Rt {
1559
2026
  }
1560
2027
  }
1561
2028
 
1562
- Rt.EMPTY_BYTE_STRING = new Rt("");
2029
+ Dt.EMPTY_BYTE_STRING = new Dt("");
1563
2030
 
1564
- const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2031
+ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1565
2032
 
1566
2033
  /**
1567
2034
  * Converts the possible Proto values for a timestamp value into a "seconds and
1568
2035
  * nanos" representation.
1569
- */ function Vt(t) {
2036
+ */ function St(t) {
1570
2037
  // The json interface (for the browser) will return an iso timestamp string,
1571
2038
  // while the proto js library (for node) will return a
1572
2039
  // google.protobuf.Timestamp instance.
@@ -1575,7 +2042,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1575
2042
  // (millis), so we do some custom parsing here.
1576
2043
  // Parse the nanos right out of the string.
1577
2044
  let e = 0;
1578
- const n = Pt.exec(t);
2045
+ const n = xt.exec(t);
1579
2046
  if (b(!!n), n[1]) {
1580
2047
  // Pad the fraction out to 9 digits (nanos).
1581
2048
  let t = n[1];
@@ -1589,21 +2056,21 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1589
2056
  };
1590
2057
  }
1591
2058
  return {
1592
- seconds: Nt(t.seconds),
1593
- nanos: Nt(t.nanos)
2059
+ seconds: Ft(t.seconds),
2060
+ nanos: Ft(t.nanos)
1594
2061
  };
1595
2062
  }
1596
2063
 
1597
2064
  /**
1598
2065
  * Converts the possible Proto types for numbers into a JavaScript number.
1599
2066
  * Returns 0 if the value is not numeric.
1600
- */ function Nt(t) {
2067
+ */ function Ft(t) {
1601
2068
  // TODO(bjornick): Handle int64 greater than 53 bits.
1602
2069
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
1603
2070
  }
1604
2071
 
1605
- /** Converts the possible Proto types for Blobs into a ByteString. */ function Dt(t) {
1606
- return "string" == typeof t ? Rt.fromBase64String(t) : Rt.fromUint8Array(t);
2072
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function qt(t) {
2073
+ return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
1607
2074
  }
1608
2075
 
1609
2076
  /**
@@ -1639,7 +2106,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1639
2106
  * FieldValueOptions to value().
1640
2107
  * - With respect to other ServerTimestampValues, they sort by their
1641
2108
  * localWriteTime.
1642
- */ function $t(t) {
2109
+ */ function Ot(t) {
1643
2110
  var e, n;
1644
2111
  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);
1645
2112
  }
@@ -1649,15 +2116,15 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1649
2116
  *
1650
2117
  * Preserving the previous values allows the user to display the last resoled
1651
2118
  * value until the backend responds with the timestamp.
1652
- */ function St(t) {
2119
+ */ function kt(t) {
1653
2120
  const e = t.mapValue.fields.__previous_value__;
1654
- return $t(e) ? St(e) : e;
2121
+ return Ot(e) ? kt(e) : e;
1655
2122
  }
1656
2123
 
1657
2124
  /**
1658
2125
  * Returns the local time at which this timestamp was first set.
1659
- */ function xt(t) {
1660
- const e = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
2126
+ */ function Ct(t) {
2127
+ const e = St(t.mapValue.fields.__local_write_time__.timestampValue);
1661
2128
  return new vt(e.seconds, e.nanos);
1662
2129
  }
1663
2130
 
@@ -1676,7 +2143,7 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1676
2143
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1677
2144
  * See the License for the specific language governing permissions and
1678
2145
  * limitations under the License.
1679
- */ const Ft = {
2146
+ */ const Lt = {
1680
2147
  fields: {
1681
2148
  __type__: {
1682
2149
  stringValue: "__max__"
@@ -1685,8 +2152,8 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1685
2152
  };
1686
2153
 
1687
2154
  /** Extracts the backend's type order for the provided value. */
1688
- function qt(t) {
1689
- 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 ? $t(t) ? 4 /* ServerTimestampValue */ :
2155
+ function Mt(t) {
2156
+ 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 ? Ot(t) ? 4 /* ServerTimestampValue */ :
1690
2157
  /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
1691
2158
  function(t) {
1692
2159
  return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
@@ -1713,10 +2180,10 @@ function qt(t) {
1713
2180
  */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : v();
1714
2181
  }
1715
2182
 
1716
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Ot(t, e) {
2183
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function Ut(t, e) {
1717
2184
  if (t === e) return !0;
1718
- const n = qt(t);
1719
- if (n !== qt(e)) return !1;
2185
+ const n = Mt(t);
2186
+ if (n !== Mt(e)) return !1;
1720
2187
  switch (n) {
1721
2188
  case 0 /* NullValue */ :
1722
2189
  case 9007199254740991 /* MaxValue */ :
@@ -1726,14 +2193,14 @@ function qt(t) {
1726
2193
  return t.booleanValue === e.booleanValue;
1727
2194
 
1728
2195
  case 4 /* ServerTimestampValue */ :
1729
- return xt(t).isEqual(xt(e));
2196
+ return Ct(t).isEqual(Ct(e));
1730
2197
 
1731
2198
  case 3 /* TimestampValue */ :
1732
2199
  return function(t, e) {
1733
2200
  if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1734
2201
  // Use string equality for ISO 8601 timestamps
1735
2202
  return t.timestampValue === e.timestampValue;
1736
- const n = Vt(t.timestampValue), r = Vt(e.timestampValue);
2203
+ const n = St(t.timestampValue), r = St(e.timestampValue);
1737
2204
  return n.seconds === r.seconds && n.nanos === r.nanos;
1738
2205
  }(t, e);
1739
2206
 
@@ -1742,7 +2209,7 @@ function qt(t) {
1742
2209
 
1743
2210
  case 6 /* BlobValue */ :
1744
2211
  return function(t, e) {
1745
- return Dt(t.bytesValue).isEqual(Dt(e.bytesValue));
2212
+ return qt(t.bytesValue).isEqual(qt(e.bytesValue));
1746
2213
  }(t, e);
1747
2214
 
1748
2215
  case 7 /* RefValue */ :
@@ -1750,27 +2217,27 @@ function qt(t) {
1750
2217
 
1751
2218
  case 8 /* GeoPointValue */ :
1752
2219
  return function(t, e) {
1753
- return Nt(t.geoPointValue.latitude) === Nt(e.geoPointValue.latitude) && Nt(t.geoPointValue.longitude) === Nt(e.geoPointValue.longitude);
2220
+ return Ft(t.geoPointValue.latitude) === Ft(e.geoPointValue.latitude) && Ft(t.geoPointValue.longitude) === Ft(e.geoPointValue.longitude);
1754
2221
  }(t, e);
1755
2222
 
1756
2223
  case 2 /* NumberValue */ :
1757
2224
  return function(t, e) {
1758
- if ("integerValue" in t && "integerValue" in e) return Nt(t.integerValue) === Nt(e.integerValue);
2225
+ if ("integerValue" in t && "integerValue" in e) return Ft(t.integerValue) === Ft(e.integerValue);
1759
2226
  if ("doubleValue" in t && "doubleValue" in e) {
1760
- const n = Nt(t.doubleValue), r = Nt(e.doubleValue);
2227
+ const n = Ft(t.doubleValue), r = Ft(e.doubleValue);
1761
2228
  return n === r ? ht(n) === ht(r) : isNaN(n) && isNaN(r);
1762
2229
  }
1763
2230
  return !1;
1764
2231
  }(t, e);
1765
2232
 
1766
2233
  case 9 /* ArrayValue */ :
1767
- return gt(t.arrayValue.values || [], e.arrayValue.values || [], Ot);
2234
+ return gt(t.arrayValue.values || [], e.arrayValue.values || [], Ut);
1768
2235
 
1769
2236
  case 10 /* ObjectValue */ :
1770
2237
  return function(t, e) {
1771
2238
  const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1772
2239
  if (Et(n) !== Et(r)) return !1;
1773
- for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ot(n[t], r[t]))) return !1;
2240
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ut(n[t], r[t]))) return !1;
1774
2241
  return !0;
1775
2242
  }
1776
2243
  /** Returns true if the ArrayValue contains the specified element. */ (t, e);
@@ -1780,13 +2247,13 @@ function qt(t) {
1780
2247
  }
1781
2248
  }
1782
2249
 
1783
- function Ct(t, e) {
1784
- return void 0 !== (t.values || []).find((t => Ot(t, e)));
2250
+ function jt(t, e) {
2251
+ return void 0 !== (t.values || []).find((t => Ut(t, e)));
1785
2252
  }
1786
2253
 
1787
- function Lt(t, e) {
2254
+ function Bt(t, e) {
1788
2255
  if (t === e) return 0;
1789
- const n = qt(t), r = qt(e);
2256
+ const n = Mt(t), r = Mt(e);
1790
2257
  if (n !== r) return _t(n, r);
1791
2258
  switch (n) {
1792
2259
  case 0 /* NullValue */ :
@@ -1798,24 +2265,24 @@ function Lt(t, e) {
1798
2265
 
1799
2266
  case 2 /* NumberValue */ :
1800
2267
  return function(t, e) {
1801
- const n = Nt(t.integerValue || t.doubleValue), r = Nt(e.integerValue || e.doubleValue);
2268
+ const n = Ft(t.integerValue || t.doubleValue), r = Ft(e.integerValue || e.doubleValue);
1802
2269
  return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1803
2270
  // one or both are NaN.
1804
2271
  isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1805
2272
  }(t, e);
1806
2273
 
1807
2274
  case 3 /* TimestampValue */ :
1808
- return kt(t.timestampValue, e.timestampValue);
2275
+ return zt(t.timestampValue, e.timestampValue);
1809
2276
 
1810
2277
  case 4 /* ServerTimestampValue */ :
1811
- return kt(xt(t), xt(e));
2278
+ return zt(Ct(t), Ct(e));
1812
2279
 
1813
2280
  case 5 /* StringValue */ :
1814
2281
  return _t(t.stringValue, e.stringValue);
1815
2282
 
1816
2283
  case 6 /* BlobValue */ :
1817
2284
  return function(t, e) {
1818
- const n = Dt(t), r = Dt(e);
2285
+ const n = qt(t), r = qt(e);
1819
2286
  return n.compareTo(r);
1820
2287
  }(t.bytesValue, e.bytesValue);
1821
2288
 
@@ -1831,16 +2298,16 @@ function Lt(t, e) {
1831
2298
 
1832
2299
  case 8 /* GeoPointValue */ :
1833
2300
  return function(t, e) {
1834
- const n = _t(Nt(t.latitude), Nt(e.latitude));
2301
+ const n = _t(Ft(t.latitude), Ft(e.latitude));
1835
2302
  if (0 !== n) return n;
1836
- return _t(Nt(t.longitude), Nt(e.longitude));
2303
+ return _t(Ft(t.longitude), Ft(e.longitude));
1837
2304
  }(t.geoPointValue, e.geoPointValue);
1838
2305
 
1839
2306
  case 9 /* ArrayValue */ :
1840
2307
  return function(t, e) {
1841
2308
  const n = t.values || [], r = e.values || [];
1842
2309
  for (let t = 0; t < n.length && t < r.length; ++t) {
1843
- const e = Lt(n[t], r[t]);
2310
+ const e = Bt(n[t], r[t]);
1844
2311
  if (e) return e;
1845
2312
  }
1846
2313
  return _t(n.length, r.length);
@@ -1848,9 +2315,9 @@ function Lt(t, e) {
1848
2315
 
1849
2316
  case 10 /* ObjectValue */ :
1850
2317
  return function(t, e) {
1851
- if (t === Ft && e === Ft) return 0;
1852
- if (t === Ft) return 1;
1853
- if (e === Ft) return -1;
2318
+ if (t === Lt && e === Lt) return 0;
2319
+ if (t === Lt) return 1;
2320
+ if (e === Lt) return -1;
1854
2321
  const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
1855
2322
  // Even though MapValues are likely sorted correctly based on their insertion
1856
2323
  // order (e.g. when received from the backend), local modifications can bring
@@ -1860,7 +2327,7 @@ function Lt(t, e) {
1860
2327
  for (let t = 0; t < r.length && t < i.length; ++t) {
1861
2328
  const e = _t(r[t], i[t]);
1862
2329
  if (0 !== e) return e;
1863
- const o = Lt(n[r[t]], s[i[t]]);
2330
+ const o = Bt(n[r[t]], s[i[t]]);
1864
2331
  if (0 !== o) return o;
1865
2332
  }
1866
2333
  return _t(r.length, i.length);
@@ -1872,35 +2339,35 @@ function Lt(t, e) {
1872
2339
  }
1873
2340
  }
1874
2341
 
1875
- function kt(t, e) {
2342
+ function zt(t, e) {
1876
2343
  if ("string" == typeof t && "string" == typeof e && t.length === e.length) return _t(t, e);
1877
- const n = Vt(t), r = Vt(e), s = _t(n.seconds, r.seconds);
2344
+ const n = St(t), r = St(e), s = _t(n.seconds, r.seconds);
1878
2345
  return 0 !== s ? s : _t(n.nanos, r.nanos);
1879
2346
  }
1880
2347
 
1881
- function Ut(t, e) {
2348
+ function Wt(t, e) {
1882
2349
  return {
1883
2350
  referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
1884
2351
  };
1885
2352
  }
1886
2353
 
1887
- /** Returns true if `value` is an ArrayValue. */ function jt(t) {
2354
+ /** Returns true if `value` is an ArrayValue. */ function Gt(t) {
1888
2355
  return !!t && "arrayValue" in t;
1889
2356
  }
1890
2357
 
1891
- /** Returns true if `value` is a NullValue. */ function Mt(t) {
2358
+ /** Returns true if `value` is a NullValue. */ function Kt(t) {
1892
2359
  return !!t && "nullValue" in t;
1893
2360
  }
1894
2361
 
1895
- /** Returns true if `value` is NaN. */ function Bt(t) {
2362
+ /** Returns true if `value` is NaN. */ function Qt(t) {
1896
2363
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
1897
2364
  }
1898
2365
 
1899
- /** Returns true if `value` is a MapValue. */ function zt(t) {
2366
+ /** Returns true if `value` is a MapValue. */ function Yt(t) {
1900
2367
  return !!t && "mapValue" in t;
1901
2368
  }
1902
2369
 
1903
- /** Creates a deep copy of `source`. */ function Gt(t) {
2370
+ /** Creates a deep copy of `source`. */ function Ht(t) {
1904
2371
  if (t.geoPointValue) return {
1905
2372
  geoPointValue: Object.assign({}, t.geoPointValue)
1906
2373
  };
@@ -1913,7 +2380,7 @@ function Ut(t, e) {
1913
2380
  fields: {}
1914
2381
  }
1915
2382
  };
1916
- return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Gt(n))), e;
2383
+ return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Ht(n))), e;
1917
2384
  }
1918
2385
  if (t.arrayValue) {
1919
2386
  const e = {
@@ -1921,18 +2388,18 @@ function Ut(t, e) {
1921
2388
  values: []
1922
2389
  }
1923
2390
  };
1924
- for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Gt(t.arrayValue.values[n]);
2391
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Ht(t.arrayValue.values[n]);
1925
2392
  return e;
1926
2393
  }
1927
2394
  return Object.assign({}, t);
1928
2395
  }
1929
2396
 
1930
- class Qt {
2397
+ class Jt {
1931
2398
  constructor(t) {
1932
2399
  this.value = t;
1933
2400
  }
1934
2401
  static empty() {
1935
- return new Qt({
2402
+ return new Jt({
1936
2403
  mapValue: {}
1937
2404
  });
1938
2405
  }
@@ -1946,7 +2413,7 @@ class Qt {
1946
2413
  {
1947
2414
  let e = this.value;
1948
2415
  for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
1949
- !zt(e)) return null;
2416
+ !Yt(e)) return null;
1950
2417
  return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
1951
2418
  }
1952
2419
  }
@@ -1956,7 +2423,7 @@ class Qt {
1956
2423
  * @param path - The field path to set.
1957
2424
  * @param value - The value to set.
1958
2425
  */ set(t, e) {
1959
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Gt(e);
2426
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Ht(e);
1960
2427
  }
1961
2428
  /**
1962
2429
  * Sets the provided fields to the provided values.
@@ -1970,7 +2437,7 @@ class Qt {
1970
2437
  const t = this.getFieldsMap(e);
1971
2438
  this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
1972
2439
  }
1973
- t ? n[s.lastSegment()] = Gt(t) : r.push(s.lastSegment());
2440
+ t ? n[s.lastSegment()] = Ht(t) : r.push(s.lastSegment());
1974
2441
  }));
1975
2442
  const s = this.getFieldsMap(e);
1976
2443
  this.applyChanges(s, n, r);
@@ -1982,10 +2449,10 @@ class Qt {
1982
2449
  * @param path - The field path to remove.
1983
2450
  */ delete(t) {
1984
2451
  const e = this.field(t.popLast());
1985
- zt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2452
+ Yt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1986
2453
  }
1987
2454
  isEqual(t) {
1988
- return Ot(this.value, t.value);
2455
+ return Ut(this.value, t.value);
1989
2456
  }
1990
2457
  /**
1991
2458
  * Returns the map that contains the leaf element of `path`. If the parent
@@ -1997,7 +2464,7 @@ class Qt {
1997
2464
  });
1998
2465
  for (let n = 0; n < t.length; ++n) {
1999
2466
  let r = e.mapValue.fields[t.get(n)];
2000
- zt(r) && r.mapValue.fields || (r = {
2467
+ Yt(r) && r.mapValue.fields || (r = {
2001
2468
  mapValue: {
2002
2469
  fields: {}
2003
2470
  }
@@ -2013,7 +2480,7 @@ class Qt {
2013
2480
  for (const e of n) delete t[e];
2014
2481
  }
2015
2482
  clone() {
2016
- return new Qt(Gt(this.value));
2483
+ return new Jt(Ht(this.value));
2017
2484
  }
2018
2485
  }
2019
2486
 
@@ -2042,7 +2509,7 @@ class Qt {
2042
2509
  * not transition to one of these states even after all mutations have been
2043
2510
  * applied, `isValidDocument()` returns false and the document should be removed
2044
2511
  * from all views.
2045
- */ class Wt {
2512
+ */ class Xt {
2046
2513
  constructor(t, e, n, r, s, i) {
2047
2514
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2048
2515
  this.documentState = i;
@@ -2051,23 +2518,23 @@ class Qt {
2051
2518
  * Creates a document with no known version or data, but which can serve as
2052
2519
  * base document for mutations.
2053
2520
  */ static newInvalidDocument(t) {
2054
- return new Wt(t, 0 /* INVALID */ , bt.min(), bt.min(), Qt.empty(), 0 /* SYNCED */);
2521
+ return new Xt(t, 0 /* INVALID */ , bt.min(), bt.min(), Jt.empty(), 0 /* SYNCED */);
2055
2522
  }
2056
2523
  /**
2057
2524
  * Creates a new document that is known to exist with the given data at the
2058
2525
  * given version.
2059
2526
  */ static newFoundDocument(t, e, n) {
2060
- return new Wt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2527
+ return new Xt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2061
2528
  }
2062
2529
  /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2063
- return new Wt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Qt.empty(), 0 /* SYNCED */);
2530
+ return new Xt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Jt.empty(), 0 /* SYNCED */);
2064
2531
  }
2065
2532
  /**
2066
2533
  * Creates a new document that is known to exist at the given version but
2067
2534
  * whose data is not known (e.g. a document that was updated without a known
2068
2535
  * base document).
2069
2536
  */ static newUnknownDocument(t, e) {
2070
- return new Wt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2537
+ return new Xt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Jt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2071
2538
  }
2072
2539
  /**
2073
2540
  * Changes the document type to indicate that it exists and that its version
@@ -2080,7 +2547,7 @@ class Qt {
2080
2547
  * Changes the document type to indicate that it doesn't exist at the given
2081
2548
  * version.
2082
2549
  */ convertToNoDocument(t) {
2083
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Qt.empty(),
2550
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Jt.empty(),
2084
2551
  this.documentState = 0 /* SYNCED */ , this;
2085
2552
  }
2086
2553
  /**
@@ -2088,14 +2555,15 @@ class Qt {
2088
2555
  * that its data is not known (e.g. a document that was updated without a known
2089
2556
  * base document).
2090
2557
  */ convertToUnknownDocument(t) {
2091
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Qt.empty(),
2558
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Jt.empty(),
2092
2559
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2093
2560
  }
2094
2561
  setHasCommittedMutations() {
2095
2562
  return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2096
2563
  }
2097
2564
  setHasLocalMutations() {
2098
- return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
2565
+ return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = bt.min(),
2566
+ this;
2099
2567
  }
2100
2568
  setReadTime(t) {
2101
2569
  return this.readTime = t, this;
@@ -2122,10 +2590,10 @@ class Qt {
2122
2590
  return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
2123
2591
  }
2124
2592
  isEqual(t) {
2125
- return t instanceof Wt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2593
+ return t instanceof Xt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2126
2594
  }
2127
2595
  mutableCopy() {
2128
- return new Wt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2596
+ return new Xt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2129
2597
  }
2130
2598
  toString() {
2131
2599
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2149,7 +2617,7 @@ class Qt {
2149
2617
  * limitations under the License.
2150
2618
  */
2151
2619
  // Visible for testing
2152
- class Yt {
2620
+ class Zt {
2153
2621
  constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2154
2622
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2155
2623
  this.startAt = i, this.endAt = o, this.P = null;
@@ -2163,26 +2631,26 @@ class Yt {
2163
2631
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2164
2632
  * using this factory method, because `Query` provides an implicit `orderBy`
2165
2633
  * property.
2166
- */ function Ht(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2167
- return new Yt(t, e, n, r, s, i, o);
2634
+ */ function te(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2635
+ return new Zt(t, e, n, r, s, i, o);
2168
2636
  }
2169
2637
 
2170
- class Kt extends class {} {
2638
+ class ee extends class {} {
2171
2639
  constructor(t, e, n) {
2172
2640
  super(), this.field = t, this.op = e, this.value = n;
2173
2641
  }
2174
2642
  /**
2175
2643
  * Creates a filter based on the provided arguments.
2176
2644
  */ static create(t, e, n) {
2177
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Jt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ee(t, n) : "in" /* IN */ === e ? new ne(t, n) : "not-in" /* NOT_IN */ === e ? new re(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new se(t, n) : new Kt(t, e, n);
2645
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new ne(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* IN */ === e ? new ue(t, n) : "not-in" /* NOT_IN */ === e ? new ce(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ae(t, n) : new ee(t, e, n);
2178
2646
  }
2179
2647
  static V(t, e, n) {
2180
- return "in" /* IN */ === e ? new Xt(t, n) : new Zt(t, n);
2648
+ return "in" /* IN */ === e ? new re(t, n) : new se(t, n);
2181
2649
  }
2182
2650
  matches(t) {
2183
2651
  const e = t.data.field(this.field);
2184
2652
  // Types do not have to match in NOT_EQUAL filters.
2185
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(Lt(e, this.value)) : null !== e && qt(this.value) === qt(e) && this.N(Lt(e, this.value));
2653
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(Bt(e, this.value)) : null !== e && Mt(this.value) === Mt(e) && this.N(Bt(e, this.value));
2186
2654
  // Only compare types with matching backend order (such as double and int).
2187
2655
  }
2188
2656
  N(t) {
@@ -2209,13 +2677,13 @@ class Kt extends class {} {
2209
2677
  return v();
2210
2678
  }
2211
2679
  }
2212
- D() {
2680
+ $() {
2213
2681
  return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
2214
2682
  }
2215
2683
  }
2216
2684
 
2217
2685
  /** Filter that matches on key fields (i.e. '__name__'). */
2218
- class Jt extends Kt {
2686
+ class ne extends ee {
2219
2687
  constructor(t, e, n) {
2220
2688
  super(t, e, n), this.key = nt.fromName(n.referenceValue);
2221
2689
  }
@@ -2225,69 +2693,69 @@ class Jt extends Kt {
2225
2693
  }
2226
2694
  }
2227
2695
 
2228
- /** Filter that matches on key fields within an array. */ class Xt extends Kt {
2696
+ /** Filter that matches on key fields within an array. */ class re extends ee {
2229
2697
  constructor(t, e) {
2230
- super(t, "in" /* IN */ , e), this.keys = te("in" /* IN */ , e);
2698
+ super(t, "in" /* IN */ , e), this.keys = ie("in" /* IN */ , e);
2231
2699
  }
2232
2700
  matches(t) {
2233
2701
  return this.keys.some((e => e.isEqual(t.key)));
2234
2702
  }
2235
2703
  }
2236
2704
 
2237
- /** Filter that matches on key fields not present within an array. */ class Zt extends Kt {
2705
+ /** Filter that matches on key fields not present within an array. */ class se extends ee {
2238
2706
  constructor(t, e) {
2239
- super(t, "not-in" /* NOT_IN */ , e), this.keys = te("not-in" /* NOT_IN */ , e);
2707
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = ie("not-in" /* NOT_IN */ , e);
2240
2708
  }
2241
2709
  matches(t) {
2242
2710
  return !this.keys.some((e => e.isEqual(t.key)));
2243
2711
  }
2244
2712
  }
2245
2713
 
2246
- function te(t, e) {
2714
+ function ie(t, e) {
2247
2715
  var n;
2248
2716
  return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => nt.fromName(t.referenceValue)));
2249
2717
  }
2250
2718
 
2251
- /** A Filter that implements the array-contains operator. */ class ee extends Kt {
2719
+ /** A Filter that implements the array-contains operator. */ class oe extends ee {
2252
2720
  constructor(t, e) {
2253
2721
  super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2254
2722
  }
2255
2723
  matches(t) {
2256
2724
  const e = t.data.field(this.field);
2257
- return jt(e) && Ct(e.arrayValue, this.value);
2725
+ return Gt(e) && jt(e.arrayValue, this.value);
2258
2726
  }
2259
2727
  }
2260
2728
 
2261
- /** A Filter that implements the IN operator. */ class ne extends Kt {
2729
+ /** A Filter that implements the IN operator. */ class ue extends ee {
2262
2730
  constructor(t, e) {
2263
2731
  super(t, "in" /* IN */ , e);
2264
2732
  }
2265
2733
  matches(t) {
2266
2734
  const e = t.data.field(this.field);
2267
- return null !== e && Ct(this.value.arrayValue, e);
2735
+ return null !== e && jt(this.value.arrayValue, e);
2268
2736
  }
2269
2737
  }
2270
2738
 
2271
- /** A Filter that implements the not-in operator. */ class re extends Kt {
2739
+ /** A Filter that implements the not-in operator. */ class ce extends ee {
2272
2740
  constructor(t, e) {
2273
2741
  super(t, "not-in" /* NOT_IN */ , e);
2274
2742
  }
2275
2743
  matches(t) {
2276
- if (Ct(this.value.arrayValue, {
2744
+ if (jt(this.value.arrayValue, {
2277
2745
  nullValue: "NULL_VALUE"
2278
2746
  })) return !1;
2279
2747
  const e = t.data.field(this.field);
2280
- return null !== e && !Ct(this.value.arrayValue, e);
2748
+ return null !== e && !jt(this.value.arrayValue, e);
2281
2749
  }
2282
2750
  }
2283
2751
 
2284
- /** A Filter that implements the array-contains-any operator. */ class se extends Kt {
2752
+ /** A Filter that implements the array-contains-any operator. */ class ae extends ee {
2285
2753
  constructor(t, e) {
2286
2754
  super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2287
2755
  }
2288
2756
  matches(t) {
2289
2757
  const e = t.data.field(this.field);
2290
- return !(!jt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Ct(this.value.arrayValue, t)));
2758
+ return !(!Gt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => jt(this.value.arrayValue, t)));
2291
2759
  }
2292
2760
  }
2293
2761
 
@@ -2304,7 +2772,7 @@ function te(t, e) {
2304
2772
  * Bound provides a function to determine whether a document comes before or
2305
2773
  * after a bound. This is influenced by whether the position is just before or
2306
2774
  * just after the provided values.
2307
- */ class ie {
2775
+ */ class he {
2308
2776
  constructor(t, e) {
2309
2777
  this.position = t, this.inclusive = e;
2310
2778
  }
@@ -2312,22 +2780,22 @@ function te(t, e) {
2312
2780
 
2313
2781
  /**
2314
2782
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2315
- */ class oe {
2783
+ */ class le {
2316
2784
  constructor(t, e = "asc" /* ASCENDING */) {
2317
2785
  this.field = t, this.dir = e;
2318
2786
  }
2319
2787
  }
2320
2788
 
2321
- function ue(t, e) {
2789
+ function fe(t, e) {
2322
2790
  return t.dir === e.dir && t.field.isEqual(e.field);
2323
2791
  }
2324
2792
 
2325
- function ce(t, e) {
2793
+ function de(t, e) {
2326
2794
  if (null === t) return null === e;
2327
2795
  if (null === e) return !1;
2328
2796
  if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2329
2797
  for (let n = 0; n < t.position.length; n++) {
2330
- if (!Ot(t.position[n], e.position[n])) return !1;
2798
+ if (!Ut(t.position[n], e.position[n])) return !1;
2331
2799
  }
2332
2800
  return !0;
2333
2801
  }
@@ -2354,25 +2822,25 @@ function ce(t, e) {
2354
2822
  * query the RemoteStore results.
2355
2823
  *
2356
2824
  * Visible for testing.
2357
- */ class ae {
2825
+ */ class we {
2358
2826
  /**
2359
2827
  * Initializes a Query with a path and optional additional query constraints.
2360
2828
  * Path must currently be empty if this is a collection group query.
2361
2829
  */
2362
2830
  constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2363
2831
  this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
2364
- this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
2832
+ this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.D = null,
2365
2833
  // The corresponding `Target` of this `Query` instance.
2366
2834
  this.S = null, this.startAt, this.endAt;
2367
2835
  }
2368
2836
  }
2369
2837
 
2370
- /** Creates a new Query for a query that matches all documents at `path` */ function he(t) {
2838
+ /** Creates a new Query for a query that matches all documents at `path` */ function me(t) {
2371
2839
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2372
2840
  }
2373
2841
 
2374
- function le(t) {
2375
- for (const e of t.filters) if (e.D()) return e.field;
2842
+ function pe(t) {
2843
+ for (const e of t.filters) if (e.$()) return e.field;
2376
2844
  return null;
2377
2845
  }
2378
2846
 
@@ -2384,7 +2852,7 @@ function le(t) {
2384
2852
  * Returns whether the query matches a collection group rather than a specific
2385
2853
  * collection.
2386
2854
  */
2387
- function fe(t) {
2855
+ function ye(t) {
2388
2856
  return null !== t.collectionGroup;
2389
2857
  }
2390
2858
 
@@ -2392,59 +2860,59 @@ function fe(t) {
2392
2860
  * Returns the implicit order by constraint that is used to execute the Query,
2393
2861
  * which can be different from the order by constraints the user provided (e.g.
2394
2862
  * the SDK and backend always orders by `__name__`).
2395
- */ function de(t) {
2863
+ */ function _e(t) {
2396
2864
  const e = E(t);
2397
- if (null === e.$) {
2398
- e.$ = [];
2399
- const t = le(e), n = he(e);
2865
+ if (null === e.D) {
2866
+ e.D = [];
2867
+ const t = pe(e), n = me(e);
2400
2868
  if (null !== t && null === n)
2401
2869
  // In order to implicitly add key ordering, we must also add the
2402
2870
  // inequality filter field for it to be a valid query.
2403
2871
  // Note that the default inequality field and key ordering is ascending.
2404
- t.isKeyField() || e.$.push(new oe(t)), e.$.push(new oe(et.keyField(), "asc" /* ASCENDING */)); else {
2872
+ t.isKeyField() || e.D.push(new le(t)), e.D.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
2405
2873
  let t = !1;
2406
- for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
2874
+ for (const n of e.explicitOrderBy) e.D.push(n), n.field.isKeyField() && (t = !0);
2407
2875
  if (!t) {
2408
2876
  // The order of the implicit key ordering always matches the last
2409
2877
  // explicit order by
2410
2878
  const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2411
- e.$.push(new oe(et.keyField(), t));
2879
+ e.D.push(new le(et.keyField(), t));
2412
2880
  }
2413
2881
  }
2414
2882
  }
2415
- return e.$;
2883
+ return e.D;
2416
2884
  }
2417
2885
 
2418
2886
  /**
2419
2887
  * Converts this `Query` instance to it's corresponding `Target` representation.
2420
- */ function we(t) {
2888
+ */ function ge(t) {
2421
2889
  const e = E(t);
2422
- if (!e.S) if ("F" /* First */ === e.limitType) e.S = Ht(e.path, e.collectionGroup, de(e), e.filters, e.limit, e.startAt, e.endAt); else {
2890
+ if (!e.S) if ("F" /* First */ === e.limitType) e.S = te(e.path, e.collectionGroup, _e(e), e.filters, e.limit, e.startAt, e.endAt); else {
2423
2891
  // Flip the orderBy directions since we want the last results
2424
2892
  const t = [];
2425
- for (const n of de(e)) {
2893
+ for (const n of _e(e)) {
2426
2894
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2427
- t.push(new oe(n.field, e));
2895
+ t.push(new le(n.field, e));
2428
2896
  }
2429
2897
  // We need to swap the cursors to match the now-flipped query ordering.
2430
- const n = e.endAt ? new ie(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ie(e.startAt.position, e.startAt.inclusive) : null;
2898
+ const n = e.endAt ? new he(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new he(e.startAt.position, e.startAt.inclusive) : null;
2431
2899
  // Now return as a LimitType.First query.
2432
- e.S = Ht(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2900
+ e.S = te(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2433
2901
  }
2434
2902
  return e.S;
2435
2903
  }
2436
2904
 
2437
- function me(t, e) {
2905
+ function ve(t, e) {
2438
2906
  return function(t, e) {
2439
2907
  if (t.limit !== e.limit) return !1;
2440
2908
  if (t.orderBy.length !== e.orderBy.length) return !1;
2441
- for (let n = 0; n < t.orderBy.length; n++) if (!ue(t.orderBy[n], e.orderBy[n])) return !1;
2909
+ for (let n = 0; n < t.orderBy.length; n++) if (!fe(t.orderBy[n], e.orderBy[n])) return !1;
2442
2910
  if (t.filters.length !== e.filters.length) return !1;
2443
2911
  for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2444
- n.op !== r.op || !n.field.isEqual(r.field) || !Ot(n.value, r.value)) return !1;
2912
+ n.op !== r.op || !n.field.isEqual(r.field) || !Ut(n.value, r.value)) return !1;
2445
2913
  var n, r;
2446
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ce(t.startAt, e.startAt) && ce(t.endAt, e.endAt);
2447
- }(we(t), we(e)) && t.limitType === e.limitType;
2914
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!de(t.startAt, e.startAt) && de(t.endAt, e.endAt);
2915
+ }(ge(t), ge(e)) && t.limitType === e.limitType;
2448
2916
  }
2449
2917
 
2450
2918
  /**
@@ -2472,7 +2940,7 @@ function me(t, e) {
2472
2940
  * The return value is an IntegerValue if it can safely represent the value,
2473
2941
  * otherwise a DoubleValue is returned.
2474
2942
  */
2475
- function pe(t, e) {
2943
+ function be(t, e) {
2476
2944
  return function(t) {
2477
2945
  return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2478
2946
  }(e) ?
@@ -2517,7 +2985,7 @@ function pe(t, e) {
2517
2985
  * See the License for the specific language governing permissions and
2518
2986
  * limitations under the License.
2519
2987
  */
2520
- /** Used to represent a field transform on a mutation. */ class ye {
2988
+ /** Used to represent a field transform on a mutation. */ class Ee {
2521
2989
  constructor() {
2522
2990
  // Make sure that the structural type of `TransformOperation` is unique.
2523
2991
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2525,15 +2993,15 @@ function pe(t, e) {
2525
2993
  }
2526
2994
  }
2527
2995
 
2528
- /** Transforms a value into a server-generated timestamp. */ class _e extends ye {}
2996
+ /** Transforms a value into a server-generated timestamp. */ class Te extends Ee {}
2529
2997
 
2530
- /** Transforms an array value via a union operation. */ class ge extends ye {
2998
+ /** Transforms an array value via a union operation. */ class Ie extends Ee {
2531
2999
  constructor(t) {
2532
3000
  super(), this.elements = t;
2533
3001
  }
2534
3002
  }
2535
3003
 
2536
- /** Transforms an array value via a remove operation. */ class ve extends ye {
3004
+ /** Transforms an array value via a remove operation. */ class Ae extends Ee {
2537
3005
  constructor(t) {
2538
3006
  super(), this.elements = t;
2539
3007
  }
@@ -2544,7 +3012,7 @@ function pe(t, e) {
2544
3012
  * transforms. Converts all field values to integers or doubles, but unlike the
2545
3013
  * backend does not cap integer values at 2^63. Instead, JavaScript number
2546
3014
  * arithmetic is used and precision loss can occur for values greater than 2^53.
2547
- */ class be extends ye {
3015
+ */ class Re extends Ee {
2548
3016
  constructor(t, e) {
2549
3017
  super(), this.q = t, this.O = e;
2550
3018
  }
@@ -2566,7 +3034,7 @@ function pe(t, e) {
2566
3034
  * See the License for the specific language governing permissions and
2567
3035
  * limitations under the License.
2568
3036
  */
2569
- /** A field path and the TransformOperation to perform upon it. */ class Ee {
3037
+ /** A field path and the TransformOperation to perform upon it. */ class Pe {
2570
3038
  constructor(t, e) {
2571
3039
  this.field = t, this.transform = e;
2572
3040
  }
@@ -2576,18 +3044,18 @@ function pe(t, e) {
2576
3044
  * Encodes a precondition for a mutation. This follows the model that the
2577
3045
  * backend accepts with the special case of an explicit "empty" precondition
2578
3046
  * (meaning no precondition).
2579
- */ class Te {
3047
+ */ class Ve {
2580
3048
  constructor(t, e) {
2581
3049
  this.updateTime = t, this.exists = e;
2582
3050
  }
2583
3051
  /** Creates a new empty Precondition. */ static none() {
2584
- return new Te;
3052
+ return new Ve;
2585
3053
  }
2586
3054
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
2587
- return new Te(void 0, t);
3055
+ return new Ve(void 0, t);
2588
3056
  }
2589
3057
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
2590
- return new Te(t);
3058
+ return new Ve(t);
2591
3059
  }
2592
3060
  /** Returns whether this Precondition is empty. */ get isNone() {
2593
3061
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -2640,16 +3108,19 @@ function pe(t, e) {
2640
3108
  * applyToLocalView() to implement the actual behavior of applying the mutation
2641
3109
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
2642
3110
  * example).
2643
- */ class Ae {}
3111
+ */ class Ne {}
2644
3112
 
2645
3113
  /**
2646
3114
  * A mutation that creates or replaces the document at the given key with the
2647
3115
  * object value contents.
2648
- */ class Ie extends Ae {
3116
+ */ class $e extends Ne {
2649
3117
  constructor(t, e, n, r = []) {
2650
3118
  super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
2651
3119
  this.type = 0 /* Set */;
2652
3120
  }
3121
+ getFieldMask() {
3122
+ return null;
3123
+ }
2653
3124
  }
2654
3125
 
2655
3126
  /**
@@ -2664,17 +3135,23 @@ function pe(t, e) {
2664
3135
  * is deleted.
2665
3136
  * * When a field is not in the mask but is in the values, the values map is
2666
3137
  * ignored.
2667
- */ class Re extends Ae {
3138
+ */ class De extends Ne {
2668
3139
  constructor(t, e, n, r, s = []) {
2669
3140
  super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
2670
3141
  this.fieldTransforms = s, this.type = 1 /* Patch */;
2671
3142
  }
3143
+ getFieldMask() {
3144
+ return this.fieldMask;
3145
+ }
2672
3146
  }
2673
3147
 
2674
- /** A mutation that deletes the document at the given key. */ class Pe extends Ae {
3148
+ /** A mutation that deletes the document at the given key. */ class xe extends Ne {
2675
3149
  constructor(t, e) {
2676
3150
  super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2677
3151
  }
3152
+ getFieldMask() {
3153
+ return null;
3154
+ }
2678
3155
  }
2679
3156
 
2680
3157
  /**
@@ -2683,10 +3160,13 @@ function pe(t, e) {
2683
3160
  *
2684
3161
  * The `verify` operation is only used in Transactions, and this class serves
2685
3162
  * primarily to facilitate serialization into protos.
2686
- */ class Ve extends Ae {
3163
+ */ class Se extends Ne {
2687
3164
  constructor(t, e) {
2688
3165
  super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2689
3166
  }
3167
+ getFieldMask() {
3168
+ return null;
3169
+ }
2690
3170
  }
2691
3171
 
2692
3172
  /**
@@ -2704,13 +3184,13 @@ function pe(t, e) {
2704
3184
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2705
3185
  * See the License for the specific language governing permissions and
2706
3186
  * limitations under the License.
2707
- */ const Ne = (() => {
3187
+ */ const Fe = (() => {
2708
3188
  const t = {
2709
3189
  asc: "ASCENDING",
2710
3190
  desc: "DESCENDING"
2711
3191
  };
2712
3192
  return t;
2713
- })(), De = (() => {
3193
+ })(), qe = (() => {
2714
3194
  const t = {
2715
3195
  "<": "LESS_THAN",
2716
3196
  "<=": "LESS_THAN_OR_EQUAL",
@@ -2740,7 +3220,7 @@ function pe(t, e) {
2740
3220
  * TODO(klimt): We can remove the databaseId argument if we keep the full
2741
3221
  * resource name in documents.
2742
3222
  */
2743
- class $e {
3223
+ class Oe {
2744
3224
  constructor(t, e) {
2745
3225
  this.databaseId = t, this.F = e;
2746
3226
  }
@@ -2757,7 +3237,7 @@ class $e {
2757
3237
  /**
2758
3238
  * Returns a value for a Date that's appropriate to put into a proto.
2759
3239
  */
2760
- function Se(t, e) {
3240
+ function ke(t, e) {
2761
3241
  if (t.F) {
2762
3242
  return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
2763
3243
  }
@@ -2772,129 +3252,129 @@ function Se(t, e) {
2772
3252
  *
2773
3253
  * Visible for testing.
2774
3254
  */
2775
- function xe(t, e) {
3255
+ function Ce(t, e) {
2776
3256
  return t.F ? e.toBase64() : e.toUint8Array();
2777
3257
  }
2778
3258
 
2779
- function Fe(t, e) {
2780
- return Se(t, e.toTimestamp());
3259
+ function Le(t, e) {
3260
+ return ke(t, e.toTimestamp());
2781
3261
  }
2782
3262
 
2783
- function qe(t) {
3263
+ function Me(t) {
2784
3264
  return b(!!t), bt.fromTimestamp(function(t) {
2785
- const e = Vt(t);
3265
+ const e = St(t);
2786
3266
  return new vt(e.seconds, e.nanos);
2787
3267
  }(t));
2788
3268
  }
2789
3269
 
2790
- function Oe(t, e) {
3270
+ function Ue(t, e) {
2791
3271
  return function(t) {
2792
3272
  return new Z([ "projects", t.projectId, "databases", t.database ]);
2793
3273
  }(t).child("documents").child(e).canonicalString();
2794
3274
  }
2795
3275
 
2796
- function Ce(t, e) {
2797
- return Oe(t.databaseId, e.path);
3276
+ function je(t, e) {
3277
+ return Ue(t.databaseId, e.path);
2798
3278
  }
2799
3279
 
2800
- function Le(t, e) {
3280
+ function Be(t, e) {
2801
3281
  const n = function(t) {
2802
3282
  const e = Z.fromString(t);
2803
- return b(He(e)), e;
3283
+ return b(tn(e)), e;
2804
3284
  }(e);
2805
- if (n.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2806
- if (n.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
3285
+ if (n.get(1) !== t.databaseId.projectId) throw new M(R, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
3286
+ if (n.get(3) !== t.databaseId.database) throw new M(R, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2807
3287
  return new nt((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2808
3288
  var r;
2809
3289
  /** Creates a Document proto from key and fields (but no create/update time) */}
2810
3290
 
2811
- function ke(t, e) {
2812
- return Oe(t.databaseId, e);
3291
+ function ze(t, e) {
3292
+ return Ue(t.databaseId, e);
2813
3293
  }
2814
3294
 
2815
- function Ue(t) {
3295
+ function We(t) {
2816
3296
  return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2817
3297
  }
2818
3298
 
2819
- function je(t, e, n) {
3299
+ function Ge(t, e, n) {
2820
3300
  return {
2821
- name: Ce(t, e),
3301
+ name: je(t, e),
2822
3302
  fields: n.value.mapValue.fields
2823
3303
  };
2824
3304
  }
2825
3305
 
2826
- function Me(t, e) {
3306
+ function Ke(t, e) {
2827
3307
  return "found" in e ? function(t, e) {
2828
3308
  b(!!e.found), e.found.name, e.found.updateTime;
2829
- const n = Le(t, e.found.name), r = qe(e.found.updateTime), s = new Qt({
3309
+ const n = Be(t, e.found.name), r = Me(e.found.updateTime), s = new Jt({
2830
3310
  mapValue: {
2831
3311
  fields: e.found.fields
2832
3312
  }
2833
3313
  });
2834
- return Wt.newFoundDocument(n, r, s);
3314
+ return Xt.newFoundDocument(n, r, s);
2835
3315
  }(t, e) : "missing" in e ? function(t, e) {
2836
3316
  b(!!e.missing), b(!!e.readTime);
2837
- const n = Le(t, e.missing), r = qe(e.readTime);
2838
- return Wt.newNoDocument(n, r);
3317
+ const n = Be(t, e.missing), r = Me(e.readTime);
3318
+ return Xt.newNoDocument(n, r);
2839
3319
  }(t, e) : v();
2840
3320
  }
2841
3321
 
2842
- function Be(t, e) {
3322
+ function Qe(t, e) {
2843
3323
  let n;
2844
- if (e instanceof Ie) n = {
2845
- update: je(t, e.key, e.value)
2846
- }; else if (e instanceof Pe) n = {
2847
- delete: Ce(t, e.key)
2848
- }; else if (e instanceof Re) n = {
2849
- update: je(t, e.key, e.data),
2850
- updateMask: Ye(e.fieldMask)
3324
+ if (e instanceof $e) n = {
3325
+ update: Ge(t, e.key, e.value)
3326
+ }; else if (e instanceof xe) n = {
3327
+ delete: je(t, e.key)
3328
+ }; else if (e instanceof De) n = {
3329
+ update: Ge(t, e.key, e.data),
3330
+ updateMask: Ze(e.fieldMask)
2851
3331
  }; else {
2852
- if (!(e instanceof Ve)) return v();
3332
+ if (!(e instanceof Se)) return v();
2853
3333
  n = {
2854
- verify: Ce(t, e.key)
3334
+ verify: je(t, e.key)
2855
3335
  };
2856
3336
  }
2857
3337
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
2858
3338
  const n = e.transform;
2859
- if (n instanceof _e) return {
3339
+ if (n instanceof Te) return {
2860
3340
  fieldPath: e.field.canonicalString(),
2861
3341
  setToServerValue: "REQUEST_TIME"
2862
3342
  };
2863
- if (n instanceof ge) return {
3343
+ if (n instanceof Ie) return {
2864
3344
  fieldPath: e.field.canonicalString(),
2865
3345
  appendMissingElements: {
2866
3346
  values: n.elements
2867
3347
  }
2868
3348
  };
2869
- if (n instanceof ve) return {
3349
+ if (n instanceof Ae) return {
2870
3350
  fieldPath: e.field.canonicalString(),
2871
3351
  removeAllFromArray: {
2872
3352
  values: n.elements
2873
3353
  }
2874
3354
  };
2875
- if (n instanceof be) return {
3355
+ if (n instanceof Re) return {
2876
3356
  fieldPath: e.field.canonicalString(),
2877
3357
  increment: n.O
2878
3358
  };
2879
3359
  throw v();
2880
3360
  }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2881
3361
  return void 0 !== e.updateTime ? {
2882
- updateTime: Fe(t, e.updateTime)
3362
+ updateTime: Le(t, e.updateTime)
2883
3363
  } : void 0 !== e.exists ? {
2884
3364
  exists: e.exists
2885
3365
  } : v();
2886
3366
  }(t, e.precondition)), n;
2887
3367
  }
2888
3368
 
2889
- function ze(t, e) {
3369
+ function Ye(t, e) {
2890
3370
  // Dissect the path into parent, collectionId, and optional key filter.
2891
3371
  const n = {
2892
3372
  structuredQuery: {}
2893
3373
  }, r = e.path;
2894
- null !== e.collectionGroup ? (n.parent = ke(t, r), n.structuredQuery.from = [ {
3374
+ null !== e.collectionGroup ? (n.parent = ze(t, r), n.structuredQuery.from = [ {
2895
3375
  collectionId: e.collectionGroup,
2896
3376
  allDescendants: !0
2897
- } ]) : (n.parent = ke(t, r.popLast()), n.structuredQuery.from = [ {
3377
+ } ]) : (n.parent = ze(t, r.popLast()), n.structuredQuery.from = [ {
2898
3378
  collectionId: r.lastSegment()
2899
3379
  } ]);
2900
3380
  const s = function(t) {
@@ -2903,36 +3383,36 @@ function ze(t, e) {
2903
3383
  // visible for testing
2904
3384
  function(t) {
2905
3385
  if ("==" /* EQUAL */ === t.op) {
2906
- if (Bt(t.value)) return {
3386
+ if (Qt(t.value)) return {
2907
3387
  unaryFilter: {
2908
- field: We(t.field),
3388
+ field: Xe(t.field),
2909
3389
  op: "IS_NAN"
2910
3390
  }
2911
3391
  };
2912
- if (Mt(t.value)) return {
3392
+ if (Kt(t.value)) return {
2913
3393
  unaryFilter: {
2914
- field: We(t.field),
3394
+ field: Xe(t.field),
2915
3395
  op: "IS_NULL"
2916
3396
  }
2917
3397
  };
2918
3398
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
2919
- if (Bt(t.value)) return {
3399
+ if (Qt(t.value)) return {
2920
3400
  unaryFilter: {
2921
- field: We(t.field),
3401
+ field: Xe(t.field),
2922
3402
  op: "IS_NOT_NAN"
2923
3403
  }
2924
3404
  };
2925
- if (Mt(t.value)) return {
3405
+ if (Kt(t.value)) return {
2926
3406
  unaryFilter: {
2927
- field: We(t.field),
3407
+ field: Xe(t.field),
2928
3408
  op: "IS_NOT_NULL"
2929
3409
  }
2930
3410
  };
2931
3411
  }
2932
3412
  return {
2933
3413
  fieldFilter: {
2934
- field: We(t.field),
2935
- op: Qe(t.op),
3414
+ field: Xe(t.field),
3415
+ op: Je(t.op),
2936
3416
  value: t.value
2937
3417
  }
2938
3418
  };
@@ -2952,8 +3432,8 @@ function ze(t, e) {
2952
3432
  // visible for testing
2953
3433
  function(t) {
2954
3434
  return {
2955
- field: We(t.field),
2956
- direction: Ge(t.dir)
3435
+ field: Xe(t.field),
3436
+ direction: He(t.dir)
2957
3437
  };
2958
3438
  }(t)));
2959
3439
  }(e.orderBy);
@@ -2977,29 +3457,29 @@ function ze(t, e) {
2977
3457
  (e.endAt)), n;
2978
3458
  }
2979
3459
 
2980
- function Ge(t) {
2981
- return Ne[t];
3460
+ function He(t) {
3461
+ return Fe[t];
2982
3462
  }
2983
3463
 
2984
3464
  // visible for testing
2985
- function Qe(t) {
2986
- return De[t];
3465
+ function Je(t) {
3466
+ return qe[t];
2987
3467
  }
2988
3468
 
2989
- function We(t) {
3469
+ function Xe(t) {
2990
3470
  return {
2991
3471
  fieldPath: t.canonicalString()
2992
3472
  };
2993
3473
  }
2994
3474
 
2995
- function Ye(t) {
3475
+ function Ze(t) {
2996
3476
  const e = [];
2997
3477
  return t.fields.forEach((t => e.push(t.canonicalString()))), {
2998
3478
  fieldPaths: e
2999
3479
  };
3000
3480
  }
3001
3481
 
3002
- function He(t) {
3482
+ function tn(t) {
3003
3483
  // Resource names have at least 4 components (project ID, database ID)
3004
3484
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
3005
3485
  }
@@ -3019,8 +3499,8 @@ function He(t) {
3019
3499
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3020
3500
  * See the License for the specific language governing permissions and
3021
3501
  * limitations under the License.
3022
- */ function Ke(t) {
3023
- return new $e(t, /* useProto3Json= */ !0);
3502
+ */ function en(t) {
3503
+ return new Oe(t, /* useProto3Json= */ !0);
3024
3504
  }
3025
3505
 
3026
3506
  /**
@@ -3048,7 +3528,7 @@ function He(t) {
3048
3528
  * base delay. This prevents clients from accidentally synchronizing their
3049
3529
  * delays causing spikes of load to the backend.
3050
3530
  */
3051
- class Je {
3531
+ class nn {
3052
3532
  constructor(
3053
3533
  /**
3054
3534
  * The AsyncQueue to run backoff operations on.
@@ -3073,7 +3553,7 @@ class Je {
3073
3553
  * Note that jitter will still be applied, so the actual delay could be as
3074
3554
  * much as 1.5*maxDelayMs.
3075
3555
  */ , s = 6e4) {
3076
- this.C = t, this.timerId = e, this.L = n, this.k = r, this.U = s, this.j = 0, this.M = null,
3556
+ this.k = t, this.timerId = e, this.C = n, this.L = r, this.M = s, this.U = 0, this.j = null,
3077
3557
  /** The last backoff attempt, as epoch milliseconds. */
3078
3558
  this.B = Date.now(), this.reset();
3079
3559
  }
@@ -3084,40 +3564,40 @@ class Je {
3084
3564
  * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and
3085
3565
  * subsequent ones will increase according to the backoffFactor.
3086
3566
  */ reset() {
3087
- this.j = 0;
3567
+ this.U = 0;
3088
3568
  }
3089
3569
  /**
3090
3570
  * Resets the backoff delay to the maximum delay (e.g. for use after a
3091
3571
  * RESOURCE_EXHAUSTED error).
3092
- */ G() {
3093
- this.j = this.U;
3572
+ */ W() {
3573
+ this.U = this.M;
3094
3574
  }
3095
3575
  /**
3096
3576
  * Returns a promise that resolves after currentDelayMs, and increases the
3097
3577
  * delay for any subsequent attempts. If there was a pending backoff operation
3098
3578
  * already, it will be canceled.
3099
- */ W(t) {
3579
+ */ G(t) {
3100
3580
  // Cancel any pending backoff operation.
3101
3581
  this.cancel();
3102
3582
  // First schedule using the current base (which may be 0 and should be
3103
3583
  // honored as such).
3104
- const e = Math.floor(this.j + this.Y()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
3584
+ const e = Math.floor(this.U + this.K()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
3105
3585
  // Guard against lastAttemptTime being in the future due to a clock change.
3106
- r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3107
- this.M = this.C.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
3586
+ r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.U} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3587
+ this.j = this.k.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
3108
3588
  t()))),
3109
3589
  // Apply backoff factor to determine next delay and ensure it is within
3110
3590
  // bounds.
3111
- this.j *= this.k, this.j < this.L && (this.j = this.L), this.j > this.U && (this.j = this.U);
3591
+ this.U *= this.L, this.U < this.C && (this.U = this.C), this.U > this.M && (this.U = this.M);
3112
3592
  }
3113
- H() {
3114
- null !== this.M && (this.M.skipDelay(), this.M = null);
3593
+ Y() {
3594
+ null !== this.j && (this.j.skipDelay(), this.j = null);
3115
3595
  }
3116
3596
  cancel() {
3117
- null !== this.M && (this.M.cancel(), this.M = null);
3597
+ null !== this.j && (this.j.cancel(), this.j = null);
3118
3598
  }
3119
- /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ Y() {
3120
- return (Math.random() - .5) * this.j;
3599
+ /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ K() {
3600
+ return (Math.random() - .5) * this.U;
3121
3601
  }
3122
3602
  }
3123
3603
 
@@ -3146,24 +3626,24 @@ class Je {
3146
3626
  * An implementation of Datastore that exposes additional state for internal
3147
3627
  * consumption.
3148
3628
  */
3149
- class Xe extends class {} {
3629
+ class rn extends class {} {
3150
3630
  constructor(t, e, n, r) {
3151
- super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
3631
+ super(), this.authCredentials = t, this.appCheckCredentials = e, this.H = n, this.q = r,
3152
3632
  this.J = !1;
3153
3633
  }
3154
3634
  X() {
3155
- if (this.J) throw new U(x, "The client has already been terminated.");
3635
+ if (this.J) throw new M(S, "The client has already been terminated.");
3156
3636
  }
3157
3637
  /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
3158
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
3159
- throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3160
- this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3638
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.H.m(t, e, n, r, s))).catch((t => {
3639
+ throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3640
+ this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3161
3641
  }));
3162
3642
  }
3163
3643
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
3164
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
3165
- throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3166
- this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3644
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.H.T(t, e, n, r, s))).catch((t => {
3645
+ throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3646
+ this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3167
3647
  }));
3168
3648
  }
3169
3649
  terminate() {
@@ -3173,19 +3653,19 @@ class Xe extends class {} {
3173
3653
 
3174
3654
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3175
3655
  // firestore-exp client.
3176
- async function Ze(t, e) {
3177
- const n = E(t), r = Ue(n.q) + "/documents", s = {
3178
- writes: e.map((t => Be(n.q, t)))
3656
+ async function sn(t, e) {
3657
+ const n = E(t), r = We(n.q) + "/documents", s = {
3658
+ writes: e.map((t => Qe(n.q, t)))
3179
3659
  };
3180
3660
  await n.m("Commit", r, s);
3181
3661
  }
3182
3662
 
3183
- async function tn(t, e) {
3184
- const n = E(t), r = Ue(n.q) + "/documents", s = {
3185
- documents: e.map((t => Ce(n.q, t)))
3663
+ async function on(t, e) {
3664
+ const n = E(t), r = We(n.q) + "/documents", s = {
3665
+ documents: e.map((t => je(n.q, t)))
3186
3666
  }, i = await n.T("BatchGetDocuments", r, s), o = new Map;
3187
3667
  i.forEach((t => {
3188
- const e = Me(n.q, t);
3668
+ const e = Ke(n.q, t);
3189
3669
  o.set(e.key.toString(), e);
3190
3670
  }));
3191
3671
  const u = [];
@@ -3195,16 +3675,16 @@ async function tn(t, e) {
3195
3675
  })), u;
3196
3676
  }
3197
3677
 
3198
- async function en(t, e) {
3199
- const n = E(t), r = ze(n.q, we(e));
3678
+ async function un(t, e) {
3679
+ const n = E(t), r = Ye(n.q, ge(e));
3200
3680
  return (await n.T("RunQuery", r.parent, {
3201
3681
  structuredQuery: r.structuredQuery
3202
3682
  })).filter((t => !!t.document)).map((t => function(t, e, n) {
3203
- const r = Le(t, e.name), s = qe(e.updateTime), i = new Qt({
3683
+ const r = Be(t, e.name), s = Me(e.updateTime), i = new Jt({
3204
3684
  mapValue: {
3205
3685
  fields: e.fields
3206
3686
  }
3207
- }), o = Wt.newFoundDocument(r, s, i);
3687
+ }), o = Xt.newFoundDocument(r, s, i);
3208
3688
  return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3209
3689
  }(n.q, t.document, void 0)));
3210
3690
  }
@@ -3224,7 +3704,7 @@ async function en(t, e) {
3224
3704
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3225
3705
  * See the License for the specific language governing permissions and
3226
3706
  * limitations under the License.
3227
- */ const nn = new Map;
3707
+ */ const cn = new Map;
3228
3708
 
3229
3709
  /**
3230
3710
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3235,17 +3715,17 @@ async function en(t, e) {
3235
3715
  * instance. Callers must invoke removeComponents() when the Firestore
3236
3716
  * instance is terminated.
3237
3717
  */
3238
- function rn(t) {
3239
- if (t._terminated) throw new U(x, "The client has already been terminated.");
3240
- if (!nn.has(t)) {
3718
+ function an(t) {
3719
+ if (t._terminated) throw new M(S, "The client has already been terminated.");
3720
+ if (!cn.has(t)) {
3241
3721
  p("ComponentProvider", "Initializing Datastore");
3242
3722
  const i = function(t) {
3243
3723
  return new mt(t, fetch.bind(null));
3244
3724
  }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3245
- new K(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ke(t._databaseId), u = function(t, e, n, r) {
3246
- return new Xe(t, e, n, r);
3725
+ new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = en(t._databaseId), u = function(t, e, n, r) {
3726
+ return new rn(t, e, n, r);
3247
3727
  }(t._authCredentials, t._appCheckCredentials, i, o);
3248
- nn.set(t, u);
3728
+ cn.set(t, u);
3249
3729
  }
3250
3730
  var e, n, r, s;
3251
3731
  /**
@@ -3263,7 +3743,7 @@ function rn(t) {
3263
3743
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3264
3744
  * See the License for the specific language governing permissions and
3265
3745
  * limitations under the License.
3266
- */ return nn.get(t);
3746
+ */ return cn.get(t);
3267
3747
  }
3268
3748
 
3269
3749
  /**
@@ -3275,21 +3755,21 @@ function rn(t) {
3275
3755
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3276
3756
  * defaults can be supplied and the value can be checked for equality.
3277
3757
  */
3278
- class sn {
3758
+ class hn {
3279
3759
  constructor(t) {
3280
3760
  var e;
3281
3761
  if (void 0 === t.host) {
3282
- if (void 0 !== t.ssl) throw new U(R, "Can't provide ssl option if host option is not set");
3762
+ if (void 0 !== t.ssl) throw new M(R, "Can't provide ssl option if host option is not set");
3283
3763
  this.host = "firestore.googleapis.com", this.ssl = true;
3284
3764
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3285
3765
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3286
3766
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3287
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(R, "cacheSizeBytes must be at least 1048576");
3767
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(R, "cacheSizeBytes must be at least 1048576");
3288
3768
  this.cacheSizeBytes = t.cacheSizeBytes;
3289
3769
  }
3290
3770
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3291
3771
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3292
- if (!0 === e && !0 === r) throw new U(R, `${t} and ${n} cannot be used together.`);
3772
+ if (!0 === e && !0 === r) throw new M(R, `${t} and ${n} cannot be used together.`);
3293
3773
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3294
3774
  }
3295
3775
  isEqual(t) {
@@ -3317,17 +3797,17 @@ class sn {
3317
3797
  * The Cloud Firestore service interface.
3318
3798
  *
3319
3799
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3320
- */ class on {
3800
+ */ class ln {
3321
3801
  /** @hideconstructor */
3322
3802
  constructor(t, e, n) {
3323
3803
  this._authCredentials = e, this._appCheckCredentials = n,
3324
3804
  /**
3325
3805
  * Whether it's a Firestore or Firestore Lite instance.
3326
3806
  */
3327
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new sn({}),
3807
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new hn({}),
3328
3808
  this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
3329
3809
  this._databaseId = function(t) {
3330
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
3810
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(R, '"projectId" not provided in firebase.initializeApp.');
3331
3811
  return new J(t.options.projectId);
3332
3812
  }
3333
3813
  /**
@@ -3346,7 +3826,7 @@ class sn {
3346
3826
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
3347
3827
  * instance.
3348
3828
  */ get app() {
3349
- if (!this._app) throw new U(x, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3829
+ if (!this._app) throw new M(S, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3350
3830
  return this._app;
3351
3831
  }
3352
3832
  get _initialized() {
@@ -3356,21 +3836,21 @@ class sn {
3356
3836
  return void 0 !== this._terminateTask;
3357
3837
  }
3358
3838
  _setSettings(t) {
3359
- if (this._settingsFrozen) throw new U(x, "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.");
3360
- this._settings = new sn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3839
+ if (this._settingsFrozen) throw new M(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.");
3840
+ this._settings = new hn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3361
3841
  if (!t) return new B;
3362
3842
  switch (t.type) {
3363
3843
  case "gapi":
3364
3844
  const e = t.client;
3365
3845
  // Make sure this really is a Gapi client.
3366
3846
  return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3367
- new W(e, t.sessionIndex || "0", t.iamToken || null);
3847
+ new K(e, t.sessionIndex || "0", t.iamToken || null);
3368
3848
 
3369
3849
  case "provider":
3370
3850
  return t.client;
3371
3851
 
3372
3852
  default:
3373
- throw new U(R, "makeAuthCredentialsProvider failed due to invalid credential type");
3853
+ throw new M(R, "makeAuthCredentialsProvider failed due to invalid credential type");
3374
3854
  }
3375
3855
  }(t.credentials));
3376
3856
  }
@@ -3398,15 +3878,15 @@ class sn {
3398
3878
  * Only ever called once.
3399
3879
  */ _terminate() {
3400
3880
  return function(t) {
3401
- const e = nn.get(t);
3402
- e && (p("ComponentProvider", "Removing Datastore"), nn.delete(t), e.terminate());
3881
+ const e = cn.get(t);
3882
+ e && (p("ComponentProvider", "Removing Datastore"), cn.delete(t), e.terminate());
3403
3883
  }(this), Promise.resolve();
3404
3884
  }
3405
3885
  }
3406
3886
 
3407
- function un(t, e) {
3887
+ function fn(t, e) {
3408
3888
  const n = _getProvider(t, "firestore/lite");
3409
- if (n.isInitialized()) throw new U(x, "Firestore can only be initialized once per app.");
3889
+ if (n.isInitialized()) throw new M(S, "Firestore can only be initialized once per app.");
3410
3890
  return n.initialize({
3411
3891
  options: e
3412
3892
  });
@@ -3420,7 +3900,7 @@ function un(t, e) {
3420
3900
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3421
3901
  * instance is associated with.
3422
3902
  * @returns The `Firestore` instance of the provided app.
3423
- */ function cn(e = t()) {
3903
+ */ function dn(e = t()) {
3424
3904
  return _getProvider(e, "firestore/lite").getImmediate();
3425
3905
  }
3426
3906
 
@@ -3436,9 +3916,9 @@ function un(t, e) {
3436
3916
  * @param port - the emulator port (ex: 9000).
3437
3917
  * @param options.mockUserToken - the mock auth token to use for unit testing
3438
3918
  * Security Rules.
3439
- */ function an(t, e, n, r = {}) {
3919
+ */ function wn(t, e, n, r = {}) {
3440
3920
  var s;
3441
- const i = (t = ut(t, on))._getSettings();
3921
+ const i = (t = ut(t, ln))._getSettings();
3442
3922
  if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3443
3923
  t._setSettings(Object.assign(Object.assign({}, i), {
3444
3924
  host: `${e}:${n}`,
@@ -3450,10 +3930,10 @@ function un(t, e) {
3450
3930
  // invalid field "uid" and missing field "sub" / "user_id".)
3451
3931
  e = h(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3452
3932
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3453
- if (!i) throw new U(R, "mockUserToken must contain 'sub' or 'user_id' field!");
3933
+ if (!i) throw new M(R, "mockUserToken must contain 'sub' or 'user_id' field!");
3454
3934
  n = new f(i);
3455
3935
  }
3456
- t._authCredentials = new z(new M(e, n));
3936
+ t._authCredentials = new z(new j(e, n));
3457
3937
  }
3458
3938
  }
3459
3939
 
@@ -3476,8 +3956,8 @@ function un(t, e) {
3476
3956
  * @param firestore - The `Firestore` instance to terminate.
3477
3957
  * @returns A `Promise` that is resolved when the instance has been successfully
3478
3958
  * terminated.
3479
- */ function hn(t) {
3480
- return t = ut(t, on), e(t.app, "firestore/lite"), t._delete();
3959
+ */ function mn(t) {
3960
+ return t = ut(t, ln), e(t.app, "firestore/lite"), t._delete();
3481
3961
  }
3482
3962
 
3483
3963
  /**
@@ -3517,7 +3997,7 @@ function un(t, e) {
3517
3997
  * and can be used to write, read, or listen to the location. The document at
3518
3998
  * the referenced location may or may not exist.
3519
3999
  */
3520
- class ln {
4000
+ class pn {
3521
4001
  /** @hideconstructor */
3522
4002
  constructor(t,
3523
4003
  /**
@@ -3545,17 +4025,17 @@ class ln {
3545
4025
  /**
3546
4026
  * The collection this `DocumentReference` belongs to.
3547
4027
  */ get parent() {
3548
- return new dn(this.firestore, this.converter, this._key.path.popLast());
4028
+ return new _n(this.firestore, this.converter, this._key.path.popLast());
3549
4029
  }
3550
4030
  withConverter(t) {
3551
- return new ln(this.firestore, t, this._key);
4031
+ return new pn(this.firestore, t, this._key);
3552
4032
  }
3553
4033
  }
3554
4034
 
3555
4035
  /**
3556
4036
  * A `Query` refers to a query which you can read or listen to. You can also
3557
4037
  * construct refined `Query` objects by adding filters and ordering.
3558
- */ class fn {
4038
+ */ class yn {
3559
4039
  // This is the lite version of the Query class in the main SDK.
3560
4040
  /** @hideconstructor protected */
3561
4041
  constructor(t,
@@ -3568,17 +4048,17 @@ class ln {
3568
4048
  this.type = "query", this.firestore = t;
3569
4049
  }
3570
4050
  withConverter(t) {
3571
- return new fn(this.firestore, t, this._query);
4051
+ return new yn(this.firestore, t, this._query);
3572
4052
  }
3573
4053
  }
3574
4054
 
3575
4055
  /**
3576
4056
  * A `CollectionReference` object can be used for adding documents, getting
3577
4057
  * document references, and querying for documents (using {@link query}).
3578
- */ class dn extends fn {
4058
+ */ class _n extends yn {
3579
4059
  /** @hideconstructor */
3580
4060
  constructor(t, e, n) {
3581
- super(t, e, new ae(n)), this._path = n,
4061
+ super(t, e, new we(n)), this._path = n,
3582
4062
  /** The type of this Firestore reference. */
3583
4063
  this.type = "collection";
3584
4064
  }
@@ -3596,23 +4076,23 @@ class ln {
3596
4076
  * subcollection. If this isn't a subcollection, the reference is null.
3597
4077
  */ get parent() {
3598
4078
  const t = this._path.popLast();
3599
- return t.isEmpty() ? null : new ln(this.firestore,
4079
+ return t.isEmpty() ? null : new pn(this.firestore,
3600
4080
  /* converter= */ null, new nt(t));
3601
4081
  }
3602
4082
  withConverter(t) {
3603
- return new dn(this.firestore, t, this._path);
4083
+ return new _n(this.firestore, t, this._path);
3604
4084
  }
3605
4085
  }
3606
4086
 
3607
- function wn(t, e, ...n) {
3608
- if (t = l(t), rt("collection", "path", e), t instanceof on) {
4087
+ function gn(t, e, ...n) {
4088
+ if (t = l(t), rt("collection", "path", e), t instanceof ln) {
3609
4089
  const r = Z.fromString(e, ...n);
3610
- return it(r), new dn(t, /* converter= */ null, r);
4090
+ return it(r), new _n(t, /* converter= */ null, r);
3611
4091
  }
3612
4092
  {
3613
- if (!(t instanceof ln || t instanceof dn)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4093
+ if (!(t instanceof pn || t instanceof _n)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3614
4094
  const r = t._path.child(Z.fromString(e, ...n));
3615
- return it(r), new dn(t.firestore,
4095
+ return it(r), new _n(t.firestore,
3616
4096
  /* converter= */ null, r);
3617
4097
  }
3618
4098
  }
@@ -3629,32 +4109,32 @@ function wn(t, e, ...n) {
3629
4109
  * collection or subcollection with this ID as the last segment of its path
3630
4110
  * will be included. Cannot contain a slash.
3631
4111
  * @returns The created `Query`.
3632
- */ function mn(t, e) {
3633
- if (t = ut(t, on), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3634
- return new fn(t,
4112
+ */ function vn(t, e) {
4113
+ if (t = ut(t, ln), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new M(R, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
4114
+ return new yn(t,
3635
4115
  /* converter= */ null,
3636
4116
  /**
3637
4117
  * Creates a new Query for a collection group query that matches all documents
3638
4118
  * within the provided collection group.
3639
4119
  */
3640
4120
  function(t) {
3641
- return new ae(Z.emptyPath(), t);
4121
+ return new we(Z.emptyPath(), t);
3642
4122
  }(e));
3643
4123
  }
3644
4124
 
3645
- function pn(t, e, ...n) {
4125
+ function bn(t, e, ...n) {
3646
4126
  if (t = l(t),
3647
4127
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3648
4128
  // 'undefined' and 'null'.
3649
- 1 === arguments.length && (e = yt.R()), rt("doc", "path", e), t instanceof on) {
4129
+ 1 === arguments.length && (e = yt.R()), rt("doc", "path", e), t instanceof ln) {
3650
4130
  const r = Z.fromString(e, ...n);
3651
- return st(r), new ln(t,
4131
+ return st(r), new pn(t,
3652
4132
  /* converter= */ null, new nt(r));
3653
4133
  }
3654
4134
  {
3655
- if (!(t instanceof ln || t instanceof dn)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4135
+ if (!(t instanceof pn || t instanceof _n)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3656
4136
  const r = t._path.child(Z.fromString(e, ...n));
3657
- return st(r), new ln(t.firestore, t instanceof dn ? t.converter : null, new nt(r));
4137
+ return st(r), new pn(t.firestore, t instanceof _n ? t.converter : null, new nt(r));
3658
4138
  }
3659
4139
  }
3660
4140
 
@@ -3665,8 +4145,8 @@ function pn(t, e, ...n) {
3665
4145
  * @param right - A reference to compare.
3666
4146
  * @returns true if the references point to the same location in the same
3667
4147
  * Firestore database.
3668
- */ function yn(t, e) {
3669
- return t = l(t), e = l(e), (t instanceof ln || t instanceof dn) && (e instanceof ln || e instanceof dn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4148
+ */ function En(t, e) {
4149
+ return t = l(t), e = l(e), (t instanceof pn || t instanceof _n) && (e instanceof pn || e instanceof _n) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3670
4150
  }
3671
4151
 
3672
4152
  /**
@@ -3677,8 +4157,8 @@ function pn(t, e, ...n) {
3677
4157
  * @param right - A `Query` to compare.
3678
4158
  * @returns true if the references point to the same location in the same
3679
4159
  * Firestore database.
3680
- */ function _n(t, e) {
3681
- return t = l(t), e = l(e), t instanceof fn && e instanceof fn && (t.firestore === e.firestore && me(t._query, e._query) && t.converter === e.converter);
4160
+ */ function Tn(t, e) {
4161
+ return t = l(t), e = l(e), t instanceof yn && e instanceof yn && (t.firestore === e.firestore && ve(t._query, e._query) && t.converter === e.converter);
3682
4162
  }
3683
4163
 
3684
4164
  /**
@@ -3704,7 +4184,7 @@ function pn(t, e, ...n) {
3704
4184
  *
3705
4185
  * Create a `FieldPath` by providing field names. If more than one field
3706
4186
  * name is provided, the path will point to a nested field in a document.
3707
- */ class gn {
4187
+ */ class In {
3708
4188
  /**
3709
4189
  * Creates a `FieldPath` from the provided field names. If more than one field
3710
4190
  * name is provided, the path will point to a nested field in a document.
@@ -3712,7 +4192,7 @@ function pn(t, e, ...n) {
3712
4192
  * @param fieldNames - A list of field names.
3713
4193
  */
3714
4194
  constructor(...t) {
3715
- for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
4195
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new M(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3716
4196
  this._internalPath = new et(t);
3717
4197
  }
3718
4198
  /**
@@ -3728,8 +4208,8 @@ function pn(t, e, ...n) {
3728
4208
  /**
3729
4209
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3730
4210
  * It can be used in queries to sort or filter by the document ID.
3731
- */ function vn() {
3732
- return new gn("__name__");
4211
+ */ function An() {
4212
+ return new In("__name__");
3733
4213
  }
3734
4214
 
3735
4215
  /**
@@ -3750,7 +4230,7 @@ function pn(t, e, ...n) {
3750
4230
  */
3751
4231
  /**
3752
4232
  * An immutable object representing an array of bytes.
3753
- */ class bn {
4233
+ */ class Rn {
3754
4234
  /** @hideconstructor */
3755
4235
  constructor(t) {
3756
4236
  this._byteString = t;
@@ -3762,9 +4242,9 @@ function pn(t, e, ...n) {
3762
4242
  * @param base64 - The Base64 string used to create the `Bytes` object.
3763
4243
  */ static fromBase64String(t) {
3764
4244
  try {
3765
- return new bn(Rt.fromBase64String(t));
4245
+ return new Rn(Dt.fromBase64String(t));
3766
4246
  } catch (t) {
3767
- throw new U(R, "Failed to construct data from Base64 string: " + t);
4247
+ throw new M(R, "Failed to construct data from Base64 string: " + t);
3768
4248
  }
3769
4249
  }
3770
4250
  /**
@@ -3772,7 +4252,7 @@ function pn(t, e, ...n) {
3772
4252
  *
3773
4253
  * @param array - The Uint8Array used to create the `Bytes` object.
3774
4254
  */ static fromUint8Array(t) {
3775
- return new bn(Rt.fromUint8Array(t));
4255
+ return new Rn(Dt.fromUint8Array(t));
3776
4256
  }
3777
4257
  /**
3778
4258
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3824,7 +4304,7 @@ function pn(t, e, ...n) {
3824
4304
  /**
3825
4305
  * Sentinel values that can be used when writing document fields with `set()`
3826
4306
  * or `update()`.
3827
- */ class En {
4307
+ */ class Pn {
3828
4308
  /**
3829
4309
  * @param _methodName - The public API endpoint that returns this class.
3830
4310
  * @hideconstructor
@@ -3856,7 +4336,7 @@ function pn(t, e, ...n) {
3856
4336
  *
3857
4337
  * Latitude values are in the range of [-90, 90].
3858
4338
  * Longitude values are in the range of [-180, 180].
3859
- */ class Tn {
4339
+ */ class Vn {
3860
4340
  /**
3861
4341
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3862
4342
  * longitude values.
@@ -3864,8 +4344,8 @@ function pn(t, e, ...n) {
3864
4344
  * @param longitude - The longitude as number between -180 and 180.
3865
4345
  */
3866
4346
  constructor(t, e) {
3867
- if (!isFinite(t) || t < -90 || t > 90) throw new U(R, "Latitude must be a number between -90 and 90, but was: " + t);
3868
- if (!isFinite(e) || e < -180 || e > 180) throw new U(R, "Longitude must be a number between -180 and 180, but was: " + e);
4347
+ if (!isFinite(t) || t < -90 || t > 90) throw new M(R, "Latitude must be a number between -90 and 90, but was: " + t);
4348
+ if (!isFinite(e) || e < -180 || e > 180) throw new M(R, "Longitude must be a number between -180 and 180, but was: " + e);
3869
4349
  this._lat = t, this._long = e;
3870
4350
  }
3871
4351
  /**
@@ -3915,29 +4395,29 @@ function pn(t, e, ...n) {
3915
4395
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3916
4396
  * See the License for the specific language governing permissions and
3917
4397
  * limitations under the License.
3918
- */ const An = /^__.*__$/;
4398
+ */ const Nn = /^__.*__$/;
3919
4399
 
3920
- /** The result of parsing document data (e.g. for a setData call). */ class In {
4400
+ /** The result of parsing document data (e.g. for a setData call). */ class $n {
3921
4401
  constructor(t, e, n) {
3922
4402
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3923
4403
  }
3924
4404
  toMutation(t, e) {
3925
- return null !== this.fieldMask ? new Re(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ie(t, this.data, e, this.fieldTransforms);
4405
+ return null !== this.fieldMask ? new De(t, this.data, this.fieldMask, e, this.fieldTransforms) : new $e(t, this.data, e, this.fieldTransforms);
3926
4406
  }
3927
4407
  }
3928
4408
 
3929
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Rn {
4409
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class Dn {
3930
4410
  constructor(t,
3931
4411
  // The fieldMask does not include document transforms.
3932
4412
  e, n) {
3933
4413
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3934
4414
  }
3935
4415
  toMutation(t, e) {
3936
- return new Re(t, this.data, this.fieldMask, e, this.fieldTransforms);
4416
+ return new De(t, this.data, this.fieldMask, e, this.fieldTransforms);
3937
4417
  }
3938
4418
  }
3939
4419
 
3940
- function Pn(t) {
4420
+ function xn(t) {
3941
4421
  switch (t) {
3942
4422
  case 0 /* Set */ :
3943
4423
  // fall through
@@ -3955,7 +4435,7 @@ function Pn(t) {
3955
4435
  }
3956
4436
  }
3957
4437
 
3958
- /** A "context" object passed around while parsing user data. */ class Vn {
4438
+ /** A "context" object passed around while parsing user data. */ class Sn {
3959
4439
  /**
3960
4440
  * Initializes a ParseContext with the given source and path.
3961
4441
  *
@@ -3987,7 +4467,7 @@ function Pn(t) {
3987
4467
  return this.settings.tt;
3988
4468
  }
3989
4469
  /** Returns a new context with the specified settings overwritten. */ et(t) {
3990
- return new Vn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
4470
+ return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3991
4471
  }
3992
4472
  nt(t) {
3993
4473
  var e;
@@ -4014,7 +4494,7 @@ function Pn(t) {
4014
4494
  });
4015
4495
  }
4016
4496
  ut(t) {
4017
- return Yn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
4497
+ return Zn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
4018
4498
  }
4019
4499
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
4020
4500
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
@@ -4026,19 +4506,19 @@ function Pn(t) {
4026
4506
  }
4027
4507
  st(t) {
4028
4508
  if (0 === t.length) throw this.ut("Document fields must not be empty");
4029
- if (Pn(this.tt) && An.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4509
+ if (xn(this.tt) && Nn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4030
4510
  }
4031
4511
  }
4032
4512
 
4033
4513
  /**
4034
4514
  * Helper for parsing raw user input (provided via the API) into internal model
4035
4515
  * classes.
4036
- */ class Nn {
4516
+ */ class Fn {
4037
4517
  constructor(t, e, n) {
4038
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ke(t);
4518
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || en(t);
4039
4519
  }
4040
4520
  /** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
4041
- return new Vn({
4521
+ return new Sn({
4042
4522
  tt: t,
4043
4523
  methodName: e,
4044
4524
  at: n,
@@ -4049,29 +4529,29 @@ function Pn(t) {
4049
4529
  }
4050
4530
  }
4051
4531
 
4052
- function Dn(t) {
4053
- const e = t._freezeSettings(), n = Ke(t._databaseId);
4054
- return new Nn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4532
+ function qn(t) {
4533
+ const e = t._freezeSettings(), n = en(t._databaseId);
4534
+ return new Fn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4055
4535
  }
4056
4536
 
4057
- /** Parse document data from a set() call. */ function $n(t, e, n, r, s, i = {}) {
4537
+ /** Parse document data from a set() call. */ function On(t, e, n, r, s, i = {}) {
4058
4538
  const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4059
- zn("Data must be an object, but it was:", o, r);
4060
- const u = Mn(r, o);
4539
+ Yn("Data must be an object, but it was:", o, r);
4540
+ const u = Kn(r, o);
4061
4541
  let c, a;
4062
- if (i.merge) c = new At(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4542
+ if (i.merge) c = new Nt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4063
4543
  const t = [];
4064
4544
  for (const r of i.mergeFields) {
4065
- const s = Gn(e, r, n);
4066
- if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
4067
- Hn(t, s) || t.push(s);
4545
+ const s = Hn(e, r, n);
4546
+ if (!o.contains(s)) throw new M(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
4547
+ tr(t, s) || t.push(s);
4068
4548
  }
4069
- c = new At(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4549
+ c = new Nt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4070
4550
  } else c = null, a = o.fieldTransforms;
4071
- return new In(new Qt(u), c, a);
4551
+ return new $n(new Jt(u), c, a);
4072
4552
  }
4073
4553
 
4074
- class Sn extends En {
4554
+ class kn extends Pn {
4075
4555
  _toFieldTransform(t) {
4076
4556
  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}`);
4077
4557
  // No transform to add for a delete, but we need to add it to our
@@ -4079,7 +4559,7 @@ class Sn extends En {
4079
4559
  return t.fieldMask.push(t.path), null;
4080
4560
  }
4081
4561
  isEqual(t) {
4082
- return t instanceof Sn;
4562
+ return t instanceof kn;
4083
4563
  }
4084
4564
  }
4085
4565
 
@@ -4098,8 +4578,8 @@ class Sn extends En {
4098
4578
  * context.
4099
4579
  * @param context - The parent context.
4100
4580
  * @param arrayElement - Whether or not the FieldValue has an array.
4101
- */ function xn(t, e, n) {
4102
- return new Vn({
4581
+ */ function Cn(t, e, n) {
4582
+ return new Sn({
4103
4583
  tt: 3 /* Argument */ ,
4104
4584
  at: e.settings.at,
4105
4585
  methodName: t._methodName,
@@ -4107,23 +4587,23 @@ class Sn extends En {
4107
4587
  }, e.databaseId, e.q, e.ignoreUndefinedProperties);
4108
4588
  }
4109
4589
 
4110
- class Fn extends En {
4590
+ class Ln extends Pn {
4111
4591
  _toFieldTransform(t) {
4112
- return new Ee(t.path, new _e);
4592
+ return new Pe(t.path, new Te);
4113
4593
  }
4114
4594
  isEqual(t) {
4115
- return t instanceof Fn;
4595
+ return t instanceof Ln;
4116
4596
  }
4117
4597
  }
4118
4598
 
4119
- class qn extends En {
4599
+ class Mn extends Pn {
4120
4600
  constructor(t, e) {
4121
4601
  super(t), this.lt = e;
4122
4602
  }
4123
4603
  _toFieldTransform(t) {
4124
- const e = xn(this, t,
4125
- /*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new ge(n);
4126
- return new Ee(t.path, r);
4604
+ const e = Cn(this, t,
4605
+ /*array=*/ !0), n = this.lt.map((t => Gn(t, e))), r = new Ie(n);
4606
+ return new Pe(t.path, r);
4127
4607
  }
4128
4608
  isEqual(t) {
4129
4609
  // TODO(mrschmidt): Implement isEquals
@@ -4131,14 +4611,14 @@ class qn extends En {
4131
4611
  }
4132
4612
  }
4133
4613
 
4134
- class On extends En {
4614
+ class Un extends Pn {
4135
4615
  constructor(t, e) {
4136
4616
  super(t), this.lt = e;
4137
4617
  }
4138
4618
  _toFieldTransform(t) {
4139
- const e = xn(this, t,
4140
- /*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new ve(n);
4141
- return new Ee(t.path, r);
4619
+ const e = Cn(this, t,
4620
+ /*array=*/ !0), n = this.lt.map((t => Gn(t, e))), r = new Ae(n);
4621
+ return new Pe(t.path, r);
4142
4622
  }
4143
4623
  isEqual(t) {
4144
4624
  // TODO(mrschmidt): Implement isEquals
@@ -4146,13 +4626,13 @@ class On extends En {
4146
4626
  }
4147
4627
  }
4148
4628
 
4149
- class Cn extends En {
4629
+ class jn extends Pn {
4150
4630
  constructor(t, e) {
4151
4631
  super(t), this.ft = e;
4152
4632
  }
4153
4633
  _toFieldTransform(t) {
4154
- const e = new be(t.q, pe(t.q, this.ft));
4155
- return new Ee(t.path, e);
4634
+ const e = new Re(t.q, be(t.q, this.ft));
4635
+ return new Pe(t.path, e);
4156
4636
  }
4157
4637
  isEqual(t) {
4158
4638
  // TODO(mrschmidt): Implement isEquals
@@ -4160,50 +4640,50 @@ class Cn extends En {
4160
4640
  }
4161
4641
  }
4162
4642
 
4163
- /** Parse update data from an update() call. */ function Ln(t, e, n, r) {
4643
+ /** Parse update data from an update() call. */ function Bn(t, e, n, r) {
4164
4644
  const s = t.ht(1 /* Update */ , e, n);
4165
- zn("Data must be an object, but it was:", s, r);
4166
- const i = [], o = Qt.empty();
4645
+ Yn("Data must be an object, but it was:", s, r);
4646
+ const i = [], o = Jt.empty();
4167
4647
  Tt(r, ((t, r) => {
4168
- const u = Wn(e, t, n);
4648
+ const u = Xn(e, t, n);
4169
4649
  // For Compat types, we have to "extract" the underlying types before
4170
4650
  // performing validation.
4171
4651
  r = l(r);
4172
4652
  const c = s.it(u);
4173
- if (r instanceof Sn)
4653
+ if (r instanceof kn)
4174
4654
  // Add it to the field mask, but don't add anything to updateData.
4175
4655
  i.push(u); else {
4176
- const t = jn(r, c);
4656
+ const t = Gn(r, c);
4177
4657
  null != t && (i.push(u), o.set(u, t));
4178
4658
  }
4179
4659
  }));
4180
- const u = new At(i);
4181
- return new Rn(o, u, s.fieldTransforms);
4660
+ const u = new Nt(i);
4661
+ return new Dn(o, u, s.fieldTransforms);
4182
4662
  }
4183
4663
 
4184
- /** Parse update data from a list of field/value arguments. */ function kn(t, e, n, r, s, i) {
4185
- const o = t.ht(1 /* Update */ , e, n), u = [ Gn(e, r, n) ], c = [ s ];
4186
- if (i.length % 2 != 0) throw new U(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4187
- for (let t = 0; t < i.length; t += 2) u.push(Gn(e, i[t])), c.push(i[t + 1]);
4188
- const a = [], h = Qt.empty();
4664
+ /** Parse update data from a list of field/value arguments. */ function zn(t, e, n, r, s, i) {
4665
+ const o = t.ht(1 /* Update */ , e, n), u = [ Hn(e, r, n) ], c = [ s ];
4666
+ if (i.length % 2 != 0) throw new M(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4667
+ for (let t = 0; t < i.length; t += 2) u.push(Hn(e, i[t])), c.push(i[t + 1]);
4668
+ const a = [], h = Jt.empty();
4189
4669
  // We iterate in reverse order to pick the last value for a field if the
4190
4670
  // user specified the field multiple times.
4191
- for (let t = u.length - 1; t >= 0; --t) if (!Hn(a, u[t])) {
4671
+ for (let t = u.length - 1; t >= 0; --t) if (!tr(a, u[t])) {
4192
4672
  const e = u[t];
4193
4673
  let n = c[t];
4194
4674
  // For Compat types, we have to "extract" the underlying types before
4195
4675
  // performing validation.
4196
4676
  n = l(n);
4197
4677
  const r = o.it(e);
4198
- if (n instanceof Sn)
4678
+ if (n instanceof kn)
4199
4679
  // Add it to the field mask, but don't add anything to updateData.
4200
4680
  a.push(e); else {
4201
- const t = jn(n, r);
4681
+ const t = Gn(n, r);
4202
4682
  null != t && (a.push(e), h.set(e, t));
4203
4683
  }
4204
4684
  }
4205
- const f = new At(a);
4206
- return new Rn(h, f, o.fieldTransforms);
4685
+ const f = new Nt(a);
4686
+ return new Dn(h, f, o.fieldTransforms);
4207
4687
  }
4208
4688
 
4209
4689
  /**
@@ -4212,8 +4692,8 @@ class Cn extends En {
4212
4692
  *
4213
4693
  * @param allowArrays - Whether the query value is an array that may directly
4214
4694
  * contain additional arrays (e.g. the operand of an `in` query).
4215
- */ function Un(t, e, n, r = !1) {
4216
- return jn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4695
+ */ function Wn(t, e, n, r = !1) {
4696
+ return Gn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4217
4697
  }
4218
4698
 
4219
4699
  /**
@@ -4224,12 +4704,12 @@ class Cn extends En {
4224
4704
  * the source of the data being parsed, etc.
4225
4705
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4226
4706
  * that should not be included in the resulting parsed data.
4227
- */ function jn(t, e) {
4228
- if (Bn(
4707
+ */ function Gn(t, e) {
4708
+ if (Qn(
4229
4709
  // Unwrap the API type from the Compat SDK. This will return the API type
4230
4710
  // from firestore-exp.
4231
- t = l(t))) return zn("Unsupported field value:", e, t), Mn(t, e);
4232
- if (t instanceof En)
4711
+ t = l(t))) return Yn("Unsupported field value:", e, t), Kn(t, e);
4712
+ if (t instanceof Pn)
4233
4713
  // FieldValues usually parse into transforms (except deleteField())
4234
4714
  // in which case we do not want to include this field in our parsed data
4235
4715
  // (as doing so will overwrite the field directly prior to the transform
@@ -4241,7 +4721,7 @@ class Cn extends En {
4241
4721
  */
4242
4722
  return function(t, e) {
4243
4723
  // Sentinels are only supported with writes, and not within arrays.
4244
- if (!Pn(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
4724
+ if (!xn(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
4245
4725
  if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
4246
4726
  const n = t._toFieldTransform(e);
4247
4727
  n && e.fieldTransforms.push(n);
@@ -4271,7 +4751,7 @@ class Cn extends En {
4271
4751
  const n = [];
4272
4752
  let r = 0;
4273
4753
  for (const s of t) {
4274
- let t = jn(s, e.ot(r));
4754
+ let t = Gn(s, e.ot(r));
4275
4755
  null == t && (
4276
4756
  // Just include nulls in the array for fields being replaced with a
4277
4757
  // sentinel.
@@ -4290,7 +4770,7 @@ class Cn extends En {
4290
4770
  if (null === (t = l(t))) return {
4291
4771
  nullValue: "NULL_VALUE"
4292
4772
  };
4293
- if ("number" == typeof t) return pe(e.q, t);
4773
+ if ("number" == typeof t) return be(e.q, t);
4294
4774
  if ("boolean" == typeof t) return {
4295
4775
  booleanValue: t
4296
4776
  };
@@ -4300,7 +4780,7 @@ class Cn extends En {
4300
4780
  if (t instanceof Date) {
4301
4781
  const n = vt.fromDate(t);
4302
4782
  return {
4303
- timestampValue: Se(e.q, n)
4783
+ timestampValue: ke(e.q, n)
4304
4784
  };
4305
4785
  }
4306
4786
  if (t instanceof vt) {
@@ -4309,23 +4789,23 @@ class Cn extends En {
4309
4789
  // truncation immediately without waiting for the backend to do that.
4310
4790
  const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4311
4791
  return {
4312
- timestampValue: Se(e.q, n)
4792
+ timestampValue: ke(e.q, n)
4313
4793
  };
4314
4794
  }
4315
- if (t instanceof Tn) return {
4795
+ if (t instanceof Vn) return {
4316
4796
  geoPointValue: {
4317
4797
  latitude: t.latitude,
4318
4798
  longitude: t.longitude
4319
4799
  }
4320
4800
  };
4321
- if (t instanceof bn) return {
4322
- bytesValue: xe(e.q, t._byteString)
4801
+ if (t instanceof Rn) return {
4802
+ bytesValue: Ce(e.q, t._byteString)
4323
4803
  };
4324
- if (t instanceof ln) {
4804
+ if (t instanceof pn) {
4325
4805
  const n = e.databaseId, r = t.firestore._databaseId;
4326
4806
  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}`);
4327
4807
  return {
4328
- referenceValue: Oe(t.firestore._databaseId || e.databaseId, t._key.path)
4808
+ referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
4329
4809
  };
4330
4810
  }
4331
4811
  throw e.ut(`Unsupported field value: ${ot(t)}`);
@@ -4339,13 +4819,13 @@ class Cn extends En {
4339
4819
  */ (t, e);
4340
4820
  }
4341
4821
 
4342
- function Mn(t, e) {
4822
+ function Kn(t, e) {
4343
4823
  const n = {};
4344
4824
  return !function(t) {
4345
4825
  for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4346
4826
  return !0;
4347
4827
  }(t) ? Tt(t, ((t, r) => {
4348
- const s = jn(r, e.nt(t));
4828
+ const s = Gn(r, e.nt(t));
4349
4829
  null != s && (n[t] = s);
4350
4830
  })) :
4351
4831
  // If we encounter an empty object, we explicitly add it to the update
@@ -4357,12 +4837,12 @@ function Mn(t, e) {
4357
4837
  };
4358
4838
  }
4359
4839
 
4360
- function Bn(t) {
4361
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Tn || t instanceof bn || t instanceof ln || t instanceof En);
4840
+ function Qn(t) {
4841
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Vn || t instanceof Rn || t instanceof pn || t instanceof Pn);
4362
4842
  }
4363
4843
 
4364
- function zn(t, e, n) {
4365
- if (!Bn(n) || !function(t) {
4844
+ function Yn(t, e, n) {
4845
+ if (!Qn(n) || !function(t) {
4366
4846
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4367
4847
  }(n)) {
4368
4848
  const r = ot(n);
@@ -4372,20 +4852,20 @@ function zn(t, e, n) {
4372
4852
 
4373
4853
  /**
4374
4854
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4375
- */ function Gn(t, e, n) {
4855
+ */ function Hn(t, e, n) {
4376
4856
  if ((
4377
4857
  // If required, replace the FieldPath Compat class with with the firestore-exp
4378
4858
  // FieldPath.
4379
- e = l(e)) instanceof gn) return e._internalPath;
4380
- if ("string" == typeof e) return Wn(t, e);
4381
- throw Yn("Field path arguments must be of type string or ", t,
4859
+ e = l(e)) instanceof In) return e._internalPath;
4860
+ if ("string" == typeof e) return Xn(t, e);
4861
+ throw Zn("Field path arguments must be of type string or ", t,
4382
4862
  /* hasConverter= */ !1,
4383
4863
  /* path= */ void 0, n);
4384
4864
  }
4385
4865
 
4386
4866
  /**
4387
4867
  * Matches any characters in a field path string that are reserved.
4388
- */ const Qn = new RegExp("[~\\*/\\[\\]]");
4868
+ */ const Jn = new RegExp("[~\\*/\\[\\]]");
4389
4869
 
4390
4870
  /**
4391
4871
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4395,29 +4875,29 @@ function zn(t, e, n) {
4395
4875
  * split on dots.
4396
4876
  * @param targetDoc - The document against which the field path will be
4397
4877
  * evaluated.
4398
- */ function Wn(t, e, n) {
4399
- if (e.search(Qn) >= 0) throw Yn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4878
+ */ function Xn(t, e, n) {
4879
+ if (e.search(Jn) >= 0) throw Zn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4400
4880
  /* hasConverter= */ !1,
4401
4881
  /* path= */ void 0, n);
4402
4882
  try {
4403
- return new gn(...e.split("."))._internalPath;
4883
+ return new In(...e.split("."))._internalPath;
4404
4884
  } catch (r) {
4405
- throw Yn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4885
+ throw Zn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4406
4886
  /* hasConverter= */ !1,
4407
4887
  /* path= */ void 0, n);
4408
4888
  }
4409
4889
  }
4410
4890
 
4411
- function Yn(t, e, n, r, s) {
4891
+ function Zn(t, e, n, r, s) {
4412
4892
  const i = r && !r.isEmpty(), o = void 0 !== s;
4413
4893
  let u = `Function ${e}() called with invalid data`;
4414
4894
  n && (u += " (via `toFirestore()`)"), u += ". ";
4415
4895
  let c = "";
4416
4896
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4417
- c += ")"), new U(R, u + t + c);
4897
+ c += ")"), new M(R, u + t + c);
4418
4898
  }
4419
4899
 
4420
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Hn(t, e) {
4900
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function tr(t, e) {
4421
4901
  return t.some((t => t.isEqual(e)));
4422
4902
  }
4423
4903
 
@@ -4445,7 +4925,7 @@ function Yn(t, e, n, r, s) {
4445
4925
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4446
4926
  * access will return 'undefined'. You can use the `exists()` method to
4447
4927
  * explicitly verify a document's existence.
4448
- */ class Kn {
4928
+ */ class er {
4449
4929
  // Note: This class is stripped down version of the DocumentSnapshot in
4450
4930
  // the legacy SDK. The changes are:
4451
4931
  // - No support for SnapshotMetadata.
@@ -4461,7 +4941,7 @@ function Yn(t, e, n, r, s) {
4461
4941
  /**
4462
4942
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4463
4943
  */ get ref() {
4464
- return new ln(this._firestore, this._converter, this._key);
4944
+ return new pn(this._firestore, this._converter, this._key);
4465
4945
  }
4466
4946
  /**
4467
4947
  * Signals whether or not the document at the snapshot's location exists.
@@ -4481,7 +4961,7 @@ function Yn(t, e, n, r, s) {
4481
4961
  if (this._converter) {
4482
4962
  // We only want to use the converter and create a new DocumentSnapshot
4483
4963
  // if a converter has been provided.
4484
- const t = new Jn(this._firestore, this._userDataWriter, this._key, this._document,
4964
+ const t = new nr(this._firestore, this._userDataWriter, this._key, this._document,
4485
4965
  /* converter= */ null);
4486
4966
  return this._converter.fromFirestore(t);
4487
4967
  }
@@ -4501,7 +4981,7 @@ function Yn(t, e, n, r, s) {
4501
4981
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4502
4982
  get(t) {
4503
4983
  if (this._document) {
4504
- const e = this._document.data.field(tr("DocumentSnapshot.get", t));
4984
+ const e = this._document.data.field(ir("DocumentSnapshot.get", t));
4505
4985
  if (null !== e) return this._userDataWriter.convertValue(e);
4506
4986
  }
4507
4987
  }
@@ -4517,7 +4997,7 @@ function Yn(t, e, n, r, s) {
4517
4997
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4518
4998
  * `exists` property will always be true and `data()` will never return
4519
4999
  * 'undefined'.
4520
- */ class Jn extends Kn {
5000
+ */ class nr extends er {
4521
5001
  /**
4522
5002
  * Retrieves all fields in the document as an `Object`.
4523
5003
  *
@@ -4535,7 +5015,7 @@ function Yn(t, e, n, r, s) {
4535
5015
  * array via the `docs` property or enumerated using the `forEach` method. The
4536
5016
  * number of documents can be determined via the `empty` and `size`
4537
5017
  * properties.
4538
- */ class Xn {
5018
+ */ class rr {
4539
5019
  /** @hideconstructor */
4540
5020
  constructor(t, e) {
4541
5021
  this._docs = e, this.query = t;
@@ -4566,14 +5046,14 @@ function Yn(t, e, n, r, s) {
4566
5046
  * @param left - A snapshot to compare.
4567
5047
  * @param right - A snapshot to compare.
4568
5048
  * @returns true if the snapshots are equal.
4569
- */ function Zn(t, e) {
4570
- return t = l(t), e = l(e), t instanceof Kn && e instanceof Kn ? 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 Xn && e instanceof Xn && (_n(t.query, e.query) && gt(t.docs, e.docs, Zn));
5049
+ */ function sr(t, e) {
5050
+ return t = l(t), e = l(e), t instanceof er && e instanceof er ? 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 rr && e instanceof rr && (Tn(t.query, e.query) && gt(t.docs, e.docs, sr));
4571
5051
  }
4572
5052
 
4573
5053
  /**
4574
5054
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4575
- */ function tr(t, e) {
4576
- return "string" == typeof e ? Wn(t, e) : e instanceof gn ? e._internalPath : e._delegate._internalPath;
5055
+ */ function ir(t, e) {
5056
+ return "string" == typeof e ? Xn(t, e) : e instanceof In ? e._internalPath : e._delegate._internalPath;
4577
5057
  }
4578
5058
 
4579
5059
  /**
@@ -4600,7 +5080,7 @@ function Yn(t, e, n, r, s) {
4600
5080
  * can then be passed to {@link query} to create a new query instance that
4601
5081
  * also contains this `QueryConstraint`.
4602
5082
  */
4603
- class er {}
5083
+ class or {}
4604
5084
 
4605
5085
  /**
4606
5086
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4610,40 +5090,40 @@ class er {}
4610
5090
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4611
5091
  * @throws if any of the provided query constraints cannot be combined with the
4612
5092
  * existing or new constraints.
4613
- */ function nr(t, ...e) {
5093
+ */ function ur(t, ...e) {
4614
5094
  for (const n of e) t = n._apply(t);
4615
5095
  return t;
4616
5096
  }
4617
5097
 
4618
- class rr extends er {
5098
+ class cr extends or {
4619
5099
  constructor(t, e, n) {
4620
5100
  super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
4621
5101
  }
4622
5102
  _apply(t) {
4623
- const e = Dn(t.firestore), n = function(t, e, n, r, s, i, o) {
5103
+ const e = qn(t.firestore), n = function(t, e, n, r, s, i, o) {
4624
5104
  let u;
4625
5105
  if (s.isKeyField()) {
4626
- if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
5106
+ if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new M(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4627
5107
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
4628
- _r(o, i);
5108
+ Tr(o, i);
4629
5109
  const e = [];
4630
- for (const n of o) e.push(yr(r, t, n));
5110
+ for (const n of o) e.push(Er(r, t, n));
4631
5111
  u = {
4632
5112
  arrayValue: {
4633
5113
  values: e
4634
5114
  }
4635
5115
  };
4636
- } else u = yr(r, t, o);
4637
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
4638
- u = Un(n, e, o,
5116
+ } else u = Er(r, t, o);
5117
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || Tr(o, i),
5118
+ u = Wn(n, e, o,
4639
5119
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
4640
- const c = Kt.create(s, i, u);
5120
+ const c = ee.create(s, i, u);
4641
5121
  return function(t, e) {
4642
- if (e.D()) {
4643
- const n = le(t);
4644
- if (null !== n && !n.isEqual(e.field)) throw new U(R, `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()}'`);
4645
- const r = he(t);
4646
- null !== r && gr(t, e.field, r);
5122
+ if (e.$()) {
5123
+ const n = pe(t);
5124
+ if (null !== n && !n.isEqual(e.field)) throw new M(R, `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()}'`);
5125
+ const r = me(t);
5126
+ null !== r && Ir(t, e.field, r);
4647
5127
  }
4648
5128
  const n = function(t, e) {
4649
5129
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -4684,12 +5164,12 @@ class rr extends er {
4684
5164
  }(e.op));
4685
5165
  if (null !== n)
4686
5166
  // Special case when it's a duplicate op to give a slightly clearer error message.
4687
- throw n === e.op ? new U(R, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
5167
+ throw n === e.op ? new M(R, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new M(R, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4688
5168
  }(t, c), c;
4689
5169
  }(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4690
- return new fn(t.firestore, t.converter, function(t, e) {
5170
+ return new yn(t.firestore, t.converter, function(t, e) {
4691
5171
  const n = t.filters.concat([ e ]);
4692
- return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
5172
+ return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4693
5173
  }(t._query, n));
4694
5174
  }
4695
5175
  }
@@ -4704,25 +5184,25 @@ class rr extends er {
4704
5184
  * "&lt;=", "!=").
4705
5185
  * @param value - The value for comparison
4706
5186
  * @returns The created {@link Query}.
4707
- */ function sr(t, e, n) {
4708
- const r = e, s = tr("where", t);
4709
- return new rr(s, r, n);
5187
+ */ function ar(t, e, n) {
5188
+ const r = e, s = ir("where", t);
5189
+ return new cr(s, r, n);
4710
5190
  }
4711
5191
 
4712
- class ir extends er {
5192
+ class hr extends or {
4713
5193
  constructor(t, e) {
4714
5194
  super(), this.dt = t, this._t = e, this.type = "orderBy";
4715
5195
  }
4716
5196
  _apply(t) {
4717
5197
  const e = function(t, e, n) {
4718
- if (null !== t.startAt) throw new U(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4719
- if (null !== t.endAt) throw new U(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4720
- const r = new oe(e, n);
5198
+ if (null !== t.startAt) throw new M(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
5199
+ if (null !== t.endAt) throw new M(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
5200
+ const r = new le(e, n);
4721
5201
  return function(t, e) {
4722
- if (null === he(t)) {
5202
+ if (null === me(t)) {
4723
5203
  // This is the first order by. It must match any inequality.
4724
- const n = le(t);
4725
- null !== n && gr(t, n, e.field);
5204
+ const n = pe(t);
5205
+ null !== n && Ir(t, n, e.field);
4726
5206
  }
4727
5207
  }(t, r), r;
4728
5208
  }
@@ -4737,10 +5217,10 @@ class ir extends er {
4737
5217
  * of the query or if any of the fields in the order by are an uncommitted
4738
5218
  * server timestamp.
4739
5219
  */ (t._query, this.dt, this._t);
4740
- return new fn(t.firestore, t.converter, function(t, e) {
5220
+ return new yn(t.firestore, t.converter, function(t, e) {
4741
5221
  // TODO(dimond): validate that orderBy does not list the same key twice.
4742
5222
  const n = t.explicitOrderBy.concat([ e ]);
4743
- return new ae(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
5223
+ return new we(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4744
5224
  }(t._query, e));
4745
5225
  }
4746
5226
  }
@@ -4753,18 +5233,18 @@ class ir extends er {
4753
5233
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4754
5234
  * not specified, order will be ascending.
4755
5235
  * @returns The created {@link Query}.
4756
- */ function or(t, e = "asc") {
4757
- const n = e, r = tr("orderBy", t);
4758
- return new ir(r, n);
5236
+ */ function lr(t, e = "asc") {
5237
+ const n = e, r = ir("orderBy", t);
5238
+ return new hr(r, n);
4759
5239
  }
4760
5240
 
4761
- class ur extends er {
5241
+ class fr extends or {
4762
5242
  constructor(t, e, n) {
4763
5243
  super(), this.type = t, this.gt = e, this.vt = n;
4764
5244
  }
4765
5245
  _apply(t) {
4766
- return new fn(t.firestore, t.converter, function(t, e, n) {
4767
- return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
5246
+ return new yn(t.firestore, t.converter, function(t, e, n) {
5247
+ return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4768
5248
  }(t._query, this.gt, this.vt));
4769
5249
  }
4770
5250
  }
@@ -4774,8 +5254,8 @@ class ur extends er {
4774
5254
  *
4775
5255
  * @param limit - The maximum number of items to return.
4776
5256
  * @returns The created {@link Query}.
4777
- */ function cr(t) {
4778
- return ct("limit", t), new ur("limit", t, "F" /* First */);
5257
+ */ function dr(t) {
5258
+ return ct("limit", t), new fr("limit", t, "F" /* First */);
4779
5259
  }
4780
5260
 
4781
5261
  /**
@@ -4786,56 +5266,56 @@ class ur extends er {
4786
5266
  *
4787
5267
  * @param limit - The maximum number of items to return.
4788
5268
  * @returns The created {@link Query}.
4789
- */ function ar(t) {
4790
- return ct("limitToLast", t), new ur("limitToLast", t, "L" /* Last */);
5269
+ */ function wr(t) {
5270
+ return ct("limitToLast", t), new fr("limitToLast", t, "L" /* Last */);
4791
5271
  }
4792
5272
 
4793
- class hr extends er {
5273
+ class mr extends or {
4794
5274
  constructor(t, e, n) {
4795
5275
  super(), this.type = t, this.bt = e, this.Et = n;
4796
5276
  }
4797
5277
  _apply(t) {
4798
- const e = pr(t, this.type, this.bt, this.Et);
4799
- return new fn(t.firestore, t.converter, function(t, e) {
4800
- return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
5278
+ const e = br(t, this.type, this.bt, this.Et);
5279
+ return new yn(t.firestore, t.converter, function(t, e) {
5280
+ return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4801
5281
  }(t._query, e));
4802
5282
  }
4803
5283
  }
4804
5284
 
4805
- function lr(...t) {
4806
- return new hr("startAt", t,
5285
+ function pr(...t) {
5286
+ return new mr("startAt", t,
4807
5287
  /*inclusive=*/ !0);
4808
5288
  }
4809
5289
 
4810
- function fr(...t) {
4811
- return new hr("startAfter", t,
5290
+ function yr(...t) {
5291
+ return new mr("startAfter", t,
4812
5292
  /*inclusive=*/ !1);
4813
5293
  }
4814
5294
 
4815
- class dr extends er {
5295
+ class _r extends or {
4816
5296
  constructor(t, e, n) {
4817
5297
  super(), this.type = t, this.bt = e, this.Et = n;
4818
5298
  }
4819
5299
  _apply(t) {
4820
- const e = pr(t, this.type, this.bt, this.Et);
4821
- return new fn(t.firestore, t.converter, function(t, e) {
4822
- return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
5300
+ const e = br(t, this.type, this.bt, this.Et);
5301
+ return new yn(t.firestore, t.converter, function(t, e) {
5302
+ return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4823
5303
  }(t._query, e));
4824
5304
  }
4825
5305
  }
4826
5306
 
4827
- function wr(...t) {
4828
- return new dr("endBefore", t,
5307
+ function gr(...t) {
5308
+ return new _r("endBefore", t,
4829
5309
  /*inclusive=*/ !1);
4830
5310
  }
4831
5311
 
4832
- function mr(...t) {
4833
- return new dr("endAt", t, /*inclusive=*/ !0);
5312
+ function vr(...t) {
5313
+ return new _r("endAt", t, /*inclusive=*/ !0);
4834
5314
  }
4835
5315
 
4836
- /** Helper function to create a bound from a document or fields */ function pr(t, e, n, r) {
4837
- if (n[0] = l(n[0]), n[0] instanceof Kn) return function(t, e, n, r, s) {
4838
- if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
5316
+ /** Helper function to create a bound from a document or fields */ function br(t, e, n, r) {
5317
+ if (n[0] = l(n[0]), n[0] instanceof er) return function(t, e, n, r, s) {
5318
+ if (!r) throw new M(V, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
4839
5319
  const i = [];
4840
5320
  // Because people expect to continue/end a query at the exact document
4841
5321
  // provided, we need to use the implicit sort order rather than the explicit
@@ -4844,42 +5324,42 @@ function mr(...t) {
4844
5324
  // the provided document. Without the key (by using the explicit sort
4845
5325
  // orders), multiple documents could match the position, yielding duplicate
4846
5326
  // results.
4847
- for (const n of de(t)) if (n.field.isKeyField()) i.push(Ut(e, r.key)); else {
5327
+ for (const n of _e(t)) if (n.field.isKeyField()) i.push(Wt(e, r.key)); else {
4848
5328
  const t = r.data.field(n.field);
4849
- if ($t(t)) throw new U(R, '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.)');
5329
+ if (Ot(t)) throw new M(R, '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.)');
4850
5330
  if (null === t) {
4851
5331
  const t = n.field.canonicalString();
4852
- throw new U(R, `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.`);
5332
+ throw new M(R, `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.`);
4853
5333
  }
4854
5334
  i.push(t);
4855
5335
  }
4856
- return new ie(i, s);
5336
+ return new he(i, s);
4857
5337
  }
4858
5338
  /**
4859
5339
  * Converts a list of field values to a `Bound` for the given query.
4860
5340
  */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
4861
5341
  {
4862
- const s = Dn(t.firestore);
5342
+ const s = qn(t.firestore);
4863
5343
  return function(t, e, n, r, s, i) {
4864
5344
  // Use explicit order by's because it has to match the query the user made
4865
5345
  const o = t.explicitOrderBy;
4866
- if (s.length > o.length) throw new U(R, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
5346
+ if (s.length > o.length) throw new M(R, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
4867
5347
  const u = [];
4868
5348
  for (let i = 0; i < s.length; i++) {
4869
5349
  const c = s[i];
4870
5350
  if (o[i].field.isKeyField()) {
4871
- if ("string" != typeof c) throw new U(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
4872
- if (!fe(t) && -1 !== c.indexOf("/")) throw new U(R, `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.`);
5351
+ if ("string" != typeof c) throw new M(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
5352
+ if (!ye(t) && -1 !== c.indexOf("/")) throw new M(R, `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.`);
4873
5353
  const n = t.path.child(Z.fromString(c));
4874
- if (!nt.isDocumentKey(n)) throw new U(R, `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.`);
5354
+ if (!nt.isDocumentKey(n)) throw new M(R, `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.`);
4875
5355
  const s = new nt(n);
4876
- u.push(Ut(e, s));
5356
+ u.push(Wt(e, s));
4877
5357
  } else {
4878
- const t = Un(n, r, c);
5358
+ const t = Wn(n, r, c);
4879
5359
  u.push(t);
4880
5360
  }
4881
5361
  }
4882
- return new ie(u, i);
5362
+ return new he(u, i);
4883
5363
  }
4884
5364
  /**
4885
5365
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -4889,28 +5369,28 @@ function mr(...t) {
4889
5369
  }
4890
5370
  }
4891
5371
 
4892
- function yr(t, e, n) {
5372
+ function Er(t, e, n) {
4893
5373
  if ("string" == typeof (n = l(n))) {
4894
- if ("" === n) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4895
- if (!fe(e) && -1 !== n.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
5374
+ if ("" === n) throw new M(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
5375
+ if (!ye(e) && -1 !== n.indexOf("/")) throw new M(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4896
5376
  const r = e.path.child(Z.fromString(n));
4897
- if (!nt.isDocumentKey(r)) throw new U(R, `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}).`);
4898
- return Ut(t, new nt(r));
5377
+ if (!nt.isDocumentKey(r)) throw new M(R, `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}).`);
5378
+ return Wt(t, new nt(r));
4899
5379
  }
4900
- if (n instanceof ln) return Ut(t, n._key);
4901
- throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
5380
+ if (n instanceof pn) return Wt(t, n._key);
5381
+ throw new M(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
4902
5382
  }
4903
5383
 
4904
5384
  /**
4905
5385
  * Validates that the value passed into a disjunctive filter satisfies all
4906
5386
  * array requirements.
4907
- */ function _r(t, e) {
4908
- if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4909
- if (t.length > 10) throw new U(R, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
5387
+ */ function Tr(t, e) {
5388
+ if (!Array.isArray(t) || 0 === t.length) throw new M(R, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
5389
+ if (t.length > 10) throw new M(R, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4910
5390
  }
4911
5391
 
4912
- function gr(t, e, n) {
4913
- if (!n.isEqual(e)) throw new U(R, `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.`);
5392
+ function Ir(t, e, n) {
5393
+ if (!n.isEqual(e)) throw new M(R, `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.`);
4914
5394
  }
4915
5395
 
4916
5396
  /**
@@ -4960,7 +5440,7 @@ function gr(t, e, n) {
4960
5440
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4961
5441
  * call.
4962
5442
  */
4963
- function vr(t, e, n) {
5443
+ function Ar(t, e, n) {
4964
5444
  let r;
4965
5445
  // Cast to `any` in order to satisfy the union type constraint on
4966
5446
  // toFirestore().
@@ -4969,9 +5449,9 @@ function vr(t, e, n) {
4969
5449
  r;
4970
5450
  }
4971
5451
 
4972
- class br extends class {
5452
+ class Rr extends class {
4973
5453
  convertValue(t, e = "none") {
4974
- switch (qt(t)) {
5454
+ switch (Mt(t)) {
4975
5455
  case 0 /* NullValue */ :
4976
5456
  return null;
4977
5457
 
@@ -4979,7 +5459,7 @@ class br extends class {
4979
5459
  return t.booleanValue;
4980
5460
 
4981
5461
  case 2 /* NumberValue */ :
4982
- return Nt(t.integerValue || t.doubleValue);
5462
+ return Ft(t.integerValue || t.doubleValue);
4983
5463
 
4984
5464
  case 3 /* TimestampValue */ :
4985
5465
  return this.convertTimestamp(t.timestampValue);
@@ -4991,7 +5471,7 @@ class br extends class {
4991
5471
  return t.stringValue;
4992
5472
 
4993
5473
  case 6 /* BlobValue */ :
4994
- return this.convertBytes(Dt(t.bytesValue));
5474
+ return this.convertBytes(qt(t.bytesValue));
4995
5475
 
4996
5476
  case 7 /* RefValue */ :
4997
5477
  return this.convertReference(t.referenceValue);
@@ -5016,7 +5496,7 @@ class br extends class {
5016
5496
  })), n;
5017
5497
  }
5018
5498
  convertGeoPoint(t) {
5019
- return new Tn(Nt(t.latitude), Nt(t.longitude));
5499
+ return new Vn(Ft(t.latitude), Ft(t.longitude));
5020
5500
  }
5021
5501
  convertArray(t, e) {
5022
5502
  return (t.values || []).map((t => this.convertValue(t, e)));
@@ -5024,23 +5504,23 @@ class br extends class {
5024
5504
  convertServerTimestamp(t, e) {
5025
5505
  switch (e) {
5026
5506
  case "previous":
5027
- const n = St(t);
5507
+ const n = kt(t);
5028
5508
  return null == n ? null : this.convertValue(n, e);
5029
5509
 
5030
5510
  case "estimate":
5031
- return this.convertTimestamp(xt(t));
5511
+ return this.convertTimestamp(Ct(t));
5032
5512
 
5033
5513
  default:
5034
5514
  return null;
5035
5515
  }
5036
5516
  }
5037
5517
  convertTimestamp(t) {
5038
- const e = Vt(t);
5518
+ const e = St(t);
5039
5519
  return new vt(e.seconds, e.nanos);
5040
5520
  }
5041
5521
  convertDocumentKey(t, e) {
5042
5522
  const n = Z.fromString(t);
5043
- b(He(n));
5523
+ b(tn(n));
5044
5524
  const r = new J(n.get(1), n.get(3)), s = new nt(n.popFirst(5));
5045
5525
  return r.isEqual(e) ||
5046
5526
  // TODO(b/64130202): Somehow support foreign references.
@@ -5052,11 +5532,11 @@ class br extends class {
5052
5532
  super(), this.firestore = t;
5053
5533
  }
5054
5534
  convertBytes(t) {
5055
- return new bn(t);
5535
+ return new Rn(t);
5056
5536
  }
5057
5537
  convertReference(t) {
5058
5538
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
5059
- return new ln(this.firestore, /* converter= */ null, e);
5539
+ return new pn(this.firestore, /* converter= */ null, e);
5060
5540
  }
5061
5541
  }
5062
5542
 
@@ -5072,12 +5552,12 @@ class br extends class {
5072
5552
  * @param reference - The reference of the document to fetch.
5073
5553
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5074
5554
  * document contents.
5075
- */ function Er(t) {
5076
- const e = rn((t = ut(t, ln)).firestore), n = new br(t.firestore);
5077
- return tn(e, [ t._key ]).then((e => {
5555
+ */ function Pr(t) {
5556
+ const e = an((t = ut(t, pn)).firestore), n = new Rr(t.firestore);
5557
+ return on(e, [ t._key ]).then((e => {
5078
5558
  b(1 === e.length);
5079
5559
  const r = e[0];
5080
- return new Kn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5560
+ return new er(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5081
5561
  }));
5082
5562
  }
5083
5563
 
@@ -5092,33 +5572,33 @@ class br extends class {
5092
5572
  *
5093
5573
  * @param query - The `Query` to execute.
5094
5574
  * @returns A Promise that will be resolved with the results of the query.
5095
- */ function Tr(t) {
5575
+ */ function Vr(t) {
5096
5576
  !function(t) {
5097
- if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
5098
- }((t = ut(t, fn))._query);
5099
- const e = rn(t.firestore), n = new br(t.firestore);
5100
- return en(e, t._query).then((e => {
5101
- const r = e.map((e => new Jn(t.firestore, n, e.key, e, t.converter)));
5577
+ if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(O, "limitToLast() queries require specifying at least one orderBy() clause");
5578
+ }((t = ut(t, yn))._query);
5579
+ const e = an(t.firestore), n = new Rr(t.firestore);
5580
+ return un(e, t._query).then((e => {
5581
+ const r = e.map((e => new nr(t.firestore, n, e.key, e, t.converter)));
5102
5582
  return "L" /* Last */ === t._query.limitType &&
5103
5583
  // Limit to last queries reverse the orderBy constraint that was
5104
5584
  // specified by the user. As such, we need to reverse the order of the
5105
5585
  // results to return the documents in the expected order.
5106
- r.reverse(), new Xn(t, r);
5586
+ r.reverse(), new rr(t, r);
5107
5587
  }));
5108
5588
  }
5109
5589
 
5110
- function Ar(t, e, n) {
5111
- const r = vr((t = ut(t, ln)).converter, e, n), s = $n(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5112
- return Ze(rn(t.firestore), [ s.toMutation(t._key, Te.none()) ]);
5590
+ function Nr(t, e, n) {
5591
+ const r = Ar((t = ut(t, pn)).converter, e, n), s = On(qn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5592
+ return sn(an(t.firestore), [ s.toMutation(t._key, Ve.none()) ]);
5113
5593
  }
5114
5594
 
5115
- function Ir(t, e, n, ...r) {
5116
- const s = Dn((t = ut(t, ln)).firestore);
5595
+ function $r(t, e, n, ...r) {
5596
+ const s = qn((t = ut(t, pn)).firestore);
5117
5597
  // For Compat types, we have to "extract" the underlying types before
5118
5598
  // performing validation.
5119
5599
  let i;
5120
- i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(s, "updateDoc", t._key, e, n, r) : Ln(s, "updateDoc", t._key, e);
5121
- return Ze(rn(t.firestore), [ i.toMutation(t._key, Te.exists(!0)) ]);
5600
+ i = "string" == typeof (e = l(e)) || e instanceof In ? zn(s, "updateDoc", t._key, e, n, r) : Bn(s, "updateDoc", t._key, e);
5601
+ return sn(an(t.firestore), [ i.toMutation(t._key, Ve.exists(!0)) ]);
5122
5602
  }
5123
5603
 
5124
5604
  /**
@@ -5132,8 +5612,8 @@ function Ir(t, e, n, ...r) {
5132
5612
  * @param reference - A reference to the document to delete.
5133
5613
  * @returns A `Promise` resolved once the document has been successfully
5134
5614
  * deleted from the backend.
5135
- */ function Rr(t) {
5136
- return Ze(rn((t = ut(t, ln)).firestore), [ new Pe(t._key, Te.none()) ]);
5615
+ */ function Dr(t) {
5616
+ return sn(an((t = ut(t, pn)).firestore), [ new xe(t._key, Ve.none()) ]);
5137
5617
  }
5138
5618
 
5139
5619
  /**
@@ -5150,9 +5630,9 @@ function Ir(t, e, n, ...r) {
5150
5630
  * @throws Error - If the provided input is not a valid Firestore document.
5151
5631
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5152
5632
  * newly created document after it has been written to the backend.
5153
- */ function Pr(t, e) {
5154
- const n = pn(t = ut(t, dn)), r = vr(t.converter, e), s = $n(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5155
- return Ze(rn(t.firestore), [ s.toMutation(n._key, Te.exists(!1)) ]).then((() => n));
5633
+ */ function xr(t, e) {
5634
+ const n = bn(t = ut(t, _n)), r = Ar(t.converter, e), s = On(qn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5635
+ return sn(an(t.firestore), [ s.toMutation(n._key, Ve.exists(!1)) ]).then((() => n));
5156
5636
  }
5157
5637
 
5158
5638
  /**
@@ -5174,15 +5654,15 @@ function Ir(t, e, n, ...r) {
5174
5654
  /**
5175
5655
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5176
5656
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5177
- */ function Vr() {
5178
- return new Sn("deleteField");
5657
+ */ function Sr() {
5658
+ return new kn("deleteField");
5179
5659
  }
5180
5660
 
5181
5661
  /**
5182
5662
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5183
5663
  * include a server-generated timestamp in the written data.
5184
- */ function Nr() {
5185
- return new Fn("serverTimestamp");
5664
+ */ function Fr() {
5665
+ return new Ln("serverTimestamp");
5186
5666
  }
5187
5667
 
5188
5668
  /**
@@ -5196,10 +5676,10 @@ function Ir(t, e, n, ...r) {
5196
5676
  * @param elements - The elements to union into the array.
5197
5677
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5198
5678
  * `updateDoc()`.
5199
- */ function Dr(...t) {
5679
+ */ function qr(...t) {
5200
5680
  // NOTE: We don't actually parse the data until it's used in set() or
5201
5681
  // update() since we'd need the Firestore instance to do this.
5202
- return new qn("arrayUnion", t);
5682
+ return new Mn("arrayUnion", t);
5203
5683
  }
5204
5684
 
5205
5685
  /**
@@ -5212,10 +5692,10 @@ function Ir(t, e, n, ...r) {
5212
5692
  * @param elements - The elements to remove from the array.
5213
5693
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5214
5694
  * `updateDoc()`
5215
- */ function $r(...t) {
5695
+ */ function Or(...t) {
5216
5696
  // NOTE: We don't actually parse the data until it's used in set() or
5217
5697
  // update() since we'd need the Firestore instance to do this.
5218
- return new On("arrayRemove", t);
5698
+ return new Un("arrayRemove", t);
5219
5699
  }
5220
5700
 
5221
5701
  /**
@@ -5236,8 +5716,8 @@ function Ir(t, e, n, ...r) {
5236
5716
  * @param n - The value to increment by.
5237
5717
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5238
5718
  * `updateDoc()`
5239
- */ function Sr(t) {
5240
- return new Cn("increment", t);
5719
+ */ function kr(t) {
5720
+ return new jn("increment", t);
5241
5721
  }
5242
5722
 
5243
5723
  /**
@@ -5263,25 +5743,25 @@ function Ir(t, e, n, ...r) {
5263
5743
  * provides methods for adding writes to the write batch. None of the writes
5264
5744
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5265
5745
  * called.
5266
- */ class xr {
5746
+ */ class Cr {
5267
5747
  /** @hideconstructor */
5268
5748
  constructor(t, e) {
5269
5749
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5270
- this._dataReader = Dn(t);
5750
+ this._dataReader = qn(t);
5271
5751
  }
5272
5752
  set(t, e, n) {
5273
5753
  this._verifyNotCommitted();
5274
- const r = Fr(t, this._firestore), s = vr(r.converter, e, n), i = $n(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5275
- return this._mutations.push(i.toMutation(r._key, Te.none())), this;
5754
+ const r = Lr(t, this._firestore), s = Ar(r.converter, e, n), i = On(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5755
+ return this._mutations.push(i.toMutation(r._key, Ve.none())), this;
5276
5756
  }
5277
5757
  update(t, e, n, ...r) {
5278
5758
  this._verifyNotCommitted();
5279
- const s = Fr(t, this._firestore);
5759
+ const s = Lr(t, this._firestore);
5280
5760
  // For Compat types, we have to "extract" the underlying types before
5281
5761
  // performing validation.
5282
5762
  let i;
5283
- return i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Ln(this._dataReader, "WriteBatch.update", s._key, e),
5284
- this._mutations.push(i.toMutation(s._key, Te.exists(!0))), this;
5763
+ return i = "string" == typeof (e = l(e)) || e instanceof In ? zn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Bn(this._dataReader, "WriteBatch.update", s._key, e),
5764
+ this._mutations.push(i.toMutation(s._key, Ve.exists(!0))), this;
5285
5765
  }
5286
5766
  /**
5287
5767
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5290,8 +5770,8 @@ function Ir(t, e, n, ...r) {
5290
5770
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5291
5771
  */ delete(t) {
5292
5772
  this._verifyNotCommitted();
5293
- const e = Fr(t, this._firestore);
5294
- return this._mutations = this._mutations.concat(new Pe(e._key, Te.none())), this;
5773
+ const e = Lr(t, this._firestore);
5774
+ return this._mutations = this._mutations.concat(new xe(e._key, Ve.none())), this;
5295
5775
  }
5296
5776
  /**
5297
5777
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5308,12 +5788,12 @@ function Ir(t, e, n, ...r) {
5308
5788
  return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
5309
5789
  }
5310
5790
  _verifyNotCommitted() {
5311
- if (this._committed) throw new U(x, "A write batch can no longer be used after commit() has been called.");
5791
+ if (this._committed) throw new M(S, "A write batch can no longer be used after commit() has been called.");
5312
5792
  }
5313
5793
  }
5314
5794
 
5315
- function Fr(t, e) {
5316
- if ((t = l(t)).firestore !== e) throw new U(R, "Provided document reference is from a different Firestore instance.");
5795
+ function Lr(t, e) {
5796
+ if ((t = l(t)).firestore !== e) throw new M(R, "Provided document reference is from a different Firestore instance.");
5317
5797
  return t;
5318
5798
  }
5319
5799
 
@@ -5329,9 +5809,9 @@ function Fr(t, e) {
5329
5809
  *
5330
5810
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5331
5811
  * writes.
5332
- */ function qr(t) {
5333
- const e = rn(t = ut(t, on));
5334
- return new xr(t, (t => Ze(e, t)));
5812
+ */ function Mr(t) {
5813
+ const e = an(t = ut(t, ln));
5814
+ return new Cr(t, (t => sn(e, t)));
5335
5815
  }
5336
5816
 
5337
5817
  /**
@@ -5353,7 +5833,7 @@ function Fr(t, e) {
5353
5833
  /**
5354
5834
  * Internal transaction object responsible for accumulating the mutations to
5355
5835
  * perform and the base versions for any documents read.
5356
- */ class Or {
5836
+ */ class Ur {
5357
5837
  constructor(t) {
5358
5838
  this.datastore = t,
5359
5839
  // The version of each document that was read during this transaction.
@@ -5372,8 +5852,8 @@ function Fr(t, e) {
5372
5852
  this.writtenDocs = new Set;
5373
5853
  }
5374
5854
  async lookup(t) {
5375
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
5376
- const e = await tn(this.datastore, t);
5855
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(R, "Firestore transactions require all reads to be executed before all writes.");
5856
+ const e = await on(this.datastore, t);
5377
5857
  return e.forEach((t => this.recordVersion(t))), e;
5378
5858
  }
5379
5859
  set(t, e) {
@@ -5388,7 +5868,7 @@ function Fr(t, e) {
5388
5868
  this.writtenDocs.add(t.toString());
5389
5869
  }
5390
5870
  delete(t) {
5391
- this.write(new Pe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5871
+ this.write(new xe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5392
5872
  }
5393
5873
  async commit() {
5394
5874
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
@@ -5401,8 +5881,8 @@ function Fr(t, e) {
5401
5881
  // a `verify` operation.
5402
5882
  t.forEach(((t, e) => {
5403
5883
  const n = nt.fromPath(e);
5404
- this.mutations.push(new Ve(n, this.precondition(n)));
5405
- })), await Ze(this.datastore, this.mutations), this.committed = !0;
5884
+ this.mutations.push(new Se(n, this.precondition(n)));
5885
+ })), await sn(this.datastore, this.mutations), this.committed = !0;
5406
5886
  }
5407
5887
  recordVersion(t) {
5408
5888
  let e;
@@ -5415,7 +5895,7 @@ function Fr(t, e) {
5415
5895
  if (n) {
5416
5896
  if (!e.isEqual(n))
5417
5897
  // This transaction will fail no matter what.
5418
- throw new U(F, "Document version changed between two reads.");
5898
+ throw new M(F, "Document version changed between two reads.");
5419
5899
  } else this.readVersions.set(t.key.toString(), e);
5420
5900
  }
5421
5901
  /**
@@ -5423,7 +5903,7 @@ function Fr(t, e) {
5423
5903
  * as a precondition, or no precondition if it was not read.
5424
5904
  */ precondition(t) {
5425
5905
  const e = this.readVersions.get(t.toString());
5426
- return !this.writtenDocs.has(t.toString()) && e ? Te.updateTime(e) : Te.none();
5906
+ return !this.writtenDocs.has(t.toString()) && e ? Ve.updateTime(e) : Ve.none();
5427
5907
  }
5428
5908
  /**
5429
5909
  * Returns the precondition for a document if the operation is an update.
@@ -5442,13 +5922,13 @@ function Fr(t, e) {
5442
5922
  // express that to the backend, we have to validate locally.
5443
5923
  // Note: this can change once we can send separate verify writes in the
5444
5924
  // transaction.
5445
- throw new U(R, "Can't update a document that doesn't exist.");
5925
+ throw new M(R, "Can't update a document that doesn't exist.");
5446
5926
  // Document exists, base precondition on document update time.
5447
- return Te.updateTime(e);
5927
+ return Ve.updateTime(e);
5448
5928
  }
5449
5929
  // Document was not read, so we just use the preconditions for a blind
5450
5930
  // update.
5451
- return Te.exists(!0);
5931
+ return Ve.exists(!0);
5452
5932
  }
5453
5933
  write(t) {
5454
5934
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5471,7 +5951,7 @@ function Fr(t, e) {
5471
5951
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5472
5952
  * See the License for the specific language governing permissions and
5473
5953
  * limitations under the License.
5474
- */ const Cr = {
5954
+ */ const jr = {
5475
5955
  maxAttempts: 5
5476
5956
  };
5477
5957
 
@@ -5495,17 +5975,17 @@ function Fr(t, e) {
5495
5975
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5496
5976
  * with backoff.
5497
5977
  */
5498
- class Lr {
5978
+ class Br {
5499
5979
  constructor(t, e, n, r, s) {
5500
5980
  this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
5501
- this.deferred = s, this.Tt = n.maxAttempts, this.At = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5981
+ this.deferred = s, this.Tt = n.maxAttempts, this.It = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5502
5982
  }
5503
5983
  /** Runs the transaction and sets the result on deferred. */ run() {
5504
- this.Tt -= 1, this.It();
5984
+ this.Tt -= 1, this.At();
5505
5985
  }
5506
- It() {
5507
- this.At.W((async () => {
5508
- const t = new Or(this.datastore), e = this.Rt(t);
5986
+ At() {
5987
+ this.It.G((async () => {
5988
+ const t = new Ur(this.datastore), e = this.Rt(t);
5509
5989
  e && e.then((e => {
5510
5990
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5511
5991
  this.deferred.resolve(e);
@@ -5528,7 +6008,7 @@ class Lr {
5528
6008
  }
5529
6009
  }
5530
6010
  Pt(t) {
5531
- this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.It(),
6011
+ this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.At(),
5532
6012
  Promise.resolve())))) : this.deferred.reject(t);
5533
6013
  }
5534
6014
  Vt(t) {
@@ -5548,29 +6028,29 @@ class Lr {
5548
6028
  default:
5549
6029
  return v();
5550
6030
 
5551
- case A:
5552
6031
  case I:
6032
+ case A:
5553
6033
  case P:
5554
- case S:
6034
+ case x:
6035
+ case k:
5555
6036
  case C:
5556
- case L:
5557
6037
  // Unauthenticated means something went wrong with our token and we need
5558
6038
  // to retry with new credentials which will happen automatically.
5559
- case $:
6039
+ case D:
5560
6040
  return !1;
5561
6041
 
5562
6042
  case R:
5563
6043
  case V:
5564
6044
  case N:
5565
- case D:
5566
- case x:
6045
+ case $:
6046
+ case S:
5567
6047
  // Aborted might be retried in some scenarios, but that is dependant on
5568
6048
  // the context and should handled individually by the calling code.
5569
6049
  // See https://cloud.google.com/apis/design/errors.
5570
6050
  case F:
5571
6051
  case q:
5572
6052
  case O:
5573
- case k:
6053
+ case L:
5574
6054
  return !0;
5575
6055
  }
5576
6056
  }(e);
@@ -5595,7 +6075,7 @@ class Lr {
5595
6075
  * See the License for the specific language governing permissions and
5596
6076
  * limitations under the License.
5597
6077
  */
5598
- /** The Platform's 'document' implementation or null if not available. */ function kr() {
6078
+ /** The Platform's 'document' implementation or null if not available. */ function zr() {
5599
6079
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5600
6080
  // eslint-disable-next-line no-restricted-globals
5601
6081
  return "undefined" != typeof document ? document : null;
@@ -5627,10 +6107,10 @@ class Lr {
5627
6107
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5628
6108
  * in newer versions of TypeScript defines `finally`, which is not available in
5629
6109
  * IE.
5630
- */ class Ur {
6110
+ */ class Wr {
5631
6111
  constructor(t, e, n, r, s) {
5632
6112
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
5633
- this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
6113
+ this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5634
6114
  // It's normal for the deferred promise to be canceled (due to cancellation)
5635
6115
  // and so we attach a dummy catch callback to avoid
5636
6116
  // 'UnhandledPromiseRejectionWarning' log spam.
@@ -5650,7 +6130,7 @@ class Lr {
5650
6130
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
5651
6131
  * the DelayedOperation class public.
5652
6132
  */ static createAndSchedule(t, e, n, r, s) {
5653
- const i = Date.now() + n, o = new Ur(t, e, i, r, s);
6133
+ const i = Date.now() + n, o = new Wr(t, e, i, r, s);
5654
6134
  return o.start(n), o;
5655
6135
  }
5656
6136
  /**
@@ -5672,7 +6152,7 @@ class Lr {
5672
6152
  * As long as the operation has not yet been run, calling cancel() provides a
5673
6153
  * guarantee that the operation will not be run.
5674
6154
  */ cancel(t) {
5675
- null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new U(A, "Operation cancelled" + (t ? ": " + t : ""))));
6155
+ null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(I, "Operation cancelled" + (t ? ": " + t : ""))));
5676
6156
  }
5677
6157
  handleDelayElapsed() {
5678
6158
  this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
@@ -5699,21 +6179,21 @@ class Lr {
5699
6179
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5700
6180
  * See the License for the specific language governing permissions and
5701
6181
  * limitations under the License.
5702
- */ class jr {
6182
+ */ class Gr {
5703
6183
  constructor() {
5704
6184
  // The last promise in the queue.
5705
6185
  this.Nt = Promise.resolve(),
5706
6186
  // A list of retryable operations. Retryable operations are run in order and
5707
6187
  // retried with backoff.
5708
- this.Dt = [],
6188
+ this.$t = [],
5709
6189
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
5710
6190
  // be changed again.
5711
- this.$t = !1,
6191
+ this.Dt = !1,
5712
6192
  // Operations scheduled to be queued in the future. Operations are
5713
6193
  // automatically removed after they are run or canceled.
5714
- this.St = [],
6194
+ this.xt = [],
5715
6195
  // visible for testing
5716
- this.xt = null,
6196
+ this.St = null,
5717
6197
  // Flag set while there's an outstanding AsyncQueue operation, used for
5718
6198
  // assertion sanity-checks.
5719
6199
  this.Ft = !1,
@@ -5722,19 +6202,19 @@ class Lr {
5722
6202
  // List of TimerIds to fast-forward delays for.
5723
6203
  this.Ot = [],
5724
6204
  // Backoff timer used to schedule retries for retryable operations
5725
- this.At = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
6205
+ this.It = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
5726
6206
  // Visibility handler that triggers an immediate retry of all retryable
5727
6207
  // operations. Meant to speed up recovery when we regain file system access
5728
6208
  // after page comes into foreground.
5729
- this.Ct = () => {
5730
- const t = kr();
5731
- t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.At.H();
6209
+ this.kt = () => {
6210
+ const t = zr();
6211
+ t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.Y();
5732
6212
  };
5733
- const t = kr();
5734
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
6213
+ const t = zr();
6214
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.kt);
5735
6215
  }
5736
6216
  get isShuttingDown() {
5737
- return this.$t;
6217
+ return this.Dt;
5738
6218
  }
5739
6219
  /**
5740
6220
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -5744,38 +6224,38 @@ class Lr {
5744
6224
  this.enqueue(t);
5745
6225
  }
5746
6226
  enqueueAndForgetEvenWhileRestricted(t) {
5747
- this.Lt(),
6227
+ this.Ct(),
5748
6228
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
5749
- this.kt(t);
6229
+ this.Lt(t);
5750
6230
  }
5751
6231
  enterRestrictedMode(t) {
5752
- if (!this.$t) {
5753
- this.$t = !0, this.qt = t || !1;
5754
- const e = kr();
5755
- e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
6232
+ if (!this.Dt) {
6233
+ this.Dt = !0, this.qt = t || !1;
6234
+ const e = zr();
6235
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.kt);
5756
6236
  }
5757
6237
  }
5758
6238
  enqueue(t) {
5759
- if (this.Lt(), this.$t)
6239
+ if (this.Ct(), this.Dt)
5760
6240
  // Return a Promise which never resolves.
5761
6241
  return new Promise((() => {}));
5762
6242
  // Create a deferred Promise that we can return to the callee. This
5763
6243
  // allows us to return a "hanging Promise" only to the callee and still
5764
6244
  // advance the queue even when the operation is not run.
5765
- const e = new j;
5766
- return this.kt((() => this.$t && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
6245
+ const e = new U;
6246
+ return this.Lt((() => this.Dt && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
5767
6247
  e.promise))).then((() => e.promise));
5768
6248
  }
5769
6249
  enqueueRetryable(t) {
5770
- this.enqueueAndForget((() => (this.Dt.push(t), this.Ut())));
6250
+ this.enqueueAndForget((() => (this.$t.push(t), this.Mt())));
5771
6251
  }
5772
6252
  /**
5773
6253
  * Runs the next operation from the retryable queue. If the operation fails,
5774
6254
  * reschedules with backoff.
5775
- */ async Ut() {
5776
- if (0 !== this.Dt.length) {
6255
+ */ async Mt() {
6256
+ if (0 !== this.$t.length) {
5777
6257
  try {
5778
- await this.Dt[0](), this.Dt.shift(), this.At.reset();
6258
+ await this.$t[0](), this.$t.shift(), this.It.reset();
5779
6259
  } catch (t) {
5780
6260
  if (!
5781
6261
  /**
@@ -5819,7 +6299,7 @@ class Lr {
5819
6299
  // Failure will be handled by AsyncQueue
5820
6300
  p("AsyncQueue", "Operation failed with retryable error: " + t);
5821
6301
  }
5822
- this.Dt.length > 0 &&
6302
+ this.$t.length > 0 &&
5823
6303
  // If there are additional operations, we re-schedule `retryNextOp()`.
5824
6304
  // This is necessary to run retryable operations that failed during
5825
6305
  // their initial attempt since we don't know whether they are already
@@ -5830,12 +6310,12 @@ class Lr {
5830
6310
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
5831
6311
  // new backoff on every call, there is only ever a single additional
5832
6312
  // operation in the queue.
5833
- this.At.W((() => this.Ut()));
6313
+ this.It.G((() => this.Mt()));
5834
6314
  }
5835
6315
  }
5836
- kt(t) {
6316
+ Lt(t) {
5837
6317
  const e = this.Nt.then((() => (this.Ft = !0, t().catch((t => {
5838
- this.xt = t, this.Ft = !1;
6318
+ this.St = t, this.Ft = !1;
5839
6319
  const e =
5840
6320
  /**
5841
6321
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -5880,20 +6360,20 @@ class Lr {
5880
6360
  return this.Nt = e, e;
5881
6361
  }
5882
6362
  enqueueAfterDelay(t, e, n) {
5883
- this.Lt(),
6363
+ this.Ct(),
5884
6364
  // Fast-forward delays for timerIds that have been overriden.
5885
6365
  this.Ot.indexOf(t) > -1 && (e = 0);
5886
- const r = Ur.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5887
- return this.St.push(r), r;
6366
+ const r = Wr.createAndSchedule(this, t, e, n, (t => this.Ut(t)));
6367
+ return this.xt.push(r), r;
5888
6368
  }
5889
- Lt() {
5890
- this.xt && v();
6369
+ Ct() {
6370
+ this.St && v();
5891
6371
  }
5892
6372
  verifyOperationInProgress() {}
5893
6373
  /**
5894
6374
  * Waits until all currently queued tasks are finished executing. Delayed
5895
6375
  * operations are not run.
5896
- */ async Mt() {
6376
+ */ async jt() {
5897
6377
  // Operations in the queue prior to draining may have enqueued additional
5898
6378
  // operations. Keep draining the queue until the tail is no longer advanced,
5899
6379
  // which indicates that no more new operations were enqueued and that all
@@ -5907,7 +6387,7 @@ class Lr {
5907
6387
  * For Tests: Determine if a delayed operation with a particular TimerId
5908
6388
  * exists.
5909
6389
  */ Bt(t) {
5910
- for (const e of this.St) if (e.timerId === t) return !0;
6390
+ for (const e of this.xt) if (e.timerId === t) return !0;
5911
6391
  return !1;
5912
6392
  }
5913
6393
  /**
@@ -5918,29 +6398,29 @@ class Lr {
5918
6398
  * @returns a Promise that resolves once all operations have been run.
5919
6399
  */ zt(t) {
5920
6400
  // Note that draining may generate more delayed ops, so we do that first.
5921
- return this.Mt().then((() => {
6401
+ return this.jt().then((() => {
5922
6402
  // Run ops in the same order they'd run if they ran naturally.
5923
- this.St.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
5924
- for (const e of this.St) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
5925
- return this.Mt();
6403
+ this.xt.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
6404
+ for (const e of this.xt) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
6405
+ return this.jt();
5926
6406
  }));
5927
6407
  }
5928
6408
  /**
5929
6409
  * For Tests: Skip all subsequent delays for a timer id.
5930
- */ Gt(t) {
6410
+ */ Wt(t) {
5931
6411
  this.Ot.push(t);
5932
6412
  }
5933
- /** Called once a DelayedOperation is run or canceled. */ jt(t) {
6413
+ /** Called once a DelayedOperation is run or canceled. */ Ut(t) {
5934
6414
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5935
- const e = this.St.indexOf(t);
5936
- this.St.splice(e, 1);
6415
+ const e = this.xt.indexOf(t);
6416
+ this.xt.splice(e, 1);
5937
6417
  }
5938
6418
  }
5939
6419
 
5940
- class Mr {
6420
+ class Kr {
5941
6421
  /** @hideconstructor */
5942
6422
  constructor(t, e) {
5943
- this._firestore = t, this._transaction = e, this._dataReader = Dn(t);
6423
+ this._firestore = t, this._transaction = e, this._dataReader = qn(t);
5944
6424
  }
5945
6425
  /**
5946
6426
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -5948,25 +6428,25 @@ class Mr {
5948
6428
  * @param documentRef - A reference to the document to be read.
5949
6429
  * @returns A `DocumentSnapshot` with the read data.
5950
6430
  */ get(t) {
5951
- const e = Fr(t, this._firestore), n = new br(this._firestore);
6431
+ const e = Lr(t, this._firestore), n = new Rr(this._firestore);
5952
6432
  return this._transaction.lookup([ e._key ]).then((t => {
5953
6433
  if (!t || 1 !== t.length) return v();
5954
6434
  const r = t[0];
5955
- if (r.isFoundDocument()) return new Kn(this._firestore, n, r.key, r, e.converter);
5956
- if (r.isNoDocument()) return new Kn(this._firestore, n, e._key, null, e.converter);
6435
+ if (r.isFoundDocument()) return new er(this._firestore, n, r.key, r, e.converter);
6436
+ if (r.isNoDocument()) return new er(this._firestore, n, e._key, null, e.converter);
5957
6437
  throw v();
5958
6438
  }));
5959
6439
  }
5960
6440
  set(t, e, n) {
5961
- const r = Fr(t, this._firestore), s = vr(r.converter, e, n), i = $n(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
6441
+ const r = Lr(t, this._firestore), s = Ar(r.converter, e, n), i = On(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5962
6442
  return this._transaction.set(r._key, i), this;
5963
6443
  }
5964
6444
  update(t, e, n, ...r) {
5965
- const s = Fr(t, this._firestore);
6445
+ const s = Lr(t, this._firestore);
5966
6446
  // For Compat types, we have to "extract" the underlying types before
5967
6447
  // performing validation.
5968
6448
  let i;
5969
- return i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(this._dataReader, "Transaction.update", s._key, e, n, r) : Ln(this._dataReader, "Transaction.update", s._key, e),
6449
+ return i = "string" == typeof (e = l(e)) || e instanceof In ? zn(this._dataReader, "Transaction.update", s._key, e, n, r) : Bn(this._dataReader, "Transaction.update", s._key, e),
5970
6450
  this._transaction.update(s._key, i), this;
5971
6451
  }
5972
6452
  /**
@@ -5975,7 +6455,7 @@ class Mr {
5975
6455
  * @param documentRef - A reference to the document to be deleted.
5976
6456
  * @returns This `Transaction` instance. Used for chaining method calls.
5977
6457
  */ delete(t) {
5978
- const e = Fr(t, this._firestore);
6458
+ const e = Lr(t, this._firestore);
5979
6459
  return this._transaction.delete(e._key), this;
5980
6460
  }
5981
6461
  }
@@ -5992,17 +6472,19 @@ class Mr {
5992
6472
  * transaction against.
5993
6473
  * @param updateFunction - The function to execute within the transaction
5994
6474
  * context.
6475
+ * @param options - An options object to configure maximum number of attempts to
6476
+ * commit.
5995
6477
  * @returns If the transaction completed successfully or was explicitly aborted
5996
6478
  * (the `updateFunction` returned a failed promise), the promise returned by the
5997
6479
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5998
6480
  * rejected promise with the corresponding failure error is returned.
5999
- */ function Br(t, e, n) {
6000
- const r = rn(t = ut(t, on)), s = Object.assign(Object.assign({}, Cr), n);
6481
+ */ function Qr(t, e, n) {
6482
+ const r = an(t = ut(t, ln)), s = Object.assign(Object.assign({}, jr), n);
6001
6483
  !function(t) {
6002
- if (t.maxAttempts < 1) throw new U(R, "Max attempts must be at least 1");
6484
+ if (t.maxAttempts < 1) throw new M(R, "Max attempts must be at least 1");
6003
6485
  }(s);
6004
- const i = new j;
6005
- return new Lr(new jr, r, s, (n => e(new Mr(t, n))), i).run(), i.promise;
6486
+ const i = new U;
6487
+ return new Br(new Gr, r, s, (n => e(new Kr(t, n))), i).run(), i.promise;
6006
6488
  }
6007
6489
 
6008
6490
  /**
@@ -6015,11 +6497,11 @@ class Mr {
6015
6497
  */ !function(t) {
6016
6498
  d = t;
6017
6499
  }(`${s}_lite`), n(new i("firestore/lite", ((t, {options: e}) => {
6018
- const n = t.getProvider("app").getImmediate(), r = new on(n, new G(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
6500
+ const n = t.getProvider("app").getImmediate(), r = new ln(n, new W(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
6019
6501
  return e && r._setSettings(e), r;
6020
6502
  }), "PUBLIC")),
6021
6503
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
6022
- r("firestore-lite", "3.4.9", "rn"), r("firestore-lite", "3.4.9", "esm2017");
6504
+ r("firestore-lite", "3.4.10-canary.8e952e2ee", "rn"), r("firestore-lite", "3.4.10-canary.8e952e2ee", "esm2017");
6023
6505
 
6024
- export { bn as Bytes, dn as CollectionReference, ln as DocumentReference, Kn as DocumentSnapshot, gn as FieldPath, En as FieldValue, on as Firestore, U as FirestoreError, Tn as GeoPoint, fn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Xn as QuerySnapshot, vt as Timestamp, Mr as Transaction, xr as WriteBatch, Pr as addDoc, $r as arrayRemove, Dr as arrayUnion, wn as collection, mn as collectionGroup, an as connectFirestoreEmulator, Rr as deleteDoc, Vr as deleteField, pn as doc, vn as documentId, mr as endAt, wr as endBefore, Er as getDoc, Tr as getDocs, cn as getFirestore, Sr as increment, un as initializeFirestore, cr as limit, ar as limitToLast, or as orderBy, nr as query, _n as queryEqual, yn as refEqual, Br as runTransaction, Nr as serverTimestamp, Ar as setDoc, m as setLogLevel, Zn as snapshotEqual, fr as startAfter, lr as startAt, hn as terminate, Ir as updateDoc, sr as where, qr as writeBatch };
6506
+ export { Rn as Bytes, _n as CollectionReference, pn as DocumentReference, er as DocumentSnapshot, In as FieldPath, Pn as FieldValue, ln as Firestore, M as FirestoreError, Vn as GeoPoint, yn as Query, or as QueryConstraint, nr as QueryDocumentSnapshot, rr as QuerySnapshot, vt as Timestamp, Kr as Transaction, Cr as WriteBatch, xr as addDoc, Or as arrayRemove, qr as arrayUnion, gn as collection, vn as collectionGroup, wn as connectFirestoreEmulator, Dr as deleteDoc, Sr as deleteField, bn as doc, An as documentId, vr as endAt, gr as endBefore, Pr as getDoc, Vr as getDocs, dn as getFirestore, kr as increment, fn as initializeFirestore, dr as limit, wr as limitToLast, lr as orderBy, ur as query, Tn as queryEqual, En as refEqual, Qr as runTransaction, Fr as serverTimestamp, Nr as setDoc, m as setLogLevel, sr as snapshotEqual, yr as startAfter, pr as startAt, mn as terminate, $r as updateDoc, ar as where, Mr as writeBatch };
6025
6507
  //# sourceMappingURL=index.rn.esm2017.js.map