@thefittingroom/shop-ui 3.2.3 → 4.2.0

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 (70) hide show
  1. package/dist/index.js +22270 -0
  2. package/dist/index.umd.cjs +22274 -0
  3. package/package.json +20 -22
  4. package/.env.dev +0 -2
  5. package/.env.example +0 -3
  6. package/.env.prod +0 -2
  7. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ErrorModal.js +0 -43
  8. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ErrorModal.js.map +0 -1
  9. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/FitModal.js +0 -106
  10. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/FitModal.js.map +0 -1
  11. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ForgotPasswordModal.js +0 -43
  12. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ForgotPasswordModal.js.map +0 -1
  13. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/LoadingAvatarModal.js +0 -38
  14. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/LoadingAvatarModal.js.map +0 -1
  15. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/LoggedOutModal.js +0 -36
  16. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/LoggedOutModal.js.map +0 -1
  17. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ModalManager.js +0 -107
  18. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ModalManager.js.map +0 -1
  19. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/NoAvatarModal.js +0 -19
  20. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/NoAvatarModal.js.map +0 -1
  21. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ResetLinkModal.js +0 -31
  22. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ResetLinkModal.js.map +0 -1
  23. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ScanCodeModal.js +0 -77
  24. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/ScanCodeModal.js.map +0 -1
  25. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/SignInModal.js +0 -94
  26. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/SignInModal.js.map +0 -1
  27. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/SizeErrorModal.js +0 -43
  28. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/SizeErrorModal.js.map +0 -1
  29. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/TryOnModal.js +0 -51
  30. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Modals/TryOnModal.js.map +0 -1
  31. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/SizeRec.js +0 -365
  32. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/SizeRec.js.map +0 -1
  33. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Vto.js +0 -52
  34. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/Vto.js.map +0 -1
  35. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/index.js +0 -16
  36. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/index.js.map +0 -1
  37. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/locale.js +0 -108
  38. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/locale.js.map +0 -1
  39. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/slider.js +0 -44
  40. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/slider.js.map +0 -1
  41. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/svgs.js +0 -33
  42. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/svgs.js.map +0 -1
  43. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/uiError.js +0 -8
  44. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/uiError.js.map +0 -1
  45. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/helpers/telephone.js +0 -12368
  46. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/helpers/telephone.js.map +0 -1
  47. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/helpers/validations.js +0 -15
  48. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/helpers/validations.js.map +0 -1
  49. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/index.js +0 -3
  50. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/index.js.map +0 -1
  51. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/init.js +0 -7
  52. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/init.js.map +0 -1
  53. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/styles/index.js +0 -12
  54. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/styles/index.js.map +0 -1
  55. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr-modal.js +0 -77
  56. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr-modal.js.map +0 -1
  57. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr-size-rec.js +0 -202
  58. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr-size-rec.js.map +0 -1
  59. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr.js +0 -212
  60. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr.js.map +0 -1
  61. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/types/index.js +0 -15
  62. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/types/index.js.map +0 -1
  63. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/tsconfig.tsbuildinfo +0 -1
  64. package/README.md +0 -153
  65. package/dist/esm/index.js +0 -28142
  66. package/dist/esm/index.js.map +0 -1
  67. package/dist/esm/index.min.js +0 -3399
  68. package/dist/esm/index.min.js.map +0 -1
  69. package/dist/tsconfig.tsbuildinfo +0 -1
  70. package/index.html +0 -126
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.min.js","sources":["../../../src/components/slider.ts","../../node_modules/@thefittingroom/sdk/dist/esm/index.js","../../../src/components/Vto.ts","../../../src/components/locale.ts","../../node_modules/style-inject/dist/style-inject.es.js","../../../src/components/Modals/ErrorModal.ts","../../../src/components/svgs.ts","../../../src/components/Modals/LoadingAvatarModal.ts","../../../src/components/Modals/ModalManager.ts","../../../src/components/Modals/ScanCodeModal.ts","../../../src/tfr-modal.ts","../../../src/components/Modals/LoggedOutModal.ts","../../../src/components/Modals/NoAvatarModal.ts","../../../src/components/Modals/SignInModal.ts","../../../src/components/Modals/ForgotPasswordModal.ts","../../../src/components/Modals/TryOnModal.ts","../../../src/components/Modals/SizeErrorModal.ts","../../../src/components/Modals/FitModal.ts","../../../src/components/SizeRec.ts","../../../src/tfr-size-rec.ts","../../../src/types/index.ts","../../../src/tfr.ts","../../../src/helpers/validations.ts","../../../src/init.ts"],"sourcesContent":["function loadImageRecursive(imageURL, imageURLs) {\n let next = function () {\n if (imageURLs.length === 0) {\n return\n }\n loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1))\n }\n var img = new Image()\n img.onload = next\n img.onerror = next\n img.src = imageURL\n}\n\nfunction loadImages(imageURLs) {\n loadImageRecursive(imageURLs.slice(-1), imageURLs.slice(0, -1))\n}\n\nexport const InitImageSlider = (sliderID: string, onChange: (slider: HTMLInputElement, imageUrl: string) => void) => {\n const slider = <HTMLInputElement>document.getElementById(sliderID)\n if (!slider) {\n throw new Error(`Slider with id ${sliderID} not found`)\n }\n\n return {\n Load(imageURLs: string[], initialValue?: number) {\n if (!Array.isArray(imageURLs) || !imageURLs.length) {\n console.debug('slider has no images to load')\n return new Error('slider has no images to load')\n }\n loadImages(imageURLs)\n const defaultScrollValue = initialValue !== undefined ? initialValue : 0\n slider.value = defaultScrollValue.toString()\n slider.max = (imageURLs.length - 1).toString()\n\n const handleSliderChange = () => {\n const currentValue = parseInt((<HTMLInputElement>slider).value)\n onChange(slider, imageURLs[currentValue])\n }\n\n onChange(slider, imageURLs[defaultScrollValue])\n slider.removeEventListener('input', handleSliderChange)\n slider.addEventListener('input', handleSliderChange)\n\n return () => {\n slider.removeEventListener('input', handleSliderChange)\n }\n },\n }\n}\n","/*!\n* thefittingroom v2.0.8 (2025-08-04T16:23:04.367Z)\n* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.\n*/\n// Code generated by tygo. DO NOT EDIT.\n\nvar requests = /*#__PURE__*/Object.freeze({\n __proto__: null\n});\n\n// Code generated by tygo. DO NOT EDIT.\n\nvar responses = /*#__PURE__*/Object.freeze({\n __proto__: null\n});\n\nconst getDefaultsFromPostinstall = () => (undefined);\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst stringToByteArray$1 = function (str) {\n // TODO(user): Use native implementations if/when available\n const out = [];\n let p = 0;\n for (let i = 0; i < str.length; i++) {\n let c = str.charCodeAt(i);\n if (c < 128) {\n out[p++] = c;\n }\n else if (c < 2048) {\n out[p++] = (c >> 6) | 192;\n out[p++] = (c & 63) | 128;\n }\n else if ((c & 0xfc00) === 0xd800 &&\n i + 1 < str.length &&\n (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);\n out[p++] = (c >> 18) | 240;\n out[p++] = ((c >> 12) & 63) | 128;\n out[p++] = ((c >> 6) & 63) | 128;\n out[p++] = (c & 63) | 128;\n }\n else {\n out[p++] = (c >> 12) | 224;\n out[p++] = ((c >> 6) & 63) | 128;\n out[p++] = (c & 63) | 128;\n }\n }\n return out;\n};\n/**\n * Turns an array of numbers into the string given by the concatenation of the\n * characters to which the numbers correspond.\n * @param bytes Array of numbers representing characters.\n * @return Stringification of the array.\n */\nconst byteArrayToString = function (bytes) {\n // TODO(user): Use native implementations if/when available\n const out = [];\n let pos = 0, c = 0;\n while (pos < bytes.length) {\n const c1 = bytes[pos++];\n if (c1 < 128) {\n out[c++] = String.fromCharCode(c1);\n }\n else if (c1 > 191 && c1 < 224) {\n const c2 = bytes[pos++];\n out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));\n }\n else if (c1 > 239 && c1 < 365) {\n // Surrogate Pair\n const c2 = bytes[pos++];\n const c3 = bytes[pos++];\n const c4 = bytes[pos++];\n const u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) -\n 0x10000;\n out[c++] = String.fromCharCode(0xd800 + (u >> 10));\n out[c++] = String.fromCharCode(0xdc00 + (u & 1023));\n }\n else {\n const c2 = bytes[pos++];\n const c3 = bytes[pos++];\n out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n }\n }\n return out.join('');\n};\n// We define it as an object literal instead of a class because a class compiled down to es5 can't\n// be treeshaked. https://github.com/rollup/rollup/issues/1691\n// Static lookup maps, lazily populated by init_()\n// TODO(dlarocque): Define this as a class, since we no longer target ES5.\nconst base64 = {\n /**\n * Maps bytes to characters.\n */\n byteToCharMap_: null,\n /**\n * Maps characters to bytes.\n */\n charToByteMap_: null,\n /**\n * Maps bytes to websafe characters.\n * @private\n */\n byteToCharMapWebSafe_: null,\n /**\n * Maps websafe characters to bytes.\n * @private\n */\n charToByteMapWebSafe_: null,\n /**\n * Our default alphabet, shared between\n * ENCODED_VALS and ENCODED_VALS_WEBSAFE\n */\n ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',\n /**\n * Our default alphabet. Value 64 (=) is special; it means \"nothing.\"\n */\n get ENCODED_VALS() {\n return this.ENCODED_VALS_BASE + '+/=';\n },\n /**\n * Our websafe alphabet.\n */\n get ENCODED_VALS_WEBSAFE() {\n return this.ENCODED_VALS_BASE + '-_.';\n },\n /**\n * Whether this browser supports the atob and btoa functions. This extension\n * started at Mozilla but is now implemented by many browsers. We use the\n * ASSUME_* variables to avoid pulling in the full useragent detection library\n * but still allowing the standard per-browser compilations.\n *\n */\n HAS_NATIVE_SUPPORT: typeof atob === 'function',\n /**\n * Base64-encode an array of bytes.\n *\n * @param input An array of bytes (numbers with\n * value in [0, 255]) to encode.\n * @param webSafe Boolean indicating we should use the\n * alternative alphabet.\n * @return The base64 encoded string.\n */\n encodeByteArray(input, webSafe) {\n if (!Array.isArray(input)) {\n throw Error('encodeByteArray takes an array as a parameter');\n }\n this.init_();\n const byteToCharMap = webSafe\n ? this.byteToCharMapWebSafe_\n : this.byteToCharMap_;\n const output = [];\n for (let i = 0; i < input.length; i += 3) {\n const byte1 = input[i];\n const haveByte2 = i + 1 < input.length;\n const byte2 = haveByte2 ? input[i + 1] : 0;\n const haveByte3 = i + 2 < input.length;\n const byte3 = haveByte3 ? input[i + 2] : 0;\n const outByte1 = byte1 >> 2;\n const outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);\n let outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6);\n let outByte4 = byte3 & 0x3f;\n if (!haveByte3) {\n outByte4 = 64;\n if (!haveByte2) {\n outByte3 = 64;\n }\n }\n output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);\n }\n return output.join('');\n },\n /**\n * Base64-encode a string.\n *\n * @param input A string to encode.\n * @param webSafe If true, we should use the\n * alternative alphabet.\n * @return The base64 encoded string.\n */\n encodeString(input, webSafe) {\n // Shortcut for Mozilla browsers that implement\n // a native base64 encoder in the form of \"btoa/atob\"\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\n return btoa(input);\n }\n return this.encodeByteArray(stringToByteArray$1(input), webSafe);\n },\n /**\n * Base64-decode a string.\n *\n * @param input to decode.\n * @param webSafe True if we should use the\n * alternative alphabet.\n * @return string representing the decoded value.\n */\n decodeString(input, webSafe) {\n // Shortcut for Mozilla browsers that implement\n // a native base64 encoder in the form of \"btoa/atob\"\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\n return atob(input);\n }\n return byteArrayToString(this.decodeStringToByteArray(input, webSafe));\n },\n /**\n * Base64-decode a string.\n *\n * In base-64 decoding, groups of four characters are converted into three\n * bytes. If the encoder did not apply padding, the input length may not\n * be a multiple of 4.\n *\n * In this case, the last group will have fewer than 4 characters, and\n * padding will be inferred. If the group has one or two characters, it decodes\n * to one byte. If the group has three characters, it decodes to two bytes.\n *\n * @param input Input to decode.\n * @param webSafe True if we should use the web-safe alphabet.\n * @return bytes representing the decoded value.\n */\n decodeStringToByteArray(input, webSafe) {\n this.init_();\n const charToByteMap = webSafe\n ? this.charToByteMapWebSafe_\n : this.charToByteMap_;\n const output = [];\n for (let i = 0; i < input.length;) {\n const byte1 = charToByteMap[input.charAt(i++)];\n const haveByte2 = i < input.length;\n const byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;\n ++i;\n const haveByte3 = i < input.length;\n const byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;\n ++i;\n const haveByte4 = i < input.length;\n const byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;\n ++i;\n if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {\n throw new DecodeBase64StringError();\n }\n const outByte1 = (byte1 << 2) | (byte2 >> 4);\n output.push(outByte1);\n if (byte3 !== 64) {\n const outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2);\n output.push(outByte2);\n if (byte4 !== 64) {\n const outByte3 = ((byte3 << 6) & 0xc0) | byte4;\n output.push(outByte3);\n }\n }\n }\n return output;\n },\n /**\n * Lazy static initialization function. Called before\n * accessing any of the static map variables.\n * @private\n */\n init_() {\n if (!this.byteToCharMap_) {\n this.byteToCharMap_ = {};\n this.charToByteMap_ = {};\n this.byteToCharMapWebSafe_ = {};\n this.charToByteMapWebSafe_ = {};\n // We want quick mappings back and forth, so we precompute two maps.\n for (let i = 0; i < this.ENCODED_VALS.length; i++) {\n this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);\n this.charToByteMap_[this.byteToCharMap_[i]] = i;\n this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);\n this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;\n // Be forgiving when decoding and correctly decode both encodings.\n if (i >= this.ENCODED_VALS_BASE.length) {\n this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;\n this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;\n }\n }\n }\n }\n};\n/**\n * An error encountered while decoding base64 string.\n */\nclass DecodeBase64StringError extends Error {\n constructor() {\n super(...arguments);\n this.name = 'DecodeBase64StringError';\n }\n}\n/**\n * URL-safe base64 encoding\n */\nconst base64Encode = function (str) {\n const utf8Bytes = stringToByteArray$1(str);\n return base64.encodeByteArray(utf8Bytes, true);\n};\n/**\n * URL-safe base64 encoding (without \".\" padding in the end).\n * e.g. Used in JSON Web Token (JWT) parts.\n */\nconst base64urlEncodeWithoutPadding = function (str) {\n // Use base64url encoding and remove padding in the end (dot characters).\n return base64Encode(str).replace(/\\./g, '');\n};\n/**\n * URL-safe base64 decoding\n *\n * NOTE: DO NOT use the global atob() function - it does NOT support the\n * base64Url variant encoding.\n *\n * @param str To be decoded\n * @return Decoded result, if possible\n */\nconst base64Decode = function (str) {\n try {\n return base64.decodeString(str, true);\n }\n catch (e) {\n console.error('base64Decode failed: ', e);\n }\n return null;\n};\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Polyfill for `globalThis` object.\n * @returns the `globalThis` object for the given environment.\n * @public\n */\nfunction getGlobal() {\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('Unable to locate global object.');\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;\n/**\n * Attempt to read defaults from a JSON string provided to\n * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in\n * process(.)env(.)__FIREBASE_DEFAULTS_PATH__\n * The dots are in parens because certain compilers (Vite?) cannot\n * handle seeing that variable in comments.\n * See https://github.com/firebase/firebase-js-sdk/issues/6838\n */\nconst getDefaultsFromEnvVariable = () => {\n if (typeof process === 'undefined' || typeof process.env === 'undefined') {\n return;\n }\n const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__;\n if (defaultsJsonString) {\n return JSON.parse(defaultsJsonString);\n }\n};\nconst getDefaultsFromCookie = () => {\n if (typeof document === 'undefined') {\n return;\n }\n let match;\n try {\n match = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);\n }\n catch (e) {\n // Some environments such as Angular Universal SSR have a\n // `document` object but error on accessing `document.cookie`.\n return;\n }\n const decoded = match && base64Decode(match[1]);\n return decoded && JSON.parse(decoded);\n};\n/**\n * Get the __FIREBASE_DEFAULTS__ object. It checks in order:\n * (1) if such an object exists as a property of `globalThis`\n * (2) if such an object was provided on a shell environment variable\n * (3) if such an object exists in a cookie\n * @public\n */\nconst getDefaults = () => {\n try {\n return (getDefaultsFromPostinstall() ||\n getDefaultsFromGlobal() ||\n getDefaultsFromEnvVariable() ||\n getDefaultsFromCookie());\n }\n catch (e) {\n /**\n * Catch-all for being unable to get __FIREBASE_DEFAULTS__ due\n * to any environment case we have not accounted for. Log to\n * info instead of swallowing so we can find these unknown cases\n * and add paths for them if needed.\n */\n console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);\n return;\n }\n};\n/**\n * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object\n * for the given product.\n * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available\n * @public\n */\nconst getDefaultEmulatorHost = (productName) => { var _a, _b; return (_b = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.emulatorHosts) === null || _b === void 0 ? void 0 : _b[productName]; };\n/**\n * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object\n * for the given product.\n * @returns a pair of hostname and port like `[\"::1\", 4000]` if available\n * @public\n */\nconst getDefaultEmulatorHostnameAndPort = (productName) => {\n const host = getDefaultEmulatorHost(productName);\n if (!host) {\n return undefined;\n }\n const separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.\n if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {\n throw new Error(`Invalid host ${host} with no separate hostname and port!`);\n }\n // eslint-disable-next-line no-restricted-globals\n const port = parseInt(host.substring(separatorIndex + 1), 10);\n if (host[0] === '[') {\n // Bracket-quoted `[ipv6addr]:port` => return \"ipv6addr\" (without brackets).\n return [host.substring(1, separatorIndex - 1), port];\n }\n else {\n return [host.substring(0, separatorIndex), port];\n }\n};\n/**\n * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.\n * @public\n */\nconst getDefaultAppConfig = () => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.config; };\n/**\n * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties\n * prefixed by \"_\")\n * @public\n */\nconst getExperimentalSetting = (name) => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a[`_${name}`]; };\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass Deferred {\n constructor() {\n this.reject = () => { };\n this.resolve = () => { };\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n /**\n * Our API internals are not promisified and cannot because our callback APIs have subtle expectations around\n * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback\n * and returns a node-style callback which will resolve or reject the Deferred's promise.\n */\n wrapCallback(callback) {\n return (error, value) => {\n if (error) {\n this.reject(error);\n }\n else {\n this.resolve(value);\n }\n if (typeof callback === 'function') {\n // Attaching noop handler just in case developer wasn't expecting\n // promises\n this.promise.catch(() => { });\n // Some of our callbacks don't expect a value and our own tests\n // assert that the parameter length is 1\n if (callback.length === 1) {\n callback(error);\n }\n else {\n callback(error, value);\n }\n }\n };\n }\n}\n\n/**\n * @license\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Checks whether host is a cloud workstation or not.\n * @public\n */\nfunction isCloudWorkstation(url) {\n // `isCloudWorkstation` is called without protocol in certain connect*Emulator functions\n // In HTTP request builders, it's called with the protocol.\n // If called with protocol prefix, it's a valid URL, so we extract the hostname\n // If called without, we assume the string is the hostname.\n try {\n const host = url.startsWith('http://') || url.startsWith('https://')\n ? new URL(url).hostname\n : url;\n return host.endsWith('.cloudworkstations.dev');\n }\n catch (_a) {\n return false;\n }\n}\n/**\n * Makes a fetch request to the given server.\n * Mostly used for forwarding cookies in Firebase Studio.\n * @public\n */\nasync function pingServer(endpoint) {\n const result = await fetch(endpoint, {\n credentials: 'include'\n });\n return result.ok;\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction createMockUserToken(token, projectId) {\n if (token.uid) {\n throw new Error('The \"uid\" field is no longer supported by mockUserToken. Please use \"sub\" instead for Firebase Auth User ID.');\n }\n // Unsecured JWTs use \"none\" as the algorithm.\n const header = {\n alg: 'none',\n type: 'JWT'\n };\n const project = projectId || 'demo-project';\n const iat = token.iat || 0;\n const sub = token.sub || token.user_id;\n if (!sub) {\n throw new Error(\"mockUserToken must contain 'sub' or 'user_id' field!\");\n }\n const payload = Object.assign({ \n // Set all required fields to decent defaults\n iss: `https://securetoken.google.com/${project}`, aud: project, iat, exp: iat + 3600, auth_time: iat, sub, user_id: sub, firebase: {\n sign_in_provider: 'custom',\n identities: {}\n } }, token);\n // Unsecured JWTs use the empty string as a signature.\n const signature = '';\n return [\n base64urlEncodeWithoutPadding(JSON.stringify(header)),\n base64urlEncodeWithoutPadding(JSON.stringify(payload)),\n signature\n ].join('.');\n}\nconst emulatorStatus = {};\n// Checks whether any products are running on an emulator\nfunction getEmulatorSummary() {\n const summary = {\n prod: [],\n emulator: []\n };\n for (const key of Object.keys(emulatorStatus)) {\n if (emulatorStatus[key]) {\n summary.emulator.push(key);\n }\n else {\n summary.prod.push(key);\n }\n }\n return summary;\n}\nfunction getOrCreateEl(id) {\n let parentDiv = document.getElementById(id);\n let created = false;\n if (!parentDiv) {\n parentDiv = document.createElement('div');\n parentDiv.setAttribute('id', id);\n created = true;\n }\n return { created, element: parentDiv };\n}\nlet previouslyDismissed = false;\n/**\n * Updates Emulator Banner. Primarily used for Firebase Studio\n * @param name\n * @param isRunningEmulator\n * @public\n */\nfunction updateEmulatorBanner(name, isRunningEmulator) {\n if (typeof window === 'undefined' ||\n typeof document === 'undefined' ||\n !isCloudWorkstation(window.location.host) ||\n emulatorStatus[name] === isRunningEmulator ||\n emulatorStatus[name] || // If already set to use emulator, can't go back to prod.\n previouslyDismissed) {\n return;\n }\n emulatorStatus[name] = isRunningEmulator;\n function prefixedId(id) {\n return `__firebase__banner__${id}`;\n }\n const bannerId = '__firebase__banner';\n const summary = getEmulatorSummary();\n const showError = summary.prod.length > 0;\n function tearDown() {\n const element = document.getElementById(bannerId);\n if (element) {\n element.remove();\n }\n }\n function setupBannerStyles(bannerEl) {\n bannerEl.style.display = 'flex';\n bannerEl.style.background = '#7faaf0';\n bannerEl.style.position = 'fixed';\n bannerEl.style.bottom = '5px';\n bannerEl.style.left = '5px';\n bannerEl.style.padding = '.5em';\n bannerEl.style.borderRadius = '5px';\n bannerEl.style.alignItems = 'center';\n }\n function setupIconStyles(prependIcon, iconId) {\n prependIcon.setAttribute('width', '24');\n prependIcon.setAttribute('id', iconId);\n prependIcon.setAttribute('height', '24');\n prependIcon.setAttribute('viewBox', '0 0 24 24');\n prependIcon.setAttribute('fill', 'none');\n prependIcon.style.marginLeft = '-6px';\n }\n function setupCloseBtn() {\n const closeBtn = document.createElement('span');\n closeBtn.style.cursor = 'pointer';\n closeBtn.style.marginLeft = '16px';\n closeBtn.style.fontSize = '24px';\n closeBtn.innerHTML = ' &times;';\n closeBtn.onclick = () => {\n previouslyDismissed = true;\n tearDown();\n };\n return closeBtn;\n }\n function setupLinkStyles(learnMoreLink, learnMoreId) {\n learnMoreLink.setAttribute('id', learnMoreId);\n learnMoreLink.innerText = 'Learn more';\n learnMoreLink.href =\n 'https://firebase.google.com/docs/studio/preview-apps#preview-backend';\n learnMoreLink.setAttribute('target', '__blank');\n learnMoreLink.style.paddingLeft = '5px';\n learnMoreLink.style.textDecoration = 'underline';\n }\n function setupDom() {\n const banner = getOrCreateEl(bannerId);\n const firebaseTextId = prefixedId('text');\n const firebaseText = document.getElementById(firebaseTextId) || document.createElement('span');\n const learnMoreId = prefixedId('learnmore');\n const learnMoreLink = document.getElementById(learnMoreId) ||\n document.createElement('a');\n const prependIconId = prefixedId('preprendIcon');\n const prependIcon = document.getElementById(prependIconId) ||\n document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n if (banner.created) {\n // update styles\n const bannerEl = banner.element;\n setupBannerStyles(bannerEl);\n setupLinkStyles(learnMoreLink, learnMoreId);\n const closeBtn = setupCloseBtn();\n setupIconStyles(prependIcon, prependIconId);\n bannerEl.append(prependIcon, firebaseText, learnMoreLink, closeBtn);\n document.body.appendChild(bannerEl);\n }\n if (showError) {\n firebaseText.innerText = `Preview backend disconnected.`;\n prependIcon.innerHTML = `<g clip-path=\"url(#clip0_6013_33858)\">\n<path d=\"M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z\" fill=\"#212121\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_6013_33858\">\n<rect width=\"24\" height=\"24\" fill=\"white\"/>\n</clipPath>\n</defs>`;\n }\n else {\n prependIcon.innerHTML = `<g clip-path=\"url(#clip0_6083_34804)\">\n<path d=\"M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z\" fill=\"#212121\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_6083_34804\">\n<rect width=\"24\" height=\"24\" fill=\"white\"/>\n</clipPath>\n</defs>`;\n firebaseText.innerText = 'Preview backend running in this workspace.';\n }\n firebaseText.setAttribute('id', firebaseTextId);\n }\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', setupDom);\n }\n else {\n setupDom();\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Returns navigator.userAgent string or '' if it's not defined.\n * @return user agent string\n */\nfunction getUA() {\n if (typeof navigator !== 'undefined' &&\n typeof navigator['userAgent'] === 'string') {\n return navigator['userAgent'];\n }\n else {\n return '';\n }\n}\n/**\n * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.\n *\n * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap\n * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally\n * wait for a callback.\n */\nfunction isMobileCordova() {\n return (typeof window !== 'undefined' &&\n // @ts-ignore Setting up an broadly applicable index signature for Window\n // just to deal with this case would probably be a bad idea.\n !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) &&\n /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()));\n}\n/**\n * Detect Node.js.\n *\n * @return true if Node.js environment is detected or specified.\n */\n// Node detection logic from: https://github.com/iliakan/detect-node/\nfunction isNode() {\n var _a;\n const forceEnvironment = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.forceEnvironment;\n if (forceEnvironment === 'node') {\n return true;\n }\n else if (forceEnvironment === 'browser') {\n return false;\n }\n try {\n return (Object.prototype.toString.call(global.process) === '[object process]');\n }\n catch (e) {\n return false;\n }\n}\n/**\n * Detect Cloudflare Worker context.\n */\nfunction isCloudflareWorker() {\n return (typeof navigator !== 'undefined' &&\n navigator.userAgent === 'Cloudflare-Workers');\n}\nfunction isBrowserExtension() {\n const runtime = typeof chrome === 'object'\n ? chrome.runtime\n : typeof browser === 'object'\n ? browser.runtime\n : undefined;\n return typeof runtime === 'object' && runtime.id !== undefined;\n}\n/**\n * Detect React Native.\n *\n * @return true if ReactNative environment is detected.\n */\nfunction isReactNative() {\n return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');\n}\n/** Detects Internet Explorer. */\nfunction isIE() {\n const ua = getUA();\n return ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;\n}\n/** Returns true if we are running in Safari. */\nfunction isSafari() {\n return (!isNode() &&\n !!navigator.userAgent &&\n navigator.userAgent.includes('Safari') &&\n !navigator.userAgent.includes('Chrome'));\n}\n/**\n * This method checks if indexedDB is supported by current browser/service worker context\n * @return true if indexedDB is supported by current browser/service worker context\n */\nfunction isIndexedDBAvailable() {\n try {\n return typeof indexedDB === 'object';\n }\n catch (e) {\n return false;\n }\n}\n/**\n * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject\n * if errors occur during the database open operation.\n *\n * @throws exception if current browser/sw context can't run idb.open (ex: Safari iframe, Firefox\n * private browsing)\n */\nfunction validateIndexedDBOpenable() {\n return new Promise((resolve, reject) => {\n try {\n let preExist = true;\n const DB_CHECK_NAME = 'validate-browser-context-for-indexeddb-analytics-module';\n const request = self.indexedDB.open(DB_CHECK_NAME);\n request.onsuccess = () => {\n request.result.close();\n // delete database only when it doesn't pre-exist\n if (!preExist) {\n self.indexedDB.deleteDatabase(DB_CHECK_NAME);\n }\n resolve(true);\n };\n request.onupgradeneeded = () => {\n preExist = false;\n };\n request.onerror = () => {\n var _a;\n reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || '');\n };\n }\n catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @fileoverview Standardized Firebase Error.\n *\n * Usage:\n *\n * // TypeScript string literals for type-safe codes\n * type Err =\n * 'unknown' |\n * 'object-not-found'\n * ;\n *\n * // Closure enum for type-safe error codes\n * // at-enum {string}\n * var Err = {\n * UNKNOWN: 'unknown',\n * OBJECT_NOT_FOUND: 'object-not-found',\n * }\n *\n * let errors: Map<Err, string> = {\n * 'generic-error': \"Unknown error\",\n * 'file-not-found': \"Could not find file: {$file}\",\n * };\n *\n * // Type-safe function - must pass a valid error code as param.\n * let error = new ErrorFactory<Err>('service', 'Service', errors);\n *\n * ...\n * throw error.create(Err.GENERIC);\n * ...\n * throw error.create(Err.FILE_NOT_FOUND, {'file': fileName});\n * ...\n * // Service: Could not file file: foo.txt (service/file-not-found).\n *\n * catch (e) {\n * assert(e.message === \"Could not find file: foo.txt.\");\n * if ((e as FirebaseError)?.code === 'service/file-not-found') {\n * console.log(\"Could not read file: \" + e['file']);\n * }\n * }\n */\nconst ERROR_NAME = 'FirebaseError';\n// Based on code from:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\nclass FirebaseError extends Error {\n constructor(\n /** The error code for this error. */\n code, message, \n /** Custom data for this error. */\n customData) {\n super(message);\n this.code = code;\n this.customData = customData;\n /** The custom name for all FirebaseErrors. */\n this.name = ERROR_NAME;\n // Fix For ES5\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n // TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n // which we can now use since we no longer target ES5.\n Object.setPrototypeOf(this, FirebaseError.prototype);\n // Maintains proper stack trace for where our error was thrown.\n // Only available on V8.\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ErrorFactory.prototype.create);\n }\n }\n}\nclass ErrorFactory {\n constructor(service, serviceName, errors) {\n this.service = service;\n this.serviceName = serviceName;\n this.errors = errors;\n }\n create(code, ...data) {\n const customData = data[0] || {};\n const fullCode = `${this.service}/${code}`;\n const template = this.errors[code];\n const message = template ? replaceTemplate(template, customData) : 'Error';\n // Service Name: Error message (service/code).\n const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`;\n const error = new FirebaseError(fullCode, fullMessage, customData);\n return error;\n }\n}\nfunction replaceTemplate(template, data) {\n return template.replace(PATTERN, (_, key) => {\n const value = data[key];\n return value != null ? String(value) : `<${key}?>`;\n });\n}\nconst PATTERN = /\\{\\$([^}]+)}/g;\nfunction isEmpty$1(obj) {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Deep equal two objects. Support Arrays and Objects.\n */\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n for (const k of aKeys) {\n if (!bKeys.includes(k)) {\n return false;\n }\n const aProp = a[k];\n const bProp = b[k];\n if (isObject(aProp) && isObject(bProp)) {\n if (!deepEqual(aProp, bProp)) {\n return false;\n }\n }\n else if (aProp !== bProp) {\n return false;\n }\n }\n for (const k of bKeys) {\n if (!aKeys.includes(k)) {\n return false;\n }\n }\n return true;\n}\nfunction isObject(thing) {\n return thing !== null && typeof thing === 'object';\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a\n * params object (e.g. {arg: 'val', arg2: 'val2'})\n * Note: You must prepend it with ? when adding it to a URL.\n */\nfunction querystring(querystringParams) {\n const params = [];\n for (const [key, value] of Object.entries(querystringParams)) {\n if (Array.isArray(value)) {\n value.forEach(arrayVal => {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));\n });\n }\n else {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n }\n }\n return params.length ? '&' + params.join('&') : '';\n}\n/**\n * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object\n * (e.g. {arg: 'val', arg2: 'val2'})\n */\nfunction querystringDecode(querystring) {\n const obj = {};\n const tokens = querystring.replace(/^\\?/, '').split('&');\n tokens.forEach(token => {\n if (token) {\n const [key, value] = token.split('=');\n obj[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n });\n return obj;\n}\n/**\n * Extract the query string part of a URL, including the leading question mark (if present).\n */\nfunction extractQuerystring(url) {\n const queryStart = url.indexOf('?');\n if (!queryStart) {\n return '';\n }\n const fragmentStart = url.indexOf('#', queryStart);\n return url.substring(queryStart, fragmentStart > 0 ? fragmentStart : undefined);\n}\n\n/**\n * Helper to make a Subscribe function (just like Promise helps make a\n * Thenable).\n *\n * @param executor Function which can make calls to a single Observer\n * as a proxy.\n * @param onNoObservers Callback when count of Observers goes to zero.\n */\nfunction createSubscribe(executor, onNoObservers) {\n const proxy = new ObserverProxy(executor, onNoObservers);\n return proxy.subscribe.bind(proxy);\n}\n/**\n * Implement fan-out for any number of Observers attached via a subscribe\n * function.\n */\nclass ObserverProxy {\n /**\n * @param executor Function which can make calls to a single Observer\n * as a proxy.\n * @param onNoObservers Callback when count of Observers goes to zero.\n */\n constructor(executor, onNoObservers) {\n this.observers = [];\n this.unsubscribes = [];\n this.observerCount = 0;\n // Micro-task scheduling by calling task.then().\n this.task = Promise.resolve();\n this.finalized = false;\n this.onNoObservers = onNoObservers;\n // Call the executor asynchronously so subscribers that are called\n // synchronously after the creation of the subscribe function\n // can still receive the very first value generated in the executor.\n this.task\n .then(() => {\n executor(this);\n })\n .catch(e => {\n this.error(e);\n });\n }\n next(value) {\n this.forEachObserver((observer) => {\n observer.next(value);\n });\n }\n error(error) {\n this.forEachObserver((observer) => {\n observer.error(error);\n });\n this.close(error);\n }\n complete() {\n this.forEachObserver((observer) => {\n observer.complete();\n });\n this.close();\n }\n /**\n * Subscribe function that can be used to add an Observer to the fan-out list.\n *\n * - We require that no event is sent to a subscriber synchronously to their\n * call to subscribe().\n */\n subscribe(nextOrObserver, error, complete) {\n let observer;\n if (nextOrObserver === undefined &&\n error === undefined &&\n complete === undefined) {\n throw new Error('Missing Observer.');\n }\n // Assemble an Observer object when passed as callback functions.\n if (implementsAnyMethods(nextOrObserver, [\n 'next',\n 'error',\n 'complete'\n ])) {\n observer = nextOrObserver;\n }\n else {\n observer = {\n next: nextOrObserver,\n error,\n complete\n };\n }\n if (observer.next === undefined) {\n observer.next = noop;\n }\n if (observer.error === undefined) {\n observer.error = noop;\n }\n if (observer.complete === undefined) {\n observer.complete = noop;\n }\n const unsub = this.unsubscribeOne.bind(this, this.observers.length);\n // Attempt to subscribe to a terminated Observable - we\n // just respond to the Observer with the final error or complete\n // event.\n if (this.finalized) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n try {\n if (this.finalError) {\n observer.error(this.finalError);\n }\n else {\n observer.complete();\n }\n }\n catch (e) {\n // nothing\n }\n return;\n });\n }\n this.observers.push(observer);\n return unsub;\n }\n // Unsubscribe is synchronous - we guarantee that no events are sent to\n // any unsubscribed Observer.\n unsubscribeOne(i) {\n if (this.observers === undefined || this.observers[i] === undefined) {\n return;\n }\n delete this.observers[i];\n this.observerCount -= 1;\n if (this.observerCount === 0 && this.onNoObservers !== undefined) {\n this.onNoObservers(this);\n }\n }\n forEachObserver(fn) {\n if (this.finalized) {\n // Already closed by previous event....just eat the additional values.\n return;\n }\n // Since sendOne calls asynchronously - there is no chance that\n // this.observers will become undefined.\n for (let i = 0; i < this.observers.length; i++) {\n this.sendOne(i, fn);\n }\n }\n // Call the Observer via one of it's callback function. We are careful to\n // confirm that the observe has not been unsubscribed since this asynchronous\n // function had been queued.\n sendOne(i, fn) {\n // Execute the callback asynchronously\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n if (this.observers !== undefined && this.observers[i] !== undefined) {\n try {\n fn(this.observers[i]);\n }\n catch (e) {\n // Ignore exceptions raised in Observers or missing methods of an\n // Observer.\n // Log error to console. b/31404806\n if (typeof console !== 'undefined' && console.error) {\n console.error(e);\n }\n }\n }\n });\n }\n close(err) {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n if (err !== undefined) {\n this.finalError = err;\n }\n // Proxy is no longer needed - garbage collect references\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n this.observers = undefined;\n this.onNoObservers = undefined;\n });\n }\n}\n/**\n * Return true if the object passed in implements any of the named methods.\n */\nfunction implementsAnyMethods(obj, methods) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n for (const method of methods) {\n if (method in obj && typeof obj[method] === 'function') {\n return true;\n }\n }\n return false;\n}\nfunction noop() {\n // do nothing\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction getModularInstance(service) {\n if (service && service._delegate) {\n return service._delegate;\n }\n else {\n return service;\n }\n}\n\n/**\n * Component for service name T, e.g. `auth`, `auth-internal`\n */\nclass Component {\n /**\n *\n * @param name The public service name, e.g. app, auth, firestore, database\n * @param instanceFactory Service factory responsible for creating the public interface\n * @param type whether the service provided by the component is public or private\n */\n constructor(name, instanceFactory, type) {\n this.name = name;\n this.instanceFactory = instanceFactory;\n this.type = type;\n this.multipleInstances = false;\n /**\n * Properties to be added to the service namespace\n */\n this.serviceProps = {};\n this.instantiationMode = \"LAZY\" /* InstantiationMode.LAZY */;\n this.onInstanceCreated = null;\n }\n setInstantiationMode(mode) {\n this.instantiationMode = mode;\n return this;\n }\n setMultipleInstances(multipleInstances) {\n this.multipleInstances = multipleInstances;\n return this;\n }\n setServiceProps(props) {\n this.serviceProps = props;\n return this;\n }\n setInstanceCreatedCallback(callback) {\n this.onInstanceCreated = callback;\n return this;\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DEFAULT_ENTRY_NAME$1 = '[DEFAULT]';\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for instance for service name T, e.g. 'auth', 'auth-internal'\n * NameServiceMapping[T] is an alias for the type of the instance\n */\nclass Provider {\n constructor(name, container) {\n this.name = name;\n this.container = container;\n this.component = null;\n this.instances = new Map();\n this.instancesDeferred = new Map();\n this.instancesOptions = new Map();\n this.onInitCallbacks = new Map();\n }\n /**\n * @param identifier A provider can provide multiple instances of a service\n * if this.component.multipleInstances is true.\n */\n get(identifier) {\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n if (!this.instancesDeferred.has(normalizedIdentifier)) {\n const deferred = new Deferred();\n this.instancesDeferred.set(normalizedIdentifier, deferred);\n if (this.isInitialized(normalizedIdentifier) ||\n this.shouldAutoInitialize()) {\n // initialize the service if it can be auto-initialized\n try {\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n if (instance) {\n deferred.resolve(instance);\n }\n }\n catch (e) {\n // when the instance factory throws an exception during get(), it should not cause\n // a fatal error. We just return the unresolved promise in this case.\n }\n }\n }\n return this.instancesDeferred.get(normalizedIdentifier).promise;\n }\n getImmediate(options) {\n var _a;\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(options === null || options === void 0 ? void 0 : options.identifier);\n const optional = (_a = options === null || options === void 0 ? void 0 : options.optional) !== null && _a !== void 0 ? _a : false;\n if (this.isInitialized(normalizedIdentifier) ||\n this.shouldAutoInitialize()) {\n try {\n return this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n }\n catch (e) {\n if (optional) {\n return null;\n }\n else {\n throw e;\n }\n }\n }\n else {\n // In case a component is not initialized and should/cannot be auto-initialized at the moment, return null if the optional flag is set, or throw\n if (optional) {\n return null;\n }\n else {\n throw Error(`Service ${this.name} is not available`);\n }\n }\n }\n getComponent() {\n return this.component;\n }\n setComponent(component) {\n if (component.name !== this.name) {\n throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);\n }\n if (this.component) {\n throw Error(`Component for ${this.name} has already been provided`);\n }\n this.component = component;\n // return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)\n if (!this.shouldAutoInitialize()) {\n return;\n }\n // if the service is eager, initialize the default instance\n if (isComponentEager(component)) {\n try {\n this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME$1 });\n }\n catch (e) {\n // when the instance factory for an eager Component throws an exception during the eager\n // initialization, it should not cause a fatal error.\n // TODO: Investigate if we need to make it configurable, because some component may want to cause\n // a fatal error in this case?\n }\n }\n // Create service instances for the pending promises and resolve them\n // NOTE: if this.multipleInstances is false, only the default instance will be created\n // and all promises with resolve with it regardless of the identifier.\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n try {\n // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n instanceDeferred.resolve(instance);\n }\n catch (e) {\n // when the instance factory throws an exception, it should not cause\n // a fatal error. We just leave the promise unresolved.\n }\n }\n }\n clearInstance(identifier = DEFAULT_ENTRY_NAME$1) {\n this.instancesDeferred.delete(identifier);\n this.instancesOptions.delete(identifier);\n this.instances.delete(identifier);\n }\n // app.delete() will call this method on every provider to delete the services\n // TODO: should we mark the provider as deleted?\n async delete() {\n const services = Array.from(this.instances.values());\n await Promise.all([\n ...services\n .filter(service => 'INTERNAL' in service) // legacy services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service.INTERNAL.delete()),\n ...services\n .filter(service => '_delete' in service) // modularized services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service._delete())\n ]);\n }\n isComponentSet() {\n return this.component != null;\n }\n isInitialized(identifier = DEFAULT_ENTRY_NAME$1) {\n return this.instances.has(identifier);\n }\n getOptions(identifier = DEFAULT_ENTRY_NAME$1) {\n return this.instancesOptions.get(identifier) || {};\n }\n initialize(opts = {}) {\n const { options = {} } = opts;\n const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);\n if (this.isInitialized(normalizedIdentifier)) {\n throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);\n }\n if (!this.isComponentSet()) {\n throw Error(`Component ${this.name} has not been registered yet`);\n }\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier,\n options\n });\n // resolve any pending promise waiting for the service instance\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n if (normalizedIdentifier === normalizedDeferredIdentifier) {\n instanceDeferred.resolve(instance);\n }\n }\n return instance;\n }\n /**\n *\n * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().\n * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.\n *\n * @param identifier An optional instance identifier\n * @returns a function to unregister the callback\n */\n onInit(callback, identifier) {\n var _a;\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n const existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) !== null && _a !== void 0 ? _a : new Set();\n existingCallbacks.add(callback);\n this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);\n const existingInstance = this.instances.get(normalizedIdentifier);\n if (existingInstance) {\n callback(existingInstance, normalizedIdentifier);\n }\n return () => {\n existingCallbacks.delete(callback);\n };\n }\n /**\n * Invoke onInit callbacks synchronously\n * @param instance the service instance`\n */\n invokeOnInitCallbacks(instance, identifier) {\n const callbacks = this.onInitCallbacks.get(identifier);\n if (!callbacks) {\n return;\n }\n for (const callback of callbacks) {\n try {\n callback(instance, identifier);\n }\n catch (_a) {\n // ignore errors in the onInit callback\n }\n }\n }\n getOrInitializeService({ instanceIdentifier, options = {} }) {\n let instance = this.instances.get(instanceIdentifier);\n if (!instance && this.component) {\n instance = this.component.instanceFactory(this.container, {\n instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),\n options\n });\n this.instances.set(instanceIdentifier, instance);\n this.instancesOptions.set(instanceIdentifier, options);\n /**\n * Invoke onInit listeners.\n * Note this.component.onInstanceCreated is different, which is used by the component creator,\n * while onInit listeners are registered by consumers of the provider.\n */\n this.invokeOnInitCallbacks(instance, instanceIdentifier);\n /**\n * Order is important\n * onInstanceCreated() should be called after this.instances.set(instanceIdentifier, instance); which\n * makes `isInitialized()` return true.\n */\n if (this.component.onInstanceCreated) {\n try {\n this.component.onInstanceCreated(this.container, instanceIdentifier, instance);\n }\n catch (_a) {\n // ignore errors in the onInstanceCreatedCallback\n }\n }\n }\n return instance || null;\n }\n normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME$1) {\n if (this.component) {\n return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME$1;\n }\n else {\n return identifier; // assume multiple instances are supported before the component is provided.\n }\n }\n shouldAutoInitialize() {\n return (!!this.component &&\n this.component.instantiationMode !== \"EXPLICIT\" /* InstantiationMode.EXPLICIT */);\n }\n}\n// undefined should be passed to the service factory for the default instance\nfunction normalizeIdentifierForFactory(identifier) {\n return identifier === DEFAULT_ENTRY_NAME$1 ? undefined : identifier;\n}\nfunction isComponentEager(component) {\n return component.instantiationMode === \"EAGER\" /* InstantiationMode.EAGER */;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`\n */\nclass ComponentContainer {\n constructor(name) {\n this.name = name;\n this.providers = new Map();\n }\n /**\n *\n * @param component Component being added\n * @param overwrite When a component with the same name has already been registered,\n * if overwrite is true: overwrite the existing component with the new component and create a new\n * provider with the new component. It can be useful in tests where you want to use different mocks\n * for different tests.\n * if overwrite is false: throw an exception\n */\n addComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n throw new Error(`Component ${component.name} has already been registered with ${this.name}`);\n }\n provider.setComponent(component);\n }\n addOrOverwriteComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n // delete the existing provider from the container, so we can register the new component\n this.providers.delete(component.name);\n }\n this.addComponent(component);\n }\n /**\n * getProvider provides a type safe interface where it can only be called with a field name\n * present in NameServiceMapping interface.\n *\n * Firebase SDKs providing services should extend NameServiceMapping interface to register\n * themselves.\n */\n getProvider(name) {\n if (this.providers.has(name)) {\n return this.providers.get(name);\n }\n // create a Provider for a service that hasn't registered with Firebase\n const provider = new Provider(name, this);\n this.providers.set(name, provider);\n return provider;\n }\n getProviders() {\n return Array.from(this.providers.values());\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A container for all of the Logger instances\n */\n/**\n * The JS SDK supports 5 log levels and also allows a user the ability to\n * silence the logs altogether.\n *\n * The order is a follows:\n * DEBUG < VERBOSE < INFO < WARN < ERROR\n *\n * All of the log types above the current log level will be captured (i.e. if\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\n * `VERBOSE` logs will not)\n */\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[LogLevel[\"DEBUG\"] = 0] = \"DEBUG\";\n LogLevel[LogLevel[\"VERBOSE\"] = 1] = \"VERBOSE\";\n LogLevel[LogLevel[\"INFO\"] = 2] = \"INFO\";\n LogLevel[LogLevel[\"WARN\"] = 3] = \"WARN\";\n LogLevel[LogLevel[\"ERROR\"] = 4] = \"ERROR\";\n LogLevel[LogLevel[\"SILENT\"] = 5] = \"SILENT\";\n})(LogLevel || (LogLevel = {}));\nconst levelStringToEnum = {\n 'debug': LogLevel.DEBUG,\n 'verbose': LogLevel.VERBOSE,\n 'info': LogLevel.INFO,\n 'warn': LogLevel.WARN,\n 'error': LogLevel.ERROR,\n 'silent': LogLevel.SILENT\n};\n/**\n * The default log level\n */\nconst defaultLogLevel = LogLevel.INFO;\n/**\n * By default, `console.debug` is not displayed in the developer console (in\n * chrome). To avoid forcing users to have to opt-in to these logs twice\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\n * logs to the `console.log` function.\n */\nconst ConsoleMethod = {\n [LogLevel.DEBUG]: 'log',\n [LogLevel.VERBOSE]: 'log',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error'\n};\n/**\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\n * messages on to their corresponding console counterparts (if the log method\n * is supported by the current log level)\n */\nconst defaultLogHandler = (instance, logType, ...args) => {\n if (logType < instance.logLevel) {\n return;\n }\n const now = new Date().toISOString();\n const method = ConsoleMethod[logType];\n if (method) {\n console[method](`[${now}] ${instance.name}:`, ...args);\n }\n else {\n throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);\n }\n};\nclass Logger {\n /**\n * Gives you an instance of a Logger to capture messages according to\n * Firebase's logging scheme.\n *\n * @param name The name that the logs will be associated with\n */\n constructor(name) {\n this.name = name;\n /**\n * The log level of the given Logger instance.\n */\n this._logLevel = defaultLogLevel;\n /**\n * The main (internal) log handler for the Logger instance.\n * Can be set to a new function in internal package code but not by user.\n */\n this._logHandler = defaultLogHandler;\n /**\n * The optional, additional, user-defined log handler for the Logger instance.\n */\n this._userLogHandler = null;\n }\n get logLevel() {\n return this._logLevel;\n }\n set logLevel(val) {\n if (!(val in LogLevel)) {\n throw new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\n }\n this._logLevel = val;\n }\n // Workaround for setter/getter having to be the same type.\n setLogLevel(val) {\n this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;\n }\n get logHandler() {\n return this._logHandler;\n }\n set logHandler(val) {\n if (typeof val !== 'function') {\n throw new TypeError('Value assigned to `logHandler` must be a function');\n }\n this._logHandler = val;\n }\n get userLogHandler() {\n return this._userLogHandler;\n }\n set userLogHandler(val) {\n this._userLogHandler = val;\n }\n /**\n * The functions below are all based on the `console` interface\n */\n debug(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);\n this._logHandler(this, LogLevel.DEBUG, ...args);\n }\n log(...args) {\n this._userLogHandler &&\n this._userLogHandler(this, LogLevel.VERBOSE, ...args);\n this._logHandler(this, LogLevel.VERBOSE, ...args);\n }\n info(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);\n this._logHandler(this, LogLevel.INFO, ...args);\n }\n warn(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);\n this._logHandler(this, LogLevel.WARN, ...args);\n }\n error(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);\n this._logHandler(this, LogLevel.ERROR, ...args);\n }\n}\n\nconst instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);\n\nlet idbProxyableTypes;\nlet cursorAdvanceMethods;\n// This is a function to prevent it throwing up in node environments.\nfunction getIdbProxyableTypes() {\n return (idbProxyableTypes ||\n (idbProxyableTypes = [\n IDBDatabase,\n IDBObjectStore,\n IDBIndex,\n IDBCursor,\n IDBTransaction,\n ]));\n}\n// This is a function to prevent it throwing up in node environments.\nfunction getCursorAdvanceMethods() {\n return (cursorAdvanceMethods ||\n (cursorAdvanceMethods = [\n IDBCursor.prototype.advance,\n IDBCursor.prototype.continue,\n IDBCursor.prototype.continuePrimaryKey,\n ]));\n}\nconst cursorRequestMap = new WeakMap();\nconst transactionDoneMap = new WeakMap();\nconst transactionStoreNamesMap = new WeakMap();\nconst transformCache = new WeakMap();\nconst reverseTransformCache = new WeakMap();\nfunction promisifyRequest(request) {\n const promise = new Promise((resolve, reject) => {\n const unlisten = () => {\n request.removeEventListener('success', success);\n request.removeEventListener('error', error);\n };\n const success = () => {\n resolve(wrap(request.result));\n unlisten();\n };\n const error = () => {\n reject(request.error);\n unlisten();\n };\n request.addEventListener('success', success);\n request.addEventListener('error', error);\n });\n promise\n .then((value) => {\n // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval\n // (see wrapFunction).\n if (value instanceof IDBCursor) {\n cursorRequestMap.set(value, request);\n }\n // Catching to avoid \"Uncaught Promise exceptions\"\n })\n .catch(() => { });\n // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This\n // is because we create many promises from a single IDBRequest.\n reverseTransformCache.set(promise, request);\n return promise;\n}\nfunction cacheDonePromiseForTransaction(tx) {\n // Early bail if we've already created a done promise for this transaction.\n if (transactionDoneMap.has(tx))\n return;\n const done = new Promise((resolve, reject) => {\n const unlisten = () => {\n tx.removeEventListener('complete', complete);\n tx.removeEventListener('error', error);\n tx.removeEventListener('abort', error);\n };\n const complete = () => {\n resolve();\n unlisten();\n };\n const error = () => {\n reject(tx.error || new DOMException('AbortError', 'AbortError'));\n unlisten();\n };\n tx.addEventListener('complete', complete);\n tx.addEventListener('error', error);\n tx.addEventListener('abort', error);\n });\n // Cache it for later retrieval.\n transactionDoneMap.set(tx, done);\n}\nlet idbProxyTraps = {\n get(target, prop, receiver) {\n if (target instanceof IDBTransaction) {\n // Special handling for transaction.done.\n if (prop === 'done')\n return transactionDoneMap.get(target);\n // Polyfill for objectStoreNames because of Edge.\n if (prop === 'objectStoreNames') {\n return target.objectStoreNames || transactionStoreNamesMap.get(target);\n }\n // Make tx.store return the only store in the transaction, or undefined if there are many.\n if (prop === 'store') {\n return receiver.objectStoreNames[1]\n ? undefined\n : receiver.objectStore(receiver.objectStoreNames[0]);\n }\n }\n // Else transform whatever we get back.\n return wrap(target[prop]);\n },\n set(target, prop, value) {\n target[prop] = value;\n return true;\n },\n has(target, prop) {\n if (target instanceof IDBTransaction &&\n (prop === 'done' || prop === 'store')) {\n return true;\n }\n return prop in target;\n },\n};\nfunction replaceTraps(callback) {\n idbProxyTraps = callback(idbProxyTraps);\n}\nfunction wrapFunction(func) {\n // Due to expected object equality (which is enforced by the caching in `wrap`), we\n // only create one new func per func.\n // Edge doesn't support objectStoreNames (booo), so we polyfill it here.\n if (func === IDBDatabase.prototype.transaction &&\n !('objectStoreNames' in IDBTransaction.prototype)) {\n return function (storeNames, ...args) {\n const tx = func.call(unwrap(this), storeNames, ...args);\n transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);\n return wrap(tx);\n };\n }\n // Cursor methods are special, as the behaviour is a little more different to standard IDB. In\n // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the\n // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense\n // with real promises, so each advance methods returns a new promise for the cursor object, or\n // undefined if the end of the cursor has been reached.\n if (getCursorAdvanceMethods().includes(func)) {\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n func.apply(unwrap(this), args);\n return wrap(cursorRequestMap.get(this));\n };\n }\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n return wrap(func.apply(unwrap(this), args));\n };\n}\nfunction transformCachableValue(value) {\n if (typeof value === 'function')\n return wrapFunction(value);\n // This doesn't return, it just creates a 'done' promise for the transaction,\n // which is later returned for transaction.done (see idbObjectHandler).\n if (value instanceof IDBTransaction)\n cacheDonePromiseForTransaction(value);\n if (instanceOfAny(value, getIdbProxyableTypes()))\n return new Proxy(value, idbProxyTraps);\n // Return the same value back if we're not going to transform it.\n return value;\n}\nfunction wrap(value) {\n // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because\n // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.\n if (value instanceof IDBRequest)\n return promisifyRequest(value);\n // If we've already transformed this value before, reuse the transformed value.\n // This is faster, but it also provides object equality.\n if (transformCache.has(value))\n return transformCache.get(value);\n const newValue = transformCachableValue(value);\n // Not all types are transformed.\n // These may be primitive types, so they can't be WeakMap keys.\n if (newValue !== value) {\n transformCache.set(value, newValue);\n reverseTransformCache.set(newValue, value);\n }\n return newValue;\n}\nconst unwrap = (value) => reverseTransformCache.get(value);\n\n/**\n * Open a database.\n *\n * @param name Name of the database.\n * @param version Schema version.\n * @param callbacks Additional callbacks.\n */\nfunction openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {\n const request = indexedDB.open(name, version);\n const openPromise = wrap(request);\n if (upgrade) {\n request.addEventListener('upgradeneeded', (event) => {\n upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);\n });\n }\n if (blocked) {\n request.addEventListener('blocked', (event) => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event.newVersion, event));\n }\n openPromise\n .then((db) => {\n if (terminated)\n db.addEventListener('close', () => terminated());\n if (blocking) {\n db.addEventListener('versionchange', (event) => blocking(event.oldVersion, event.newVersion, event));\n }\n })\n .catch(() => { });\n return openPromise;\n}\n\nconst readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];\nconst writeMethods = ['put', 'add', 'delete', 'clear'];\nconst cachedMethods = new Map();\nfunction getMethod(target, prop) {\n if (!(target instanceof IDBDatabase &&\n !(prop in target) &&\n typeof prop === 'string')) {\n return;\n }\n if (cachedMethods.get(prop))\n return cachedMethods.get(prop);\n const targetFuncName = prop.replace(/FromIndex$/, '');\n const useIndex = prop !== targetFuncName;\n const isWrite = writeMethods.includes(targetFuncName);\n if (\n // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.\n !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||\n !(isWrite || readMethods.includes(targetFuncName))) {\n return;\n }\n const method = async function (storeName, ...args) {\n // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(\n const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');\n let target = tx.store;\n if (useIndex)\n target = target.index(args.shift());\n // Must reject if op rejects.\n // If it's a write operation, must reject if tx.done rejects.\n // Must reject with op rejection first.\n // Must resolve with op value.\n // Must handle both promises (no unhandled rejections)\n return (await Promise.all([\n target[targetFuncName](...args),\n isWrite && tx.done,\n ]))[0];\n };\n cachedMethods.set(prop, method);\n return method;\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),\n has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),\n}));\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass PlatformLoggerServiceImpl {\n constructor(container) {\n this.container = container;\n }\n // In initial implementation, this will be called by installations on\n // auth token refresh, and installations will send this string.\n getPlatformInfoString() {\n const providers = this.container.getProviders();\n // Loop through providers and get library/version pairs from any that are\n // version components.\n return providers\n .map(provider => {\n if (isVersionServiceProvider(provider)) {\n const service = provider.getImmediate();\n return `${service.library}/${service.version}`;\n }\n else {\n return null;\n }\n })\n .filter(logString => logString)\n .join(' ');\n }\n}\n/**\n *\n * @param provider check if this provider provides a VersionService\n *\n * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider\n * provides VersionService. The provider is not necessarily a 'app-version'\n * provider.\n */\nfunction isVersionServiceProvider(provider) {\n const component = provider.getComponent();\n return (component === null || component === void 0 ? void 0 : component.type) === \"VERSION\" /* ComponentType.VERSION */;\n}\n\nconst name$q = \"@firebase/app\";\nconst version$1$1 = \"0.13.2\";\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst logger = new Logger('@firebase/app');\n\nconst name$p = \"@firebase/app-compat\";\n\nconst name$o = \"@firebase/analytics-compat\";\n\nconst name$n = \"@firebase/analytics\";\n\nconst name$m = \"@firebase/app-check-compat\";\n\nconst name$l = \"@firebase/app-check\";\n\nconst name$k = \"@firebase/auth\";\n\nconst name$j = \"@firebase/auth-compat\";\n\nconst name$i = \"@firebase/database\";\n\nconst name$h = \"@firebase/data-connect\";\n\nconst name$g = \"@firebase/database-compat\";\n\nconst name$f = \"@firebase/functions\";\n\nconst name$e = \"@firebase/functions-compat\";\n\nconst name$d = \"@firebase/installations\";\n\nconst name$c = \"@firebase/installations-compat\";\n\nconst name$b = \"@firebase/messaging\";\n\nconst name$a = \"@firebase/messaging-compat\";\n\nconst name$9 = \"@firebase/performance\";\n\nconst name$8 = \"@firebase/performance-compat\";\n\nconst name$7 = \"@firebase/remote-config\";\n\nconst name$6 = \"@firebase/remote-config-compat\";\n\nconst name$5 = \"@firebase/storage\";\n\nconst name$4 = \"@firebase/storage-compat\";\n\nconst name$3 = \"@firebase/firestore\";\n\nconst name$2 = \"@firebase/ai\";\n\nconst name$1$1 = \"@firebase/firestore-compat\";\n\nconst name$r = \"firebase\";\nconst version$2 = \"11.10.0\";\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The default app name\n *\n * @internal\n */\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\nconst PLATFORM_LOG_STRING = {\n [name$q]: 'fire-core',\n [name$p]: 'fire-core-compat',\n [name$n]: 'fire-analytics',\n [name$o]: 'fire-analytics-compat',\n [name$l]: 'fire-app-check',\n [name$m]: 'fire-app-check-compat',\n [name$k]: 'fire-auth',\n [name$j]: 'fire-auth-compat',\n [name$i]: 'fire-rtdb',\n [name$h]: 'fire-data-connect',\n [name$g]: 'fire-rtdb-compat',\n [name$f]: 'fire-fn',\n [name$e]: 'fire-fn-compat',\n [name$d]: 'fire-iid',\n [name$c]: 'fire-iid-compat',\n [name$b]: 'fire-fcm',\n [name$a]: 'fire-fcm-compat',\n [name$9]: 'fire-perf',\n [name$8]: 'fire-perf-compat',\n [name$7]: 'fire-rc',\n [name$6]: 'fire-rc-compat',\n [name$5]: 'fire-gcs',\n [name$4]: 'fire-gcs-compat',\n [name$3]: 'fire-fst',\n [name$1$1]: 'fire-fst-compat',\n [name$2]: 'fire-vertex',\n 'fire-js': 'fire-js', // Platform identifier for JS SDK.\n [name$r]: 'fire-js-all'\n};\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @internal\n */\nconst _apps = new Map();\n/**\n * @internal\n */\nconst _serverApps = new Map();\n/**\n * Registered components.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _components = new Map();\n/**\n * @param component - the component being added to this app's container\n *\n * @internal\n */\nfunction _addComponent(app, component) {\n try {\n app.container.addComponent(component);\n }\n catch (e) {\n logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);\n }\n}\n/**\n *\n * @param component - the component to register\n * @returns whether or not the component is registered successfully\n *\n * @internal\n */\nfunction _registerComponent(component) {\n const componentName = component.name;\n if (_components.has(componentName)) {\n logger.debug(`There were multiple attempts to register component ${componentName}.`);\n return false;\n }\n _components.set(componentName, component);\n // add the component to existing app instances\n for (const app of _apps.values()) {\n _addComponent(app, component);\n }\n for (const serverApp of _serverApps.values()) {\n _addComponent(serverApp, component);\n }\n return true;\n}\n/**\n *\n * @param app - FirebaseApp instance\n * @param name - service name\n *\n * @returns the provider for the service with the matching name\n *\n * @internal\n */\nfunction _getProvider(app, name) {\n const heartbeatController = app.container\n .getProvider('heartbeat')\n .getImmediate({ optional: true });\n if (heartbeatController) {\n void heartbeatController.triggerHeartbeat();\n }\n return app.container.getProvider(name);\n}\n/**\n *\n * @param obj - an object of type FirebaseApp.\n *\n * @returns true if the provided object is of type FirebaseServerAppImpl.\n *\n * @internal\n */\nfunction _isFirebaseServerApp(obj) {\n if (obj === null || obj === undefined) {\n return false;\n }\n return obj.settings !== undefined;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst ERRORS = {\n [\"no-app\" /* AppError.NO_APP */]: \"No Firebase App '{$appName}' has been created - \" +\n 'call initializeApp() first',\n [\"bad-app-name\" /* AppError.BAD_APP_NAME */]: \"Illegal App name: '{$appName}'\",\n [\"duplicate-app\" /* AppError.DUPLICATE_APP */]: \"Firebase App named '{$appName}' already exists with different options or config\",\n [\"app-deleted\" /* AppError.APP_DELETED */]: \"Firebase App named '{$appName}' already deleted\",\n [\"server-app-deleted\" /* AppError.SERVER_APP_DELETED */]: 'Firebase Server App has been deleted',\n [\"no-options\" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',\n [\"invalid-app-argument\" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +\n 'Firebase App instance.',\n [\"invalid-log-argument\" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',\n [\"idb-open\" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-get\" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-set\" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-delete\" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"finalization-registry-not-supported\" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */]: 'FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.',\n [\"invalid-server-app-environment\" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */]: 'FirebaseServerApp is not for use in browser environments.'\n};\nconst ERROR_FACTORY = new ErrorFactory('app', 'Firebase', ERRORS);\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass FirebaseAppImpl {\n constructor(options, config, container) {\n this._isDeleted = false;\n this._options = Object.assign({}, options);\n this._config = Object.assign({}, config);\n this._name = config.name;\n this._automaticDataCollectionEnabled =\n config.automaticDataCollectionEnabled;\n this._container = container;\n this.container.addComponent(new Component('app', () => this, \"PUBLIC\" /* ComponentType.PUBLIC */));\n }\n get automaticDataCollectionEnabled() {\n this.checkDestroyed();\n return this._automaticDataCollectionEnabled;\n }\n set automaticDataCollectionEnabled(val) {\n this.checkDestroyed();\n this._automaticDataCollectionEnabled = val;\n }\n get name() {\n this.checkDestroyed();\n return this._name;\n }\n get options() {\n this.checkDestroyed();\n return this._options;\n }\n get config() {\n this.checkDestroyed();\n return this._config;\n }\n get container() {\n return this._container;\n }\n get isDeleted() {\n return this._isDeleted;\n }\n set isDeleted(val) {\n this._isDeleted = val;\n }\n /**\n * This function will throw an Error if the App has already been deleted -\n * use before performing API actions on the App.\n */\n checkDestroyed() {\n if (this.isDeleted) {\n throw ERROR_FACTORY.create(\"app-deleted\" /* AppError.APP_DELETED */, { appName: this._name });\n }\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The current SDK version.\n *\n * @public\n */\nconst SDK_VERSION = version$2;\nfunction initializeApp(_options, rawConfig = {}) {\n let options = _options;\n if (typeof rawConfig !== 'object') {\n const name = rawConfig;\n rawConfig = { name };\n }\n const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: true }, rawConfig);\n const name = config.name;\n if (typeof name !== 'string' || !name) {\n throw ERROR_FACTORY.create(\"bad-app-name\" /* AppError.BAD_APP_NAME */, {\n appName: String(name)\n });\n }\n options || (options = getDefaultAppConfig());\n if (!options) {\n throw ERROR_FACTORY.create(\"no-options\" /* AppError.NO_OPTIONS */);\n }\n const existingApp = _apps.get(name);\n if (existingApp) {\n // return the existing app if options and config deep equal the ones in the existing app.\n if (deepEqual(options, existingApp.options) &&\n deepEqual(config, existingApp.config)) {\n return existingApp;\n }\n else {\n throw ERROR_FACTORY.create(\"duplicate-app\" /* AppError.DUPLICATE_APP */, { appName: name });\n }\n }\n const container = new ComponentContainer(name);\n for (const component of _components.values()) {\n container.addComponent(component);\n }\n const newApp = new FirebaseAppImpl(options, config, container);\n _apps.set(name, newApp);\n return newApp;\n}\n/**\n * Retrieves a {@link @firebase/app#FirebaseApp} instance.\n *\n * When called with no arguments, the default app is returned. When an app name\n * is provided, the app corresponding to that name is returned.\n *\n * An exception is thrown if the app being retrieved has not yet been\n * initialized.\n *\n * @example\n * ```javascript\n * // Return the default app\n * const app = getApp();\n * ```\n *\n * @example\n * ```javascript\n * // Return a named app\n * const otherApp = getApp(\"otherApp\");\n * ```\n *\n * @param name - Optional name of the app to return. If no name is\n * provided, the default is `\"[DEFAULT]\"`.\n *\n * @returns The app corresponding to the provided app name.\n * If no app name is provided, the default app is returned.\n *\n * @public\n */\nfunction getApp(name = DEFAULT_ENTRY_NAME) {\n const app = _apps.get(name);\n if (!app && name === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {\n return initializeApp();\n }\n if (!app) {\n throw ERROR_FACTORY.create(\"no-app\" /* AppError.NO_APP */, { appName: name });\n }\n return app;\n}\n/**\n * Registers a library's name and version for platform logging purposes.\n * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)\n * @param version - Current version of that library.\n * @param variant - Bundle variant, e.g., node, rn, etc.\n *\n * @public\n */\nfunction registerVersion(libraryKeyOrName, version, variant) {\n var _a;\n // TODO: We can use this check to whitelist strings when/if we set up\n // a good whitelist system.\n let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;\n if (variant) {\n library += `-${variant}`;\n }\n const libraryMismatch = library.match(/\\s|\\//);\n const versionMismatch = version.match(/\\s|\\//);\n if (libraryMismatch || versionMismatch) {\n const warning = [\n `Unable to register library \"${library}\" with version \"${version}\":`\n ];\n if (libraryMismatch) {\n warning.push(`library name \"${library}\" contains illegal characters (whitespace or \"/\")`);\n }\n if (libraryMismatch && versionMismatch) {\n warning.push('and');\n }\n if (versionMismatch) {\n warning.push(`version name \"${version}\" contains illegal characters (whitespace or \"/\")`);\n }\n logger.warn(warning.join(' '));\n return;\n }\n _registerComponent(new Component(`${library}-version`, () => ({ library, version }), \"VERSION\" /* ComponentType.VERSION */));\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DB_NAME$1 = 'firebase-heartbeat-database';\nconst DB_VERSION$1 = 1;\nconst STORE_NAME = 'firebase-heartbeat-store';\nlet dbPromise = null;\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDB(DB_NAME$1, DB_VERSION$1, {\n upgrade: (db, oldVersion) => {\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (oldVersion) {\n case 0:\n try {\n db.createObjectStore(STORE_NAME);\n }\n catch (e) {\n // Safari/iOS browsers throw occasional exceptions on\n // db.createObjectStore() that may be a bug. Avoid blocking\n // the rest of the app functionality.\n console.warn(e);\n }\n }\n }\n }).catch(e => {\n throw ERROR_FACTORY.create(\"idb-open\" /* AppError.IDB_OPEN */, {\n originalErrorMessage: e.message\n });\n });\n }\n return dbPromise;\n}\nasync function readHeartbeatsFromIndexedDB(app) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME);\n const result = await tx.objectStore(STORE_NAME).get(computeKey(app));\n // We already have the value but tx.done can throw,\n // so we need to await it here to catch errors\n await tx.done;\n return result;\n }\n catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n }\n else {\n const idbGetError = ERROR_FACTORY.create(\"idb-get\" /* AppError.IDB_GET */, {\n originalErrorMessage: e === null || e === void 0 ? void 0 : e.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nasync function writeHeartbeatsToIndexedDB(app, heartbeatObject) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME, 'readwrite');\n const objectStore = tx.objectStore(STORE_NAME);\n await objectStore.put(heartbeatObject, computeKey(app));\n await tx.done;\n }\n catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n }\n else {\n const idbGetError = ERROR_FACTORY.create(\"idb-set\" /* AppError.IDB_WRITE */, {\n originalErrorMessage: e === null || e === void 0 ? void 0 : e.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nfunction computeKey(app) {\n return `${app.name}!${app.options.appId}`;\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst MAX_HEADER_BYTES = 1024;\nconst MAX_NUM_STORED_HEARTBEATS = 30;\nclass HeartbeatServiceImpl {\n constructor(container) {\n this.container = container;\n /**\n * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate\n * the header string.\n * Stores one record per date. This will be consolidated into the standard\n * format of one record per user agent string before being sent as a header.\n * Populated from indexedDB when the controller is instantiated and should\n * be kept in sync with indexedDB.\n * Leave public for easier testing.\n */\n this._heartbeatsCache = null;\n const app = this.container.getProvider('app').getImmediate();\n this._storage = new HeartbeatStorageImpl(app);\n this._heartbeatsCachePromise = this._storage.read().then(result => {\n this._heartbeatsCache = result;\n return result;\n });\n }\n /**\n * Called to report a heartbeat. The function will generate\n * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it\n * to IndexedDB.\n * Note that we only store one heartbeat per day. So if a heartbeat for today is\n * already logged, subsequent calls to this function in the same day will be ignored.\n */\n async triggerHeartbeat() {\n var _a, _b;\n try {\n const platformLogger = this.container\n .getProvider('platform-logger')\n .getImmediate();\n // This is the \"Firebase user agent\" string from the platform logger\n // service, not the browser user agent.\n const agent = platformLogger.getPlatformInfoString();\n const date = getUTCDateString();\n if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null) {\n this._heartbeatsCache = await this._heartbeatsCachePromise;\n // If we failed to construct a heartbeats cache, then return immediately.\n if (((_b = this._heartbeatsCache) === null || _b === void 0 ? void 0 : _b.heartbeats) == null) {\n return;\n }\n }\n // Do not store a heartbeat if one is already stored for this day\n // or if a header has already been sent today.\n if (this._heartbeatsCache.lastSentHeartbeatDate === date ||\n this._heartbeatsCache.heartbeats.some(singleDateHeartbeat => singleDateHeartbeat.date === date)) {\n return;\n }\n else {\n // There is no entry for this date. Create one.\n this._heartbeatsCache.heartbeats.push({ date, agent });\n // If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.\n // Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.\n if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {\n const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);\n this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);\n }\n }\n return this._storage.overwrite(this._heartbeatsCache);\n }\n catch (e) {\n logger.warn(e);\n }\n }\n /**\n * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.\n * It also clears all heartbeats from memory as well as in IndexedDB.\n *\n * NOTE: Consuming product SDKs should not send the header if this method\n * returns an empty string.\n */\n async getHeartbeatsHeader() {\n var _a;\n try {\n if (this._heartbeatsCache === null) {\n await this._heartbeatsCachePromise;\n }\n // If it's still null or the array is empty, there is no data to send.\n if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null ||\n this._heartbeatsCache.heartbeats.length === 0) {\n return '';\n }\n const date = getUTCDateString();\n // Extract as many heartbeats from the cache as will fit under the size limit.\n const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);\n const headerString = base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));\n // Store last sent date to prevent another being logged/sent for the same day.\n this._heartbeatsCache.lastSentHeartbeatDate = date;\n if (unsentEntries.length > 0) {\n // Store any unsent entries if they exist.\n this._heartbeatsCache.heartbeats = unsentEntries;\n // This seems more likely than emptying the array (below) to lead to some odd state\n // since the cache isn't empty and this will be called again on the next request,\n // and is probably safest if we await it.\n await this._storage.overwrite(this._heartbeatsCache);\n }\n else {\n this._heartbeatsCache.heartbeats = [];\n // Do not wait for this, to reduce latency.\n void this._storage.overwrite(this._heartbeatsCache);\n }\n return headerString;\n }\n catch (e) {\n logger.warn(e);\n return '';\n }\n }\n}\nfunction getUTCDateString() {\n const today = new Date();\n // Returns date format 'YYYY-MM-DD'\n return today.toISOString().substring(0, 10);\n}\nfunction extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {\n // Heartbeats grouped by user agent in the standard format to be sent in\n // the header.\n const heartbeatsToSend = [];\n // Single date format heartbeats that are not sent.\n let unsentEntries = heartbeatsCache.slice();\n for (const singleDateHeartbeat of heartbeatsCache) {\n // Look for an existing entry with the same user agent.\n const heartbeatEntry = heartbeatsToSend.find(hb => hb.agent === singleDateHeartbeat.agent);\n if (!heartbeatEntry) {\n // If no entry for this user agent exists, create one.\n heartbeatsToSend.push({\n agent: singleDateHeartbeat.agent,\n dates: [singleDateHeartbeat.date]\n });\n if (countBytes(heartbeatsToSend) > maxSize) {\n // If the header would exceed max size, remove the added heartbeat\n // entry and stop adding to the header.\n heartbeatsToSend.pop();\n break;\n }\n }\n else {\n heartbeatEntry.dates.push(singleDateHeartbeat.date);\n // If the header would exceed max size, remove the added date\n // and stop adding to the header.\n if (countBytes(heartbeatsToSend) > maxSize) {\n heartbeatEntry.dates.pop();\n break;\n }\n }\n // Pop unsent entry from queue. (Skipped if adding the entry exceeded\n // quota and the loop breaks early.)\n unsentEntries = unsentEntries.slice(1);\n }\n return {\n heartbeatsToSend,\n unsentEntries\n };\n}\nclass HeartbeatStorageImpl {\n constructor(app) {\n this.app = app;\n this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();\n }\n async runIndexedDBEnvironmentCheck() {\n if (!isIndexedDBAvailable()) {\n return false;\n }\n else {\n return validateIndexedDBOpenable()\n .then(() => true)\n .catch(() => false);\n }\n }\n /**\n * Read all heartbeats.\n */\n async read() {\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return { heartbeats: [] };\n }\n else {\n const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);\n if (idbHeartbeatObject === null || idbHeartbeatObject === void 0 ? void 0 : idbHeartbeatObject.heartbeats) {\n return idbHeartbeatObject;\n }\n else {\n return { heartbeats: [] };\n }\n }\n }\n // overwrite the storage with the provided heartbeats\n async overwrite(heartbeatsObject) {\n var _a;\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n }\n else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: heartbeatsObject.heartbeats\n });\n }\n }\n // add heartbeats\n async add(heartbeatsObject) {\n var _a;\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n }\n else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: [\n ...existingHeartbeatsObject.heartbeats,\n ...heartbeatsObject.heartbeats\n ]\n });\n }\n }\n}\n/**\n * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped\n * in a platform logging header JSON object, stringified, and converted\n * to base 64.\n */\nfunction countBytes(heartbeatsCache) {\n // base64 has a restricted set of characters, all of which should be 1 byte.\n return base64urlEncodeWithoutPadding(\n // heartbeatsCache wrapper properties\n JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;\n}\n/**\n * Returns the index of the heartbeat with the earliest date.\n * If the heartbeats array is empty, -1 is returned.\n */\nfunction getEarliestHeartbeatIdx(heartbeats) {\n if (heartbeats.length === 0) {\n return -1;\n }\n let earliestHeartbeatIdx = 0;\n let earliestHeartbeatDate = heartbeats[0].date;\n for (let i = 1; i < heartbeats.length; i++) {\n if (heartbeats[i].date < earliestHeartbeatDate) {\n earliestHeartbeatDate = heartbeats[i].date;\n earliestHeartbeatIdx = i;\n }\n }\n return earliestHeartbeatIdx;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction registerCoreComponents(variant) {\n _registerComponent(new Component('platform-logger', container => new PlatformLoggerServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n _registerComponent(new Component('heartbeat', container => new HeartbeatServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n // Register `app` package.\n registerVersion(name$q, version$1$1, variant);\n // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation\n registerVersion(name$q, version$1$1, 'esm2017');\n // Register platform SDK identifier (no version).\n registerVersion('fire-js', '');\n}\n\n/**\n * Firebase App\n *\n * @remarks This package coordinates the communication between the different Firebase components\n * @packageDocumentation\n */\nregisterCoreComponents('');\n\nvar commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n/** @license\nCopyright The Closure Library Authors.\nSPDX-License-Identifier: Apache-2.0\n*/\n\nvar Integer;\nvar Md5;\n(function() {var h;/** @license\n\n Copyright The Closure Library Authors.\n SPDX-License-Identifier: Apache-2.0\n*/\nfunction k(f,a){function c(){}c.prototype=a.prototype;f.D=a.prototype;f.prototype=new c;f.prototype.constructor=f;f.C=function(d,e,g){for(var b=Array(arguments.length-2),r=2;r<arguments.length;r++)b[r-2]=arguments[r];return a.prototype[e].apply(d,b)};}function l(){this.blockSize=-1;}function m(){this.blockSize=-1;this.blockSize=64;this.g=Array(4);this.B=Array(this.blockSize);this.o=this.h=0;this.s();}k(m,l);m.prototype.s=function(){this.g[0]=1732584193;this.g[1]=4023233417;this.g[2]=2562383102;this.g[3]=271733878;this.o=this.h=0;};\nfunction n(f,a,c){c||(c=0);var d=Array(16);if(\"string\"===typeof a)for(var e=0;16>e;++e)d[e]=a.charCodeAt(c++)|a.charCodeAt(c++)<<8|a.charCodeAt(c++)<<16|a.charCodeAt(c++)<<24;else for(e=0;16>e;++e)d[e]=a[c++]|a[c++]<<8|a[c++]<<16|a[c++]<<24;a=f.g[0];c=f.g[1];e=f.g[2];var g=f.g[3];var b=a+(g^c&(e^g))+d[0]+3614090360&4294967295;a=c+(b<<7&4294967295|b>>>25);b=g+(e^a&(c^e))+d[1]+3905402710&4294967295;g=a+(b<<12&4294967295|b>>>20);b=e+(c^g&(a^c))+d[2]+606105819&4294967295;e=g+(b<<17&4294967295|b>>>15);\nb=c+(a^e&(g^a))+d[3]+3250441966&4294967295;c=e+(b<<22&4294967295|b>>>10);b=a+(g^c&(e^g))+d[4]+4118548399&4294967295;a=c+(b<<7&4294967295|b>>>25);b=g+(e^a&(c^e))+d[5]+1200080426&4294967295;g=a+(b<<12&4294967295|b>>>20);b=e+(c^g&(a^c))+d[6]+2821735955&4294967295;e=g+(b<<17&4294967295|b>>>15);b=c+(a^e&(g^a))+d[7]+4249261313&4294967295;c=e+(b<<22&4294967295|b>>>10);b=a+(g^c&(e^g))+d[8]+1770035416&4294967295;a=c+(b<<7&4294967295|b>>>25);b=g+(e^a&(c^e))+d[9]+2336552879&4294967295;g=a+(b<<12&4294967295|\nb>>>20);b=e+(c^g&(a^c))+d[10]+4294925233&4294967295;e=g+(b<<17&4294967295|b>>>15);b=c+(a^e&(g^a))+d[11]+2304563134&4294967295;c=e+(b<<22&4294967295|b>>>10);b=a+(g^c&(e^g))+d[12]+1804603682&4294967295;a=c+(b<<7&4294967295|b>>>25);b=g+(e^a&(c^e))+d[13]+4254626195&4294967295;g=a+(b<<12&4294967295|b>>>20);b=e+(c^g&(a^c))+d[14]+2792965006&4294967295;e=g+(b<<17&4294967295|b>>>15);b=c+(a^e&(g^a))+d[15]+1236535329&4294967295;c=e+(b<<22&4294967295|b>>>10);b=a+(e^g&(c^e))+d[1]+4129170786&4294967295;a=c+(b<<\n5&4294967295|b>>>27);b=g+(c^e&(a^c))+d[6]+3225465664&4294967295;g=a+(b<<9&4294967295|b>>>23);b=e+(a^c&(g^a))+d[11]+643717713&4294967295;e=g+(b<<14&4294967295|b>>>18);b=c+(g^a&(e^g))+d[0]+3921069994&4294967295;c=e+(b<<20&4294967295|b>>>12);b=a+(e^g&(c^e))+d[5]+3593408605&4294967295;a=c+(b<<5&4294967295|b>>>27);b=g+(c^e&(a^c))+d[10]+38016083&4294967295;g=a+(b<<9&4294967295|b>>>23);b=e+(a^c&(g^a))+d[15]+3634488961&4294967295;e=g+(b<<14&4294967295|b>>>18);b=c+(g^a&(e^g))+d[4]+3889429448&4294967295;c=\ne+(b<<20&4294967295|b>>>12);b=a+(e^g&(c^e))+d[9]+568446438&4294967295;a=c+(b<<5&4294967295|b>>>27);b=g+(c^e&(a^c))+d[14]+3275163606&4294967295;g=a+(b<<9&4294967295|b>>>23);b=e+(a^c&(g^a))+d[3]+4107603335&4294967295;e=g+(b<<14&4294967295|b>>>18);b=c+(g^a&(e^g))+d[8]+1163531501&4294967295;c=e+(b<<20&4294967295|b>>>12);b=a+(e^g&(c^e))+d[13]+2850285829&4294967295;a=c+(b<<5&4294967295|b>>>27);b=g+(c^e&(a^c))+d[2]+4243563512&4294967295;g=a+(b<<9&4294967295|b>>>23);b=e+(a^c&(g^a))+d[7]+1735328473&4294967295;\ne=g+(b<<14&4294967295|b>>>18);b=c+(g^a&(e^g))+d[12]+2368359562&4294967295;c=e+(b<<20&4294967295|b>>>12);b=a+(c^e^g)+d[5]+4294588738&4294967295;a=c+(b<<4&4294967295|b>>>28);b=g+(a^c^e)+d[8]+2272392833&4294967295;g=a+(b<<11&4294967295|b>>>21);b=e+(g^a^c)+d[11]+1839030562&4294967295;e=g+(b<<16&4294967295|b>>>16);b=c+(e^g^a)+d[14]+4259657740&4294967295;c=e+(b<<23&4294967295|b>>>9);b=a+(c^e^g)+d[1]+2763975236&4294967295;a=c+(b<<4&4294967295|b>>>28);b=g+(a^c^e)+d[4]+1272893353&4294967295;g=a+(b<<11&4294967295|\nb>>>21);b=e+(g^a^c)+d[7]+4139469664&4294967295;e=g+(b<<16&4294967295|b>>>16);b=c+(e^g^a)+d[10]+3200236656&4294967295;c=e+(b<<23&4294967295|b>>>9);b=a+(c^e^g)+d[13]+681279174&4294967295;a=c+(b<<4&4294967295|b>>>28);b=g+(a^c^e)+d[0]+3936430074&4294967295;g=a+(b<<11&4294967295|b>>>21);b=e+(g^a^c)+d[3]+3572445317&4294967295;e=g+(b<<16&4294967295|b>>>16);b=c+(e^g^a)+d[6]+76029189&4294967295;c=e+(b<<23&4294967295|b>>>9);b=a+(c^e^g)+d[9]+3654602809&4294967295;a=c+(b<<4&4294967295|b>>>28);b=g+(a^c^e)+d[12]+\n3873151461&4294967295;g=a+(b<<11&4294967295|b>>>21);b=e+(g^a^c)+d[15]+530742520&4294967295;e=g+(b<<16&4294967295|b>>>16);b=c+(e^g^a)+d[2]+3299628645&4294967295;c=e+(b<<23&4294967295|b>>>9);b=a+(e^(c|~g))+d[0]+4096336452&4294967295;a=c+(b<<6&4294967295|b>>>26);b=g+(c^(a|~e))+d[7]+1126891415&4294967295;g=a+(b<<10&4294967295|b>>>22);b=e+(a^(g|~c))+d[14]+2878612391&4294967295;e=g+(b<<15&4294967295|b>>>17);b=c+(g^(e|~a))+d[5]+4237533241&4294967295;c=e+(b<<21&4294967295|b>>>11);b=a+(e^(c|~g))+d[12]+1700485571&\n4294967295;a=c+(b<<6&4294967295|b>>>26);b=g+(c^(a|~e))+d[3]+2399980690&4294967295;g=a+(b<<10&4294967295|b>>>22);b=e+(a^(g|~c))+d[10]+4293915773&4294967295;e=g+(b<<15&4294967295|b>>>17);b=c+(g^(e|~a))+d[1]+2240044497&4294967295;c=e+(b<<21&4294967295|b>>>11);b=a+(e^(c|~g))+d[8]+1873313359&4294967295;a=c+(b<<6&4294967295|b>>>26);b=g+(c^(a|~e))+d[15]+4264355552&4294967295;g=a+(b<<10&4294967295|b>>>22);b=e+(a^(g|~c))+d[6]+2734768916&4294967295;e=g+(b<<15&4294967295|b>>>17);b=c+(g^(e|~a))+d[13]+1309151649&\n4294967295;c=e+(b<<21&4294967295|b>>>11);b=a+(e^(c|~g))+d[4]+4149444226&4294967295;a=c+(b<<6&4294967295|b>>>26);b=g+(c^(a|~e))+d[11]+3174756917&4294967295;g=a+(b<<10&4294967295|b>>>22);b=e+(a^(g|~c))+d[2]+718787259&4294967295;e=g+(b<<15&4294967295|b>>>17);b=c+(g^(e|~a))+d[9]+3951481745&4294967295;f.g[0]=f.g[0]+a&4294967295;f.g[1]=f.g[1]+(e+(b<<21&4294967295|b>>>11))&4294967295;f.g[2]=f.g[2]+e&4294967295;f.g[3]=f.g[3]+g&4294967295;}\nm.prototype.u=function(f,a){ void 0===a&&(a=f.length);for(var c=a-this.blockSize,d=this.B,e=this.h,g=0;g<a;){if(0==e)for(;g<=c;)n(this,f,g),g+=this.blockSize;if(\"string\"===typeof f)for(;g<a;){if(d[e++]=f.charCodeAt(g++),e==this.blockSize){n(this,d);e=0;break}}else for(;g<a;)if(d[e++]=f[g++],e==this.blockSize){n(this,d);e=0;break}}this.h=e;this.o+=a;};\nm.prototype.v=function(){var f=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);f[0]=128;for(var a=1;a<f.length-8;++a)f[a]=0;var c=8*this.o;for(a=f.length-8;a<f.length;++a)f[a]=c&255,c/=256;this.u(f);f=Array(16);for(a=c=0;4>a;++a)for(var d=0;32>d;d+=8)f[c++]=this.g[a]>>>d&255;return f};function p(f,a){var c=q;return Object.prototype.hasOwnProperty.call(c,f)?c[f]:c[f]=a(f)}function t(f,a){this.h=a;for(var c=[],d=true,e=f.length-1;0<=e;e--){var g=f[e]|0;d&&g==a||(c[e]=g,d=false);}this.g=c;}var q={};function u(f){return -128<=f&&128>f?p(f,function(a){return new t([a|0],0>a?-1:0)}):new t([f|0],0>f?-1:0)}function v(f){if(isNaN(f)||!isFinite(f))return w;if(0>f)return x(v(-f));for(var a=[],c=1,d=0;f>=c;d++)a[d]=f/c|0,c*=4294967296;return new t(a,0)}\nfunction y(f,a){if(0==f.length)throw Error(\"number format error: empty string\");a=a||10;if(2>a||36<a)throw Error(\"radix out of range: \"+a);if(\"-\"==f.charAt(0))return x(y(f.substring(1),a));if(0<=f.indexOf(\"-\"))throw Error('number format error: interior \"-\" character');for(var c=v(Math.pow(a,8)),d=w,e=0;e<f.length;e+=8){var g=Math.min(8,f.length-e),b=parseInt(f.substring(e,e+g),a);8>g?(g=v(Math.pow(a,g)),d=d.j(g).add(v(b))):(d=d.j(c),d=d.add(v(b)));}return d}var w=u(0),z=u(1),A=u(16777216);h=t.prototype;\nh.m=function(){if(B(this))return -x(this).m();for(var f=0,a=1,c=0;c<this.g.length;c++){var d=this.i(c);f+=(0<=d?d:4294967296+d)*a;a*=4294967296;}return f};h.toString=function(f){f=f||10;if(2>f||36<f)throw Error(\"radix out of range: \"+f);if(C(this))return \"0\";if(B(this))return \"-\"+x(this).toString(f);for(var a=v(Math.pow(f,6)),c=this,d=\"\";;){var e=D(c,a).g;c=F(c,e.j(a));var g=((0<c.g.length?c.g[0]:c.h)>>>0).toString(f);c=e;if(C(c))return g+d;for(;6>g.length;)g=\"0\"+g;d=g+d;}};\nh.i=function(f){return 0>f?0:f<this.g.length?this.g[f]:this.h};function C(f){if(0!=f.h)return false;for(var a=0;a<f.g.length;a++)if(0!=f.g[a])return false;return true}function B(f){return -1==f.h}h.l=function(f){f=F(this,f);return B(f)?-1:C(f)?0:1};function x(f){for(var a=f.g.length,c=[],d=0;d<a;d++)c[d]=~f.g[d];return (new t(c,~f.h)).add(z)}h.abs=function(){return B(this)?x(this):this};\nh.add=function(f){for(var a=Math.max(this.g.length,f.g.length),c=[],d=0,e=0;e<=a;e++){var g=d+(this.i(e)&65535)+(f.i(e)&65535),b=(g>>>16)+(this.i(e)>>>16)+(f.i(e)>>>16);d=b>>>16;g&=65535;b&=65535;c[e]=b<<16|g;}return new t(c,c[c.length-1]&-2147483648?-1:0)};function F(f,a){return f.add(x(a))}\nh.j=function(f){if(C(this)||C(f))return w;if(B(this))return B(f)?x(this).j(x(f)):x(x(this).j(f));if(B(f))return x(this.j(x(f)));if(0>this.l(A)&&0>f.l(A))return v(this.m()*f.m());for(var a=this.g.length+f.g.length,c=[],d=0;d<2*a;d++)c[d]=0;for(d=0;d<this.g.length;d++)for(var e=0;e<f.g.length;e++){var g=this.i(d)>>>16,b=this.i(d)&65535,r=f.i(e)>>>16,E=f.i(e)&65535;c[2*d+2*e]+=b*E;G(c,2*d+2*e);c[2*d+2*e+1]+=g*E;G(c,2*d+2*e+1);c[2*d+2*e+1]+=b*r;G(c,2*d+2*e+1);c[2*d+2*e+2]+=g*r;G(c,2*d+2*e+2);}for(d=0;d<\na;d++)c[d]=c[2*d+1]<<16|c[2*d];for(d=a;d<2*a;d++)c[d]=0;return new t(c,0)};function G(f,a){for(;(f[a]&65535)!=f[a];)f[a+1]+=f[a]>>>16,f[a]&=65535,a++;}function H(f,a){this.g=f;this.h=a;}\nfunction D(f,a){if(C(a))throw Error(\"division by zero\");if(C(f))return new H(w,w);if(B(f))return a=D(x(f),a),new H(x(a.g),x(a.h));if(B(a))return a=D(f,x(a)),new H(x(a.g),a.h);if(30<f.g.length){if(B(f)||B(a))throw Error(\"slowDivide_ only works with positive integers.\");for(var c=z,d=a;0>=d.l(f);)c=I(c),d=I(d);var e=J(c,1),g=J(d,1);d=J(d,2);for(c=J(c,2);!C(d);){var b=g.add(d);0>=b.l(f)&&(e=e.add(c),g=b);d=J(d,1);c=J(c,1);}a=F(f,e.j(a));return new H(e,a)}for(e=w;0<=f.l(a);){c=Math.max(1,Math.floor(f.m()/\na.m()));d=Math.ceil(Math.log(c)/Math.LN2);d=48>=d?1:Math.pow(2,d-48);g=v(c);for(b=g.j(a);B(b)||0<b.l(f);)c-=d,g=v(c),b=g.j(a);C(g)&&(g=z);e=e.add(g);f=F(f,b);}return new H(e,f)}h.A=function(f){return D(this,f).h};h.and=function(f){for(var a=Math.max(this.g.length,f.g.length),c=[],d=0;d<a;d++)c[d]=this.i(d)&f.i(d);return new t(c,this.h&f.h)};h.or=function(f){for(var a=Math.max(this.g.length,f.g.length),c=[],d=0;d<a;d++)c[d]=this.i(d)|f.i(d);return new t(c,this.h|f.h)};\nh.xor=function(f){for(var a=Math.max(this.g.length,f.g.length),c=[],d=0;d<a;d++)c[d]=this.i(d)^f.i(d);return new t(c,this.h^f.h)};function I(f){for(var a=f.g.length+1,c=[],d=0;d<a;d++)c[d]=f.i(d)<<1|f.i(d-1)>>>31;return new t(c,f.h)}function J(f,a){var c=a>>5;a%=32;for(var d=f.g.length-c,e=[],g=0;g<d;g++)e[g]=0<a?f.i(g+c)>>>a|f.i(g+c+1)<<32-a:f.i(g+c);return new t(e,f.h)}m.prototype.digest=m.prototype.v;m.prototype.reset=m.prototype.s;m.prototype.update=m.prototype.u;Md5 = m;t.prototype.add=t.prototype.add;t.prototype.multiply=t.prototype.j;t.prototype.modulo=t.prototype.A;t.prototype.compare=t.prototype.l;t.prototype.toNumber=t.prototype.m;t.prototype.toString=t.prototype.toString;t.prototype.getBits=t.prototype.i;t.fromNumber=v;t.fromString=y;Integer = t;}).apply( typeof commonjsGlobal$1 !== 'undefined' ? commonjsGlobal$1 : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\n/** @license\nCopyright The Closure Library Authors.\nSPDX-License-Identifier: Apache-2.0\n*/\n\nvar XhrIo;\nvar WebChannel;\nvar EventType;\nvar ErrorCode;\nvar Stat;\nvar Event;\nvar getStatEventTarget;\nvar createWebChannelTransport;\n(function() {var h,aa=\"function\"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};function ba(a){a=[\"object\"==typeof globalThis&&globalThis,a,\"object\"==typeof window&&window,\"object\"==typeof self&&self,\"object\"==typeof commonjsGlobal&&commonjsGlobal];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error(\"Cannot find global object\");}var ca=ba(this);\nfunction da(a,b){if(b)a:{var c=ca;a=a.split(\".\");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e];}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:true,writable:true,value:b});}}function ea(a,b){a instanceof String&&(a+=\"\");var c=0,d=false,e={next:function(){if(!d&&c<a.length){var f=c++;return {value:b(f,a[f]),done:false}}d=true;return {done:true,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}\nda(\"Array.prototype.values\",function(a){return a?a:function(){return ea(this,function(b,c){return c})}});/** @license\n\n Copyright The Closure Library Authors.\n SPDX-License-Identifier: Apache-2.0\n*/\nvar fa=fa||{},k=this||self;function ha(a){var b=typeof a;b=\"object\"!=b?b:a?Array.isArray(a)?\"array\":b:\"null\";return \"array\"==b||\"object\"==b&&\"number\"==typeof a.length}function n(a){var b=typeof a;return \"object\"==b&&null!=a||\"function\"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)}\nfunction ja(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}}function p(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?ia:ja;return p.apply(null,arguments)}\nfunction ka(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();d.push.apply(d,arguments);return a.apply(this,d)}}function r(a,b){function c(){}c.prototype=b.prototype;a.aa=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Qb=function(d,e,f){for(var g=Array(arguments.length-2),m=2;m<arguments.length;m++)g[m-2]=arguments[m];return b.prototype[e].apply(d,g)};}function la(a){const b=a.length;if(0<b){const c=Array(b);for(let d=0;d<b;d++)c[d]=a[d];return c}return []}function ma(a,b){for(let c=1;c<arguments.length;c++){const d=arguments[c];if(ha(d)){const e=a.length||0,f=d.length||0;a.length=e+f;for(let g=0;g<f;g++)a[e+g]=d[g];}else a.push(d);}}class na{constructor(a,b){this.i=a;this.j=b;this.h=0;this.g=null;}get(){let a;0<this.h?(this.h--,a=this.g,this.g=a.next,a.next=null):a=this.i();return a}}function t(a){return /^[\\s\\xa0]*$/.test(a)}function u(){var a=k.navigator;return a&&(a=a.userAgent)?a:\"\"}function oa(a){oa[\" \"](a);return a}oa[\" \"]=function(){};var pa=-1!=u().indexOf(\"Gecko\")&&!(-1!=u().toLowerCase().indexOf(\"webkit\")&&-1==u().indexOf(\"Edge\"))&&!(-1!=u().indexOf(\"Trident\")||-1!=u().indexOf(\"MSIE\"))&&-1==u().indexOf(\"Edge\");function qa(a,b,c){for(const d in a)b.call(c,a[d],d,a);}function ra(a,b){for(const c in a)b.call(void 0,a[c],c,a);}function sa(a){const b={};for(const c in a)b[c]=a[c];return b}const ta=\"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");function ua(a,b){let c,d;for(let e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(let f=0;f<ta.length;f++)c=ta[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c]);}}function va(a){var b=1;a=a.split(\":\");const c=[];for(;0<b&&a.length;)c.push(a.shift()),b--;a.length&&c.push(a.join(\":\"));return c}function wa(a){k.setTimeout(()=>{throw a;},0);}function xa(){var a=za;let b=null;a.g&&(b=a.g,a.g=a.g.next,a.g||(a.h=null),b.next=null);return b}class Aa{constructor(){this.h=this.g=null;}add(a,b){const c=Ba.get();c.set(a,b);this.h?this.h.next=c:this.g=c;this.h=c;}}var Ba=new na(()=>new Ca,a=>a.reset());class Ca{constructor(){this.next=this.g=this.h=null;}set(a,b){this.h=a;this.g=b;this.next=null;}reset(){this.next=this.g=this.h=null;}}let x,y=false,za=new Aa,Ea=()=>{const a=k.Promise.resolve(void 0);x=()=>{a.then(Da);};};var Da=()=>{for(var a;a=xa();){try{a.h.call(a.g);}catch(c){wa(c);}var b=Ba;b.j(a);100>b.h&&(b.h++,a.next=b.g,b.g=a);}y=false;};function z(){this.s=this.s;this.C=this.C;}z.prototype.s=false;z.prototype.ma=function(){this.s||(this.s=true,this.N());};z.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()();};function A(a,b){this.type=a;this.g=this.target=b;this.defaultPrevented=false;}A.prototype.h=function(){this.defaultPrevented=true;};var Fa=function(){if(!k.addEventListener||!Object.defineProperty)return false;var a=false,b=Object.defineProperty({},\"passive\",{get:function(){a=true;}});try{const c=()=>{};k.addEventListener(\"test\",c,b);k.removeEventListener(\"test\",c,b);}catch(c){}return a}();function C(a,b){A.call(this,a?a.type:\"\");this.relatedTarget=this.g=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key=\"\";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=false;this.state=null;this.pointerId=0;this.pointerType=\"\";this.i=null;if(a){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.g=b;if(b=a.relatedTarget){if(pa){a:{try{oa(b.nodeName);var e=!0;break a}catch(f){}e=\nfalse;}e||(b=null);}}else \"mouseover\"==c?b=a.fromElement:\"mouseout\"==c&&(b=a.toElement);this.relatedTarget=b;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.key=a.key||\"\";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=\na.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType=\"string\"===typeof a.pointerType?a.pointerType:Ga[a.pointerType]||\"\";this.state=a.state;this.i=a;a.defaultPrevented&&C.aa.h.call(this);}}r(C,A);var Ga={2:\"touch\",3:\"pen\",4:\"mouse\"};C.prototype.h=function(){C.aa.h.call(this);var a=this.i;a.preventDefault?a.preventDefault():a.returnValue=false;};var D=\"closure_listenable_\"+(1E6*Math.random()|0);var Ha=0;function Ia(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.ha=e;this.key=++Ha;this.da=this.fa=false;}function Ja(a){a.da=true;a.listener=null;a.proxy=null;a.src=null;a.ha=null;}function Ka(a){this.src=a;this.g={};this.h=0;}Ka.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.g[f];a||(a=this.g[f]=[],this.h++);var g=La(a,b,d,e);-1<g?(b=a[g],c||(b.fa=false)):(b=new Ia(b,this.src,f,!!d,e),b.fa=c,a.push(b));return b};function Ma(a,b){var c=b.type;if(c in a.g){var d=a.g[c],e=Array.prototype.indexOf.call(d,b,void 0),f;(f=0<=e)&&Array.prototype.splice.call(d,e,1);f&&(Ja(b),0==a.g[c].length&&(delete a.g[c],a.h--));}}\nfunction La(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.da&&f.listener==b&&f.capture==!!c&&f.ha==d)return e}return -1}var Na=\"closure_lm_\"+(1E6*Math.random()|0),Oa={};function Qa(a,b,c,d,e){if(Array.isArray(b)){for(var f=0;f<b.length;f++)Qa(a,b[f],c,d,e);return null}c=Sa(c);return a&&a[D]?a.K(b,c,n(d)?!!d.capture:false,e):Ta(a,b,c,false,d,e)}\nfunction Ta(a,b,c,d,e,f){if(!b)throw Error(\"Invalid event type\");var g=n(e)?!!e.capture:!!e,m=Ua(a);m||(a[Na]=m=new Ka(a));c=m.add(b,c,d,g,f);if(c.proxy)return c;d=Va();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)Fa||(e=g),void 0===e&&(e=false),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(Wa(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error(\"addEventListener and attachEvent are unavailable.\");return c}\nfunction Va(){function a(c){return b.call(a.src,a.listener,c)}const b=Xa;return a}function Ya(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)Ya(a,b[f],c,d,e);else (d=n(d)?!!d.capture:!!d,c=Sa(c),a&&a[D])?(a=a.i,b=String(b).toString(),b in a.g&&(f=a.g[b],c=La(f,c,d,e),-1<c&&(Ja(f[c]),Array.prototype.splice.call(f,c,1),0==f.length&&(delete a.g[b],a.h--)))):a&&(a=Ua(a))&&(b=a.g[b.toString()],a=-1,b&&(a=La(b,c,d,e)),(c=-1<a?b[a]:null)&&Za(c));}\nfunction Za(a){if(\"number\"!==typeof a&&a&&!a.da){var b=a.src;if(b&&b[D])Ma(b.i,a);else {var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(Wa(c),d):b.addListener&&b.removeListener&&b.removeListener(d);(c=Ua(b))?(Ma(c,a),0==c.h&&(c.src=null,b[Na]=null)):Ja(a);}}}function Wa(a){return a in Oa?Oa[a]:Oa[a]=\"on\"+a}function Xa(a,b){if(a.da)a=true;else {b=new C(b,this);var c=a.listener,d=a.ha||a.src;a.fa&&Za(a);a=c.call(d,b);}return a}\nfunction Ua(a){a=a[Na];return a instanceof Ka?a:null}var $a=\"__closure_events_fn_\"+(1E9*Math.random()>>>0);function Sa(a){if(\"function\"===typeof a)return a;a[$a]||(a[$a]=function(b){return a.handleEvent(b)});return a[$a]}function E(){z.call(this);this.i=new Ka(this);this.M=this;this.F=null;}r(E,z);E.prototype[D]=true;E.prototype.removeEventListener=function(a,b,c,d){Ya(this,a,b,c,d);};\nfunction F(a,b){var c,d=a.F;if(d)for(c=[];d;d=d.F)c.push(d);a=a.M;d=b.type||b;if(\"string\"===typeof b)b=new A(b,a);else if(b instanceof A)b.target=b.target||a;else {var e=b;b=new A(d,a);ua(b,e);}e=true;if(c)for(var f=c.length-1;0<=f;f--){var g=b.g=c[f];e=ab(g,d,true,b)&&e;}g=b.g=a;e=ab(g,d,true,b)&&e;e=ab(g,d,false,b)&&e;if(c)for(f=0;f<c.length;f++)g=b.g=c[f],e=ab(g,d,false,b)&&e;}\nE.prototype.N=function(){E.aa.N.call(this);if(this.i){var a=this.i,c;for(c in a.g){for(var d=a.g[c],e=0;e<d.length;e++)Ja(d[e]);delete a.g[c];a.h--;}}this.F=null;};E.prototype.K=function(a,b,c,d){return this.i.add(String(a),b,false,c,d)};E.prototype.L=function(a,b,c,d){return this.i.add(String(a),b,true,c,d)};\nfunction ab(a,b,c,d){b=a.i.g[String(b)];if(!b)return true;b=b.concat();for(var e=true,f=0;f<b.length;++f){var g=b[f];if(g&&!g.da&&g.capture==c){var m=g.listener,q=g.ha||g.src;g.fa&&Ma(a.i,g);e=false!==m.call(q,d)&&e;}}return e&&!d.defaultPrevented}function bb(a,b,c){if(\"function\"===typeof a)c&&(a=p(a,c));else if(a&&\"function\"==typeof a.handleEvent)a=p(a.handleEvent,a);else throw Error(\"Invalid listener argument\");return 2147483647<Number(b)?-1:k.setTimeout(a,b||0)}function cb(a){a.g=bb(()=>{a.g=null;a.i&&(a.i=false,cb(a));},a.l);const b=a.h;a.h=null;a.m.apply(null,b);}class eb extends z{constructor(a,b){super();this.m=a;this.l=b;this.h=null;this.i=false;this.g=null;}j(a){this.h=arguments;this.g?this.i=true:cb(this);}N(){super.N();this.g&&(k.clearTimeout(this.g),this.g=null,this.i=false,this.h=null);}}function G(a){z.call(this);this.h=a;this.g={};}r(G,z);var fb=[];function gb(a){qa(a.g,function(b,c){this.g.hasOwnProperty(c)&&Za(b);},a);a.g={};}G.prototype.N=function(){G.aa.N.call(this);gb(this);};G.prototype.handleEvent=function(){throw Error(\"EventHandler.handleEvent not implemented\");};var hb=k.JSON.stringify;var ib=k.JSON.parse;var jb=class{stringify(a){return k.JSON.stringify(a,void 0)}parse(a){return k.JSON.parse(a,void 0)}};function kb(){}kb.prototype.h=null;function lb(a){return a.h||(a.h=a.i())}function mb(){}var H={OPEN:\"a\",kb:\"b\",Ja:\"c\",wb:\"d\"};function nb(){A.call(this,\"d\");}r(nb,A);function ob(){A.call(this,\"c\");}r(ob,A);var I={},pb=null;function qb(){return pb=pb||new E}I.La=\"serverreachability\";function rb(a){A.call(this,I.La,a);}r(rb,A);function J(a){const b=qb();F(b,new rb(b));}I.STAT_EVENT=\"statevent\";function sb(a,b){A.call(this,I.STAT_EVENT,a);this.stat=b;}r(sb,A);function K(a){const b=qb();F(b,new sb(b,a));}I.Ma=\"timingevent\";function tb(a,b){A.call(this,I.Ma,a);this.size=b;}r(tb,A);\nfunction ub(a,b){if(\"function\"!==typeof a)throw Error(\"Fn must not be null and must be a function\");return k.setTimeout(function(){a();},b)}function vb(){this.g=true;}vb.prototype.xa=function(){this.g=false;};function wb(a,b,c,d,e,f){a.info(function(){if(a.g)if(f){var g=\"\";for(var m=f.split(\"&\"),q=0;q<m.length;q++){var l=m[q].split(\"=\");if(1<l.length){var v=l[0];l=l[1];var w=v.split(\"_\");g=2<=w.length&&\"type\"==w[1]?g+(v+\"=\"+l+\"&\"):g+(v+\"=redacted&\");}}}else g=null;else g=f;return \"XMLHTTP REQ (\"+d+\") [attempt \"+e+\"]: \"+b+\"\\n\"+c+\"\\n\"+g});}\nfunction xb(a,b,c,d,e,f,g){a.info(function(){return \"XMLHTTP RESP (\"+d+\") [ attempt \"+e+\"]: \"+b+\"\\n\"+c+\"\\n\"+f+\" \"+g});}function L(a,b,c,d){a.info(function(){return \"XMLHTTP TEXT (\"+b+\"): \"+yb(a,c)+(d?\" \"+d:\"\")});}function zb(a,b){a.info(function(){return \"TIMEOUT: \"+b});}vb.prototype.info=function(){};\nfunction yb(a,b){if(!a.g)return b;if(!b)return null;try{var c=JSON.parse(b);if(c)for(a=0;a<c.length;a++)if(Array.isArray(c[a])){var d=c[a];if(!(2>d.length)){var e=d[1];if(Array.isArray(e)&&!(1>e.length)){var f=e[0];if(\"noop\"!=f&&\"stop\"!=f&&\"close\"!=f)for(var g=1;g<e.length;g++)e[g]=\"\";}}}return hb(c)}catch(m){return b}}var Ab={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9};var Bb={lb:\"complete\",Hb:\"success\",Ja:\"error\",Ia:\"abort\",zb:\"ready\",Ab:\"readystatechange\",TIMEOUT:\"timeout\",vb:\"incrementaldata\",yb:\"progress\",ob:\"downloadprogress\",Pb:\"uploadprogress\"};var Cb;function Db(){}r(Db,kb);Db.prototype.g=function(){return new XMLHttpRequest};Db.prototype.i=function(){return {}};Cb=new Db;function M(a,b,c,d){this.j=a;this.i=b;this.l=c;this.R=d||1;this.U=new G(this);this.I=45E3;this.H=null;this.o=false;this.m=this.A=this.v=this.L=this.F=this.S=this.B=null;this.D=[];this.g=null;this.C=0;this.s=this.u=null;this.X=-1;this.J=false;this.O=0;this.M=null;this.W=this.K=this.T=this.P=false;this.h=new Eb;}function Eb(){this.i=null;this.g=\"\";this.h=false;}var Fb={},Gb={};function Hb(a,b,c){a.L=1;a.v=Ib(N(b));a.m=c;a.P=true;Jb(a,null);}\nfunction Jb(a,b){a.F=Date.now();Kb(a);a.A=N(a.v);var c=a.A,d=a.R;Array.isArray(d)||(d=[String(d)]);Lb(c.i,\"t\",d);a.C=0;c=a.j.J;a.h=new Eb;a.g=Mb(a.j,c?b:null,!a.m);0<a.O&&(a.M=new eb(p(a.Y,a,a.g),a.O));b=a.U;c=a.g;d=a.ca;var e=\"readystatechange\";Array.isArray(e)||(e&&(fb[0]=e.toString()),e=fb);for(var f=0;f<e.length;f++){var g=Qa(c,e[f],d||b.handleEvent,false,b.h||b);if(!g)break;b.g[g.key]=g;}b=a.H?sa(a.H):{};a.m?(a.u||(a.u=\"POST\"),b[\"Content-Type\"]=\"application/x-www-form-urlencoded\",a.g.ea(a.A,a.u,\na.m,b)):(a.u=\"GET\",a.g.ea(a.A,a.u,null,b));J();wb(a.i,a.u,a.A,a.l,a.R,a.m);}M.prototype.ca=function(a){a=a.target;const b=this.M;b&&3==P(a)?b.j():this.Y(a);};\nM.prototype.Y=function(a){try{if(a==this.g)a:{const w=P(this.g);var b=this.g.Ba();const O=this.g.Z();if(!(3>w)&&(3!=w||this.g&&(this.h.h||this.g.oa()||Nb(this.g)))){this.J||4!=w||7==b||(8==b||0>=O?J(3):J(2));Ob(this);var c=this.g.Z();this.X=c;b:if(Pb(this)){var d=Nb(this.g);a=\"\";var e=d.length,f=4==P(this.g);if(!this.h.i){if(\"undefined\"===typeof TextDecoder){Q(this);Qb(this);var g=\"\";break b}this.h.i=new k.TextDecoder;}for(b=0;b<e;b++)this.h.h=!0,a+=this.h.i.decode(d[b],{stream:!(f&&b==e-1)});d.length=\n0;this.h.g+=a;this.C=0;g=this.h.g;}else g=this.g.oa();this.o=200==c;xb(this.i,this.u,this.A,this.l,this.R,w,c);if(this.o){if(this.T&&!this.K){b:{if(this.g){var m,q=this.g;if((m=q.g?q.g.getResponseHeader(\"X-HTTP-Initial-Response\"):null)&&!t(m)){var l=m;break b}}l=null;}if(c=l)L(this.i,this.l,c,\"Initial handshake response via X-HTTP-Initial-Response\"),this.K=!0,Rb(this,c);else {this.o=!1;this.s=3;K(12);Q(this);Qb(this);break a}}if(this.P){c=!0;let B;for(;!this.J&&this.C<g.length;)if(B=Sb(this,g),B==Gb){4==\nw&&(this.s=4,K(14),c=!1);L(this.i,this.l,null,\"[Incomplete Response]\");break}else if(B==Fb){this.s=4;K(15);L(this.i,this.l,g,\"[Invalid Chunk]\");c=!1;break}else L(this.i,this.l,B,null),Rb(this,B);Pb(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0);4!=w||0!=g.length||this.h.h||(this.s=1,K(16),c=!1);this.o=this.o&&c;if(!c)L(this.i,this.l,g,\"[Invalid Chunked Response]\"),Q(this),Qb(this);else if(0<g.length&&!this.W){this.W=!0;var v=this.j;v.g==this&&v.ba&&!v.M&&(v.j.info(\"Great, no buffering proxy detected. Bytes received: \"+\ng.length),Tb(v),v.M=!0,K(11));}}else L(this.i,this.l,g,null),Rb(this,g);4==w&&Q(this);this.o&&!this.J&&(4==w?Ub(this.j,this):(this.o=!1,Kb(this)));}else Vb(this.g),400==c&&0<g.indexOf(\"Unknown SID\")?(this.s=3,K(12)):(this.s=0,K(13)),Q(this),Qb(this);}}}catch(w){}finally{}};function Pb(a){return a.g?\"GET\"==a.u&&2!=a.L&&a.j.Ca:false}\nfunction Sb(a,b){var c=a.C,d=b.indexOf(\"\\n\",c);if(-1==d)return Gb;c=Number(b.substring(c,d));if(isNaN(c))return Fb;d+=1;if(d+c>b.length)return Gb;b=b.slice(d,d+c);a.C=d+c;return b}M.prototype.cancel=function(){this.J=true;Q(this);};function Kb(a){a.S=Date.now()+a.I;Wb(a,a.I);}function Wb(a,b){if(null!=a.B)throw Error(\"WatchDog timer not null\");a.B=ub(p(a.ba,a),b);}function Ob(a){a.B&&(k.clearTimeout(a.B),a.B=null);}\nM.prototype.ba=function(){this.B=null;const a=Date.now();0<=a-this.S?(zb(this.i,this.A),2!=this.L&&(J(),K(17)),Q(this),this.s=2,Qb(this)):Wb(this,this.S-a);};function Qb(a){0==a.j.G||a.J||Ub(a.j,a);}function Q(a){Ob(a);var b=a.M;b&&\"function\"==typeof b.ma&&b.ma();a.M=null;gb(a.U);a.g&&(b=a.g,a.g=null,b.abort(),b.ma());}\nfunction Rb(a,b){try{var c=a.j;if(0!=c.G&&(c.g==a||Xb(c.h,a)))if(!a.K&&Xb(c.h,a)&&3==c.G){try{var d=c.Da.g.parse(b);}catch(l){d=null;}if(Array.isArray(d)&&3==d.length){var e=d;if(0==e[0])a:{if(!c.u){if(c.g)if(c.g.F+3E3<a.F)Yb(c),Zb(c);else break a;$b(c);K(18);}}else c.za=e[1],0<c.za-c.T&&37500>e[2]&&c.F&&0==c.v&&!c.C&&(c.C=ub(p(c.Za,c),6E3));if(1>=ac(c.h)&&c.ca){try{c.ca();}catch(l){}c.ca=void 0;}}else R(c,11);}else if((a.K||c.g==a)&&Yb(c),!t(b))for(e=c.Da.g.parse(b),b=0;b<e.length;b++){let l=e[b];c.T=\nl[0];l=l[1];if(2==c.G)if(\"c\"==l[0]){c.K=l[1];c.ia=l[2];const v=l[3];null!=v&&(c.la=v,c.j.info(\"VER=\"+c.la));const w=l[4];null!=w&&(c.Aa=w,c.j.info(\"SVER=\"+c.Aa));const O=l[5];null!=O&&\"number\"===typeof O&&0<O&&(d=1.5*O,c.L=d,c.j.info(\"backChannelRequestTimeoutMs_=\"+d));d=c;const B=a.g;if(B){const ya=B.g?B.g.getResponseHeader(\"X-Client-Wire-Protocol\"):null;if(ya){var f=d.h;f.g||-1==ya.indexOf(\"spdy\")&&-1==ya.indexOf(\"quic\")&&-1==ya.indexOf(\"h2\")||(f.j=f.l,f.g=new Set,f.h&&(bc(f,f.h),f.h=null));}if(d.D){const db=\nB.g?B.g.getResponseHeader(\"X-HTTP-Session-Id\"):null;db&&(d.ya=db,S(d.I,d.D,db));}}c.G=3;c.l&&c.l.ua();c.ba&&(c.R=Date.now()-a.F,c.j.info(\"Handshake RTT: \"+c.R+\"ms\"));d=c;var g=a;d.qa=cc(d,d.J?d.ia:null,d.W);if(g.K){dc(d.h,g);var m=g,q=d.L;q&&(m.I=q);m.B&&(Ob(m),Kb(m));d.g=g;}else ec(d);0<c.i.length&&fc(c);}else \"stop\"!=l[0]&&\"close\"!=l[0]||R(c,7);else 3==c.G&&(\"stop\"==l[0]||\"close\"==l[0]?\"stop\"==l[0]?R(c,7):gc(c):\"noop\"!=l[0]&&c.l&&c.l.ta(l),c.v=0);}J(4);}catch(l){}}var hc=class{constructor(a,b){this.g=a;this.map=b;}};function ic(a){this.l=a||10;k.PerformanceNavigationTiming?(a=k.performance.getEntriesByType(\"navigation\"),a=0<a.length&&(\"hq\"==a[0].nextHopProtocol||\"h2\"==a[0].nextHopProtocol)):a=!!(k.chrome&&k.chrome.loadTimes&&k.chrome.loadTimes()&&k.chrome.loadTimes().wasFetchedViaSpdy);this.j=a?this.l:1;this.g=null;1<this.j&&(this.g=new Set);this.h=null;this.i=[];}function jc(a){return a.h?true:a.g?a.g.size>=a.j:false}function ac(a){return a.h?1:a.g?a.g.size:0}function Xb(a,b){return a.h?a.h==b:a.g?a.g.has(b):false}\nfunction bc(a,b){a.g?a.g.add(b):a.h=b;}function dc(a,b){a.h&&a.h==b?a.h=null:a.g&&a.g.has(b)&&a.g.delete(b);}ic.prototype.cancel=function(){this.i=kc(this);if(this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const a of this.g.values())a.cancel();this.g.clear();}};function kc(a){if(null!=a.h)return a.i.concat(a.h.D);if(null!=a.g&&0!==a.g.size){let b=a.i;for(const c of a.g.values())b=b.concat(c.D);return b}return la(a.i)}function lc(a){if(a.V&&\"function\"==typeof a.V)return a.V();if(\"undefined\"!==typeof Map&&a instanceof Map||\"undefined\"!==typeof Set&&a instanceof Set)return Array.from(a.values());if(\"string\"===typeof a)return a.split(\"\");if(ha(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}b=[];c=0;for(d in a)b[c++]=a[d];return b}\nfunction mc(a){if(a.na&&\"function\"==typeof a.na)return a.na();if(!a.V||\"function\"!=typeof a.V){if(\"undefined\"!==typeof Map&&a instanceof Map)return Array.from(a.keys());if(!(\"undefined\"!==typeof Set&&a instanceof Set)){if(ha(a)||\"string\"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}b=[];c=0;for(const d in a)b[c++]=d;return b}}}\nfunction nc(a,b){if(a.forEach&&\"function\"==typeof a.forEach)a.forEach(b,void 0);else if(ha(a)||\"string\"===typeof a)Array.prototype.forEach.call(a,b,void 0);else for(var c=mc(a),d=lc(a),e=d.length,f=0;f<e;f++)b.call(void 0,d[f],c&&c[f],a);}var oc=RegExp(\"^(?:([^:/?#.]+):)?(?://(?:([^\\\\\\\\/?#]*)@)?([^\\\\\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\\\\\/?#]|$))?([^?#]+)?(?:\\\\?([^#]*))?(?:#([\\\\s\\\\S]*))?$\");function pc(a,b){if(a){a=a.split(\"&\");for(var c=0;c<a.length;c++){var d=a[c].indexOf(\"=\"),e=null;if(0<=d){var f=a[c].substring(0,d);e=a[c].substring(d+1);}else f=a[c];b(f,e?decodeURIComponent(e.replace(/\\+/g,\" \")):\"\");}}}function T(a){this.g=this.o=this.j=\"\";this.s=null;this.m=this.l=\"\";this.h=false;if(a instanceof T){this.h=a.h;qc(this,a.j);this.o=a.o;this.g=a.g;rc(this,a.s);this.l=a.l;var b=a.i;var c=new sc;c.i=b.i;b.g&&(c.g=new Map(b.g),c.h=b.h);tc(this,c);this.m=a.m;}else a&&(b=String(a).match(oc))?(this.h=false,qc(this,b[1]||\"\",true),this.o=uc(b[2]||\"\"),this.g=uc(b[3]||\"\",true),rc(this,b[4]),this.l=uc(b[5]||\"\",true),tc(this,b[6]||\"\",true),this.m=uc(b[7]||\"\")):(this.h=false,this.i=new sc(null,this.h));}\nT.prototype.toString=function(){var a=[],b=this.j;b&&a.push(vc(b,wc,true),\":\");var c=this.g;if(c||\"file\"==b)a.push(\"//\"),(b=this.o)&&a.push(vc(b,wc,true),\"@\"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,\"%$1\")),c=this.s,null!=c&&a.push(\":\",String(c));if(c=this.l)this.g&&\"/\"!=c.charAt(0)&&a.push(\"/\"),a.push(vc(c,\"/\"==c.charAt(0)?xc:yc,true));(c=this.i.toString())&&a.push(\"?\",c);(c=this.m)&&a.push(\"#\",vc(c,zc));return a.join(\"\")};function N(a){return new T(a)}\nfunction qc(a,b,c){a.j=c?uc(b,true):b;a.j&&(a.j=a.j.replace(/:$/,\"\"));}function rc(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error(\"Bad port number \"+b);a.s=b;}else a.s=null;}function tc(a,b,c){b instanceof sc?(a.i=b,Ac(a.i,a.h)):(c||(b=vc(b,Bc)),a.i=new sc(b,a.h));}function S(a,b,c){a.i.set(b,c);}function Ib(a){S(a,\"zx\",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36));return a}\nfunction uc(a,b){return a?b?decodeURI(a.replace(/%25/g,\"%2525\")):decodeURIComponent(a):\"\"}function vc(a,b,c){return \"string\"===typeof a?(a=encodeURI(a).replace(b,Cc),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,\"%$1\")),a):null}function Cc(a){a=a.charCodeAt(0);return \"%\"+(a>>4&15).toString(16)+(a&15).toString(16)}var wc=/[#\\/\\?@]/g,yc=/[#\\?:]/g,xc=/[#\\?]/g,Bc=/[#\\?@]/g,zc=/#/g;function sc(a,b){this.h=this.g=null;this.i=a||null;this.j=!!b;}\nfunction U(a){a.g||(a.g=new Map,a.h=0,a.i&&pc(a.i,function(b,c){a.add(decodeURIComponent(b.replace(/\\+/g,\" \")),c);}));}h=sc.prototype;h.add=function(a,b){U(this);this.i=null;a=V(this,a);var c=this.g.get(a);c||this.g.set(a,c=[]);c.push(b);this.h+=1;return this};function Dc(a,b){U(a);b=V(a,b);a.g.has(b)&&(a.i=null,a.h-=a.g.get(b).length,a.g.delete(b));}function Ec(a,b){U(a);b=V(a,b);return a.g.has(b)}\nh.forEach=function(a,b){U(this);this.g.forEach(function(c,d){c.forEach(function(e){a.call(b,e,d,this);},this);},this);};h.na=function(){U(this);const a=Array.from(this.g.values()),b=Array.from(this.g.keys()),c=[];for(let d=0;d<b.length;d++){const e=a[d];for(let f=0;f<e.length;f++)c.push(b[d]);}return c};h.V=function(a){U(this);let b=[];if(\"string\"===typeof a)Ec(this,a)&&(b=b.concat(this.g.get(V(this,a))));else {a=Array.from(this.g.values());for(let c=0;c<a.length;c++)b=b.concat(a[c]);}return b};\nh.set=function(a,b){U(this);this.i=null;a=V(this,a);Ec(this,a)&&(this.h-=this.g.get(a).length);this.g.set(a,[b]);this.h+=1;return this};h.get=function(a,b){if(!a)return b;a=this.V(a);return 0<a.length?String(a[0]):b};function Lb(a,b,c){Dc(a,b);0<c.length&&(a.i=null,a.g.set(V(a,b),la(c)),a.h+=c.length);}\nh.toString=function(){if(this.i)return this.i;if(!this.g)return \"\";const a=[],b=Array.from(this.g.keys());for(var c=0;c<b.length;c++){var d=b[c];const f=encodeURIComponent(String(d)),g=this.V(d);for(d=0;d<g.length;d++){var e=f;\"\"!==g[d]&&(e+=\"=\"+encodeURIComponent(String(g[d])));a.push(e);}}return this.i=a.join(\"&\")};function V(a,b){b=String(b);a.j&&(b=b.toLowerCase());return b}\nfunction Ac(a,b){b&&!a.j&&(U(a),a.i=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(Dc(this,d),Lb(this,e,c));},a));a.j=b;}function Fc(a,b){const c=new vb;if(k.Image){const d=new Image;d.onload=ka(W,c,\"TestLoadImage: loaded\",true,b,d);d.onerror=ka(W,c,\"TestLoadImage: error\",false,b,d);d.onabort=ka(W,c,\"TestLoadImage: abort\",false,b,d);d.ontimeout=ka(W,c,\"TestLoadImage: timeout\",false,b,d);k.setTimeout(function(){if(d.ontimeout)d.ontimeout();},1E4);d.src=a;}else b(false);}\nfunction Gc(a,b){const c=new vb,d=new AbortController,e=setTimeout(()=>{d.abort();W(c,\"TestPingServer: timeout\",false,b);},1E4);fetch(a,{signal:d.signal}).then(f=>{clearTimeout(e);f.ok?W(c,\"TestPingServer: ok\",true,b):W(c,\"TestPingServer: server error\",false,b);}).catch(()=>{clearTimeout(e);W(c,\"TestPingServer: error\",false,b);});}function W(a,b,c,d,e){try{e&&(e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null),d(c);}catch(f){}}function Hc(){this.g=new jb;}function Ic(a,b,c){const d=c||\"\";try{nc(a,function(e,f){let g=e;n(e)&&(g=hb(e));b.push(d+f+\"=\"+encodeURIComponent(g));});}catch(e){throw b.push(d+\"type=\"+encodeURIComponent(\"_badmap\")),e;}}function Jc(a){this.l=a.Ub||null;this.j=a.eb||false;}r(Jc,kb);Jc.prototype.g=function(){return new Kc(this.l,this.j)};Jc.prototype.i=function(a){return function(){return a}}({});function Kc(a,b){E.call(this);this.D=a;this.o=b;this.m=void 0;this.status=this.readyState=0;this.responseType=this.responseText=this.response=this.statusText=\"\";this.onreadystatechange=null;this.u=new Headers;this.h=null;this.B=\"GET\";this.A=\"\";this.g=false;this.v=this.j=this.l=null;}r(Kc,E);h=Kc.prototype;\nh.open=function(a,b){if(0!=this.readyState)throw this.abort(),Error(\"Error reopening a connection\");this.B=a;this.A=b;this.readyState=1;Lc(this);};h.send=function(a){if(1!=this.readyState)throw this.abort(),Error(\"need to call open() first. \");this.g=true;const b={headers:this.u,method:this.B,credentials:this.m,cache:void 0};a&&(b.body=a);(this.D||k).fetch(new Request(this.A,b)).then(this.Sa.bind(this),this.ga.bind(this));};\nh.abort=function(){this.response=this.responseText=\"\";this.u=new Headers;this.status=0;this.j&&this.j.cancel(\"Request was aborted.\").catch(()=>{});1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=false,Mc(this));this.readyState=0;};\nh.Sa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,Lc(this)),this.g&&(this.readyState=3,Lc(this),this.g)))if(\"arraybuffer\"===this.responseType)a.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(\"undefined\"!==typeof k.ReadableStream&&\"body\"in a){this.j=a.body.getReader();if(this.o){if(this.responseType)throw Error('responseType must be empty for \"streamBinaryChunks\" mode responses.');this.response=\n[];}else this.response=this.responseText=\"\",this.v=new TextDecoder;Nc(this);}else a.text().then(this.Ra.bind(this),this.ga.bind(this));};function Nc(a){a.j.read().then(a.Pa.bind(a)).catch(a.ga.bind(a));}h.Pa=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var b=a.value?a.value:new Uint8Array(0);if(b=this.v.decode(b,{stream:!a.done}))this.response=this.responseText+=b;}a.done?Mc(this):Lc(this);3==this.readyState&&Nc(this);}};\nh.Ra=function(a){this.g&&(this.response=this.responseText=a,Mc(this));};h.Qa=function(a){this.g&&(this.response=a,Mc(this));};h.ga=function(){this.g&&Mc(this);};function Mc(a){a.readyState=4;a.l=null;a.j=null;a.v=null;Lc(a);}h.setRequestHeader=function(a,b){this.u.append(a,b);};h.getResponseHeader=function(a){return this.h?this.h.get(a.toLowerCase())||\"\":\"\"};\nh.getAllResponseHeaders=function(){if(!this.h)return \"\";const a=[],b=this.h.entries();for(var c=b.next();!c.done;)c=c.value,a.push(c[0]+\": \"+c[1]),c=b.next();return a.join(\"\\r\\n\")};function Lc(a){a.onreadystatechange&&a.onreadystatechange.call(a);}Object.defineProperty(Kc.prototype,\"withCredentials\",{get:function(){return \"include\"===this.m},set:function(a){this.m=a?\"include\":\"same-origin\";}});function Oc(a){let b=\"\";qa(a,function(c,d){b+=d;b+=\":\";b+=c;b+=\"\\r\\n\";});return b}function Pc(a,b,c){a:{for(d in c){var d=false;break a}d=true;}d||(c=Oc(c),\"string\"===typeof a?(null!=c&&encodeURIComponent(String(c))):S(a,b,c));}function X(a){E.call(this);this.headers=new Map;this.o=a||null;this.h=false;this.v=this.g=null;this.D=\"\";this.m=0;this.l=\"\";this.j=this.B=this.u=this.A=false;this.I=null;this.H=\"\";this.J=false;}r(X,E);var Qc=/^https?$/i,Rc=[\"POST\",\"PUT\"];h=X.prototype;h.Ha=function(a){this.J=a;};\nh.ea=function(a,b,c,d){if(this.g)throw Error(\"[goog.net.XhrIo] Object is active with another request=\"+this.D+\"; newUri=\"+a);b=b?b.toUpperCase():\"GET\";this.D=a;this.l=\"\";this.m=0;this.A=false;this.h=true;this.g=this.o?this.o.g():Cb.g();this.v=this.o?lb(this.o):lb(Cb);this.g.onreadystatechange=p(this.Ea,this);try{this.B=!0,this.g.open(b,String(a),!0),this.B=!1;}catch(f){Sc(this,f);return}a=c||\"\";c=new Map(this.headers);if(d)if(Object.getPrototypeOf(d)===Object.prototype)for(var e in d)c.set(e,d[e]);else if(\"function\"===\ntypeof d.keys&&\"function\"===typeof d.get)for(const f of d.keys())c.set(f,d.get(f));else throw Error(\"Unknown input type for opt_headers: \"+String(d));d=Array.from(c.keys()).find(f=>\"content-type\"==f.toLowerCase());e=k.FormData&&a instanceof k.FormData;!(0<=Array.prototype.indexOf.call(Rc,b,void 0))||d||e||c.set(\"Content-Type\",\"application/x-www-form-urlencoded;charset=utf-8\");for(const [f,g]of c)this.g.setRequestHeader(f,g);this.H&&(this.g.responseType=this.H);\"withCredentials\"in this.g&&this.g.withCredentials!==\nthis.J&&(this.g.withCredentials=this.J);try{Tc(this),this.u=!0,this.g.send(a),this.u=!1;}catch(f){Sc(this,f);}};function Sc(a,b){a.h=false;a.g&&(a.j=true,a.g.abort(),a.j=false);a.l=b;a.m=5;Uc(a);Vc(a);}function Uc(a){a.A||(a.A=true,F(a,\"complete\"),F(a,\"error\"));}h.abort=function(a){this.g&&this.h&&(this.h=false,this.j=true,this.g.abort(),this.j=false,this.m=a||7,F(this,\"complete\"),F(this,\"abort\"),Vc(this));};h.N=function(){this.g&&(this.h&&(this.h=false,this.j=true,this.g.abort(),this.j=false),Vc(this,true));X.aa.N.call(this);};\nh.Ea=function(){this.s||(this.B||this.u||this.j?Wc(this):this.bb());};h.bb=function(){Wc(this);};\nfunction Wc(a){if(a.h&&\"undefined\"!=typeof fa&&(!a.v[1]||4!=P(a)||2!=a.Z()))if(a.u&&4==P(a))bb(a.Ea,0,a);else if(F(a,\"readystatechange\"),4==P(a)){a.h=false;try{const g=a.Z();a:switch(g){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var b=!0;break a;default:b=!1;}var c;if(!(c=b)){var d;if(d=0===g){var e=String(a.D).match(oc)[1]||null;!e&&k.self&&k.self.location&&(e=k.self.location.protocol.slice(0,-1));d=!Qc.test(e?e.toLowerCase():\"\");}c=d;}if(c)F(a,\"complete\"),F(a,\"success\");else {a.m=\n6;try{var f=2<P(a)?a.g.statusText:\"\";}catch(m){f=\"\";}a.l=f+\" [\"+a.Z()+\"]\";Uc(a);}}finally{Vc(a);}}}function Vc(a,b){if(a.g){Tc(a);const c=a.g,d=a.v[0]?()=>{}:null;a.g=null;a.v=null;b||F(a,\"ready\");try{c.onreadystatechange=d;}catch(e){}}}function Tc(a){a.I&&(k.clearTimeout(a.I),a.I=null);}h.isActive=function(){return !!this.g};function P(a){return a.g?a.g.readyState:0}h.Z=function(){try{return 2<P(this)?this.g.status:-1}catch(a){return -1}};h.oa=function(){try{return this.g?this.g.responseText:\"\"}catch(a){return \"\"}};\nh.Oa=function(a){if(this.g){var b=this.g.responseText;a&&0==b.indexOf(a)&&(b=b.substring(a.length));return ib(b)}};function Nb(a){try{if(!a.g)return null;if(\"response\"in a.g)return a.g.response;switch(a.H){case \"\":case \"text\":return a.g.responseText;case \"arraybuffer\":if(\"mozResponseArrayBuffer\"in a.g)return a.g.mozResponseArrayBuffer}return null}catch(b){return null}}\nfunction Vb(a){const b={};a=(a.g&&2<=P(a)?a.g.getAllResponseHeaders()||\"\":\"\").split(\"\\r\\n\");for(let d=0;d<a.length;d++){if(t(a[d]))continue;var c=va(a[d]);const e=c[0];c=c[1];if(\"string\"!==typeof c)continue;c=c.trim();const f=b[e]||[];b[e]=f;f.push(c);}ra(b,function(d){return d.join(\", \")});}h.Ba=function(){return this.m};h.Ka=function(){return \"string\"===typeof this.l?this.l:String(this.l)};function Xc(a,b,c){return c&&c.internalChannelParams?c.internalChannelParams[a]||b:b}\nfunction Yc(a){this.Aa=0;this.i=[];this.j=new vb;this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null;this.Ya=this.U=0;this.Va=Xc(\"failFast\",false,a);this.F=this.C=this.u=this.s=this.l=null;this.X=true;this.za=this.T=-1;this.Y=this.v=this.B=0;this.Ta=Xc(\"baseRetryDelayMs\",5E3,a);this.cb=Xc(\"retryDelaySeedMs\",1E4,a);this.Wa=Xc(\"forwardChannelMaxRetries\",2,a);this.wa=Xc(\"forwardChannelRequestTimeoutMs\",2E4,a);this.pa=a&&a.xmlHttpFactory||void 0;this.Xa=a&&a.Tb||void 0;this.Ca=\na&&a.useFetchStreams||false;this.L=void 0;this.J=a&&a.supportsCrossDomainXhr||false;this.K=\"\";this.h=new ic(a&&a.concurrentRequestLimit);this.Da=new Hc;this.P=a&&a.fastHandshake||false;this.O=a&&a.encodeInitMessageHeaders||false;this.P&&this.O&&(this.O=false);this.Ua=a&&a.Rb||false;a&&a.xa&&this.j.xa();a&&a.forceLongPolling&&(this.X=false);this.ba=!this.P&&this.X&&a&&a.detectBufferingProxy||false;this.ja=void 0;a&&a.longPollingTimeout&&0<a.longPollingTimeout&&(this.ja=a.longPollingTimeout);this.ca=void 0;this.R=0;this.M=\nfalse;this.ka=this.A=null;}h=Yc.prototype;h.la=8;h.G=1;h.connect=function(a,b,c,d){K(0);this.W=a;this.H=b||{};c&&void 0!==d&&(this.H.OSID=c,this.H.OAID=d);this.F=this.X;this.I=cc(this,null,this.W);fc(this);};\nfunction gc(a){Zc(a);if(3==a.G){var b=a.U++,c=N(a.I);S(c,\"SID\",a.K);S(c,\"RID\",b);S(c,\"TYPE\",\"terminate\");$c(a,c);b=new M(a,a.j,b);b.L=2;b.v=Ib(N(c));c=false;if(k.navigator&&k.navigator.sendBeacon)try{c=k.navigator.sendBeacon(b.v.toString(),\"\");}catch(d){}!c&&k.Image&&((new Image).src=b.v,c=true);c||(b.g=Mb(b.j,null),b.g.ea(b.v));b.F=Date.now();Kb(b);}ad(a);}function Zb(a){a.g&&(Tb(a),a.g.cancel(),a.g=null);}\nfunction Zc(a){Zb(a);a.u&&(k.clearTimeout(a.u),a.u=null);Yb(a);a.h.cancel();a.s&&(\"number\"===typeof a.s&&k.clearTimeout(a.s),a.s=null);}function fc(a){if(!jc(a.h)&&!a.s){a.s=true;var b=a.Ga;x||Ea();y||(x(),y=true);za.add(b,a);a.B=0;}}function bd(a,b){if(ac(a.h)>=a.h.j-(a.s?1:0))return false;if(a.s)return a.i=b.D.concat(a.i),true;if(1==a.G||2==a.G||a.B>=(a.Va?0:a.Wa))return false;a.s=ub(p(a.Ga,a,b),cd(a,a.B));a.B++;return true}\nh.Ga=function(a){if(this.s)if(this.s=null,1==this.G){if(!a){this.U=Math.floor(1E5*Math.random());a=this.U++;const e=new M(this,this.j,a);let f=this.o;this.S&&(f?(f=sa(f),ua(f,this.S)):f=this.S);null!==this.m||this.O||(e.H=f,f=null);if(this.P)a:{var b=0;for(var c=0;c<this.i.length;c++){b:{var d=this.i[c];if(\"__data__\"in d.map&&(d=d.map.__data__,\"string\"===typeof d)){d=d.length;break b}d=void 0;}if(void 0===d)break;b+=d;if(4096<b){b=c;break a}if(4096===b||c===this.i.length-1){b=c+1;break a}}b=1E3;}else b=\n1E3;b=dd(this,e,b);c=N(this.I);S(c,\"RID\",a);S(c,\"CVER\",22);this.D&&S(c,\"X-HTTP-Session-Id\",this.D);$c(this,c);f&&(this.O?b=\"headers=\"+encodeURIComponent(String(Oc(f)))+\"&\"+b:this.m&&Pc(c,this.m,f));bc(this.h,e);this.Ua&&S(c,\"TYPE\",\"init\");this.P?(S(c,\"$req\",b),S(c,\"SID\",\"null\"),e.T=true,Hb(e,c,null)):Hb(e,c,b);this.G=2;}}else 3==this.G&&(a?ed(this,a):0==this.i.length||jc(this.h)||ed(this));};\nfunction ed(a,b){var c;b?c=b.l:c=a.U++;const d=N(a.I);S(d,\"SID\",a.K);S(d,\"RID\",c);S(d,\"AID\",a.T);$c(a,d);a.m&&a.o&&Pc(d,a.m,a.o);c=new M(a,a.j,c,a.B+1);null===a.m&&(c.H=a.o);b&&(a.i=b.D.concat(a.i));b=dd(a,c,1E3);c.I=Math.round(.5*a.wa)+Math.round(.5*a.wa*Math.random());bc(a.h,c);Hb(c,d,b);}function $c(a,b){a.H&&qa(a.H,function(c,d){S(b,d,c);});a.l&&nc({},function(c,d){S(b,d,c);});}\nfunction dd(a,b,c){c=Math.min(a.i.length,c);var d=a.l?p(a.l.Na,a.l,a):null;a:{var e=a.i;let f=-1;for(;;){const g=[\"count=\"+c];-1==f?0<c?(f=e[0].g,g.push(\"ofs=\"+f)):f=0:g.push(\"ofs=\"+f);let m=true;for(let q=0;q<c;q++){let l=e[q].g;const v=e[q].map;l-=f;if(0>l)f=Math.max(0,e[q].g-100),m=false;else try{Ic(v,g,\"req\"+l+\"_\");}catch(w){d&&d(v);}}if(m){d=g.join(\"&\");break a}}}a=a.i.splice(0,c);b.D=a;return d}function ec(a){if(!a.g&&!a.u){a.Y=1;var b=a.Fa;x||Ea();y||(x(),y=true);za.add(b,a);a.v=0;}}\nfunction $b(a){if(a.g||a.u||3<=a.v)return false;a.Y++;a.u=ub(p(a.Fa,a),cd(a,a.v));a.v++;return true}h.Fa=function(){this.u=null;fd(this);if(this.ba&&!(this.M||null==this.g||0>=this.R)){var a=2*this.R;this.j.info(\"BP detection timer enabled: \"+a);this.A=ub(p(this.ab,this),a);}};h.ab=function(){this.A&&(this.A=null,this.j.info(\"BP detection timeout reached.\"),this.j.info(\"Buffering proxy detected and switch to long-polling!\"),this.F=false,this.M=true,K(10),Zb(this),fd(this));};\nfunction Tb(a){null!=a.A&&(k.clearTimeout(a.A),a.A=null);}function fd(a){a.g=new M(a,a.j,\"rpc\",a.Y);null===a.m&&(a.g.H=a.o);a.g.O=0;var b=N(a.qa);S(b,\"RID\",\"rpc\");S(b,\"SID\",a.K);S(b,\"AID\",a.T);S(b,\"CI\",a.F?\"0\":\"1\");!a.F&&a.ja&&S(b,\"TO\",a.ja);S(b,\"TYPE\",\"xmlhttp\");$c(a,b);a.m&&a.o&&Pc(b,a.m,a.o);a.L&&(a.g.I=a.L);var c=a.g;a=a.ia;c.L=1;c.v=Ib(N(b));c.m=null;c.P=true;Jb(c,a);}h.Za=function(){null!=this.C&&(this.C=null,Zb(this),$b(this),K(19));};function Yb(a){null!=a.C&&(k.clearTimeout(a.C),a.C=null);}\nfunction Ub(a,b){var c=null;if(a.g==b){Yb(a);Tb(a);a.g=null;var d=2;}else if(Xb(a.h,b))c=b.D,dc(a.h,b),d=1;else return;if(0!=a.G)if(b.o)if(1==d){c=b.m?b.m.length:0;b=Date.now()-b.F;var e=a.B;d=qb();F(d,new tb(d,c));fc(a);}else ec(a);else if(e=b.s,3==e||0==e&&0<b.X||!(1==d&&bd(a,b)||2==d&&$b(a)))switch(c&&0<c.length&&(b=a.h,b.i=b.i.concat(c)),e){case 1:R(a,5);break;case 4:R(a,10);break;case 3:R(a,6);break;default:R(a,2);}}\nfunction cd(a,b){let c=a.Ta+Math.floor(Math.random()*a.cb);a.isActive()||(c*=2);return c*b}function R(a,b){a.j.info(\"Error code \"+b);if(2==b){var c=p(a.fb,a),d=a.Xa;const e=!d;d=new T(d||\"//www.google.com/images/cleardot.gif\");k.location&&\"http\"==k.location.protocol||qc(d,\"https\");Ib(d);e?Fc(d.toString(),c):Gc(d.toString(),c);}else K(2);a.G=0;a.l&&a.l.sa(b);ad(a);Zc(a);}h.fb=function(a){a?(this.j.info(\"Successfully pinged google.com\"),K(2)):(this.j.info(\"Failed to ping google.com\"),K(1));};\nfunction ad(a){a.G=0;a.ka=[];if(a.l){const b=kc(a.h);if(0!=b.length||0!=a.i.length)ma(a.ka,b),ma(a.ka,a.i),a.h.i.length=0,la(a.i),a.i.length=0;a.l.ra();}}function cc(a,b,c){var d=c instanceof T?N(c):new T(c);if(\"\"!=d.g)b&&(d.g=b+\".\"+d.g),rc(d,d.s);else {var e=k.location;d=e.protocol;b=b?b+\".\"+e.hostname:e.hostname;e=+e.port;var f=new T(null);d&&qc(f,d);b&&(f.g=b);e&&rc(f,e);c&&(f.l=c);d=f;}c=a.D;b=a.ya;c&&b&&S(d,c,b);S(d,\"VER\",a.la);$c(a,d);return d}\nfunction Mb(a,b,c){if(b&&!a.J)throw Error(\"Can't create secondary domain capable XhrIo object.\");b=a.Ca&&!a.pa?new X(new Jc({eb:c})):new X(a.pa);b.Ha(a.J);return b}h.isActive=function(){return !!this.l&&this.l.isActive(this)};function gd(){}h=gd.prototype;h.ua=function(){};h.ta=function(){};h.sa=function(){};h.ra=function(){};h.isActive=function(){return true};h.Na=function(){};function hd(){}hd.prototype.g=function(a,b){return new Y(a,b)};\nfunction Y(a,b){E.call(this);this.g=new Yc(b);this.l=a;this.h=b&&b.messageUrlParams||null;a=b&&b.messageHeaders||null;b&&b.clientProtocolHeaderRequired&&(a?a[\"X-Client-Protocol\"]=\"webchannel\":a={\"X-Client-Protocol\":\"webchannel\"});this.g.o=a;a=b&&b.initMessageHeaders||null;b&&b.messageContentType&&(a?a[\"X-WebChannel-Content-Type\"]=b.messageContentType:a={\"X-WebChannel-Content-Type\":b.messageContentType});b&&b.va&&(a?a[\"X-WebChannel-Client-Profile\"]=b.va:a={\"X-WebChannel-Client-Profile\":b.va});this.g.S=\na;(a=b&&b.Sb)&&!t(a)&&(this.g.m=a);this.v=b&&b.supportsCrossDomainXhr||false;this.u=b&&b.sendRawJson||false;(b=b&&b.httpSessionIdParam)&&!t(b)&&(this.g.D=b,a=this.h,null!==a&&b in a&&(a=this.h,b in a&&delete a[b]));this.j=new Z(this);}r(Y,E);Y.prototype.m=function(){this.g.l=this.j;this.v&&(this.g.J=true);this.g.connect(this.l,this.h||void 0);};Y.prototype.close=function(){gc(this.g);};\nY.prototype.o=function(a){var b=this.g;if(\"string\"===typeof a){var c={};c.__data__=a;a=c;}else this.u&&(c={},c.__data__=hb(a),a=c);b.i.push(new hc(b.Ya++,a));3==b.G&&fc(b);};Y.prototype.N=function(){this.g.l=null;delete this.j;gc(this.g);delete this.g;Y.aa.N.call(this);};\nfunction id(a){nb.call(this);a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var b=a.__sm__;if(b){a:{for(const c in b){a=c;break a}a=void 0;}if(this.i=a)a=this.i,b=null!==b&&a in b?b[a]:void 0;this.data=b;}else this.data=a;}r(id,nb);function jd(){ob.call(this);this.status=1;}r(jd,ob);function Z(a){this.g=a;}r(Z,gd);Z.prototype.ua=function(){F(this.g,\"a\");};Z.prototype.ta=function(a){F(this.g,new id(a));};\nZ.prototype.sa=function(a){F(this.g,new jd());};Z.prototype.ra=function(){F(this.g,\"b\");};hd.prototype.createWebChannel=hd.prototype.g;Y.prototype.send=Y.prototype.o;Y.prototype.open=Y.prototype.m;Y.prototype.close=Y.prototype.close;createWebChannelTransport = function(){return new hd};getStatEventTarget = function(){return qb()};Event = I;Stat = {mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20};Ab.NO_ERROR=0;Ab.TIMEOUT=8;Ab.HTTP_ERROR=6;\nErrorCode = Ab;Bb.COMPLETE=\"complete\";EventType = Bb;mb.EventType=H;H.OPEN=\"a\";H.CLOSE=\"b\";H.ERROR=\"c\";H.MESSAGE=\"d\";E.prototype.listen=E.prototype.K;WebChannel = mb;X.prototype.listenOnce=X.prototype.L;X.prototype.getLastError=X.prototype.Ka;X.prototype.getLastErrorCode=X.prototype.Ba;X.prototype.getStatus=X.prototype.Z;X.prototype.getResponseJson=X.prototype.Oa;X.prototype.getResponseText=X.prototype.oa;\nX.prototype.send=X.prototype.ea;X.prototype.setWithCredentials=X.prototype.Ha;XhrIo = X;}).apply( typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});\n\nconst F = \"@firebase/firestore\", M$1 = \"4.8.0\";\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Simple wrapper around a nullable UID. Mostly exists to make code more\n * readable.\n */\nclass User {\n constructor(e) {\n this.uid = e;\n }\n isAuthenticated() {\n return null != this.uid;\n }\n /**\n * Returns a key representing this user, suitable for inclusion in a\n * dictionary.\n */ toKey() {\n return this.isAuthenticated() ? \"uid:\" + this.uid : \"anonymous-user\";\n }\n isEqual(e) {\n return e.uid === this.uid;\n }\n}\n\n/** A user with a null UID. */ User.UNAUTHENTICATED = new User(null), \n// TODO(mikelehen): Look into getting a proper uid-equivalent for\n// non-FirebaseAuth providers.\nUser.GOOGLE_CREDENTIALS = new User(\"google-credentials-uid\"), User.FIRST_PARTY = new User(\"first-party-uid\"), \nUser.MOCK_USER = new User(\"mock-user\");\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nlet x = \"11.10.0\";\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst O = new Logger(\"@firebase/firestore\");\n\n// Helper methods are needed because variables can't be exported as read/write\nfunction __PRIVATE_getLogLevel() {\n return O.logLevel;\n}\n\nfunction __PRIVATE_logDebug(e, ...t) {\n if (O.logLevel <= LogLevel.DEBUG) {\n const n = t.map(__PRIVATE_argToString);\n O.debug(`Firestore (${x}): ${e}`, ...n);\n }\n}\n\nfunction __PRIVATE_logError(e, ...t) {\n if (O.logLevel <= LogLevel.ERROR) {\n const n = t.map(__PRIVATE_argToString);\n O.error(`Firestore (${x}): ${e}`, ...n);\n }\n}\n\n/**\n * @internal\n */ function __PRIVATE_logWarn(e, ...t) {\n if (O.logLevel <= LogLevel.WARN) {\n const n = t.map(__PRIVATE_argToString);\n O.warn(`Firestore (${x}): ${e}`, ...n);\n }\n}\n\n/**\n * Converts an additional log parameter to a string representation.\n */ function __PRIVATE_argToString(e) {\n if (\"string\" == typeof e) return e;\n try {\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /** Formats an object as a JSON string, suitable for logging. */\n return function __PRIVATE_formatJSON(e) {\n return JSON.stringify(e);\n }(e);\n } catch (t) {\n // Converting to JSON failed, just log the object directly\n return e;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function fail(e, t, n) {\n let r = \"Unexpected state\";\n \"string\" == typeof t ? r = t : n = t, __PRIVATE__fail(e, r, n);\n}\n\nfunction __PRIVATE__fail(e, t, n) {\n // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n let r = `FIRESTORE (${x}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;\n if (void 0 !== n) try {\n r += \" CONTEXT: \" + JSON.stringify(n);\n } catch (e) {\n r += \" CONTEXT: \" + n;\n }\n // NOTE: We don't use FirestoreError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n throw __PRIVATE_logError(r), new Error(r);\n}\n\nfunction __PRIVATE_hardAssert(e, t, n, r) {\n let i = \"Unexpected state\";\n \"string\" == typeof n ? i = n : r = n, e || __PRIVATE__fail(t, i, r);\n}\n\n/**\n * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an\n * instance of `T` before casting.\n */ function __PRIVATE_debugCast(e, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nt) {\n return e;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const N = {\n // Causes are copied from:\n // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h\n /** Not an error; returned on success. */\n OK: \"ok\",\n /** The operation was cancelled (typically by the caller). */\n CANCELLED: \"cancelled\",\n /** Unknown error or an error from a different error domain. */\n UNKNOWN: \"unknown\",\n /**\n * Client specified an invalid argument. Note that this differs from\n * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are\n * problematic regardless of the state of the system (e.g., a malformed file\n * name).\n */\n INVALID_ARGUMENT: \"invalid-argument\",\n /**\n * Deadline expired before operation could complete. For operations that\n * change the state of the system, this error may be returned even if the\n * operation has completed successfully. For example, a successful response\n * from a server could have been delayed long enough for the deadline to\n * expire.\n */\n DEADLINE_EXCEEDED: \"deadline-exceeded\",\n /** Some requested entity (e.g., file or directory) was not found. */\n NOT_FOUND: \"not-found\",\n /**\n * Some entity that we attempted to create (e.g., file or directory) already\n * exists.\n */\n ALREADY_EXISTS: \"already-exists\",\n /**\n * The caller does not have permission to execute the specified operation.\n * PERMISSION_DENIED must not be used for rejections caused by exhausting\n * some resource (use RESOURCE_EXHAUSTED instead for those errors).\n * PERMISSION_DENIED must not be used if the caller cannot be identified\n * (use UNAUTHENTICATED instead for those errors).\n */\n PERMISSION_DENIED: \"permission-denied\",\n /**\n * The request does not have valid authentication credentials for the\n * operation.\n */\n UNAUTHENTICATED: \"unauthenticated\",\n /**\n * Some resource has been exhausted, perhaps a per-user quota, or perhaps the\n * entire file system is out of space.\n */\n RESOURCE_EXHAUSTED: \"resource-exhausted\",\n /**\n * Operation was rejected because the system is not in a state required for\n * the operation's execution. For example, directory to be deleted may be\n * non-empty, an rmdir operation is applied to a non-directory, etc.\n *\n * A litmus test that may help a service implementor in deciding\n * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:\n * (a) Use UNAVAILABLE if the client can retry just the failing call.\n * (b) Use ABORTED if the client should retry at a higher-level\n * (e.g., restarting a read-modify-write sequence).\n * (c) Use FAILED_PRECONDITION if the client should not retry until\n * the system state has been explicitly fixed. E.g., if an \"rmdir\"\n * fails because the directory is non-empty, FAILED_PRECONDITION\n * should be returned since the client should not retry unless\n * they have first fixed up the directory by deleting files from it.\n * (d) Use FAILED_PRECONDITION if the client performs conditional\n * REST Get/Update/Delete on a resource and the resource on the\n * server does not match the condition. E.g., conflicting\n * read-modify-write on the same resource.\n */\n FAILED_PRECONDITION: \"failed-precondition\",\n /**\n * The operation was aborted, typically due to a concurrency issue like\n * sequencer check failures, transaction aborts, etc.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n ABORTED: \"aborted\",\n /**\n * Operation was attempted past the valid range. E.g., seeking or reading\n * past end of file.\n *\n * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed\n * if the system state changes. For example, a 32-bit file system will\n * generate INVALID_ARGUMENT if asked to read at an offset that is not in the\n * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from\n * an offset past the current file size.\n *\n * There is a fair bit of overlap between FAILED_PRECONDITION and\n * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error)\n * when it applies so that callers who are iterating through a space can\n * easily look for an OUT_OF_RANGE error to detect when they are done.\n */\n OUT_OF_RANGE: \"out-of-range\",\n /** Operation is not implemented or not supported/enabled in this service. */\n UNIMPLEMENTED: \"unimplemented\",\n /**\n * Internal errors. Means some invariants expected by underlying System has\n * been broken. If you see one of these errors, Something is very broken.\n */\n INTERNAL: \"internal\",\n /**\n * The service is currently unavailable. This is a most likely a transient\n * condition and may be corrected by retrying with a backoff.\n *\n * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,\n * and UNAVAILABLE.\n */\n UNAVAILABLE: \"unavailable\",\n /** Unrecoverable data loss or corruption. */\n DATA_LOSS: \"data-loss\"\n};\n\n/** An error returned by a Firestore operation. */ class FirestoreError extends FirebaseError {\n /** @hideconstructor */\n constructor(\n /**\n * The backend error code associated with this error.\n */\n e, \n /**\n * A custom error description.\n */\n t) {\n super(e, t), this.code = e, this.message = t, \n // HACK: We write a toString property directly because Error is not a real\n // class and so inheritance does not work correctly. We could alternatively\n // do the same \"back-door inheritance\" trick that FirebaseError does.\n this.toString = () => `${this.name}: [code=${this.code}]: ${this.message}`;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_Deferred {\n constructor() {\n this.promise = new Promise(((e, t) => {\n this.resolve = e, this.reject = t;\n }));\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_OAuthToken {\n constructor(e, t) {\n this.user = t, this.type = \"OAuth\", this.headers = new Map, this.headers.set(\"Authorization\", `Bearer ${e}`);\n }\n}\n\n/**\n * A CredentialsProvider that always yields an empty token.\n * @internal\n */ class __PRIVATE_EmptyAuthCredentialsProvider {\n getToken() {\n return Promise.resolve(null);\n }\n invalidateToken() {}\n start(e, t) {\n // Fire with initial user.\n e.enqueueRetryable((() => t(User.UNAUTHENTICATED)));\n }\n shutdown() {}\n}\n\n/**\n * A CredentialsProvider that always returns a constant token. Used for\n * emulator token mocking.\n */ class __PRIVATE_EmulatorAuthCredentialsProvider {\n constructor(e) {\n this.token = e, \n /**\n * Stores the listener registered with setChangeListener()\n * This isn't actually necessary since the UID never changes, but we use this\n * to verify the listen contract is adhered to in tests.\n */\n this.changeListener = null;\n }\n getToken() {\n return Promise.resolve(this.token);\n }\n invalidateToken() {}\n start(e, t) {\n this.changeListener = t, \n // Fire with initial user.\n e.enqueueRetryable((() => t(this.token.user)));\n }\n shutdown() {\n this.changeListener = null;\n }\n}\n\nclass __PRIVATE_FirebaseAuthCredentialsProvider {\n constructor(e) {\n this.t = e, \n /** Tracks the current User. */\n this.currentUser = User.UNAUTHENTICATED, \n /**\n * Counter used to detect if the token changed while a getToken request was\n * outstanding.\n */\n this.i = 0, this.forceRefresh = false, this.auth = null;\n }\n start(e, t) {\n __PRIVATE_hardAssert(void 0 === this.o, 42304);\n let n = this.i;\n // A change listener that prevents double-firing for the same token change.\n const __PRIVATE_guardedChangeListener = e => this.i !== n ? (n = this.i, \n t(e)) : Promise.resolve();\n // A promise that can be waited on to block on the next token change.\n // This promise is re-created after each change.\n let r = new __PRIVATE_Deferred;\n this.o = () => {\n this.i++, this.currentUser = this.u(), r.resolve(), r = new __PRIVATE_Deferred, \n e.enqueueRetryable((() => __PRIVATE_guardedChangeListener(this.currentUser)));\n };\n const __PRIVATE_awaitNextToken = () => {\n const t = r;\n e.enqueueRetryable((async () => {\n await t.promise, await __PRIVATE_guardedChangeListener(this.currentUser);\n }));\n }, __PRIVATE_registerAuth = e => {\n __PRIVATE_logDebug(\"FirebaseAuthCredentialsProvider\", \"Auth detected\"), this.auth = e, \n this.o && (this.auth.addAuthTokenListener(this.o), __PRIVATE_awaitNextToken());\n };\n this.t.onInit((e => __PRIVATE_registerAuth(e))), \n // Our users can initialize Auth right after Firestore, so we give it\n // a chance to register itself with the component framework before we\n // determine whether to start up in unauthenticated mode.\n setTimeout((() => {\n if (!this.auth) {\n const e = this.t.getImmediate({\n optional: true\n });\n e ? __PRIVATE_registerAuth(e) : (\n // If auth is still not available, proceed with `null` user\n __PRIVATE_logDebug(\"FirebaseAuthCredentialsProvider\", \"Auth not yet detected\"), \n r.resolve(), r = new __PRIVATE_Deferred);\n }\n }), 0), __PRIVATE_awaitNextToken();\n }\n getToken() {\n // Take note of the current value of the tokenCounter so that this method\n // can fail (with an ABORTED error) if there is a token change while the\n // request is outstanding.\n const e = this.i, t = this.forceRefresh;\n return this.forceRefresh = false, this.auth ? this.auth.getToken(t).then((t => \n // Cancel the request since the token changed while the request was\n // outstanding so the response is potentially for a previous user (which\n // user, we can't be sure).\n this.i !== e ? (__PRIVATE_logDebug(\"FirebaseAuthCredentialsProvider\", \"getToken aborted due to token change.\"), \n this.getToken()) : t ? (__PRIVATE_hardAssert(\"string\" == typeof t.accessToken, 31837, {\n l: t\n }), new __PRIVATE_OAuthToken(t.accessToken, this.currentUser)) : null)) : Promise.resolve(null);\n }\n invalidateToken() {\n this.forceRefresh = true;\n }\n shutdown() {\n this.auth && this.o && this.auth.removeAuthTokenListener(this.o), this.o = void 0;\n }\n // Auth.getUid() can return null even with a user logged in. It is because\n // getUid() is synchronous, but the auth code populating Uid is asynchronous.\n // This method should only be called in the AuthTokenListener callback\n // to guarantee to get the actual user.\n u() {\n const e = this.auth && this.auth.getUid();\n return __PRIVATE_hardAssert(null === e || \"string\" == typeof e, 2055, {\n h: e\n }), new User(e);\n }\n}\n\n/*\n * FirstPartyToken provides a fresh token each time its value\n * is requested, because if the token is too old, requests will be rejected.\n * Technically this may no longer be necessary since the SDK should gracefully\n * recover from unauthenticated errors (see b/33147818 for context), but it's\n * safer to keep the implementation as-is.\n */ class __PRIVATE_FirstPartyToken {\n constructor(e, t, n) {\n this.P = e, this.T = t, this.I = n, this.type = \"FirstParty\", this.user = User.FIRST_PARTY, \n this.A = new Map;\n }\n /**\n * Gets an authorization token, using a provided factory function, or return\n * null.\n */ R() {\n return this.I ? this.I() : null;\n }\n get headers() {\n this.A.set(\"X-Goog-AuthUser\", this.P);\n // Use array notation to prevent minification\n const e = this.R();\n return e && this.A.set(\"Authorization\", e), this.T && this.A.set(\"X-Goog-Iam-Authorization-Token\", this.T), \n this.A;\n }\n}\n\n/*\n * Provides user credentials required for the Firestore JavaScript SDK\n * to authenticate the user, using technique that is only available\n * to applications hosted by Google.\n */ class __PRIVATE_FirstPartyAuthCredentialsProvider {\n constructor(e, t, n) {\n this.P = e, this.T = t, this.I = n;\n }\n getToken() {\n return Promise.resolve(new __PRIVATE_FirstPartyToken(this.P, this.T, this.I));\n }\n start(e, t) {\n // Fire with initial uid.\n e.enqueueRetryable((() => t(User.FIRST_PARTY)));\n }\n shutdown() {}\n invalidateToken() {}\n}\n\nclass AppCheckToken {\n constructor(e) {\n this.value = e, this.type = \"AppCheck\", this.headers = new Map, e && e.length > 0 && this.headers.set(\"x-firebase-appcheck\", this.value);\n }\n}\n\nclass __PRIVATE_FirebaseAppCheckTokenProvider {\n constructor(t, n) {\n this.V = n, this.forceRefresh = false, this.appCheck = null, this.m = null, this.p = null, \n _isFirebaseServerApp(t) && t.settings.appCheckToken && (this.p = t.settings.appCheckToken);\n }\n start(e, t) {\n __PRIVATE_hardAssert(void 0 === this.o, 3512);\n const onTokenChanged = e => {\n null != e.error && __PRIVATE_logDebug(\"FirebaseAppCheckTokenProvider\", `Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);\n const n = e.token !== this.m;\n return this.m = e.token, __PRIVATE_logDebug(\"FirebaseAppCheckTokenProvider\", `Received ${n ? \"new\" : \"existing\"} token.`), \n n ? t(e.token) : Promise.resolve();\n };\n this.o = t => {\n e.enqueueRetryable((() => onTokenChanged(t)));\n };\n const __PRIVATE_registerAppCheck = e => {\n __PRIVATE_logDebug(\"FirebaseAppCheckTokenProvider\", \"AppCheck detected\"), this.appCheck = e, \n this.o && this.appCheck.addTokenListener(this.o);\n };\n this.V.onInit((e => __PRIVATE_registerAppCheck(e))), \n // Our users can initialize AppCheck after Firestore, so we give it\n // a chance to register itself with the component framework.\n setTimeout((() => {\n if (!this.appCheck) {\n const e = this.V.getImmediate({\n optional: true\n });\n e ? __PRIVATE_registerAppCheck(e) : \n // If AppCheck is still not available, proceed without it.\n __PRIVATE_logDebug(\"FirebaseAppCheckTokenProvider\", \"AppCheck not yet detected\");\n }\n }), 0);\n }\n getToken() {\n if (this.p) return Promise.resolve(new AppCheckToken(this.p));\n const e = this.forceRefresh;\n return this.forceRefresh = false, this.appCheck ? this.appCheck.getToken(e).then((e => e ? (__PRIVATE_hardAssert(\"string\" == typeof e.token, 44558, {\n tokenResult: e\n }), this.m = e.token, new AppCheckToken(e.token)) : null)) : Promise.resolve(null);\n }\n invalidateToken() {\n this.forceRefresh = true;\n }\n shutdown() {\n this.appCheck && this.o && this.appCheck.removeTokenListener(this.o), this.o = void 0;\n }\n}\n\n/**\n * Builds a CredentialsProvider depending on the type of\n * the credentials passed in.\n */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Generates `nBytes` of random bytes.\n *\n * If `nBytes < 0` , an error will be thrown.\n */\nfunction __PRIVATE_randomBytes(e) {\n // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.\n const t = \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n \"undefined\" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(e);\n if (t && \"function\" == typeof t.getRandomValues) t.getRandomValues(n); else \n // Falls back to Math.random\n for (let t = 0; t < e; t++) n[t] = Math.floor(256 * Math.random());\n return n;\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An instance of the Platform's 'TextEncoder' implementation.\n */ function __PRIVATE_newTextEncoder() {\n return new TextEncoder;\n}\n\n/**\n * An instance of the Platform's 'TextDecoder' implementation.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A utility class for generating unique alphanumeric IDs of a specified length.\n *\n * @internal\n * Exported internally for testing purposes.\n */\nclass __PRIVATE_AutoId {\n static newId() {\n // Alphanumeric characters\n const e = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\", t = 62 * Math.floor(256 / 62);\n // The largest byte value that is a multiple of `char.length`.\n let n = \"\";\n for (;n.length < 20; ) {\n const r = __PRIVATE_randomBytes(40);\n for (let i = 0; i < r.length; ++i) \n // Only accept values that are [0, maxMultiple), this ensures they can\n // be evenly mapped to indices of `chars` via a modulo operation.\n n.length < 20 && r[i] < t && (n += e.charAt(r[i] % 62));\n }\n return n;\n }\n}\n\nfunction __PRIVATE_primitiveComparator(e, t) {\n return e < t ? -1 : e > t ? 1 : 0;\n}\n\n/** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {\n let n = 0;\n for (;n < e.length && n < t.length; ) {\n const r = e.codePointAt(n), i = t.codePointAt(n);\n if (r !== i) {\n if (r < 128 && i < 128) \n // ASCII comparison\n return __PRIVATE_primitiveComparator(r, i);\n {\n // Lazy instantiate TextEncoder\n const s = __PRIVATE_newTextEncoder(), o = __PRIVATE_compareByteArrays$1(s.encode(__PRIVATE_getUtf8SafeSubstring(e, n)), s.encode(__PRIVATE_getUtf8SafeSubstring(t, n)));\n // UTF-8 encode the character at index i for byte comparison.\n return 0 !== o ? o : __PRIVATE_primitiveComparator(r, i);\n }\n }\n // Increment by 2 for surrogate pairs, 1 otherwise\n n += r > 65535 ? 2 : 1;\n }\n // Compare lengths if all characters are equal\n return __PRIVATE_primitiveComparator(e.length, t.length);\n}\n\nfunction __PRIVATE_getUtf8SafeSubstring(e, t) {\n return e.codePointAt(t) > 65535 ? e.substring(t, t + 2) : e.substring(t, t + 1);\n}\n\nfunction __PRIVATE_compareByteArrays$1(e, t) {\n for (let n = 0; n < e.length && n < t.length; ++n) if (e[n] !== t[n]) return __PRIVATE_primitiveComparator(e[n], t[n]);\n return __PRIVATE_primitiveComparator(e.length, t.length);\n}\n\n/** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {\n return e.length === t.length && e.every(((e, r) => n(e, t[r])));\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const B = \"__name__\";\n\n/**\n * Path represents an ordered sequence of string segments.\n */ class BasePath {\n constructor(e, t, n) {\n void 0 === t ? t = 0 : t > e.length && fail(637, {\n offset: t,\n range: e.length\n }), void 0 === n ? n = e.length - t : n > e.length - t && fail(1746, {\n length: n,\n range: e.length - t\n }), this.segments = e, this.offset = t, this.len = n;\n }\n get length() {\n return this.len;\n }\n isEqual(e) {\n return 0 === BasePath.comparator(this, e);\n }\n child(e) {\n const t = this.segments.slice(this.offset, this.limit());\n return e instanceof BasePath ? e.forEach((e => {\n t.push(e);\n })) : t.push(e), this.construct(t);\n }\n /** The index of one past the last segment of the path. */ limit() {\n return this.offset + this.length;\n }\n popFirst(e) {\n return e = void 0 === e ? 1 : e, this.construct(this.segments, this.offset + e, this.length - e);\n }\n popLast() {\n return this.construct(this.segments, this.offset, this.length - 1);\n }\n firstSegment() {\n return this.segments[this.offset];\n }\n lastSegment() {\n return this.get(this.length - 1);\n }\n get(e) {\n return this.segments[this.offset + e];\n }\n isEmpty() {\n return 0 === this.length;\n }\n isPrefixOf(e) {\n if (e.length < this.length) return false;\n for (let t = 0; t < this.length; t++) if (this.get(t) !== e.get(t)) return false;\n return true;\n }\n isImmediateParentOf(e) {\n if (this.length + 1 !== e.length) return false;\n for (let t = 0; t < this.length; t++) if (this.get(t) !== e.get(t)) return false;\n return true;\n }\n forEach(e) {\n for (let t = this.offset, n = this.limit(); t < n; t++) e(this.segments[t]);\n }\n toArray() {\n return this.segments.slice(this.offset, this.limit());\n }\n /**\n * Compare 2 paths segment by segment, prioritizing numeric IDs\n * (e.g., \"__id123__\") in numeric ascending order, followed by string\n * segments in lexicographical order.\n */ static comparator(e, t) {\n const n = Math.min(e.length, t.length);\n for (let r = 0; r < n; r++) {\n const n = BasePath.compareSegments(e.get(r), t.get(r));\n if (0 !== n) return n;\n }\n return __PRIVATE_primitiveComparator(e.length, t.length);\n }\n static compareSegments(e, t) {\n const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);\n return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);\n }\n // Checks if a segment is a numeric ID (starts with \"__id\" and ends with \"__\").\n static isNumericId(e) {\n return e.startsWith(\"__id\") && e.endsWith(\"__\");\n }\n static extractNumericId(e) {\n return Integer.fromString(e.substring(4, e.length - 2));\n }\n}\n\n/**\n * A slash-separated path for navigating resources (documents and collections)\n * within Firestore.\n *\n * @internal\n */ class ResourcePath extends BasePath {\n construct(e, t, n) {\n return new ResourcePath(e, t, n);\n }\n canonicalString() {\n // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n return this.toArray().join(\"/\");\n }\n toString() {\n return this.canonicalString();\n }\n /**\n * Returns a string representation of this path\n * where each path segment has been encoded with\n * `encodeURIComponent`.\n */ toUriEncodedString() {\n return this.toArray().map(encodeURIComponent).join(\"/\");\n }\n /**\n * Creates a resource path from the given slash-delimited string. If multiple\n * arguments are provided, all components are combined. Leading and trailing\n * slashes from all components are ignored.\n */ static fromString(...e) {\n // NOTE: The client is ignorant of any path segments containing escape\n // sequences (e.g. __id123__) and just passes them through raw (they exist\n // for legacy reasons and should not be used frequently).\n const t = [];\n for (const n of e) {\n if (n.indexOf(\"//\") >= 0) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid segment (${n}). Paths must not contain // in them.`);\n // Strip leading and trailing slashed.\n t.push(...n.split(\"/\").filter((e => e.length > 0)));\n }\n return new ResourcePath(t);\n }\n static emptyPath() {\n return new ResourcePath([]);\n }\n}\n\nconst L$1 = /^[_a-zA-Z][_a-zA-Z0-9]*$/;\n\n/**\n * A dot-separated path for navigating sub-objects within a document.\n * @internal\n */ class FieldPath$1 extends BasePath {\n construct(e, t, n) {\n return new FieldPath$1(e, t, n);\n }\n /**\n * Returns true if the string could be used as a segment in a field path\n * without escaping.\n */ static isValidIdentifier(e) {\n return L$1.test(e);\n }\n canonicalString() {\n return this.toArray().map((e => (e = e.replace(/\\\\/g, \"\\\\\\\\\").replace(/`/g, \"\\\\`\"), \n FieldPath$1.isValidIdentifier(e) || (e = \"`\" + e + \"`\"), e))).join(\".\");\n }\n toString() {\n return this.canonicalString();\n }\n /**\n * Returns true if this field references the key of a document.\n */ isKeyField() {\n return 1 === this.length && this.get(0) === B;\n }\n /**\n * The field designating the key of a document.\n */ static keyField() {\n return new FieldPath$1([ B ]);\n }\n /**\n * Parses a field string from the given server-formatted string.\n *\n * - Splitting the empty string is not allowed (for now at least).\n * - Empty segments within the string (e.g. if there are two consecutive\n * separators) are not allowed.\n *\n * TODO(b/37244157): we should make this more strict. Right now, it allows\n * non-identifier path components, even if they aren't escaped.\n */ static fromServerFormat(e) {\n const t = [];\n let n = \"\", r = 0;\n const __PRIVATE_addCurrentSegment = () => {\n if (0 === n.length) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);\n t.push(n), n = \"\";\n };\n let i = false;\n for (;r < e.length; ) {\n const t = e[r];\n if (\"\\\\\" === t) {\n if (r + 1 === e.length) throw new FirestoreError(N.INVALID_ARGUMENT, \"Path has trailing escape character: \" + e);\n const t = e[r + 1];\n if (\"\\\\\" !== t && \".\" !== t && \"`\" !== t) throw new FirestoreError(N.INVALID_ARGUMENT, \"Path has invalid escape sequence: \" + e);\n n += t, r += 2;\n } else \"`\" === t ? (i = !i, r++) : \".\" !== t || i ? (n += t, r++) : (__PRIVATE_addCurrentSegment(), \n r++);\n }\n if (__PRIVATE_addCurrentSegment(), i) throw new FirestoreError(N.INVALID_ARGUMENT, \"Unterminated ` in path: \" + e);\n return new FieldPath$1(t);\n }\n static emptyPath() {\n return new FieldPath$1([]);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @internal\n */ class DocumentKey {\n constructor(e) {\n this.path = e;\n }\n static fromPath(e) {\n return new DocumentKey(ResourcePath.fromString(e));\n }\n static fromName(e) {\n return new DocumentKey(ResourcePath.fromString(e).popFirst(5));\n }\n static empty() {\n return new DocumentKey(ResourcePath.emptyPath());\n }\n get collectionGroup() {\n return this.path.popLast().lastSegment();\n }\n /** Returns true if the document is in the specified collectionId. */ hasCollectionId(e) {\n return this.path.length >= 2 && this.path.get(this.path.length - 2) === e;\n }\n /** Returns the collection group (i.e. the name of the parent collection) for this key. */ getCollectionGroup() {\n return this.path.get(this.path.length - 2);\n }\n /** Returns the fully qualified path to the parent collection. */ getCollectionPath() {\n return this.path.popLast();\n }\n isEqual(e) {\n return null !== e && 0 === ResourcePath.comparator(this.path, e.path);\n }\n toString() {\n return this.path.toString();\n }\n static comparator(e, t) {\n return ResourcePath.comparator(e.path, t.path);\n }\n static isDocumentKey(e) {\n return e.length % 2 == 0;\n }\n /**\n * Creates and returns a new document key with the given segments.\n *\n * @param segments - The segments of the path to the document\n * @returns A new instance of DocumentKey\n */ static fromSegments(e) {\n return new DocumentKey(new ResourcePath(e.slice()));\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function __PRIVATE_validateNonEmptyArgument(e, t, n) {\n if (!n) throw new FirestoreError(N.INVALID_ARGUMENT, `Function ${e}() cannot be called with an empty ${t}.`);\n}\n\n/**\n * Validates that two boolean options are not set at the same time.\n * @internal\n */ function __PRIVATE_validateIsNotUsedTogether(e, t, n, r) {\n if (true === t && true === r) throw new FirestoreError(N.INVALID_ARGUMENT, `${e} and ${n} cannot be used together.`);\n}\n\n/**\n * Validates that `path` refers to a document (indicated by the fact it contains\n * an even numbers of segments).\n */ function __PRIVATE_validateDocumentPath(e) {\n if (!DocumentKey.isDocumentKey(e)) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`);\n}\n\n/**\n * Validates that `path` refers to a collection (indicated by the fact it\n * contains an odd numbers of segments).\n */ function __PRIVATE_validateCollectionPath(e) {\n if (DocumentKey.isDocumentKey(e)) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`);\n}\n\n/**\n * Returns true if it's a non-null object without a custom prototype\n * (i.e. excludes Array, Date, etc.).\n */ function __PRIVATE_isPlainObject(e) {\n return \"object\" == typeof e && null !== e && (Object.getPrototypeOf(e) === Object.prototype || null === Object.getPrototypeOf(e));\n}\n\n/** Returns a string describing the type / value of the provided input. */ function __PRIVATE_valueDescription(e) {\n if (void 0 === e) return \"undefined\";\n if (null === e) return \"null\";\n if (\"string\" == typeof e) return e.length > 20 && (e = `${e.substring(0, 20)}...`), \n JSON.stringify(e);\n if (\"number\" == typeof e || \"boolean\" == typeof e) return \"\" + e;\n if (\"object\" == typeof e) {\n if (e instanceof Array) return \"an array\";\n {\n const t = \n /** try to get the constructor name for an object. */\n function __PRIVATE_tryGetCustomObjectType(e) {\n if (e.constructor) return e.constructor.name;\n return null;\n }\n /**\n * Casts `obj` to `T`, optionally unwrapping Compat types to expose the\n * underlying instance. Throws if `obj` is not an instance of `T`.\n *\n * This cast is used in the Lite and Full SDK to verify instance types for\n * arguments passed to the public API.\n * @internal\n */ (e);\n return t ? `a custom ${t} object` : \"an object\";\n }\n }\n return \"function\" == typeof e ? \"a function\" : fail(12329, {\n type: typeof e\n });\n}\n\nfunction __PRIVATE_cast(e, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nt) {\n if (\"_delegate\" in e && (\n // Unwrap Compat types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n e = e._delegate), !(e instanceof t)) {\n if (t.name === e.constructor.name) throw new FirestoreError(N.INVALID_ARGUMENT, \"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?\");\n {\n const n = __PRIVATE_valueDescription(e);\n throw new FirestoreError(N.INVALID_ARGUMENT, `Expected type '${t.name}', but it was: ${n}`);\n }\n }\n return e;\n}\n\n/**\n * @license\n * Copyright 2025 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Helper function to define a JSON schema {@link Property}.\n * @private\n * @internal\n */ function property(e, t) {\n const n = {\n typeString: e\n };\n return t && (n.value = t), n;\n}\n\n/**\n * Validates the JSON object based on the provided schema, and narrows the type to the provided\n * JSON schema.\n * @private\n * @internal\n *\n * @param json A JSON object to validate.\n * @param scheme a {@link JsonSchema} that defines the properties to validate.\n * @returns true if the JSON schema exists within the object. Throws a FirestoreError otherwise.\n */ function __PRIVATE_validateJSON(e, t) {\n if (!__PRIVATE_isPlainObject(e)) throw new FirestoreError(N.INVALID_ARGUMENT, \"JSON must be an object\");\n let n;\n for (const r in t) if (t[r]) {\n const i = t[r].typeString, s = \"value\" in t[r] ? {\n value: t[r].value\n } : void 0;\n if (!(r in e)) {\n n = `JSON missing required field: '${r}'`;\n break;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const o = e[r];\n if (i && typeof o !== i) {\n n = `JSON field '${r}' must be a ${i}.`;\n break;\n }\n if (void 0 !== s && o !== s.value) {\n n = `Expected '${r}' field to equal '${s.value}'`;\n break;\n }\n }\n if (n) throw new FirestoreError(N.INVALID_ARGUMENT, n);\n return true;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// The earliest date supported by Firestore timestamps (0001-01-01T00:00:00Z).\nconst k = -62135596800, q = 1e6;\n\n// Number of nanoseconds in a millisecond.\n/**\n * A `Timestamp` represents a point in time independent of any time zone or\n * calendar, represented as seconds and fractions of seconds at nanosecond\n * resolution in UTC Epoch time.\n *\n * It is encoded using the Proleptic Gregorian Calendar which extends the\n * Gregorian calendar backwards to year one. It is encoded assuming all minutes\n * are 60 seconds long, i.e. leap seconds are \"smeared\" so that no leap second\n * table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59.999999999Z.\n *\n * For examples and further specifications, refer to the\n * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.\n */\nclass Timestamp {\n /**\n * Creates a new timestamp with the current date, with millisecond precision.\n *\n * @returns a new timestamp representing the current date.\n */\n static now() {\n return Timestamp.fromMillis(Date.now());\n }\n /**\n * Creates a new timestamp from the given date.\n *\n * @param date - The date to initialize the `Timestamp` from.\n * @returns A new `Timestamp` representing the same point in time as the given\n * date.\n */ static fromDate(e) {\n return Timestamp.fromMillis(e.getTime());\n }\n /**\n * Creates a new timestamp from the given number of milliseconds.\n *\n * @param milliseconds - Number of milliseconds since Unix epoch\n * 1970-01-01T00:00:00Z.\n * @returns A new `Timestamp` representing the same point in time as the given\n * number of milliseconds.\n */ static fromMillis(e) {\n const t = Math.floor(e / 1e3), n = Math.floor((e - 1e3 * t) * q);\n return new Timestamp(t, n);\n }\n /**\n * Creates a new timestamp.\n *\n * @param seconds - The number of seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n * @param nanoseconds - The non-negative fractions of a second at nanosecond\n * resolution. Negative second values with fractions must still have\n * non-negative nanoseconds values that count forward in time. Must be\n * from 0 to 999,999,999 inclusive.\n */ constructor(\n /**\n * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.\n */\n e, \n /**\n * The fractions of a second at nanosecond resolution.*\n */\n t) {\n if (this.seconds = e, this.nanoseconds = t, t < 0) throw new FirestoreError(N.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + t);\n if (t >= 1e9) throw new FirestoreError(N.INVALID_ARGUMENT, \"Timestamp nanoseconds out of range: \" + t);\n if (e < k) throw new FirestoreError(N.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + e);\n // This will break in the year 10,000.\n if (e >= 253402300800) throw new FirestoreError(N.INVALID_ARGUMENT, \"Timestamp seconds out of range: \" + e);\n }\n /**\n * Converts a `Timestamp` to a JavaScript `Date` object. This conversion\n * causes a loss of precision since `Date` objects only support millisecond\n * precision.\n *\n * @returns JavaScript `Date` object representing the same point in time as\n * this `Timestamp`, with millisecond precision.\n */ toDate() {\n return new Date(this.toMillis());\n }\n /**\n * Converts a `Timestamp` to a numeric timestamp (in milliseconds since\n * epoch). This operation causes a loss of precision.\n *\n * @returns The point in time corresponding to this timestamp, represented as\n * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.\n */ toMillis() {\n return 1e3 * this.seconds + this.nanoseconds / q;\n }\n _compareTo(e) {\n return this.seconds === e.seconds ? __PRIVATE_primitiveComparator(this.nanoseconds, e.nanoseconds) : __PRIVATE_primitiveComparator(this.seconds, e.seconds);\n }\n /**\n * Returns true if this `Timestamp` is equal to the provided one.\n *\n * @param other - The `Timestamp` to compare against.\n * @returns true if this `Timestamp` is equal to the provided one.\n */ isEqual(e) {\n return e.seconds === this.seconds && e.nanoseconds === this.nanoseconds;\n }\n /** Returns a textual representation of this `Timestamp`. */ toString() {\n return \"Timestamp(seconds=\" + this.seconds + \", nanoseconds=\" + this.nanoseconds + \")\";\n }\n /**\n * Returns a JSON-serializable representation of this `Timestamp`.\n */ toJSON() {\n return {\n type: Timestamp._jsonSchemaVersion,\n seconds: this.seconds,\n nanoseconds: this.nanoseconds\n };\n }\n /**\n * Builds a `Timestamp` instance from a JSON object created by {@link Timestamp.toJSON}.\n */ static fromJSON(e) {\n if (__PRIVATE_validateJSON(e, Timestamp._jsonSchema)) return new Timestamp(e.seconds, e.nanoseconds);\n }\n /**\n * Converts this object to a primitive string, which allows `Timestamp` objects\n * to be compared using the `>`, `<=`, `>=` and `>` operators.\n */ valueOf() {\n // This method returns a string of the form <seconds>.<nanoseconds> where\n // <seconds> is translated to have a non-negative value and both <seconds>\n // and <nanoseconds> are left-padded with zeroes to be a consistent length.\n // Strings with this format then have a lexicographical ordering that matches\n // the expected ordering. The <seconds> translation is done to avoid having\n // a leading negative sign (i.e. a leading '-' character) in its string\n // representation, which would affect its lexicographical ordering.\n const e = this.seconds - k;\n // Note: Up to 12 decimal digits are required to represent all valid\n // 'seconds' values.\n return String(e).padStart(12, \"0\") + \".\" + String(this.nanoseconds).padStart(9, \"0\");\n }\n}\n\nTimestamp._jsonSchemaVersion = \"firestore/timestamp/1.0\", Timestamp._jsonSchema = {\n type: property(\"string\", Timestamp._jsonSchemaVersion),\n seconds: property(\"number\"),\n nanoseconds: property(\"number\")\n};\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A version of a document in Firestore. This corresponds to the version\n * timestamp, such as update_time or read_time.\n */\nclass SnapshotVersion {\n static fromTimestamp(e) {\n return new SnapshotVersion(e);\n }\n static min() {\n return new SnapshotVersion(new Timestamp(0, 0));\n }\n static max() {\n return new SnapshotVersion(new Timestamp(253402300799, 999999999));\n }\n constructor(e) {\n this.timestamp = e;\n }\n compareTo(e) {\n return this.timestamp._compareTo(e.timestamp);\n }\n isEqual(e) {\n return this.timestamp.isEqual(e.timestamp);\n }\n /** Returns a number representation of the version for use in spec tests. */ toMicroseconds() {\n // Convert to microseconds.\n return 1e6 * this.timestamp.seconds + this.timestamp.nanoseconds / 1e3;\n }\n toString() {\n return \"SnapshotVersion(\" + this.timestamp.toString() + \")\";\n }\n toTimestamp() {\n return this.timestamp;\n }\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The initial mutation batch id for each index. Gets updated during index\n * backfill.\n */ const Q$1 = -1;\n\n/**\n * Creates an offset that matches all documents with a read time higher than\n * `readTime`.\n */ function __PRIVATE_newIndexOffsetSuccessorFromReadTime(e, t) {\n // We want to create an offset that matches all documents with a read time\n // greater than the provided read time. To do so, we technically need to\n // create an offset for `(readTime, MAX_DOCUMENT_KEY)`. While we could use\n // Unicode codepoints to generate MAX_DOCUMENT_KEY, it is much easier to use\n // `(readTime + 1, DocumentKey.empty())` since `> DocumentKey.empty()` matches\n // all valid document IDs.\n const n = e.toTimestamp().seconds, r = e.toTimestamp().nanoseconds + 1, i = SnapshotVersion.fromTimestamp(1e9 === r ? new Timestamp(n + 1, 0) : new Timestamp(n, r));\n return new IndexOffset(i, DocumentKey.empty(), t);\n}\n\n/** Creates a new offset based on the provided document. */ function __PRIVATE_newIndexOffsetFromDocument(e) {\n return new IndexOffset(e.readTime, e.key, Q$1);\n}\n\n/**\n * Stores the latest read time, document and batch ID that were processed for an\n * index.\n */ class IndexOffset {\n constructor(\n /**\n * The latest read time version that has been indexed by Firestore for this\n * field index.\n */\n e, \n /**\n * The key of the last document that was indexed for this query. Use\n * `DocumentKey.empty()` if no document has been indexed.\n */\n t, \n /*\n * The largest mutation batch id that's been processed by Firestore.\n */\n n) {\n this.readTime = e, this.documentKey = t, this.largestBatchId = n;\n }\n /** Returns an offset that sorts before all regular offsets. */ static min() {\n return new IndexOffset(SnapshotVersion.min(), DocumentKey.empty(), Q$1);\n }\n /** Returns an offset that sorts after all regular offsets. */ static max() {\n return new IndexOffset(SnapshotVersion.max(), DocumentKey.empty(), Q$1);\n }\n}\n\nfunction __PRIVATE_indexOffsetComparator(e, t) {\n let n = e.readTime.compareTo(t.readTime);\n return 0 !== n ? n : (n = DocumentKey.comparator(e.documentKey, t.documentKey), \n 0 !== n ? n : __PRIVATE_primitiveComparator(e.largestBatchId, t.largestBatchId));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const $ = \"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.\";\n\n/**\n * A base class representing a persistence transaction, encapsulating both the\n * transaction's sequence numbers as well as a list of onCommitted listeners.\n *\n * When you call Persistence.runTransaction(), it will create a transaction and\n * pass it to your callback. You then pass it to any method that operates\n * on persistence.\n */ class PersistenceTransaction {\n constructor() {\n this.onCommittedListeners = [];\n }\n addOnCommittedListener(e) {\n this.onCommittedListeners.push(e);\n }\n raiseOnCommittedEvent() {\n this.onCommittedListeners.forEach((e => e()));\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Verifies the error thrown by a LocalStore operation. If a LocalStore\n * operation fails because the primary lease has been taken by another client,\n * we ignore the error (the persistence layer will immediately call\n * `applyPrimaryLease` to propagate the primary state change). All other errors\n * are re-thrown.\n *\n * @param err - An error returned by a LocalStore operation.\n * @returns A Promise that resolves after we recovered, or the original error.\n */ async function __PRIVATE_ignoreIfPrimaryLeaseLoss(e) {\n if (e.code !== N.FAILED_PRECONDITION || e.message !== $) throw e;\n __PRIVATE_logDebug(\"LocalStore\", \"Unexpectedly lost primary lease\");\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * PersistencePromise is essentially a re-implementation of Promise except\n * it has a .next() method instead of .then() and .next() and .catch() callbacks\n * are executed synchronously when a PersistencePromise resolves rather than\n * asynchronously (Promise implementations use setImmediate() or similar).\n *\n * This is necessary to interoperate with IndexedDB which will automatically\n * commit transactions if control is returned to the event loop without\n * synchronously initiating another operation on the transaction.\n *\n * NOTE: .then() and .catch() only allow a single consumer, unlike normal\n * Promises.\n */ class PersistencePromise {\n constructor(e) {\n // NOTE: next/catchCallback will always point to our own wrapper functions,\n // not the user's raw next() or catch() callbacks.\n this.nextCallback = null, this.catchCallback = null, \n // When the operation resolves, we'll set result or error and mark isDone.\n this.result = void 0, this.error = void 0, this.isDone = false, \n // Set to true when .then() or .catch() are called and prevents additional\n // chaining.\n this.callbackAttached = false, e((e => {\n this.isDone = true, this.result = e, this.nextCallback && \n // value should be defined unless T is Void, but we can't express\n // that in the type system.\n this.nextCallback(e);\n }), (e => {\n this.isDone = true, this.error = e, this.catchCallback && this.catchCallback(e);\n }));\n }\n catch(e) {\n return this.next(void 0, e);\n }\n next(e, t) {\n return this.callbackAttached && fail(59440), this.callbackAttached = true, this.isDone ? this.error ? this.wrapFailure(t, this.error) : this.wrapSuccess(e, this.result) : new PersistencePromise(((n, r) => {\n this.nextCallback = t => {\n this.wrapSuccess(e, t).next(n, r);\n }, this.catchCallback = e => {\n this.wrapFailure(t, e).next(n, r);\n };\n }));\n }\n toPromise() {\n return new Promise(((e, t) => {\n this.next(e, t);\n }));\n }\n wrapUserFunction(e) {\n try {\n const t = e();\n return t instanceof PersistencePromise ? t : PersistencePromise.resolve(t);\n } catch (e) {\n return PersistencePromise.reject(e);\n }\n }\n wrapSuccess(e, t) {\n return e ? this.wrapUserFunction((() => e(t))) : PersistencePromise.resolve(t);\n }\n wrapFailure(e, t) {\n return e ? this.wrapUserFunction((() => e(t))) : PersistencePromise.reject(t);\n }\n static resolve(e) {\n return new PersistencePromise(((t, n) => {\n t(e);\n }));\n }\n static reject(e) {\n return new PersistencePromise(((t, n) => {\n n(e);\n }));\n }\n static waitFor(\n // Accept all Promise types in waitFor().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n e) {\n return new PersistencePromise(((t, n) => {\n let r = 0, i = 0, s = false;\n e.forEach((e => {\n ++r, e.next((() => {\n ++i, s && i === r && t();\n }), (e => n(e)));\n })), s = true, i === r && t();\n }));\n }\n /**\n * Given an array of predicate functions that asynchronously evaluate to a\n * boolean, implements a short-circuiting `or` between the results. Predicates\n * will be evaluated until one of them returns `true`, then stop. The final\n * result will be whether any of them returned `true`.\n */ static or(e) {\n let t = PersistencePromise.resolve(false);\n for (const n of e) t = t.next((e => e ? PersistencePromise.resolve(e) : n()));\n return t;\n }\n static forEach(e, t) {\n const n = [];\n return e.forEach(((e, r) => {\n n.push(t.call(this, e, r));\n })), this.waitFor(n);\n }\n /**\n * Concurrently map all array elements through asynchronous function.\n */ static mapArray(e, t) {\n return new PersistencePromise(((n, r) => {\n const i = e.length, s = new Array(i);\n let o = 0;\n for (let _ = 0; _ < i; _++) {\n const a = _;\n t(e[a]).next((e => {\n s[a] = e, ++o, o === i && n(s);\n }), (e => r(e)));\n }\n }));\n }\n /**\n * An alternative to recursive PersistencePromise calls, that avoids\n * potential memory problems from unbounded chains of promises.\n *\n * The `action` will be called repeatedly while `condition` is true.\n */ static doWhile(e, t) {\n return new PersistencePromise(((n, r) => {\n const process = () => {\n true === e() ? t().next((() => {\n process();\n }), r) : n();\n };\n process();\n }));\n }\n}\n\n/** Parse User Agent to determine Android version. Returns -1 if not found. */ function __PRIVATE_getAndroidVersion(e) {\n const t = e.match(/Android ([\\d.]+)/i), n = t ? t[1].split(\".\").slice(0, 2).join(\".\") : \"-1\";\n return Number(n);\n}\n\n/** Verifies whether `e` is an IndexedDbTransactionError. */ function __PRIVATE_isIndexedDbTransactionError(e) {\n // Use name equality, as instanceof checks on errors don't work with errors\n // that wrap other errors.\n return \"IndexedDbTransactionError\" === e.name;\n}\n\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to\n * exceed. All subsequent calls to next will return increasing values. If provided with a\n * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as\n * well as write out sequence numbers that it produces via `next()`.\n */ class __PRIVATE_ListenSequence {\n constructor(e, t) {\n this.previousValue = e, t && (t.sequenceNumberHandler = e => this._e(e), this.ae = e => t.writeSequenceNumber(e));\n }\n _e(e) {\n return this.previousValue = Math.max(e, this.previousValue), this.previousValue;\n }\n next() {\n const e = ++this.previousValue;\n return this.ae && this.ae(e), e;\n }\n}\n\n__PRIVATE_ListenSequence.ue = -1;\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Sentinel value that sorts before any Mutation Batch ID. */\nconst G = -1;\n\n/**\n * Returns whether a variable is either undefined or null.\n */ function __PRIVATE_isNullOrUndefined(e) {\n return null == e;\n}\n\n/** Returns whether the value represents -0. */ function __PRIVATE_isNegativeZero(e) {\n // Detect if the value is -0.0. Based on polyfill from\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n return 0 === e && 1 / e == -1 / 0;\n}\n\n/**\n * Returns whether a value is an integer and in the safe integer range\n * @param value - The value to test for being an integer and in the safe range\n */ function isSafeInteger(e) {\n return \"number\" == typeof e && Number.isInteger(e) && !__PRIVATE_isNegativeZero(e) && e <= Number.MAX_SAFE_INTEGER && e >= Number.MIN_SAFE_INTEGER;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const z = \"\u0001\";\n\n/**\n * Encodes a resource path into a IndexedDb-compatible string form.\n */\nfunction __PRIVATE_encodeResourcePath(e) {\n let t = \"\";\n for (let n = 0; n < e.length; n++) t.length > 0 && (t = __PRIVATE_encodeSeparator(t)), \n t = __PRIVATE_encodeSegment(e.get(n), t);\n return __PRIVATE_encodeSeparator(t);\n}\n\n/** Encodes a single segment of a resource path into the given result */ function __PRIVATE_encodeSegment(e, t) {\n let n = t;\n const r = e.length;\n for (let t = 0; t < r; t++) {\n const r = e.charAt(t);\n switch (r) {\n case \"\\0\":\n n += \"\u0001\u0010\";\n break;\n\n case z:\n n += \"\u0001\u0011\";\n break;\n\n default:\n n += r;\n }\n }\n return n;\n}\n\n/** Encodes a path separator into the given result */ function __PRIVATE_encodeSeparator(e) {\n return e + z + \"\u0001\";\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function __PRIVATE_objectSize(e) {\n let t = 0;\n for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && t++;\n return t;\n}\n\nfunction forEach(e, t) {\n for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && t(n, e[n]);\n}\n\nfunction isEmpty(e) {\n for (const t in e) if (Object.prototype.hasOwnProperty.call(e, t)) return false;\n return true;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// An immutable sorted map implementation, based on a Left-leaning Red-Black\n// tree.\nclass SortedMap {\n constructor(e, t) {\n this.comparator = e, this.root = t || LLRBNode.EMPTY;\n }\n // Returns a copy of the map, with the specified key/value added or replaced.\n insert(e, t) {\n return new SortedMap(this.comparator, this.root.insert(e, t, this.comparator).copy(null, null, LLRBNode.BLACK, null, null));\n }\n // Returns a copy of the map, with the specified key removed.\n remove(e) {\n return new SortedMap(this.comparator, this.root.remove(e, this.comparator).copy(null, null, LLRBNode.BLACK, null, null));\n }\n // Returns the value of the node with the given key, or null.\n get(e) {\n let t = this.root;\n for (;!t.isEmpty(); ) {\n const n = this.comparator(e, t.key);\n if (0 === n) return t.value;\n n < 0 ? t = t.left : n > 0 && (t = t.right);\n }\n return null;\n }\n // Returns the index of the element in this sorted map, or -1 if it doesn't\n // exist.\n indexOf(e) {\n // Number of nodes that were pruned when descending right\n let t = 0, n = this.root;\n for (;!n.isEmpty(); ) {\n const r = this.comparator(e, n.key);\n if (0 === r) return t + n.left.size;\n r < 0 ? n = n.left : (\n // Count all nodes left of the node plus the node itself\n t += n.left.size + 1, n = n.right);\n }\n // Node not found\n return -1;\n }\n isEmpty() {\n return this.root.isEmpty();\n }\n // Returns the total number of nodes in the map.\n get size() {\n return this.root.size;\n }\n // Returns the minimum key in the map.\n minKey() {\n return this.root.minKey();\n }\n // Returns the maximum key in the map.\n maxKey() {\n return this.root.maxKey();\n }\n // Traverses the map in key order and calls the specified action function\n // for each key/value pair. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n inorderTraversal(e) {\n return this.root.inorderTraversal(e);\n }\n forEach(e) {\n this.inorderTraversal(((t, n) => (e(t, n), false)));\n }\n toString() {\n const e = [];\n return this.inorderTraversal(((t, n) => (e.push(`${t}:${n}`), false))), `{${e.join(\", \")}}`;\n }\n // Traverses the map in reverse key order and calls the specified action\n // function for each key/value pair. If action returns true, traversal is\n // aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n reverseTraversal(e) {\n return this.root.reverseTraversal(e);\n }\n // Returns an iterator over the SortedMap.\n getIterator() {\n return new SortedMapIterator(this.root, null, this.comparator, false);\n }\n getIteratorFrom(e) {\n return new SortedMapIterator(this.root, e, this.comparator, false);\n }\n getReverseIterator() {\n return new SortedMapIterator(this.root, null, this.comparator, true);\n }\n getReverseIteratorFrom(e) {\n return new SortedMapIterator(this.root, e, this.comparator, true);\n }\n}\n\n // end SortedMap\n// An iterator over an LLRBNode.\nclass SortedMapIterator {\n constructor(e, t, n, r) {\n this.isReverse = r, this.nodeStack = [];\n let i = 1;\n for (;!e.isEmpty(); ) if (i = t ? n(e.key, t) : 1, \n // flip the comparison if we're going in reverse\n t && r && (i *= -1), i < 0) \n // This node is less than our start key. ignore it\n e = this.isReverse ? e.left : e.right; else {\n if (0 === i) {\n // This node is exactly equal to our start key. Push it on the stack,\n // but stop iterating;\n this.nodeStack.push(e);\n break;\n }\n // This node is greater than our start key, add it to the stack and move\n // to the next one\n this.nodeStack.push(e), e = this.isReverse ? e.right : e.left;\n }\n }\n getNext() {\n let e = this.nodeStack.pop();\n const t = {\n key: e.key,\n value: e.value\n };\n if (this.isReverse) for (e = e.left; !e.isEmpty(); ) this.nodeStack.push(e), e = e.right; else for (e = e.right; !e.isEmpty(); ) this.nodeStack.push(e), \n e = e.left;\n return t;\n }\n hasNext() {\n return this.nodeStack.length > 0;\n }\n peek() {\n if (0 === this.nodeStack.length) return null;\n const e = this.nodeStack[this.nodeStack.length - 1];\n return {\n key: e.key,\n value: e.value\n };\n }\n}\n\n // end SortedMapIterator\n// Represents a node in a Left-leaning Red-Black tree.\nclass LLRBNode {\n constructor(e, t, n, r, i) {\n this.key = e, this.value = t, this.color = null != n ? n : LLRBNode.RED, this.left = null != r ? r : LLRBNode.EMPTY, \n this.right = null != i ? i : LLRBNode.EMPTY, this.size = this.left.size + 1 + this.right.size;\n }\n // Returns a copy of the current node, optionally replacing pieces of it.\n copy(e, t, n, r, i) {\n return new LLRBNode(null != e ? e : this.key, null != t ? t : this.value, null != n ? n : this.color, null != r ? r : this.left, null != i ? i : this.right);\n }\n isEmpty() {\n return false;\n }\n // Traverses the tree in key order and calls the specified action function\n // for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n inorderTraversal(e) {\n return this.left.inorderTraversal(e) || e(this.key, this.value) || this.right.inorderTraversal(e);\n }\n // Traverses the tree in reverse key order and calls the specified action\n // function for each node. If action returns true, traversal is aborted.\n // Returns the first truthy value returned by action, or the last falsey\n // value returned by action.\n reverseTraversal(e) {\n return this.right.reverseTraversal(e) || e(this.key, this.value) || this.left.reverseTraversal(e);\n }\n // Returns the minimum node in the tree.\n min() {\n return this.left.isEmpty() ? this : this.left.min();\n }\n // Returns the maximum key in the tree.\n minKey() {\n return this.min().key;\n }\n // Returns the maximum key in the tree.\n maxKey() {\n return this.right.isEmpty() ? this.key : this.right.maxKey();\n }\n // Returns new tree, with the key/value added.\n insert(e, t, n) {\n let r = this;\n const i = n(e, r.key);\n return r = i < 0 ? r.copy(null, null, null, r.left.insert(e, t, n), null) : 0 === i ? r.copy(null, t, null, null, null) : r.copy(null, null, null, null, r.right.insert(e, t, n)), \n r.fixUp();\n }\n removeMin() {\n if (this.left.isEmpty()) return LLRBNode.EMPTY;\n let e = this;\n return e.left.isRed() || e.left.left.isRed() || (e = e.moveRedLeft()), e = e.copy(null, null, null, e.left.removeMin(), null), \n e.fixUp();\n }\n // Returns new tree, with the specified item removed.\n remove(e, t) {\n let n, r = this;\n if (t(e, r.key) < 0) r.left.isEmpty() || r.left.isRed() || r.left.left.isRed() || (r = r.moveRedLeft()), \n r = r.copy(null, null, null, r.left.remove(e, t), null); else {\n if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()), \n 0 === t(e, r.key)) {\n if (r.right.isEmpty()) return LLRBNode.EMPTY;\n n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());\n }\n r = r.copy(null, null, null, null, r.right.remove(e, t));\n }\n return r.fixUp();\n }\n isRed() {\n return this.color;\n }\n // Returns new tree after performing any needed rotations.\n fixUp() {\n let e = this;\n return e.right.isRed() && !e.left.isRed() && (e = e.rotateLeft()), e.left.isRed() && e.left.left.isRed() && (e = e.rotateRight()), \n e.left.isRed() && e.right.isRed() && (e = e.colorFlip()), e;\n }\n moveRedLeft() {\n let e = this.colorFlip();\n return e.right.left.isRed() && (e = e.copy(null, null, null, null, e.right.rotateRight()), \n e = e.rotateLeft(), e = e.colorFlip()), e;\n }\n moveRedRight() {\n let e = this.colorFlip();\n return e.left.left.isRed() && (e = e.rotateRight(), e = e.colorFlip()), e;\n }\n rotateLeft() {\n const e = this.copy(null, null, LLRBNode.RED, null, this.right.left);\n return this.right.copy(null, null, this.color, e, null);\n }\n rotateRight() {\n const e = this.copy(null, null, LLRBNode.RED, this.left.right, null);\n return this.left.copy(null, null, this.color, null, e);\n }\n colorFlip() {\n const e = this.left.copy(null, null, !this.left.color, null, null), t = this.right.copy(null, null, !this.right.color, null, null);\n return this.copy(null, null, !this.color, e, t);\n }\n // For testing.\n checkMaxDepth() {\n const e = this.check();\n return Math.pow(2, e) <= this.size + 1;\n }\n // In a balanced RB tree, the black-depth (number of black nodes) from root to\n // leaves is equal on both sides. This function verifies that or asserts.\n check() {\n if (this.isRed() && this.left.isRed()) throw fail(43730, {\n key: this.key,\n value: this.value\n });\n if (this.right.isRed()) throw fail(14113, {\n key: this.key,\n value: this.value\n });\n const e = this.left.check();\n if (e !== this.right.check()) throw fail(27949);\n return e + (this.isRed() ? 0 : 1);\n }\n}\n\n // end LLRBNode\n// Empty node is shared between all LLRB trees.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nLLRBNode.EMPTY = null, LLRBNode.RED = true, LLRBNode.BLACK = false;\n\n// end LLRBEmptyNode\nLLRBNode.EMPTY = new \n// Represents an empty node (a leaf node in the Red-Black Tree).\nclass LLRBEmptyNode {\n constructor() {\n this.size = 0;\n }\n get key() {\n throw fail(57766);\n }\n get value() {\n throw fail(16141);\n }\n get color() {\n throw fail(16727);\n }\n get left() {\n throw fail(29726);\n }\n get right() {\n throw fail(36894);\n }\n // Returns a copy of the current node.\n copy(e, t, n, r, i) {\n return this;\n }\n // Returns a copy of the tree, with the specified key/value added.\n insert(e, t, n) {\n return new LLRBNode(e, t);\n }\n // Returns a copy of the tree, with the specified key removed.\n remove(e, t) {\n return this;\n }\n isEmpty() {\n return true;\n }\n inorderTraversal(e) {\n return false;\n }\n reverseTraversal(e) {\n return false;\n }\n minKey() {\n return null;\n }\n maxKey() {\n return null;\n }\n isRed() {\n return false;\n }\n // For testing.\n checkMaxDepth() {\n return true;\n }\n check() {\n return 0;\n }\n};\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * SortedSet is an immutable (copy-on-write) collection that holds elements\n * in order specified by the provided comparator.\n *\n * NOTE: if provided comparator returns 0 for two elements, we consider them to\n * be equal!\n */\nclass SortedSet {\n constructor(e) {\n this.comparator = e, this.data = new SortedMap(this.comparator);\n }\n has(e) {\n return null !== this.data.get(e);\n }\n first() {\n return this.data.minKey();\n }\n last() {\n return this.data.maxKey();\n }\n get size() {\n return this.data.size;\n }\n indexOf(e) {\n return this.data.indexOf(e);\n }\n /** Iterates elements in order defined by \"comparator\" */ forEach(e) {\n this.data.inorderTraversal(((t, n) => (e(t), false)));\n }\n /** Iterates over `elem`s such that: range[0] &lt;= elem &lt; range[1]. */ forEachInRange(e, t) {\n const n = this.data.getIteratorFrom(e[0]);\n for (;n.hasNext(); ) {\n const r = n.getNext();\n if (this.comparator(r.key, e[1]) >= 0) return;\n t(r.key);\n }\n }\n /**\n * Iterates over `elem`s such that: start &lt;= elem until false is returned.\n */ forEachWhile(e, t) {\n let n;\n for (n = void 0 !== t ? this.data.getIteratorFrom(t) : this.data.getIterator(); n.hasNext(); ) {\n if (!e(n.getNext().key)) return;\n }\n }\n /** Finds the least element greater than or equal to `elem`. */ firstAfterOrEqual(e) {\n const t = this.data.getIteratorFrom(e);\n return t.hasNext() ? t.getNext().key : null;\n }\n getIterator() {\n return new SortedSetIterator(this.data.getIterator());\n }\n getIteratorFrom(e) {\n return new SortedSetIterator(this.data.getIteratorFrom(e));\n }\n /** Inserts or updates an element */ add(e) {\n return this.copy(this.data.remove(e).insert(e, true));\n }\n /** Deletes an element */ delete(e) {\n return this.has(e) ? this.copy(this.data.remove(e)) : this;\n }\n isEmpty() {\n return this.data.isEmpty();\n }\n unionWith(e) {\n let t = this;\n // Make sure `result` always refers to the larger one of the two sets.\n return t.size < e.size && (t = e, e = this), e.forEach((e => {\n t = t.add(e);\n })), t;\n }\n isEqual(e) {\n if (!(e instanceof SortedSet)) return false;\n if (this.size !== e.size) return false;\n const t = this.data.getIterator(), n = e.data.getIterator();\n for (;t.hasNext(); ) {\n const e = t.getNext().key, r = n.getNext().key;\n if (0 !== this.comparator(e, r)) return false;\n }\n return true;\n }\n toArray() {\n const e = [];\n return this.forEach((t => {\n e.push(t);\n })), e;\n }\n toString() {\n const e = [];\n return this.forEach((t => e.push(t))), \"SortedSet(\" + e.toString() + \")\";\n }\n copy(e) {\n const t = new SortedSet(this.comparator);\n return t.data = e, t;\n }\n}\n\nclass SortedSetIterator {\n constructor(e) {\n this.iter = e;\n }\n getNext() {\n return this.iter.getNext().key;\n }\n hasNext() {\n return this.iter.hasNext();\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provides a set of fields that can be used to partially patch a document.\n * FieldMask is used in conjunction with ObjectValue.\n * Examples:\n * foo - Overwrites foo entirely with the provided value. If foo is not\n * present in the companion ObjectValue, the field is deleted.\n * foo.bar - Overwrites only the field bar of the object foo.\n * If foo is not an object, foo is replaced with an object\n * containing foo\n */ class FieldMask {\n constructor(e) {\n this.fields = e, \n // TODO(dimond): validation of FieldMask\n // Sort the field mask to support `FieldMask.isEqual()` and assert below.\n e.sort(FieldPath$1.comparator);\n }\n static empty() {\n return new FieldMask([]);\n }\n /**\n * Returns a new FieldMask object that is the result of adding all the given\n * fields paths to this field mask.\n */ unionWith(e) {\n let t = new SortedSet(FieldPath$1.comparator);\n for (const e of this.fields) t = t.add(e);\n for (const n of e) t = t.add(n);\n return new FieldMask(t.toArray());\n }\n /**\n * Verifies that `fieldPath` is included by at least one field in this field\n * mask.\n *\n * This is an O(n) operation, where `n` is the size of the field mask.\n */ covers(e) {\n for (const t of this.fields) if (t.isPrefixOf(e)) return true;\n return false;\n }\n isEqual(e) {\n return __PRIVATE_arrayEquals(this.fields, e.fields, ((e, t) => e.isEqual(t)));\n }\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An error encountered while decoding base64 string.\n */ class __PRIVATE_Base64DecodeError extends Error {\n constructor() {\n super(...arguments), this.name = \"Base64DecodeError\";\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Immutable class that represents a \"proto\" byte string.\n *\n * Proto byte strings can either be Base64-encoded strings or Uint8Arrays when\n * sent on the wire. This class abstracts away this differentiation by holding\n * the proto byte string in a common class that must be converted into a string\n * before being sent as a proto.\n * @internal\n */ class ByteString {\n constructor(e) {\n this.binaryString = e;\n }\n static fromBase64String(e) {\n const t = function __PRIVATE_decodeBase64(e) {\n try {\n return atob(e);\n } catch (e) {\n // Check that `DOMException` is defined before using it to avoid\n // \"ReferenceError: Property 'DOMException' doesn't exist\" in react-native.\n // (https://github.com/firebase/firebase-js-sdk/issues/7115)\n throw \"undefined\" != typeof DOMException && e instanceof DOMException ? new __PRIVATE_Base64DecodeError(\"Invalid base64 string: \" + e) : e;\n }\n }\n /** Converts a binary string to a Base64 encoded string. */ (e);\n return new ByteString(t);\n }\n static fromUint8Array(e) {\n // TODO(indexing); Remove the copy of the byte string here as this method\n // is frequently called during indexing.\n const t = \n /**\n * Helper function to convert an Uint8array to a binary string.\n */\n function __PRIVATE_binaryStringFromUint8Array(e) {\n let t = \"\";\n for (let n = 0; n < e.length; ++n) t += String.fromCharCode(e[n]);\n return t;\n }\n /**\n * Helper function to convert a binary string to an Uint8Array.\n */ (e);\n return new ByteString(t);\n }\n [Symbol.iterator]() {\n let e = 0;\n return {\n next: () => e < this.binaryString.length ? {\n value: this.binaryString.charCodeAt(e++),\n done: false\n } : {\n value: void 0,\n done: true\n }\n };\n }\n toBase64() {\n return function __PRIVATE_encodeBase64(e) {\n return btoa(e);\n }(this.binaryString);\n }\n toUint8Array() {\n return function __PRIVATE_uint8ArrayFromBinaryString(e) {\n const t = new Uint8Array(e.length);\n for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n);\n return t;\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // A RegExp matching ISO 8601 UTC timestamps with optional fraction.\n (this.binaryString);\n }\n approximateByteSize() {\n return 2 * this.binaryString.length;\n }\n compareTo(e) {\n return __PRIVATE_primitiveComparator(this.binaryString, e.binaryString);\n }\n isEqual(e) {\n return this.binaryString === e.binaryString;\n }\n}\n\nByteString.EMPTY_BYTE_STRING = new ByteString(\"\");\n\nconst it = new RegExp(/^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.(\\d+))?Z$/);\n\n/**\n * Converts the possible Proto values for a timestamp value into a \"seconds and\n * nanos\" representation.\n */ function __PRIVATE_normalizeTimestamp(e) {\n // The json interface (for the browser) will return an iso timestamp string,\n // while the proto js library (for node) will return a\n // google.protobuf.Timestamp instance.\n if (__PRIVATE_hardAssert(!!e, 39018), \"string\" == typeof e) {\n // The date string can have higher precision (nanos) than the Date class\n // (millis), so we do some custom parsing here.\n // Parse the nanos right out of the string.\n let t = 0;\n const n = it.exec(e);\n if (__PRIVATE_hardAssert(!!n, 46558, {\n timestamp: e\n }), n[1]) {\n // Pad the fraction out to 9 digits (nanos).\n let e = n[1];\n e = (e + \"000000000\").substr(0, 9), t = Number(e);\n }\n // Parse the date to get the seconds.\n const r = new Date(e);\n return {\n seconds: Math.floor(r.getTime() / 1e3),\n nanos: t\n };\n }\n return {\n seconds: __PRIVATE_normalizeNumber(e.seconds),\n nanos: __PRIVATE_normalizeNumber(e.nanos)\n };\n}\n\n/**\n * Converts the possible Proto types for numbers into a JavaScript number.\n * Returns 0 if the value is not numeric.\n */ function __PRIVATE_normalizeNumber(e) {\n // TODO(bjornick): Handle int64 greater than 53 bits.\n return \"number\" == typeof e ? e : \"string\" == typeof e ? Number(e) : 0;\n}\n\n/** Converts the possible Proto types for Blobs into a ByteString. */ function __PRIVATE_normalizeByteString(e) {\n return \"string\" == typeof e ? ByteString.fromBase64String(e) : ByteString.fromUint8Array(e);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a locally-applied ServerTimestamp.\n *\n * Server Timestamps are backed by MapValues that contain an internal field\n * `__type__` with a value of `server_timestamp`. The previous value and local\n * write time are stored in its `__previous_value__` and `__local_write_time__`\n * fields respectively.\n *\n * Notes:\n * - ServerTimestampValue instances are created as the result of applying a\n * transform. They can only exist in the local view of a document. Therefore\n * they do not need to be parsed or serialized.\n * - When evaluated locally (e.g. for snapshot.data()), they by default\n * evaluate to `null`. This behavior can be configured by passing custom\n * FieldValueOptions to value().\n * - With respect to other ServerTimestampValues, they sort by their\n * localWriteTime.\n */ const st = \"server_timestamp\", ot = \"__type__\", _t = \"__previous_value__\", at = \"__local_write_time__\";\n\nfunction __PRIVATE_isServerTimestamp(e) {\n var t, n;\n return (null === (n = ((null === (t = null == e ? void 0 : e.mapValue) || void 0 === t ? void 0 : t.fields) || {})[ot]) || void 0 === n ? void 0 : n.stringValue) === st;\n}\n\n/**\n * Creates a new ServerTimestamp proto value (using the internal format).\n */\n/**\n * Returns the value of the field before this ServerTimestamp was set.\n *\n * Preserving the previous values allows the user to display the last resoled\n * value until the backend responds with the timestamp.\n */\nfunction __PRIVATE_getPreviousValue(e) {\n const t = e.mapValue.fields[_t];\n return __PRIVATE_isServerTimestamp(t) ? __PRIVATE_getPreviousValue(t) : t;\n}\n\n/**\n * Returns the local time at which this timestamp was first set.\n */ function __PRIVATE_getLocalWriteTime(e) {\n const t = __PRIVATE_normalizeTimestamp(e.mapValue.fields[at].timestampValue);\n return new Timestamp(t.seconds, t.nanos);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class DatabaseInfo {\n /**\n * Constructs a DatabaseInfo using the provided host, databaseId and\n * persistenceKey.\n *\n * @param databaseId - The database to use.\n * @param appId - The Firebase App Id.\n * @param persistenceKey - A unique identifier for this Firestore's local\n * storage (used in conjunction with the databaseId).\n * @param host - The Firestore backend host to connect to.\n * @param ssl - Whether to use SSL when connecting.\n * @param forceLongPolling - Whether to use the forceLongPolling option\n * when using WebChannel as the network transport.\n * @param autoDetectLongPolling - Whether to use the detectBufferingProxy\n * option when using WebChannel as the network transport.\n * @param longPollingOptions Options that configure long-polling.\n * @param useFetchStreams Whether to use the Fetch API instead of\n * XMLHTTPRequest\n */\n constructor(e, t, n, r, i, s, o, _, a, u) {\n this.databaseId = e, this.appId = t, this.persistenceKey = n, this.host = r, this.ssl = i, \n this.forceLongPolling = s, this.autoDetectLongPolling = o, this.longPollingOptions = _, \n this.useFetchStreams = a, this.isUsingEmulator = u;\n }\n}\n\n/** The default database name for a project. */ const ut = \"(default)\";\n\n/**\n * Represents the database ID a Firestore client is associated with.\n * @internal\n */ class DatabaseId {\n constructor(e, t) {\n this.projectId = e, this.database = t || ut;\n }\n static empty() {\n return new DatabaseId(\"\", \"\");\n }\n get isDefaultDatabase() {\n return this.database === ut;\n }\n isEqual(e) {\n return e instanceof DatabaseId && e.projectId === this.projectId && e.database === this.database;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst ct = \"__type__\", lt = \"__max__\", ht = {\n mapValue: {\n }\n}, Pt = \"__vector__\", Tt = \"value\";\n\n/** Extracts the backend's type order for the provided value. */\nfunction __PRIVATE_typeOrder(e) {\n return \"nullValue\" in e ? 0 /* TypeOrder.NullValue */ : \"booleanValue\" in e ? 1 /* TypeOrder.BooleanValue */ : \"integerValue\" in e || \"doubleValue\" in e ? 2 /* TypeOrder.NumberValue */ : \"timestampValue\" in e ? 3 /* TypeOrder.TimestampValue */ : \"stringValue\" in e ? 5 /* TypeOrder.StringValue */ : \"bytesValue\" in e ? 6 /* TypeOrder.BlobValue */ : \"referenceValue\" in e ? 7 /* TypeOrder.RefValue */ : \"geoPointValue\" in e ? 8 /* TypeOrder.GeoPointValue */ : \"arrayValue\" in e ? 9 /* TypeOrder.ArrayValue */ : \"mapValue\" in e ? __PRIVATE_isServerTimestamp(e) ? 4 /* TypeOrder.ServerTimestampValue */ : __PRIVATE_isMaxValue(e) ? 9007199254740991 /* TypeOrder.MaxValue */ : __PRIVATE_isVectorValue(e) ? 10 /* TypeOrder.VectorValue */ : 11 /* TypeOrder.ObjectValue */ : fail(28295, {\n value: e\n });\n}\n\n/** Tests `left` and `right` for equality based on the backend semantics. */ function __PRIVATE_valueEquals(e, t) {\n if (e === t) return true;\n const n = __PRIVATE_typeOrder(e);\n if (n !== __PRIVATE_typeOrder(t)) return false;\n switch (n) {\n case 0 /* TypeOrder.NullValue */ :\n case 9007199254740991 /* TypeOrder.MaxValue */ :\n return true;\n\n case 1 /* TypeOrder.BooleanValue */ :\n return e.booleanValue === t.booleanValue;\n\n case 4 /* TypeOrder.ServerTimestampValue */ :\n return __PRIVATE_getLocalWriteTime(e).isEqual(__PRIVATE_getLocalWriteTime(t));\n\n case 3 /* TypeOrder.TimestampValue */ :\n return function __PRIVATE_timestampEquals(e, t) {\n if (\"string\" == typeof e.timestampValue && \"string\" == typeof t.timestampValue && e.timestampValue.length === t.timestampValue.length) \n // Use string equality for ISO 8601 timestamps\n return e.timestampValue === t.timestampValue;\n const n = __PRIVATE_normalizeTimestamp(e.timestampValue), r = __PRIVATE_normalizeTimestamp(t.timestampValue);\n return n.seconds === r.seconds && n.nanos === r.nanos;\n }(e, t);\n\n case 5 /* TypeOrder.StringValue */ :\n return e.stringValue === t.stringValue;\n\n case 6 /* TypeOrder.BlobValue */ :\n return function __PRIVATE_blobEquals(e, t) {\n return __PRIVATE_normalizeByteString(e.bytesValue).isEqual(__PRIVATE_normalizeByteString(t.bytesValue));\n }(e, t);\n\n case 7 /* TypeOrder.RefValue */ :\n return e.referenceValue === t.referenceValue;\n\n case 8 /* TypeOrder.GeoPointValue */ :\n return function __PRIVATE_geoPointEquals(e, t) {\n return __PRIVATE_normalizeNumber(e.geoPointValue.latitude) === __PRIVATE_normalizeNumber(t.geoPointValue.latitude) && __PRIVATE_normalizeNumber(e.geoPointValue.longitude) === __PRIVATE_normalizeNumber(t.geoPointValue.longitude);\n }(e, t);\n\n case 2 /* TypeOrder.NumberValue */ :\n return function __PRIVATE_numberEquals(e, t) {\n if (\"integerValue\" in e && \"integerValue\" in t) return __PRIVATE_normalizeNumber(e.integerValue) === __PRIVATE_normalizeNumber(t.integerValue);\n if (\"doubleValue\" in e && \"doubleValue\" in t) {\n const n = __PRIVATE_normalizeNumber(e.doubleValue), r = __PRIVATE_normalizeNumber(t.doubleValue);\n return n === r ? __PRIVATE_isNegativeZero(n) === __PRIVATE_isNegativeZero(r) : isNaN(n) && isNaN(r);\n }\n return false;\n }(e, t);\n\n case 9 /* TypeOrder.ArrayValue */ :\n return __PRIVATE_arrayEquals(e.arrayValue.values || [], t.arrayValue.values || [], __PRIVATE_valueEquals);\n\n case 10 /* TypeOrder.VectorValue */ :\n case 11 /* TypeOrder.ObjectValue */ :\n return function __PRIVATE_objectEquals(e, t) {\n const n = e.mapValue.fields || {}, r = t.mapValue.fields || {};\n if (__PRIVATE_objectSize(n) !== __PRIVATE_objectSize(r)) return false;\n for (const e in n) if (n.hasOwnProperty(e) && (void 0 === r[e] || !__PRIVATE_valueEquals(n[e], r[e]))) return false;\n return true;\n }\n /** Returns true if the ArrayValue contains the specified element. */ (e, t);\n\n default:\n return fail(52216, {\n left: e\n });\n }\n}\n\nfunction __PRIVATE_arrayValueContains(e, t) {\n return void 0 !== (e.values || []).find((e => __PRIVATE_valueEquals(e, t)));\n}\n\nfunction __PRIVATE_valueCompare(e, t) {\n if (e === t) return 0;\n const n = __PRIVATE_typeOrder(e), r = __PRIVATE_typeOrder(t);\n if (n !== r) return __PRIVATE_primitiveComparator(n, r);\n switch (n) {\n case 0 /* TypeOrder.NullValue */ :\n case 9007199254740991 /* TypeOrder.MaxValue */ :\n return 0;\n\n case 1 /* TypeOrder.BooleanValue */ :\n return __PRIVATE_primitiveComparator(e.booleanValue, t.booleanValue);\n\n case 2 /* TypeOrder.NumberValue */ :\n return function __PRIVATE_compareNumbers(e, t) {\n const n = __PRIVATE_normalizeNumber(e.integerValue || e.doubleValue), r = __PRIVATE_normalizeNumber(t.integerValue || t.doubleValue);\n return n < r ? -1 : n > r ? 1 : n === r ? 0 : \n // one or both are NaN.\n isNaN(n) ? isNaN(r) ? 0 : -1 : 1;\n }(e, t);\n\n case 3 /* TypeOrder.TimestampValue */ :\n return __PRIVATE_compareTimestamps(e.timestampValue, t.timestampValue);\n\n case 4 /* TypeOrder.ServerTimestampValue */ :\n return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));\n\n case 5 /* TypeOrder.StringValue */ :\n return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);\n\n case 6 /* TypeOrder.BlobValue */ :\n return function __PRIVATE_compareBlobs(e, t) {\n const n = __PRIVATE_normalizeByteString(e), r = __PRIVATE_normalizeByteString(t);\n return n.compareTo(r);\n }(e.bytesValue, t.bytesValue);\n\n case 7 /* TypeOrder.RefValue */ :\n return function __PRIVATE_compareReferences(e, t) {\n const n = e.split(\"/\"), r = t.split(\"/\");\n for (let e = 0; e < n.length && e < r.length; e++) {\n const t = __PRIVATE_primitiveComparator(n[e], r[e]);\n if (0 !== t) return t;\n }\n return __PRIVATE_primitiveComparator(n.length, r.length);\n }(e.referenceValue, t.referenceValue);\n\n case 8 /* TypeOrder.GeoPointValue */ :\n return function __PRIVATE_compareGeoPoints(e, t) {\n const n = __PRIVATE_primitiveComparator(__PRIVATE_normalizeNumber(e.latitude), __PRIVATE_normalizeNumber(t.latitude));\n if (0 !== n) return n;\n return __PRIVATE_primitiveComparator(__PRIVATE_normalizeNumber(e.longitude), __PRIVATE_normalizeNumber(t.longitude));\n }(e.geoPointValue, t.geoPointValue);\n\n case 9 /* TypeOrder.ArrayValue */ :\n return __PRIVATE_compareArrays(e.arrayValue, t.arrayValue);\n\n case 10 /* TypeOrder.VectorValue */ :\n return function __PRIVATE_compareVectors(e, t) {\n var n, r, i, s;\n const o = e.fields || {}, _ = t.fields || {}, a = null === (n = o[Tt]) || void 0 === n ? void 0 : n.arrayValue, u = null === (r = _[Tt]) || void 0 === r ? void 0 : r.arrayValue, c = __PRIVATE_primitiveComparator((null === (i = null == a ? void 0 : a.values) || void 0 === i ? void 0 : i.length) || 0, (null === (s = null == u ? void 0 : u.values) || void 0 === s ? void 0 : s.length) || 0);\n if (0 !== c) return c;\n return __PRIVATE_compareArrays(a, u);\n }(e.mapValue, t.mapValue);\n\n case 11 /* TypeOrder.ObjectValue */ :\n return function __PRIVATE_compareMaps(e, t) {\n if (e === ht.mapValue && t === ht.mapValue) return 0;\n if (e === ht.mapValue) return 1;\n if (t === ht.mapValue) return -1;\n const n = e.fields || {}, r = Object.keys(n), i = t.fields || {}, s = Object.keys(i);\n // Even though MapValues are likely sorted correctly based on their insertion\n // order (e.g. when received from the backend), local modifications can bring\n // elements out of order. We need to re-sort the elements to ensure that\n // canonical IDs are independent of insertion order.\n r.sort(), s.sort();\n for (let e = 0; e < r.length && e < s.length; ++e) {\n const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);\n if (0 !== t) return t;\n const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);\n if (0 !== o) return o;\n }\n return __PRIVATE_primitiveComparator(r.length, s.length);\n }\n /**\n * Generates the canonical ID for the provided field value (as used in Target\n * serialization).\n */ (e.mapValue, t.mapValue);\n\n default:\n throw fail(23264, {\n le: n\n });\n }\n}\n\nfunction __PRIVATE_compareTimestamps(e, t) {\n if (\"string\" == typeof e && \"string\" == typeof t && e.length === t.length) return __PRIVATE_primitiveComparator(e, t);\n const n = __PRIVATE_normalizeTimestamp(e), r = __PRIVATE_normalizeTimestamp(t), i = __PRIVATE_primitiveComparator(n.seconds, r.seconds);\n return 0 !== i ? i : __PRIVATE_primitiveComparator(n.nanos, r.nanos);\n}\n\nfunction __PRIVATE_compareArrays(e, t) {\n const n = e.values || [], r = t.values || [];\n for (let e = 0; e < n.length && e < r.length; ++e) {\n const t = __PRIVATE_valueCompare(n[e], r[e]);\n if (t) return t;\n }\n return __PRIVATE_primitiveComparator(n.length, r.length);\n}\n\nfunction canonicalId(e) {\n return __PRIVATE_canonifyValue(e);\n}\n\nfunction __PRIVATE_canonifyValue(e) {\n return \"nullValue\" in e ? \"null\" : \"booleanValue\" in e ? \"\" + e.booleanValue : \"integerValue\" in e ? \"\" + e.integerValue : \"doubleValue\" in e ? \"\" + e.doubleValue : \"timestampValue\" in e ? function __PRIVATE_canonifyTimestamp(e) {\n const t = __PRIVATE_normalizeTimestamp(e);\n return `time(${t.seconds},${t.nanos})`;\n }(e.timestampValue) : \"stringValue\" in e ? e.stringValue : \"bytesValue\" in e ? function __PRIVATE_canonifyByteString(e) {\n return __PRIVATE_normalizeByteString(e).toBase64();\n }(e.bytesValue) : \"referenceValue\" in e ? function __PRIVATE_canonifyReference(e) {\n return DocumentKey.fromName(e).toString();\n }(e.referenceValue) : \"geoPointValue\" in e ? function __PRIVATE_canonifyGeoPoint(e) {\n return `geo(${e.latitude},${e.longitude})`;\n }(e.geoPointValue) : \"arrayValue\" in e ? function __PRIVATE_canonifyArray(e) {\n let t = \"[\", n = true;\n for (const r of e.values || []) n ? n = false : t += \",\", t += __PRIVATE_canonifyValue(r);\n return t + \"]\";\n }\n /**\n * Returns an approximate (and wildly inaccurate) in-memory size for the field\n * value.\n *\n * The memory size takes into account only the actual user data as it resides\n * in memory and ignores object overhead.\n */ (e.arrayValue) : \"mapValue\" in e ? function __PRIVATE_canonifyMap(e) {\n // Iteration order in JavaScript is not guaranteed. To ensure that we generate\n // matching canonical IDs for identical maps, we need to sort the keys.\n const t = Object.keys(e.fields || {}).sort();\n let n = \"{\", r = true;\n for (const i of t) r ? r = false : n += \",\", n += `${i}:${__PRIVATE_canonifyValue(e.fields[i])}`;\n return n + \"}\";\n }(e.mapValue) : fail(61005, {\n value: e\n });\n}\n\nfunction __PRIVATE_estimateByteSize(e) {\n switch (__PRIVATE_typeOrder(e)) {\n case 0 /* TypeOrder.NullValue */ :\n case 1 /* TypeOrder.BooleanValue */ :\n return 4;\n\n case 2 /* TypeOrder.NumberValue */ :\n return 8;\n\n case 3 /* TypeOrder.TimestampValue */ :\n case 8 /* TypeOrder.GeoPointValue */ :\n // GeoPoints are made up of two distinct numbers (latitude + longitude)\n return 16;\n\n case 4 /* TypeOrder.ServerTimestampValue */ :\n const t = __PRIVATE_getPreviousValue(e);\n return t ? 16 + __PRIVATE_estimateByteSize(t) : 16;\n\n case 5 /* TypeOrder.StringValue */ :\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures:\n // \"JavaScript's String type is [...] a set of elements of 16-bit unsigned\n // integer values\"\n return 2 * e.stringValue.length;\n\n case 6 /* TypeOrder.BlobValue */ :\n return __PRIVATE_normalizeByteString(e.bytesValue).approximateByteSize();\n\n case 7 /* TypeOrder.RefValue */ :\n return e.referenceValue.length;\n\n case 9 /* TypeOrder.ArrayValue */ :\n return function __PRIVATE_estimateArrayByteSize(e) {\n return (e.values || []).reduce(((e, t) => e + __PRIVATE_estimateByteSize(t)), 0);\n }\n /** Returns a reference value for the provided database and key. */ (e.arrayValue);\n\n case 10 /* TypeOrder.VectorValue */ :\n case 11 /* TypeOrder.ObjectValue */ :\n return function __PRIVATE_estimateMapByteSize(e) {\n let t = 0;\n return forEach(e.fields, ((e, n) => {\n t += e.length + __PRIVATE_estimateByteSize(n);\n })), t;\n }(e.mapValue);\n\n default:\n throw fail(13486, {\n value: e\n });\n }\n}\n\nfunction __PRIVATE_refValue(e, t) {\n return {\n referenceValue: `projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`\n };\n}\n\n/** Returns true if `value` is an IntegerValue . */ function isInteger(e) {\n return !!e && \"integerValue\" in e;\n}\n\n/** Returns true if `value` is a DoubleValue. */\n/** Returns true if `value` is an ArrayValue. */\nfunction isArray(e) {\n return !!e && \"arrayValue\" in e;\n}\n\n/** Returns true if `value` is a NullValue. */ function __PRIVATE_isNullValue(e) {\n return !!e && \"nullValue\" in e;\n}\n\n/** Returns true if `value` is NaN. */ function __PRIVATE_isNanValue(e) {\n return !!e && \"doubleValue\" in e && isNaN(Number(e.doubleValue));\n}\n\n/** Returns true if `value` is a MapValue. */ function __PRIVATE_isMapValue(e) {\n return !!e && \"mapValue\" in e;\n}\n\n/** Returns true if `value` is a VetorValue. */ function __PRIVATE_isVectorValue(e) {\n var t, n;\n return (null === (n = ((null === (t = null == e ? void 0 : e.mapValue) || void 0 === t ? void 0 : t.fields) || {})[ct]) || void 0 === n ? void 0 : n.stringValue) === Pt;\n}\n\n/** Creates a deep copy of `source`. */ function __PRIVATE_deepClone(e) {\n if (e.geoPointValue) return {\n geoPointValue: Object.assign({}, e.geoPointValue)\n };\n if (e.timestampValue && \"object\" == typeof e.timestampValue) return {\n timestampValue: Object.assign({}, e.timestampValue)\n };\n if (e.mapValue) {\n const t = {\n mapValue: {\n fields: {}\n }\n };\n return forEach(e.mapValue.fields, ((e, n) => t.mapValue.fields[e] = __PRIVATE_deepClone(n))), \n t;\n }\n if (e.arrayValue) {\n const t = {\n arrayValue: {\n values: []\n }\n };\n for (let n = 0; n < (e.arrayValue.values || []).length; ++n) t.arrayValue.values[n] = __PRIVATE_deepClone(e.arrayValue.values[n]);\n return t;\n }\n return Object.assign({}, e);\n}\n\n/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */ function __PRIVATE_isMaxValue(e) {\n return (((e.mapValue || {}).fields || {}).__type__ || {}).stringValue === lt;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An ObjectValue represents a MapValue in the Firestore Proto and offers the\n * ability to add and remove fields (via the ObjectValueBuilder).\n */ class ObjectValue {\n constructor(e) {\n this.value = e;\n }\n static empty() {\n return new ObjectValue({\n mapValue: {}\n });\n }\n /**\n * Returns the value at the given path or null.\n *\n * @param path - the path to search\n * @returns The value at the path or null if the path is not set.\n */ field(e) {\n if (e.isEmpty()) return this.value;\n {\n let t = this.value;\n for (let n = 0; n < e.length - 1; ++n) if (t = (t.mapValue.fields || {})[e.get(n)], \n !__PRIVATE_isMapValue(t)) return null;\n return t = (t.mapValue.fields || {})[e.lastSegment()], t || null;\n }\n }\n /**\n * Sets the field to the provided value.\n *\n * @param path - The field path to set.\n * @param value - The value to set.\n */ set(e, t) {\n this.getFieldsMap(e.popLast())[e.lastSegment()] = __PRIVATE_deepClone(t);\n }\n /**\n * Sets the provided fields to the provided values.\n *\n * @param data - A map of fields to values (or null for deletes).\n */ setAll(e) {\n let t = FieldPath$1.emptyPath(), n = {}, r = [];\n e.forEach(((e, i) => {\n if (!t.isImmediateParentOf(i)) {\n // Insert the accumulated changes at this parent location\n const e = this.getFieldsMap(t);\n this.applyChanges(e, n, r), n = {}, r = [], t = i.popLast();\n }\n e ? n[i.lastSegment()] = __PRIVATE_deepClone(e) : r.push(i.lastSegment());\n }));\n const i = this.getFieldsMap(t);\n this.applyChanges(i, n, r);\n }\n /**\n * Removes the field at the specified path. If there is no field at the\n * specified path, nothing is changed.\n *\n * @param path - The field path to remove.\n */ delete(e) {\n const t = this.field(e.popLast());\n __PRIVATE_isMapValue(t) && t.mapValue.fields && delete t.mapValue.fields[e.lastSegment()];\n }\n isEqual(e) {\n return __PRIVATE_valueEquals(this.value, e.value);\n }\n /**\n * Returns the map that contains the leaf element of `path`. If the parent\n * entry does not yet exist, or if it is not a map, a new map will be created.\n */ getFieldsMap(e) {\n let t = this.value;\n t.mapValue.fields || (t.mapValue = {\n fields: {}\n });\n for (let n = 0; n < e.length; ++n) {\n let r = t.mapValue.fields[e.get(n)];\n __PRIVATE_isMapValue(r) && r.mapValue.fields || (r = {\n mapValue: {\n fields: {}\n }\n }, t.mapValue.fields[e.get(n)] = r), t = r;\n }\n return t.mapValue.fields;\n }\n /**\n * Modifies `fieldsMap` by adding, replacing or deleting the specified\n * entries.\n */ applyChanges(e, t, n) {\n forEach(t, ((t, n) => e[t] = n));\n for (const t of n) delete e[t];\n }\n clone() {\n return new ObjectValue(__PRIVATE_deepClone(this.value));\n }\n}\n\n/**\n * Returns a FieldMask built from all fields in a MapValue.\n */ function __PRIVATE_extractFieldMask(e) {\n const t = [];\n return forEach(e.fields, ((e, n) => {\n const r = new FieldPath$1([ e ]);\n if (__PRIVATE_isMapValue(n)) {\n const e = __PRIVATE_extractFieldMask(n.mapValue).fields;\n if (0 === e.length) \n // Preserve the empty map by adding it to the FieldMask.\n t.push(r); else \n // For nested and non-empty ObjectValues, add the FieldPath of the\n // leaf nodes.\n for (const n of e) t.push(r.child(n));\n } else \n // For nested and non-empty ObjectValues, add the FieldPath of the leaf\n // nodes.\n t.push(r);\n })), new FieldMask(t);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a document in Firestore with a key, version, data and whether it\n * has local mutations applied to it.\n *\n * Documents can transition between states via `convertToFoundDocument()`,\n * `convertToNoDocument()` and `convertToUnknownDocument()`. If a document does\n * not transition to one of these states even after all mutations have been\n * applied, `isValidDocument()` returns false and the document should be removed\n * from all views.\n */ class MutableDocument {\n constructor(e, t, n, r, i, s, o) {\n this.key = e, this.documentType = t, this.version = n, this.readTime = r, this.createTime = i, \n this.data = s, this.documentState = o;\n }\n /**\n * Creates a document with no known version or data, but which can serve as\n * base document for mutations.\n */ static newInvalidDocument(e) {\n return new MutableDocument(e, 0 /* DocumentType.INVALID */ , \n /* version */ SnapshotVersion.min(), \n /* readTime */ SnapshotVersion.min(), \n /* createTime */ SnapshotVersion.min(), ObjectValue.empty(), 0 /* DocumentState.SYNCED */);\n }\n /**\n * Creates a new document that is known to exist with the given data at the\n * given version.\n */ static newFoundDocument(e, t, n, r) {\n return new MutableDocument(e, 1 /* DocumentType.FOUND_DOCUMENT */ , \n /* version */ t, \n /* readTime */ SnapshotVersion.min(), \n /* createTime */ n, r, 0 /* DocumentState.SYNCED */);\n }\n /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(e, t) {\n return new MutableDocument(e, 2 /* DocumentType.NO_DOCUMENT */ , \n /* version */ t, \n /* readTime */ SnapshotVersion.min(), \n /* createTime */ SnapshotVersion.min(), ObjectValue.empty(), 0 /* DocumentState.SYNCED */);\n }\n /**\n * Creates a new document that is known to exist at the given version but\n * whose data is not known (e.g. a document that was updated without a known\n * base document).\n */ static newUnknownDocument(e, t) {\n return new MutableDocument(e, 3 /* DocumentType.UNKNOWN_DOCUMENT */ , \n /* version */ t, \n /* readTime */ SnapshotVersion.min(), \n /* createTime */ SnapshotVersion.min(), ObjectValue.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);\n }\n /**\n * Changes the document type to indicate that it exists and that its version\n * and data are known.\n */ convertToFoundDocument(e, t) {\n // If a document is switching state from being an invalid or deleted\n // document to a valid (FOUND_DOCUMENT) document, either due to receiving an\n // update from Watch or due to applying a local set mutation on top\n // of a deleted document, our best guess about its createTime would be the\n // version at which the document transitioned to a FOUND_DOCUMENT.\n return !this.createTime.isEqual(SnapshotVersion.min()) || 2 /* DocumentType.NO_DOCUMENT */ !== this.documentType && 0 /* DocumentType.INVALID */ !== this.documentType || (this.createTime = e), \n this.version = e, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ , this.data = t, \n this.documentState = 0 /* DocumentState.SYNCED */ , this;\n }\n /**\n * Changes the document type to indicate that it doesn't exist at the given\n * version.\n */ convertToNoDocument(e) {\n return this.version = e, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ , \n this.data = ObjectValue.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , \n this;\n }\n /**\n * Changes the document type to indicate that it exists at a given version but\n * that its data is not known (e.g. a document that was updated without a known\n * base document).\n */ convertToUnknownDocument(e) {\n return this.version = e, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ , \n this.data = ObjectValue.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , \n this;\n }\n setHasCommittedMutations() {\n return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;\n }\n setHasLocalMutations() {\n return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = SnapshotVersion.min(), \n this;\n }\n setReadTime(e) {\n return this.readTime = e, this;\n }\n get hasLocalMutations() {\n return 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ === this.documentState;\n }\n get hasCommittedMutations() {\n return 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ === this.documentState;\n }\n get hasPendingWrites() {\n return this.hasLocalMutations || this.hasCommittedMutations;\n }\n isValidDocument() {\n return 0 /* DocumentType.INVALID */ !== this.documentType;\n }\n isFoundDocument() {\n return 1 /* DocumentType.FOUND_DOCUMENT */ === this.documentType;\n }\n isNoDocument() {\n return 2 /* DocumentType.NO_DOCUMENT */ === this.documentType;\n }\n isUnknownDocument() {\n return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;\n }\n isEqual(e) {\n return e instanceof MutableDocument && this.key.isEqual(e.key) && this.version.isEqual(e.version) && this.documentType === e.documentType && this.documentState === e.documentState && this.data.isEqual(e.data);\n }\n mutableCopy() {\n return new MutableDocument(this.key, this.documentType, this.version, this.readTime, this.createTime, this.data.clone(), this.documentState);\n }\n toString() {\n return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;\n }\n}\n\n/**\n * Compares the value for field `field` in the provided documents. Throws if\n * the field does not exist in both documents.\n */\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a bound of a query.\n *\n * The bound is specified with the given components representing a position and\n * whether it's just before or just after the position (relative to whatever the\n * query order is).\n *\n * The position represents a logical index position for a query. It's a prefix\n * of values for the (potentially implicit) order by clauses of a query.\n *\n * Bound provides a function to determine whether a document comes before or\n * after a bound. This is influenced by whether the position is just before or\n * just after the provided values.\n */\nclass Bound {\n constructor(e, t) {\n this.position = e, this.inclusive = t;\n }\n}\n\nfunction __PRIVATE_boundCompareToDocument(e, t, n) {\n let r = 0;\n for (let i = 0; i < e.position.length; i++) {\n const s = t[i], o = e.position[i];\n if (s.field.isKeyField()) r = DocumentKey.comparator(DocumentKey.fromName(o.referenceValue), n.key); else {\n r = __PRIVATE_valueCompare(o, n.data.field(s.field));\n }\n if (\"desc\" /* Direction.DESCENDING */ === s.dir && (r *= -1), 0 !== r) break;\n }\n return r;\n}\n\n/**\n * Returns true if a document sorts after a bound using the provided sort\n * order.\n */ function __PRIVATE_boundEquals(e, t) {\n if (null === e) return null === t;\n if (null === t) return false;\n if (e.inclusive !== t.inclusive || e.position.length !== t.position.length) return false;\n for (let n = 0; n < e.position.length; n++) {\n if (!__PRIVATE_valueEquals(e.position[n], t.position[n])) return false;\n }\n return true;\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An ordering on a field, in some Direction. Direction defaults to ASCENDING.\n */ class OrderBy {\n constructor(e, t = \"asc\" /* Direction.ASCENDING */) {\n this.field = e, this.dir = t;\n }\n}\n\nfunction __PRIVATE_orderByEquals(e, t) {\n return e.dir === t.dir && e.field.isEqual(t.field);\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class Filter {}\n\nclass FieldFilter extends Filter {\n constructor(e, t, n) {\n super(), this.field = e, this.op = t, this.value = n;\n }\n /**\n * Creates a filter based on the provided arguments.\n */ static create(e, t, n) {\n return e.isKeyField() ? \"in\" /* Operator.IN */ === t || \"not-in\" /* Operator.NOT_IN */ === t ? this.createKeyFieldInFilter(e, t, n) : new __PRIVATE_KeyFieldFilter(e, t, n) : \"array-contains\" /* Operator.ARRAY_CONTAINS */ === t ? new __PRIVATE_ArrayContainsFilter(e, n) : \"in\" /* Operator.IN */ === t ? new __PRIVATE_InFilter(e, n) : \"not-in\" /* Operator.NOT_IN */ === t ? new __PRIVATE_NotInFilter(e, n) : \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ === t ? new __PRIVATE_ArrayContainsAnyFilter(e, n) : new FieldFilter(e, t, n);\n }\n static createKeyFieldInFilter(e, t, n) {\n return \"in\" /* Operator.IN */ === t ? new __PRIVATE_KeyFieldInFilter(e, n) : new __PRIVATE_KeyFieldNotInFilter(e, n);\n }\n matches(e) {\n const t = e.data.field(this.field);\n // Types do not have to match in NOT_EQUAL filters.\n return \"!=\" /* Operator.NOT_EQUAL */ === this.op ? null !== t && void 0 === t.nullValue && this.matchesComparison(__PRIVATE_valueCompare(t, this.value)) : null !== t && __PRIVATE_typeOrder(this.value) === __PRIVATE_typeOrder(t) && this.matchesComparison(__PRIVATE_valueCompare(t, this.value));\n // Only compare types with matching backend order (such as double and int).\n }\n matchesComparison(e) {\n switch (this.op) {\n case \"<\" /* Operator.LESS_THAN */ :\n return e < 0;\n\n case \"<=\" /* Operator.LESS_THAN_OR_EQUAL */ :\n return e <= 0;\n\n case \"==\" /* Operator.EQUAL */ :\n return 0 === e;\n\n case \"!=\" /* Operator.NOT_EQUAL */ :\n return 0 !== e;\n\n case \">\" /* Operator.GREATER_THAN */ :\n return e > 0;\n\n case \">=\" /* Operator.GREATER_THAN_OR_EQUAL */ :\n return e >= 0;\n\n default:\n return fail(47266, {\n operator: this.op\n });\n }\n }\n isInequality() {\n return [ \"<\" /* Operator.LESS_THAN */ , \"<=\" /* Operator.LESS_THAN_OR_EQUAL */ , \">\" /* Operator.GREATER_THAN */ , \">=\" /* Operator.GREATER_THAN_OR_EQUAL */ , \"!=\" /* Operator.NOT_EQUAL */ , \"not-in\" /* Operator.NOT_IN */ ].indexOf(this.op) >= 0;\n }\n getFlattenedFilters() {\n return [ this ];\n }\n getFilters() {\n return [ this ];\n }\n}\n\nclass CompositeFilter extends Filter {\n constructor(e, t) {\n super(), this.filters = e, this.op = t, this.he = null;\n }\n /**\n * Creates a filter based on the provided arguments.\n */ static create(e, t) {\n return new CompositeFilter(e, t);\n }\n matches(e) {\n return __PRIVATE_compositeFilterIsConjunction(this) ? void 0 === this.filters.find((t => !t.matches(e))) : void 0 !== this.filters.find((t => t.matches(e)));\n }\n getFlattenedFilters() {\n return null !== this.he || (this.he = this.filters.reduce(((e, t) => e.concat(t.getFlattenedFilters())), [])), \n this.he;\n }\n // Returns a mutable copy of `this.filters`\n getFilters() {\n return Object.assign([], this.filters);\n }\n}\n\nfunction __PRIVATE_compositeFilterIsConjunction(e) {\n return \"and\" /* CompositeOperator.AND */ === e.op;\n}\n\n/**\n * Returns true if this filter is a conjunction of field filters only. Returns false otherwise.\n */ function __PRIVATE_compositeFilterIsFlatConjunction(e) {\n return __PRIVATE_compositeFilterIsFlat(e) && __PRIVATE_compositeFilterIsConjunction(e);\n}\n\n/**\n * Returns true if this filter does not contain any composite filters. Returns false otherwise.\n */ function __PRIVATE_compositeFilterIsFlat(e) {\n for (const t of e.filters) if (t instanceof CompositeFilter) return false;\n return true;\n}\n\nfunction __PRIVATE_canonifyFilter(e) {\n if (e instanceof FieldFilter) \n // TODO(b/29183165): Technically, this won't be unique if two values have\n // the same description, such as the int 3 and the string \"3\". So we should\n // add the types in here somehow, too.\n return e.field.canonicalString() + e.op.toString() + canonicalId(e.value);\n if (__PRIVATE_compositeFilterIsFlatConjunction(e)) \n // Older SDK versions use an implicit AND operation between their filters.\n // In the new SDK versions, the developer may use an explicit AND filter.\n // To stay consistent with the old usages, we add a special case to ensure\n // the canonical ID for these two are the same. For example:\n // `col.whereEquals(\"a\", 1).whereEquals(\"b\", 2)` should have the same\n // canonical ID as `col.where(and(equals(\"a\",1), equals(\"b\",2)))`.\n return e.filters.map((e => __PRIVATE_canonifyFilter(e))).join(\",\");\n {\n // filter instanceof CompositeFilter\n const t = e.filters.map((e => __PRIVATE_canonifyFilter(e))).join(\",\");\n return `${e.op}(${t})`;\n }\n}\n\nfunction __PRIVATE_filterEquals(e, t) {\n return e instanceof FieldFilter ? function __PRIVATE_fieldFilterEquals(e, t) {\n return t instanceof FieldFilter && e.op === t.op && e.field.isEqual(t.field) && __PRIVATE_valueEquals(e.value, t.value);\n }(e, t) : e instanceof CompositeFilter ? function __PRIVATE_compositeFilterEquals(e, t) {\n if (t instanceof CompositeFilter && e.op === t.op && e.filters.length === t.filters.length) {\n return e.filters.reduce(((e, n, r) => e && __PRIVATE_filterEquals(n, t.filters[r])), true);\n }\n return false;\n }\n /**\n * Returns a new composite filter that contains all filter from\n * `compositeFilter` plus all the given filters in `otherFilters`.\n */ (e, t) : void fail(19439);\n}\n\n/** Returns a debug description for `filter`. */ function __PRIVATE_stringifyFilter(e) {\n return e instanceof FieldFilter ? function __PRIVATE_stringifyFieldFilter(e) {\n return `${e.field.canonicalString()} ${e.op} ${canonicalId(e.value)}`;\n }\n /** Filter that matches on key fields (i.e. '__name__'). */ (e) : e instanceof CompositeFilter ? function __PRIVATE_stringifyCompositeFilter(e) {\n return e.op.toString() + \" {\" + e.getFilters().map(__PRIVATE_stringifyFilter).join(\" ,\") + \"}\";\n }(e) : \"Filter\";\n}\n\nclass __PRIVATE_KeyFieldFilter extends FieldFilter {\n constructor(e, t, n) {\n super(e, t, n), this.key = DocumentKey.fromName(n.referenceValue);\n }\n matches(e) {\n const t = DocumentKey.comparator(e.key, this.key);\n return this.matchesComparison(t);\n }\n}\n\n/** Filter that matches on key fields within an array. */ class __PRIVATE_KeyFieldInFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"in\" /* Operator.IN */ , t), this.keys = __PRIVATE_extractDocumentKeysFromArrayValue(\"in\" /* Operator.IN */ , t);\n }\n matches(e) {\n return this.keys.some((t => t.isEqual(e.key)));\n }\n}\n\n/** Filter that matches on key fields not present within an array. */ class __PRIVATE_KeyFieldNotInFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"not-in\" /* Operator.NOT_IN */ , t), this.keys = __PRIVATE_extractDocumentKeysFromArrayValue(\"not-in\" /* Operator.NOT_IN */ , t);\n }\n matches(e) {\n return !this.keys.some((t => t.isEqual(e.key)));\n }\n}\n\nfunction __PRIVATE_extractDocumentKeysFromArrayValue(e, t) {\n var n;\n return ((null === (n = t.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((e => DocumentKey.fromName(e.referenceValue)));\n}\n\n/** A Filter that implements the array-contains operator. */ class __PRIVATE_ArrayContainsFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"array-contains\" /* Operator.ARRAY_CONTAINS */ , t);\n }\n matches(e) {\n const t = e.data.field(this.field);\n return isArray(t) && __PRIVATE_arrayValueContains(t.arrayValue, this.value);\n }\n}\n\n/** A Filter that implements the IN operator. */ class __PRIVATE_InFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"in\" /* Operator.IN */ , t);\n }\n matches(e) {\n const t = e.data.field(this.field);\n return null !== t && __PRIVATE_arrayValueContains(this.value.arrayValue, t);\n }\n}\n\n/** A Filter that implements the not-in operator. */ class __PRIVATE_NotInFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"not-in\" /* Operator.NOT_IN */ , t);\n }\n matches(e) {\n if (__PRIVATE_arrayValueContains(this.value.arrayValue, {\n nullValue: \"NULL_VALUE\"\n })) return false;\n const t = e.data.field(this.field);\n return null !== t && void 0 === t.nullValue && !__PRIVATE_arrayValueContains(this.value.arrayValue, t);\n }\n}\n\n/** A Filter that implements the array-contains-any operator. */ class __PRIVATE_ArrayContainsAnyFilter extends FieldFilter {\n constructor(e, t) {\n super(e, \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ , t);\n }\n matches(e) {\n const t = e.data.field(this.field);\n return !(!isArray(t) || !t.arrayValue.values) && t.arrayValue.values.some((e => __PRIVATE_arrayValueContains(this.value.arrayValue, e)));\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Visible for testing\nclass __PRIVATE_TargetImpl {\n constructor(e, t = null, n = [], r = [], i = null, s = null, o = null) {\n this.path = e, this.collectionGroup = t, this.orderBy = n, this.filters = r, this.limit = i, \n this.startAt = s, this.endAt = o, this.Pe = null;\n }\n}\n\n/**\n * Initializes a Target with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n *\n * NOTE: you should always construct `Target` from `Query.toTarget` instead of\n * using this factory method, because `Query` provides an implicit `orderBy`\n * property.\n */ function __PRIVATE_newTarget(e, t = null, n = [], r = [], i = null, s = null, o = null) {\n return new __PRIVATE_TargetImpl(e, t, n, r, i, s, o);\n}\n\nfunction __PRIVATE_canonifyTarget(e) {\n const t = __PRIVATE_debugCast(e);\n if (null === t.Pe) {\n let e = t.path.canonicalString();\n null !== t.collectionGroup && (e += \"|cg:\" + t.collectionGroup), e += \"|f:\", e += t.filters.map((e => __PRIVATE_canonifyFilter(e))).join(\",\"), \n e += \"|ob:\", e += t.orderBy.map((e => function __PRIVATE_canonifyOrderBy(e) {\n // TODO(b/29183165): Make this collision robust.\n return e.field.canonicalString() + e.dir;\n }(e))).join(\",\"), __PRIVATE_isNullOrUndefined(t.limit) || (e += \"|l:\", e += t.limit), \n t.startAt && (e += \"|lb:\", e += t.startAt.inclusive ? \"b:\" : \"a:\", e += t.startAt.position.map((e => canonicalId(e))).join(\",\")), \n t.endAt && (e += \"|ub:\", e += t.endAt.inclusive ? \"a:\" : \"b:\", e += t.endAt.position.map((e => canonicalId(e))).join(\",\")), \n t.Pe = e;\n }\n return t.Pe;\n}\n\nfunction __PRIVATE_targetEquals(e, t) {\n if (e.limit !== t.limit) return false;\n if (e.orderBy.length !== t.orderBy.length) return false;\n for (let n = 0; n < e.orderBy.length; n++) if (!__PRIVATE_orderByEquals(e.orderBy[n], t.orderBy[n])) return false;\n if (e.filters.length !== t.filters.length) return false;\n for (let n = 0; n < e.filters.length; n++) if (!__PRIVATE_filterEquals(e.filters[n], t.filters[n])) return false;\n return e.collectionGroup === t.collectionGroup && (!!e.path.isEqual(t.path) && (!!__PRIVATE_boundEquals(e.startAt, t.startAt) && __PRIVATE_boundEquals(e.endAt, t.endAt)));\n}\n\nfunction __PRIVATE_targetIsDocumentTarget(e) {\n return DocumentKey.isDocumentKey(e.path) && null === e.collectionGroup && 0 === e.filters.length;\n}\n\n/** Returns the number of segments of a perfect index for this target. */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Query encapsulates all the query attributes we support in the SDK. It can\n * be run against the LocalStore, as well as be converted to a `Target` to\n * query the RemoteStore results.\n *\n * Visible for testing.\n */\nclass __PRIVATE_QueryImpl {\n /**\n * Initializes a Query with a path and optional additional query constraints.\n * Path must currently be empty if this is a collection group query.\n */\n constructor(e, t = null, n = [], r = [], i = null, s = \"F\" /* LimitType.First */ , o = null, _ = null) {\n this.path = e, this.collectionGroup = t, this.explicitOrderBy = n, this.filters = r, \n this.limit = i, this.limitType = s, this.startAt = o, this.endAt = _, this.Te = null, \n // The corresponding `Target` of this `Query` instance, for use with\n // non-aggregate queries.\n this.Ie = null, \n // The corresponding `Target` of this `Query` instance, for use with\n // aggregate queries. Unlike targets for non-aggregate queries,\n // aggregate query targets do not contain normalized order-bys, they only\n // contain explicit order-bys.\n this.de = null, this.startAt, this.endAt;\n }\n}\n\n/** Creates a new Query instance with the options provided. */ function __PRIVATE_newQuery(e, t, n, r, i, s, o, _) {\n return new __PRIVATE_QueryImpl(e, t, n, r, i, s, o, _);\n}\n\n/** Creates a new Query for a query that matches all documents at `path` */ function __PRIVATE_newQueryForPath(e) {\n return new __PRIVATE_QueryImpl(e);\n}\n\n/**\n * Helper to convert a collection group query into a collection query at a\n * specific path. This is used when executing collection group queries, since\n * we have to split the query into a set of collection queries at multiple\n * paths.\n */\n/**\n * Returns true if this query does not specify any query constraints that\n * could remove results.\n */\nfunction __PRIVATE_queryMatchesAllDocuments(e) {\n return 0 === e.filters.length && null === e.limit && null == e.startAt && null == e.endAt && (0 === e.explicitOrderBy.length || 1 === e.explicitOrderBy.length && e.explicitOrderBy[0].field.isKeyField());\n}\n\n// Returns the sorted set of inequality filter fields used in this query.\n/**\n * Returns whether the query matches a collection group rather than a specific\n * collection.\n */\nfunction __PRIVATE_isCollectionGroupQuery(e) {\n return null !== e.collectionGroup;\n}\n\n/**\n * Returns the normalized order-by constraint that is used to execute the Query,\n * which can be different from the order-by constraints the user provided (e.g.\n * the SDK and backend always orders by `__name__`). The normalized order-by\n * includes implicit order-bys in addition to the explicit user provided\n * order-bys.\n */ function __PRIVATE_queryNormalizedOrderBy(e) {\n const t = __PRIVATE_debugCast(e);\n if (null === t.Te) {\n t.Te = [];\n const e = new Set;\n // Any explicit order by fields should be added as is.\n for (const n of t.explicitOrderBy) t.Te.push(n), e.add(n.field.canonicalString());\n // The order of the implicit ordering always matches the last explicit order by.\n const n = t.explicitOrderBy.length > 0 ? t.explicitOrderBy[t.explicitOrderBy.length - 1].dir : \"asc\" /* Direction.ASCENDING */ , r = function __PRIVATE_getInequalityFilterFields(e) {\n let t = new SortedSet(FieldPath$1.comparator);\n return e.filters.forEach((e => {\n e.getFlattenedFilters().forEach((e => {\n e.isInequality() && (t = t.add(e.field));\n }));\n })), t;\n }\n /**\n * Creates a new Query for a collection group query that matches all documents\n * within the provided collection group.\n */ (t);\n // Any inequality fields not explicitly ordered should be implicitly ordered in a lexicographical\n // order. When there are multiple inequality filters on the same field, the field should be added\n // only once.\n // Note: `SortedSet<FieldPath>` sorts the key field before other fields. However, we want the key\n // field to be sorted last.\n r.forEach((r => {\n e.has(r.canonicalString()) || r.isKeyField() || t.Te.push(new OrderBy(r, n));\n })), \n // Add the document key field to the last if it is not explicitly ordered.\n e.has(FieldPath$1.keyField().canonicalString()) || t.Te.push(new OrderBy(FieldPath$1.keyField(), n));\n }\n return t.Te;\n}\n\n/**\n * Converts this `Query` instance to its corresponding `Target` representation.\n */ function __PRIVATE_queryToTarget(e) {\n const t = __PRIVATE_debugCast(e);\n return t.Ie || (t.Ie = __PRIVATE__queryToTarget(t, __PRIVATE_queryNormalizedOrderBy(e))), \n t.Ie;\n}\n\nfunction __PRIVATE__queryToTarget(e, t) {\n if (\"F\" /* LimitType.First */ === e.limitType) return __PRIVATE_newTarget(e.path, e.collectionGroup, t, e.filters, e.limit, e.startAt, e.endAt);\n {\n // Flip the orderBy directions since we want the last results\n t = t.map((e => {\n const t = \"desc\" /* Direction.DESCENDING */ === e.dir ? \"asc\" /* Direction.ASCENDING */ : \"desc\" /* Direction.DESCENDING */;\n return new OrderBy(e.field, t);\n }));\n // We need to swap the cursors to match the now-flipped query ordering.\n const n = e.endAt ? new Bound(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new Bound(e.startAt.position, e.startAt.inclusive) : null;\n // Now return as a LimitType.First query.\n return __PRIVATE_newTarget(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);\n }\n}\n\nfunction __PRIVATE_queryWithAddedFilter(e, t) {\n const n = e.filters.concat([ t ]);\n return new __PRIVATE_QueryImpl(e.path, e.collectionGroup, e.explicitOrderBy.slice(), n, e.limit, e.limitType, e.startAt, e.endAt);\n}\n\nfunction __PRIVATE_queryWithLimit(e, t, n) {\n return new __PRIVATE_QueryImpl(e.path, e.collectionGroup, e.explicitOrderBy.slice(), e.filters.slice(), t, n, e.startAt, e.endAt);\n}\n\nfunction __PRIVATE_queryEquals(e, t) {\n return __PRIVATE_targetEquals(__PRIVATE_queryToTarget(e), __PRIVATE_queryToTarget(t)) && e.limitType === t.limitType;\n}\n\n// TODO(b/29183165): This is used to get a unique string from a query to, for\n// example, use as a dictionary key, but the implementation is subject to\n// collisions. Make it collision-free.\nfunction __PRIVATE_canonifyQuery(e) {\n return `${__PRIVATE_canonifyTarget(__PRIVATE_queryToTarget(e))}|lt:${e.limitType}`;\n}\n\nfunction __PRIVATE_stringifyQuery(e) {\n return `Query(target=${function __PRIVATE_stringifyTarget(e) {\n let t = e.path.canonicalString();\n return null !== e.collectionGroup && (t += \" collectionGroup=\" + e.collectionGroup), \n e.filters.length > 0 && (t += `, filters: [${e.filters.map((e => __PRIVATE_stringifyFilter(e))).join(\", \")}]`), \n __PRIVATE_isNullOrUndefined(e.limit) || (t += \", limit: \" + e.limit), e.orderBy.length > 0 && (t += `, orderBy: [${e.orderBy.map((e => function __PRIVATE_stringifyOrderBy(e) {\n return `${e.field.canonicalString()} (${e.dir})`;\n }(e))).join(\", \")}]`), e.startAt && (t += \", startAt: \", t += e.startAt.inclusive ? \"b:\" : \"a:\", \n t += e.startAt.position.map((e => canonicalId(e))).join(\",\")), e.endAt && (t += \", endAt: \", \n t += e.endAt.inclusive ? \"a:\" : \"b:\", t += e.endAt.position.map((e => canonicalId(e))).join(\",\")), \n `Target(${t})`;\n }(__PRIVATE_queryToTarget(e))}; limitType=${e.limitType})`;\n}\n\n/** Returns whether `doc` matches the constraints of `query`. */ function __PRIVATE_queryMatches(e, t) {\n return t.isFoundDocument() && function __PRIVATE_queryMatchesPathAndCollectionGroup(e, t) {\n const n = t.key.path;\n return null !== e.collectionGroup ? t.key.hasCollectionId(e.collectionGroup) && e.path.isPrefixOf(n) : DocumentKey.isDocumentKey(e.path) ? e.path.isEqual(n) : e.path.isImmediateParentOf(n);\n }\n /**\n * A document must have a value for every ordering clause in order to show up\n * in the results.\n */ (e, t) && function __PRIVATE_queryMatchesOrderBy(e, t) {\n // We must use `queryNormalizedOrderBy()` to get the list of all orderBys (both implicit and explicit).\n // Note that for OR queries, orderBy applies to all disjunction terms and implicit orderBys must\n // be taken into account. For example, the query \"a > 1 || b==1\" has an implicit \"orderBy a\" due\n // to the inequality, and is evaluated as \"a > 1 orderBy a || b==1 orderBy a\".\n // A document with content of {b:1} matches the filters, but does not match the orderBy because\n // it's missing the field 'a'.\n for (const n of __PRIVATE_queryNormalizedOrderBy(e)) \n // order-by key always matches\n if (!n.field.isKeyField() && null === t.data.field(n.field)) return false;\n return true;\n }(e, t) && function __PRIVATE_queryMatchesFilters(e, t) {\n for (const n of e.filters) if (!n.matches(t)) return false;\n return true;\n }\n /** Makes sure a document is within the bounds, if provided. */ (e, t) && function __PRIVATE_queryMatchesBounds(e, t) {\n if (e.startAt && !\n /**\n * Returns true if a document sorts before a bound using the provided sort\n * order.\n */\n function __PRIVATE_boundSortsBeforeDocument(e, t, n) {\n const r = __PRIVATE_boundCompareToDocument(e, t, n);\n return e.inclusive ? r <= 0 : r < 0;\n }(e.startAt, __PRIVATE_queryNormalizedOrderBy(e), t)) return false;\n if (e.endAt && !function __PRIVATE_boundSortsAfterDocument(e, t, n) {\n const r = __PRIVATE_boundCompareToDocument(e, t, n);\n return e.inclusive ? r >= 0 : r > 0;\n }(e.endAt, __PRIVATE_queryNormalizedOrderBy(e), t)) return false;\n return true;\n }\n /**\n * Returns the collection group that this query targets.\n *\n * PORTING NOTE: This is only used in the Web SDK to facilitate multi-tab\n * synchronization for query results.\n */ (e, t);\n}\n\nfunction __PRIVATE_queryCollectionGroup(e) {\n return e.collectionGroup || (e.path.length % 2 == 1 ? e.path.lastSegment() : e.path.get(e.path.length - 2));\n}\n\n/**\n * Returns a new comparator function that can be used to compare two documents\n * based on the Query's ordering constraint.\n */ function __PRIVATE_newQueryComparator(e) {\n return (t, n) => {\n let r = false;\n for (const i of __PRIVATE_queryNormalizedOrderBy(e)) {\n const e = __PRIVATE_compareDocs(i, t, n);\n if (0 !== e) return e;\n r = r || i.field.isKeyField();\n }\n return 0;\n };\n}\n\nfunction __PRIVATE_compareDocs(e, t, n) {\n const r = e.field.isKeyField() ? DocumentKey.comparator(t.key, n.key) : function __PRIVATE_compareDocumentsByField(e, t, n) {\n const r = t.data.field(e), i = n.data.field(e);\n return null !== r && null !== i ? __PRIVATE_valueCompare(r, i) : fail(42886);\n }(e.field, t, n);\n switch (e.dir) {\n case \"asc\" /* Direction.ASCENDING */ :\n return r;\n\n case \"desc\" /* Direction.DESCENDING */ :\n return -1 * r;\n\n default:\n return fail(19790, {\n direction: e.dir\n });\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A map implementation that uses objects as keys. Objects must have an\n * associated equals function and must be immutable. Entries in the map are\n * stored together with the key being produced from the mapKeyFn. This map\n * automatically handles collisions of keys.\n */ class ObjectMap {\n constructor(e, t) {\n this.mapKeyFn = e, this.equalsFn = t, \n /**\n * The inner map for a key/value pair. Due to the possibility of collisions we\n * keep a list of entries that we do a linear search through to find an actual\n * match. Note that collisions should be rare, so we still expect near\n * constant time lookups in practice.\n */\n this.inner = {}, \n /** The number of entries stored in the map */\n this.innerSize = 0;\n }\n /** Get a value for this key, or undefined if it does not exist. */ get(e) {\n const t = this.mapKeyFn(e), n = this.inner[t];\n if (void 0 !== n) for (const [t, r] of n) if (this.equalsFn(t, e)) return r;\n }\n has(e) {\n return void 0 !== this.get(e);\n }\n /** Put this key and value in the map. */ set(e, t) {\n const n = this.mapKeyFn(e), r = this.inner[n];\n if (void 0 === r) return this.inner[n] = [ [ e, t ] ], void this.innerSize++;\n for (let n = 0; n < r.length; n++) if (this.equalsFn(r[n][0], e)) \n // This is updating an existing entry and does not increase `innerSize`.\n return void (r[n] = [ e, t ]);\n r.push([ e, t ]), this.innerSize++;\n }\n /**\n * Remove this key from the map. Returns a boolean if anything was deleted.\n */ delete(e) {\n const t = this.mapKeyFn(e), n = this.inner[t];\n if (void 0 === n) return false;\n for (let r = 0; r < n.length; r++) if (this.equalsFn(n[r][0], e)) return 1 === n.length ? delete this.inner[t] : n.splice(r, 1), \n this.innerSize--, true;\n return false;\n }\n forEach(e) {\n forEach(this.inner, ((t, n) => {\n for (const [t, r] of n) e(t, r);\n }));\n }\n isEmpty() {\n return isEmpty(this.inner);\n }\n size() {\n return this.innerSize;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Et = new SortedMap(DocumentKey.comparator);\n\nfunction __PRIVATE_mutableDocumentMap() {\n return Et;\n}\n\nconst At = new SortedMap(DocumentKey.comparator);\n\nfunction documentMap(...e) {\n let t = At;\n for (const n of e) t = t.insert(n.key, n);\n return t;\n}\n\nfunction __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e) {\n let t = At;\n return e.forEach(((e, n) => t = t.insert(e, n.overlayedDocument))), t;\n}\n\nfunction __PRIVATE_newOverlayMap() {\n return __PRIVATE_newDocumentKeyMap();\n}\n\nfunction __PRIVATE_newMutationMap() {\n return __PRIVATE_newDocumentKeyMap();\n}\n\nfunction __PRIVATE_newDocumentKeyMap() {\n return new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t)));\n}\n\nconst Rt = new SortedMap(DocumentKey.comparator);\n\nconst Vt = new SortedSet(DocumentKey.comparator);\n\nfunction __PRIVATE_documentKeySet(...e) {\n let t = Vt;\n for (const n of e) t = t.add(n);\n return t;\n}\n\nconst mt = new SortedSet(__PRIVATE_primitiveComparator);\n\nfunction __PRIVATE_targetIdSet() {\n return mt;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Returns an DoubleValue for `value` that is encoded based the serializer's\n * `useProto3Json` setting.\n */ function __PRIVATE_toDouble(e, t) {\n if (e.useProto3Json) {\n if (isNaN(t)) return {\n doubleValue: \"NaN\"\n };\n if (t === 1 / 0) return {\n doubleValue: \"Infinity\"\n };\n if (t === -1 / 0) return {\n doubleValue: \"-Infinity\"\n };\n }\n return {\n doubleValue: __PRIVATE_isNegativeZero(t) ? \"-0\" : t\n };\n}\n\n/**\n * Returns an IntegerValue for `value`.\n */ function __PRIVATE_toInteger(e) {\n return {\n integerValue: \"\" + e\n };\n}\n\n/**\n * Returns a value for a number that's appropriate to put into a proto.\n * The return value is an IntegerValue if it can safely represent the value,\n * otherwise a DoubleValue is returned.\n */ function toNumber(e, t) {\n return isSafeInteger(t) ? __PRIVATE_toInteger(t) : __PRIVATE_toDouble(e, t);\n}\n\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Used to represent a field transform on a mutation. */ class TransformOperation {\n constructor() {\n // Make sure that the structural type of `TransformOperation` is unique.\n // See https://github.com/microsoft/TypeScript/issues/5451\n this._ = void 0;\n }\n}\n\n/**\n * Computes the local transform result against the provided `previousValue`,\n * optionally using the provided localWriteTime.\n */ function __PRIVATE_applyTransformOperationToLocalView(e, t, n) {\n return e instanceof __PRIVATE_ServerTimestampTransform ? function serverTimestamp$1(e, t) {\n const n = {\n fields: {\n [ot]: {\n stringValue: st\n },\n [at]: {\n timestampValue: {\n seconds: e.seconds,\n nanos: e.nanoseconds\n }\n }\n }\n };\n // We should avoid storing deeply nested server timestamp map values\n // because we never use the intermediate \"previous values\".\n // For example:\n // previous: 42L, add: t1, result: t1 -> 42L\n // previous: t1, add: t2, result: t2 -> 42L (NOT t2 -> t1 -> 42L)\n // previous: t2, add: t3, result: t3 -> 42L (NOT t3 -> t2 -> t1 -> 42L)\n // `getPreviousValue` recursively traverses server timestamps to find the\n // least recent Value.\n return t && __PRIVATE_isServerTimestamp(t) && (t = __PRIVATE_getPreviousValue(t)), \n t && (n.fields[_t] = t), {\n mapValue: n\n };\n }(n, t) : e instanceof __PRIVATE_ArrayUnionTransformOperation ? __PRIVATE_applyArrayUnionTransformOperation(e, t) : e instanceof __PRIVATE_ArrayRemoveTransformOperation ? __PRIVATE_applyArrayRemoveTransformOperation(e, t) : function __PRIVATE_applyNumericIncrementTransformOperationToLocalView(e, t) {\n // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit\n // precision and resolves overflows by reducing precision, we do not\n // manually cap overflows at 2^63.\n const n = __PRIVATE_computeTransformOperationBaseValue(e, t), r = asNumber(n) + asNumber(e.Ee);\n return isInteger(n) && isInteger(e.Ee) ? __PRIVATE_toInteger(r) : __PRIVATE_toDouble(e.serializer, r);\n }(e, t);\n}\n\n/**\n * Computes a final transform result after the transform has been acknowledged\n * by the server, potentially using the server-provided transformResult.\n */ function __PRIVATE_applyTransformOperationToRemoteDocument(e, t, n) {\n // The server just sends null as the transform result for array operations,\n // so we have to calculate a result the same as we do for local\n // applications.\n return e instanceof __PRIVATE_ArrayUnionTransformOperation ? __PRIVATE_applyArrayUnionTransformOperation(e, t) : e instanceof __PRIVATE_ArrayRemoveTransformOperation ? __PRIVATE_applyArrayRemoveTransformOperation(e, t) : n;\n}\n\n/**\n * If this transform operation is not idempotent, returns the base value to\n * persist for this transform. If a base value is returned, the transform\n * operation is always applied to this base value, even if document has\n * already been updated.\n *\n * Base values provide consistent behavior for non-idempotent transforms and\n * allow us to return the same latency-compensated value even if the backend\n * has already applied the transform operation. The base value is null for\n * idempotent transforms, as they can be re-played even if the backend has\n * already applied them.\n *\n * @returns a base value to store along with the mutation, or null for\n * idempotent transforms.\n */ function __PRIVATE_computeTransformOperationBaseValue(e, t) {\n return e instanceof __PRIVATE_NumericIncrementTransformOperation ? \n /** Returns true if `value` is either an IntegerValue or a DoubleValue. */\n function __PRIVATE_isNumber(e) {\n return isInteger(e) || function __PRIVATE_isDouble(e) {\n return !!e && \"doubleValue\" in e;\n }(e);\n }(t) ? t : {\n integerValue: 0\n } : null;\n}\n\n/** Transforms a value into a server-generated timestamp. */\nclass __PRIVATE_ServerTimestampTransform extends TransformOperation {}\n\n/** Transforms an array value via a union operation. */ class __PRIVATE_ArrayUnionTransformOperation extends TransformOperation {\n constructor(e) {\n super(), this.elements = e;\n }\n}\n\nfunction __PRIVATE_applyArrayUnionTransformOperation(e, t) {\n const n = __PRIVATE_coercedFieldValuesArray(t);\n for (const t of e.elements) n.some((e => __PRIVATE_valueEquals(e, t))) || n.push(t);\n return {\n arrayValue: {\n values: n\n }\n };\n}\n\n/** Transforms an array value via a remove operation. */ class __PRIVATE_ArrayRemoveTransformOperation extends TransformOperation {\n constructor(e) {\n super(), this.elements = e;\n }\n}\n\nfunction __PRIVATE_applyArrayRemoveTransformOperation(e, t) {\n let n = __PRIVATE_coercedFieldValuesArray(t);\n for (const t of e.elements) n = n.filter((e => !__PRIVATE_valueEquals(e, t)));\n return {\n arrayValue: {\n values: n\n }\n };\n}\n\n/**\n * Implements the backend semantics for locally computed NUMERIC_ADD (increment)\n * transforms. Converts all field values to integers or doubles, but unlike the\n * backend does not cap integer values at 2^63. Instead, JavaScript number\n * arithmetic is used and precision loss can occur for values greater than 2^53.\n */ class __PRIVATE_NumericIncrementTransformOperation extends TransformOperation {\n constructor(e, t) {\n super(), this.serializer = e, this.Ee = t;\n }\n}\n\nfunction asNumber(e) {\n return __PRIVATE_normalizeNumber(e.integerValue || e.doubleValue);\n}\n\nfunction __PRIVATE_coercedFieldValuesArray(e) {\n return isArray(e) && e.arrayValue.values ? e.arrayValue.values.slice() : [];\n}\n\nfunction __PRIVATE_fieldTransformEquals(e, t) {\n return e.field.isEqual(t.field) && function __PRIVATE_transformOperationEquals(e, t) {\n return e instanceof __PRIVATE_ArrayUnionTransformOperation && t instanceof __PRIVATE_ArrayUnionTransformOperation || e instanceof __PRIVATE_ArrayRemoveTransformOperation && t instanceof __PRIVATE_ArrayRemoveTransformOperation ? __PRIVATE_arrayEquals(e.elements, t.elements, __PRIVATE_valueEquals) : e instanceof __PRIVATE_NumericIncrementTransformOperation && t instanceof __PRIVATE_NumericIncrementTransformOperation ? __PRIVATE_valueEquals(e.Ee, t.Ee) : e instanceof __PRIVATE_ServerTimestampTransform && t instanceof __PRIVATE_ServerTimestampTransform;\n }(e.transform, t.transform);\n}\n\n/** The result of successfully applying a mutation to the backend. */\nclass MutationResult {\n constructor(\n /**\n * The version at which the mutation was committed:\n *\n * - For most operations, this is the updateTime in the WriteResult.\n * - For deletes, the commitTime of the WriteResponse (because deletes are\n * not stored and have no updateTime).\n *\n * Note that these versions can be different: No-op writes will not change\n * the updateTime even though the commitTime advances.\n */\n e, \n /**\n * The resulting fields returned from the backend after a mutation\n * containing field transforms has been committed. Contains one FieldValue\n * for each FieldTransform that was in the mutation.\n *\n * Will be empty if the mutation did not contain any field transforms.\n */\n t) {\n this.version = e, this.transformResults = t;\n }\n}\n\n/**\n * Encodes a precondition for a mutation. This follows the model that the\n * backend accepts with the special case of an explicit \"empty\" precondition\n * (meaning no precondition).\n */ class Precondition {\n constructor(e, t) {\n this.updateTime = e, this.exists = t;\n }\n /** Creates a new empty Precondition. */ static none() {\n return new Precondition;\n }\n /** Creates a new Precondition with an exists flag. */ static exists(e) {\n return new Precondition(void 0, e);\n }\n /** Creates a new Precondition based on a version a document exists at. */ static updateTime(e) {\n return new Precondition(e);\n }\n /** Returns whether this Precondition is empty. */ get isNone() {\n return void 0 === this.updateTime && void 0 === this.exists;\n }\n isEqual(e) {\n return this.exists === e.exists && (this.updateTime ? !!e.updateTime && this.updateTime.isEqual(e.updateTime) : !e.updateTime);\n }\n}\n\n/** Returns true if the preconditions is valid for the given document. */ function __PRIVATE_preconditionIsValidForDocument(e, t) {\n return void 0 !== e.updateTime ? t.isFoundDocument() && t.version.isEqual(e.updateTime) : void 0 === e.exists || e.exists === t.isFoundDocument();\n}\n\n/**\n * A mutation describes a self-contained change to a document. Mutations can\n * create, replace, delete, and update subsets of documents.\n *\n * Mutations not only act on the value of the document but also its version.\n *\n * For local mutations (mutations that haven't been committed yet), we preserve\n * the existing version for Set and Patch mutations. For Delete mutations, we\n * reset the version to 0.\n *\n * Here's the expected transition table.\n *\n * MUTATION APPLIED TO RESULTS IN\n *\n * SetMutation Document(v3) Document(v3)\n * SetMutation NoDocument(v3) Document(v0)\n * SetMutation InvalidDocument(v0) Document(v0)\n * PatchMutation Document(v3) Document(v3)\n * PatchMutation NoDocument(v3) NoDocument(v3)\n * PatchMutation InvalidDocument(v0) UnknownDocument(v3)\n * DeleteMutation Document(v3) NoDocument(v0)\n * DeleteMutation NoDocument(v3) NoDocument(v0)\n * DeleteMutation InvalidDocument(v0) NoDocument(v0)\n *\n * For acknowledged mutations, we use the updateTime of the WriteResponse as\n * the resulting version for Set and Patch mutations. As deletes have no\n * explicit update time, we use the commitTime of the WriteResponse for\n * Delete mutations.\n *\n * If a mutation is acknowledged by the backend but fails the precondition check\n * locally, we transition to an `UnknownDocument` and rely on Watch to send us\n * the updated version.\n *\n * Field transforms are used only with Patch and Set Mutations. We use the\n * `updateTransforms` message to store transforms, rather than the `transforms`s\n * messages.\n *\n * ## Subclassing Notes\n *\n * Every type of mutation needs to implement its own applyToRemoteDocument() and\n * applyToLocalView() to implement the actual behavior of applying the mutation\n * to some source document (see `setMutationApplyToRemoteDocument()` for an\n * example).\n */ class Mutation {}\n\n/**\n * A utility method to calculate a `Mutation` representing the overlay from the\n * final state of the document, and a `FieldMask` representing the fields that\n * are mutated by the local mutations.\n */ function __PRIVATE_calculateOverlayMutation(e, t) {\n if (!e.hasLocalMutations || t && 0 === t.fields.length) return null;\n // mask is null when sets or deletes are applied to the current document.\n if (null === t) return e.isNoDocument() ? new __PRIVATE_DeleteMutation(e.key, Precondition.none()) : new __PRIVATE_SetMutation(e.key, e.data, Precondition.none());\n {\n const n = e.data, r = ObjectValue.empty();\n let i = new SortedSet(FieldPath$1.comparator);\n for (let e of t.fields) if (!i.has(e)) {\n let t = n.field(e);\n // If we are deleting a nested field, we take the immediate parent as\n // the mask used to construct the resulting mutation.\n // Justification: Nested fields can create parent fields implicitly. If\n // only a leaf entry is deleted in later mutations, the parent field\n // should still remain, but we may have lost this information.\n // Consider mutation (foo.bar 1), then mutation (foo.bar delete()).\n // This leaves the final result (foo, {}). Despite the fact that `doc`\n // has the correct result, `foo` is not in `mask`, and the resulting\n // mutation would miss `foo`.\n null === t && e.length > 1 && (e = e.popLast(), t = n.field(e)), null === t ? r.delete(e) : r.set(e, t), \n i = i.add(e);\n }\n return new __PRIVATE_PatchMutation(e.key, r, new FieldMask(i.toArray()), Precondition.none());\n }\n}\n\n/**\n * Applies this mutation to the given document for the purposes of computing a\n * new remote document. If the input document doesn't match the expected state\n * (e.g. it is invalid or outdated), the document type may transition to\n * unknown.\n *\n * @param mutation - The mutation to apply.\n * @param document - The document to mutate. The input document can be an\n * invalid document if the client has no knowledge of the pre-mutation state\n * of the document.\n * @param mutationResult - The result of applying the mutation from the backend.\n */ function __PRIVATE_mutationApplyToRemoteDocument(e, t, n) {\n e instanceof __PRIVATE_SetMutation ? function __PRIVATE_setMutationApplyToRemoteDocument(e, t, n) {\n // Unlike setMutationApplyToLocalView, if we're applying a mutation to a\n // remote document the server has accepted the mutation so the precondition\n // must have held.\n const r = e.value.clone(), i = __PRIVATE_serverTransformResults(e.fieldTransforms, t, n.transformResults);\n r.setAll(i), t.convertToFoundDocument(n.version, r).setHasCommittedMutations();\n }(e, t, n) : e instanceof __PRIVATE_PatchMutation ? function __PRIVATE_patchMutationApplyToRemoteDocument(e, t, n) {\n if (!__PRIVATE_preconditionIsValidForDocument(e.precondition, t)) \n // Since the mutation was not rejected, we know that the precondition\n // matched on the backend. We therefore must not have the expected version\n // of the document in our cache and convert to an UnknownDocument with a\n // known updateTime.\n return void t.convertToUnknownDocument(n.version);\n const r = __PRIVATE_serverTransformResults(e.fieldTransforms, t, n.transformResults), i = t.data;\n i.setAll(__PRIVATE_getPatch(e)), i.setAll(r), t.convertToFoundDocument(n.version, i).setHasCommittedMutations();\n }(e, t, n) : function __PRIVATE_deleteMutationApplyToRemoteDocument(e, t, n) {\n // Unlike applyToLocalView, if we're applying a mutation to a remote\n // document the server has accepted the mutation so the precondition must\n // have held.\n t.convertToNoDocument(n.version).setHasCommittedMutations();\n }(0, t, n);\n}\n\n/**\n * Applies this mutation to the given document for the purposes of computing\n * the new local view of a document. If the input document doesn't match the\n * expected state, the document is not modified.\n *\n * @param mutation - The mutation to apply.\n * @param document - The document to mutate. The input document can be an\n * invalid document if the client has no knowledge of the pre-mutation state\n * of the document.\n * @param previousMask - The fields that have been updated before applying this mutation.\n * @param localWriteTime - A timestamp indicating the local write time of the\n * batch this mutation is a part of.\n * @returns A `FieldMask` representing the fields that are changed by applying this mutation.\n */ function __PRIVATE_mutationApplyToLocalView(e, t, n, r) {\n return e instanceof __PRIVATE_SetMutation ? function __PRIVATE_setMutationApplyToLocalView(e, t, n, r) {\n if (!__PRIVATE_preconditionIsValidForDocument(e.precondition, t)) \n // The mutation failed to apply (e.g. a document ID created with add()\n // caused a name collision).\n return n;\n const i = e.value.clone(), s = __PRIVATE_localTransformResults(e.fieldTransforms, r, t);\n return i.setAll(s), t.convertToFoundDocument(t.version, i).setHasLocalMutations(), \n null;\n // SetMutation overwrites all fields.\n }\n /**\n * A mutation that modifies fields of the document at the given key with the\n * given values. The values are applied through a field mask:\n *\n * * When a field is in both the mask and the values, the corresponding field\n * is updated.\n * * When a field is in neither the mask nor the values, the corresponding\n * field is unmodified.\n * * When a field is in the mask but not in the values, the corresponding field\n * is deleted.\n * * When a field is not in the mask but is in the values, the values map is\n * ignored.\n */ (e, t, n, r) : e instanceof __PRIVATE_PatchMutation ? function __PRIVATE_patchMutationApplyToLocalView(e, t, n, r) {\n if (!__PRIVATE_preconditionIsValidForDocument(e.precondition, t)) return n;\n const i = __PRIVATE_localTransformResults(e.fieldTransforms, r, t), s = t.data;\n if (s.setAll(__PRIVATE_getPatch(e)), s.setAll(i), t.convertToFoundDocument(t.version, s).setHasLocalMutations(), \n null === n) return null;\n return n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e => e.field)));\n }\n /**\n * Returns a FieldPath/Value map with the content of the PatchMutation.\n */ (e, t, n, r) : function __PRIVATE_deleteMutationApplyToLocalView(e, t, n) {\n if (__PRIVATE_preconditionIsValidForDocument(e.precondition, t)) return t.convertToNoDocument(t.version).setHasLocalMutations(), \n null;\n return n;\n }\n /**\n * A mutation that verifies the existence of the document at the given key with\n * the provided precondition.\n *\n * The `verify` operation is only used in Transactions, and this class serves\n * primarily to facilitate serialization into protos.\n */ (e, t, n);\n}\n\n/**\n * If this mutation is not idempotent, returns the base value to persist with\n * this mutation. If a base value is returned, the mutation is always applied\n * to this base value, even if document has already been updated.\n *\n * The base value is a sparse object that consists of only the document\n * fields for which this mutation contains a non-idempotent transformation\n * (e.g. a numeric increment). The provided value guarantees consistent\n * behavior for non-idempotent transforms and allow us to return the same\n * latency-compensated value even if the backend has already applied the\n * mutation. The base value is null for idempotent mutations, as they can be\n * re-played even if the backend has already applied them.\n *\n * @returns a base value to store along with the mutation, or null for\n * idempotent mutations.\n */ function __PRIVATE_mutationExtractBaseValue(e, t) {\n let n = null;\n for (const r of e.fieldTransforms) {\n const e = t.data.field(r.field), i = __PRIVATE_computeTransformOperationBaseValue(r.transform, e || null);\n null != i && (null === n && (n = ObjectValue.empty()), n.set(r.field, i));\n }\n return n || null;\n}\n\nfunction __PRIVATE_mutationEquals(e, t) {\n return e.type === t.type && (!!e.key.isEqual(t.key) && (!!e.precondition.isEqual(t.precondition) && (!!function __PRIVATE_fieldTransformsAreEqual(e, t) {\n return void 0 === e && void 0 === t || !(!e || !t) && __PRIVATE_arrayEquals(e, t, ((e, t) => __PRIVATE_fieldTransformEquals(e, t)));\n }(e.fieldTransforms, t.fieldTransforms) && (0 /* MutationType.Set */ === e.type ? e.value.isEqual(t.value) : 1 /* MutationType.Patch */ !== e.type || e.data.isEqual(t.data) && e.fieldMask.isEqual(t.fieldMask)))));\n}\n\n/**\n * A mutation that creates or replaces the document at the given key with the\n * object value contents.\n */ class __PRIVATE_SetMutation extends Mutation {\n constructor(e, t, n, r = []) {\n super(), this.key = e, this.value = t, this.precondition = n, this.fieldTransforms = r, \n this.type = 0 /* MutationType.Set */;\n }\n getFieldMask() {\n return null;\n }\n}\n\nclass __PRIVATE_PatchMutation extends Mutation {\n constructor(e, t, n, r, i = []) {\n super(), this.key = e, this.data = t, this.fieldMask = n, this.precondition = r, \n this.fieldTransforms = i, this.type = 1 /* MutationType.Patch */;\n }\n getFieldMask() {\n return this.fieldMask;\n }\n}\n\nfunction __PRIVATE_getPatch(e) {\n const t = new Map;\n return e.fieldMask.fields.forEach((n => {\n if (!n.isEmpty()) {\n const r = e.data.field(n);\n t.set(n, r);\n }\n })), t;\n}\n\n/**\n * Creates a list of \"transform results\" (a transform result is a field value\n * representing the result of applying a transform) for use after a mutation\n * containing transforms has been acknowledged by the server.\n *\n * @param fieldTransforms - The field transforms to apply the result to.\n * @param mutableDocument - The current state of the document after applying all\n * previous mutations.\n * @param serverTransformResults - The transform results received by the server.\n * @returns The transform results list.\n */ function __PRIVATE_serverTransformResults(e, t, n) {\n const r = new Map;\n __PRIVATE_hardAssert(e.length === n.length, 32656, {\n Ae: n.length,\n Re: e.length\n });\n for (let i = 0; i < n.length; i++) {\n const s = e[i], o = s.transform, _ = t.data.field(s.field);\n r.set(s.field, __PRIVATE_applyTransformOperationToRemoteDocument(o, _, n[i]));\n }\n return r;\n}\n\n/**\n * Creates a list of \"transform results\" (a transform result is a field value\n * representing the result of applying a transform) for use when applying a\n * transform locally.\n *\n * @param fieldTransforms - The field transforms to apply the result to.\n * @param localWriteTime - The local time of the mutation (used to\n * generate ServerTimestampValues).\n * @param mutableDocument - The document to apply transforms on.\n * @returns The transform results list.\n */ function __PRIVATE_localTransformResults(e, t, n) {\n const r = new Map;\n for (const i of e) {\n const e = i.transform, s = n.data.field(i.field);\n r.set(i.field, __PRIVATE_applyTransformOperationToLocalView(e, s, t));\n }\n return r;\n}\n\n/** A mutation that deletes the document at the given key. */ class __PRIVATE_DeleteMutation extends Mutation {\n constructor(e, t) {\n super(), this.key = e, this.precondition = t, this.type = 2 /* MutationType.Delete */ , \n this.fieldTransforms = [];\n }\n getFieldMask() {\n return null;\n }\n}\n\nclass __PRIVATE_VerifyMutation extends Mutation {\n constructor(e, t) {\n super(), this.key = e, this.precondition = t, this.type = 3 /* MutationType.Verify */ , \n this.fieldTransforms = [];\n }\n getFieldMask() {\n return null;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A batch of mutations that will be sent as one unit to the backend.\n */ class MutationBatch {\n /**\n * @param batchId - The unique ID of this mutation batch.\n * @param localWriteTime - The original write time of this mutation.\n * @param baseMutations - Mutations that are used to populate the base\n * values when this mutation is applied locally. This can be used to locally\n * overwrite values that are persisted in the remote document cache. Base\n * mutations are never sent to the backend.\n * @param mutations - The user-provided mutations in this mutation batch.\n * User-provided mutations are applied both locally and remotely on the\n * backend.\n */\n constructor(e, t, n, r) {\n this.batchId = e, this.localWriteTime = t, this.baseMutations = n, this.mutations = r;\n }\n /**\n * Applies all the mutations in this MutationBatch to the specified document\n * to compute the state of the remote document\n *\n * @param document - The document to apply mutations to.\n * @param batchResult - The result of applying the MutationBatch to the\n * backend.\n */ applyToRemoteDocument(e, t) {\n const n = t.mutationResults;\n for (let t = 0; t < this.mutations.length; t++) {\n const r = this.mutations[t];\n if (r.key.isEqual(e.key)) {\n __PRIVATE_mutationApplyToRemoteDocument(r, e, n[t]);\n }\n }\n }\n /**\n * Computes the local view of a document given all the mutations in this\n * batch.\n *\n * @param document - The document to apply mutations to.\n * @param mutatedFields - Fields that have been updated before applying this mutation batch.\n * @returns A `FieldMask` representing all the fields that are mutated.\n */ applyToLocalView(e, t) {\n // First, apply the base state. This allows us to apply non-idempotent\n // transform against a consistent set of values.\n for (const n of this.baseMutations) n.key.isEqual(e.key) && (t = __PRIVATE_mutationApplyToLocalView(n, e, t, this.localWriteTime));\n // Second, apply all user-provided mutations.\n for (const n of this.mutations) n.key.isEqual(e.key) && (t = __PRIVATE_mutationApplyToLocalView(n, e, t, this.localWriteTime));\n return t;\n }\n /**\n * Computes the local view for all provided documents given the mutations in\n * this batch. Returns a `DocumentKey` to `Mutation` map which can be used to\n * replace all the mutation applications.\n */ applyToLocalDocumentSet(e, t) {\n // TODO(mrschmidt): This implementation is O(n^2). If we apply the mutations\n // directly (as done in `applyToLocalView()`), we can reduce the complexity\n // to O(n).\n const n = __PRIVATE_newMutationMap();\n return this.mutations.forEach((r => {\n const i = e.get(r.key), s = i.overlayedDocument;\n // TODO(mutabledocuments): This method should take a MutableDocumentMap\n // and we should remove this cast.\n let o = this.applyToLocalView(s, i.mutatedFields);\n // Set mutatedFields to null if the document is only from local mutations.\n // This creates a Set or Delete mutation, instead of trying to create a\n // patch mutation as the overlay.\n o = t.has(r.key) ? null : o;\n const _ = __PRIVATE_calculateOverlayMutation(s, o);\n null !== _ && n.set(r.key, _), s.isValidDocument() || s.convertToNoDocument(SnapshotVersion.min());\n })), n;\n }\n keys() {\n return this.mutations.reduce(((e, t) => e.add(t.key)), __PRIVATE_documentKeySet());\n }\n isEqual(e) {\n return this.batchId === e.batchId && __PRIVATE_arrayEquals(this.mutations, e.mutations, ((e, t) => __PRIVATE_mutationEquals(e, t))) && __PRIVATE_arrayEquals(this.baseMutations, e.baseMutations, ((e, t) => __PRIVATE_mutationEquals(e, t)));\n }\n}\n\n/** The result of applying a mutation batch to the backend. */ class MutationBatchResult {\n constructor(e, t, n, \n /**\n * A pre-computed mapping from each mutated document to the resulting\n * version.\n */\n r) {\n this.batch = e, this.commitVersion = t, this.mutationResults = n, this.docVersions = r;\n }\n /**\n * Creates a new MutationBatchResult for the given batch and results. There\n * must be one result for each mutation in the batch. This static factory\n * caches a document=&gt;version mapping (docVersions).\n */ static from(e, t, n) {\n __PRIVATE_hardAssert(e.mutations.length === n.length, 58842, {\n Ve: e.mutations.length,\n me: n.length\n });\n let r = function __PRIVATE_documentVersionMap() {\n return Rt;\n }();\n const i = e.mutations;\n for (let e = 0; e < i.length; e++) r = r.insert(i[e].key, n[e].version);\n return new MutationBatchResult(e, t, n, r);\n }\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Representation of an overlay computed by Firestore.\n *\n * Holds information about a mutation and the largest batch id in Firestore when\n * the mutation was created.\n */ class Overlay {\n constructor(e, t) {\n this.largestBatchId = e, this.mutation = t;\n }\n getKey() {\n return this.mutation.key;\n }\n isEqual(e) {\n return null !== e && this.mutation === e.mutation;\n }\n toString() {\n return `Overlay{\\n largestBatchId: ${this.largestBatchId},\\n mutation: ${this.mutation.toString()}\\n }`;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class ExistenceFilter {\n constructor(e, t) {\n this.count = e, this.unchangedNames = t;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Error Codes describing the different ways GRPC can fail. These are copied\n * directly from GRPC's sources here:\n *\n * https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h\n *\n * Important! The names of these identifiers matter because the string forms\n * are used for reverse lookups from the webchannel stream. Do NOT change the\n * names of these identifiers or change this into a const enum.\n */ var ft, gt;\n\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a non-write operation.\n *\n * See isPermanentWriteError for classifying write errors.\n */\nfunction __PRIVATE_isPermanentError(e) {\n switch (e) {\n case N.OK:\n return fail(64938);\n\n case N.CANCELLED:\n case N.UNKNOWN:\n case N.DEADLINE_EXCEEDED:\n case N.RESOURCE_EXHAUSTED:\n case N.INTERNAL:\n case N.UNAVAILABLE:\n // Unauthenticated means something went wrong with our token and we need\n // to retry with new credentials which will happen automatically.\n case N.UNAUTHENTICATED:\n return false;\n\n case N.INVALID_ARGUMENT:\n case N.NOT_FOUND:\n case N.ALREADY_EXISTS:\n case N.PERMISSION_DENIED:\n case N.FAILED_PRECONDITION:\n // Aborted might be retried in some scenarios, but that is dependent on\n // the context and should handled individually by the calling code.\n // See https://cloud.google.com/apis/design/errors.\n case N.ABORTED:\n case N.OUT_OF_RANGE:\n case N.UNIMPLEMENTED:\n case N.DATA_LOSS:\n return true;\n\n default:\n return fail(15467, {\n code: e\n });\n }\n}\n\n/**\n * Determines whether an error code represents a permanent error when received\n * in response to a write operation.\n *\n * Write operations must be handled specially because as of b/119437764, ABORTED\n * errors on the write stream should be retried too (even though ABORTED errors\n * are not generally retryable).\n *\n * Note that during the initial handshake on the write stream an ABORTED error\n * signals that we should discard our stream token (i.e. it is permanent). This\n * means a handshake error should be classified with isPermanentError, above.\n */\n/**\n * Maps an error Code from GRPC status code number, like 0, 1, or 14. These\n * are not the same as HTTP status codes.\n *\n * @returns The Code equivalent to the given GRPC status code. Fails if there\n * is no match.\n */\nfunction __PRIVATE_mapCodeFromRpcCode(e) {\n if (void 0 === e) \n // This shouldn't normally happen, but in certain error cases (like trying\n // to send invalid proto messages) we may get an error with no GRPC code.\n return __PRIVATE_logError(\"GRPC error has no .code\"), N.UNKNOWN;\n switch (e) {\n case ft.OK:\n return N.OK;\n\n case ft.CANCELLED:\n return N.CANCELLED;\n\n case ft.UNKNOWN:\n return N.UNKNOWN;\n\n case ft.DEADLINE_EXCEEDED:\n return N.DEADLINE_EXCEEDED;\n\n case ft.RESOURCE_EXHAUSTED:\n return N.RESOURCE_EXHAUSTED;\n\n case ft.INTERNAL:\n return N.INTERNAL;\n\n case ft.UNAVAILABLE:\n return N.UNAVAILABLE;\n\n case ft.UNAUTHENTICATED:\n return N.UNAUTHENTICATED;\n\n case ft.INVALID_ARGUMENT:\n return N.INVALID_ARGUMENT;\n\n case ft.NOT_FOUND:\n return N.NOT_FOUND;\n\n case ft.ALREADY_EXISTS:\n return N.ALREADY_EXISTS;\n\n case ft.PERMISSION_DENIED:\n return N.PERMISSION_DENIED;\n\n case ft.FAILED_PRECONDITION:\n return N.FAILED_PRECONDITION;\n\n case ft.ABORTED:\n return N.ABORTED;\n\n case ft.OUT_OF_RANGE:\n return N.OUT_OF_RANGE;\n\n case ft.UNIMPLEMENTED:\n return N.UNIMPLEMENTED;\n\n case ft.DATA_LOSS:\n return N.DATA_LOSS;\n\n default:\n return fail(39323, {\n code: e\n });\n }\n}\n\n/**\n * Converts an HTTP response's error status to the equivalent error code.\n *\n * @param status - An HTTP error response status (\"FAILED_PRECONDITION\",\n * \"UNKNOWN\", etc.)\n * @returns The equivalent Code. Non-matching responses are mapped to\n * Code.UNKNOWN.\n */ (gt = ft || (ft = {}))[gt.OK = 0] = \"OK\", gt[gt.CANCELLED = 1] = \"CANCELLED\", \ngt[gt.UNKNOWN = 2] = \"UNKNOWN\", gt[gt.INVALID_ARGUMENT = 3] = \"INVALID_ARGUMENT\", \ngt[gt.DEADLINE_EXCEEDED = 4] = \"DEADLINE_EXCEEDED\", gt[gt.NOT_FOUND = 5] = \"NOT_FOUND\", \ngt[gt.ALREADY_EXISTS = 6] = \"ALREADY_EXISTS\", gt[gt.PERMISSION_DENIED = 7] = \"PERMISSION_DENIED\", \ngt[gt.UNAUTHENTICATED = 16] = \"UNAUTHENTICATED\", gt[gt.RESOURCE_EXHAUSTED = 8] = \"RESOURCE_EXHAUSTED\", \ngt[gt.FAILED_PRECONDITION = 9] = \"FAILED_PRECONDITION\", gt[gt.ABORTED = 10] = \"ABORTED\", \ngt[gt.OUT_OF_RANGE = 11] = \"OUT_OF_RANGE\", gt[gt.UNIMPLEMENTED = 12] = \"UNIMPLEMENTED\", \ngt[gt.INTERNAL = 13] = \"INTERNAL\", gt[gt.UNAVAILABLE = 14] = \"UNAVAILABLE\", gt[gt.DATA_LOSS = 15] = \"DATA_LOSS\";\n\n/**\n * Sets the value of the `testingHooksSpi` object.\n * @param instance the instance to set.\n */\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst yt = new Integer([ 4294967295, 4294967295 ], 0);\n\n// Hash a string using md5 hashing algorithm.\nfunction __PRIVATE_getMd5HashValue(e) {\n const t = __PRIVATE_newTextEncoder().encode(e), n = new Md5;\n return n.update(t), new Uint8Array(n.digest());\n}\n\n// Interpret the 16 bytes array as two 64-bit unsigned integers, encoded using\n// 2’s complement using little endian.\nfunction __PRIVATE_get64BitUints(e) {\n const t = new DataView(e.buffer), n = t.getUint32(0, /* littleEndian= */ true), r = t.getUint32(4, /* littleEndian= */ true), i = t.getUint32(8, /* littleEndian= */ true), s = t.getUint32(12, /* littleEndian= */ true);\n return [ new Integer([ n, r ], 0), new Integer([ i, s ], 0) ];\n}\n\nclass BloomFilter {\n constructor(e, t, n) {\n if (this.bitmap = e, this.padding = t, this.hashCount = n, t < 0 || t >= 8) throw new __PRIVATE_BloomFilterError(`Invalid padding: ${t}`);\n if (n < 0) throw new __PRIVATE_BloomFilterError(`Invalid hash count: ${n}`);\n if (e.length > 0 && 0 === this.hashCount) \n // Only empty bloom filter can have 0 hash count.\n throw new __PRIVATE_BloomFilterError(`Invalid hash count: ${n}`);\n if (0 === e.length && 0 !== t) \n // Empty bloom filter should have 0 padding.\n throw new __PRIVATE_BloomFilterError(`Invalid padding when bitmap length is 0: ${t}`);\n this.fe = 8 * e.length - t, \n // Set the bit count in Integer to avoid repetition in mightContain().\n this.ge = Integer.fromNumber(this.fe);\n }\n // Calculate the ith hash value based on the hashed 64bit integers,\n // and calculate its corresponding bit index in the bitmap to be checked.\n pe(e, t, n) {\n // Calculate hashed value h(i) = h1 + (i * h2).\n let r = e.add(t.multiply(Integer.fromNumber(n)));\n // Wrap if hash value overflow 64bit.\n return 1 === r.compare(yt) && (r = new Integer([ r.getBits(0), r.getBits(1) ], 0)), \n r.modulo(this.ge).toNumber();\n }\n // Return whether the bit on the given index in the bitmap is set to 1.\n ye(e) {\n return !!(this.bitmap[Math.floor(e / 8)] & 1 << e % 8);\n }\n mightContain(e) {\n // Empty bitmap should always return false on membership check.\n if (0 === this.fe) return false;\n const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);\n for (let e = 0; e < this.hashCount; e++) {\n const t = this.pe(n, r, e);\n if (!this.ye(t)) return false;\n }\n return true;\n }\n /** Create bloom filter for testing purposes only. */ static create(e, t, n) {\n const r = e % 8 == 0 ? 0 : 8 - e % 8, i = new Uint8Array(Math.ceil(e / 8)), s = new BloomFilter(i, r, t);\n return n.forEach((e => s.insert(e))), s;\n }\n insert(e) {\n if (0 === this.fe) return;\n const t = __PRIVATE_getMd5HashValue(e), [n, r] = __PRIVATE_get64BitUints(t);\n for (let e = 0; e < this.hashCount; e++) {\n const t = this.pe(n, r, e);\n this.we(t);\n }\n }\n we(e) {\n const t = Math.floor(e / 8), n = e % 8;\n this.bitmap[t] |= 1 << n;\n }\n}\n\nclass __PRIVATE_BloomFilterError extends Error {\n constructor() {\n super(...arguments), this.name = \"BloomFilterError\";\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An event from the RemoteStore. It is split into targetChanges (changes to the\n * state or the set of documents in our watched targets) and documentUpdates\n * (changes to the actual documents).\n */ class RemoteEvent {\n constructor(\n /**\n * The snapshot version this event brings us up to, or MIN if not set.\n */\n e, \n /**\n * A map from target to changes to the target. See TargetChange.\n */\n t, \n /**\n * A map of targets that is known to be inconsistent, and the purpose for\n * re-listening. Listens for these targets should be re-established without\n * resume tokens.\n */\n n, \n /**\n * A set of which documents have changed or been deleted, along with the\n * doc's new values (if not deleted).\n */\n r, \n /**\n * A set of which document updates are due only to limbo resolution targets.\n */\n i) {\n this.snapshotVersion = e, this.targetChanges = t, this.targetMismatches = n, this.documentUpdates = r, \n this.resolvedLimboDocuments = i;\n }\n /**\n * HACK: Views require RemoteEvents in order to determine whether the view is\n * CURRENT, but secondary tabs don't receive remote events. So this method is\n * used to create a synthesized RemoteEvent that can be used to apply a\n * CURRENT status change to a View, for queries executed in a different tab.\n */\n // PORTING NOTE: Multi-tab only\n static createSynthesizedRemoteEventForCurrentChange(e, t, n) {\n const r = new Map;\n return r.set(e, TargetChange.createSynthesizedTargetChangeForCurrentChange(e, t, n)), \n new RemoteEvent(SnapshotVersion.min(), r, new SortedMap(__PRIVATE_primitiveComparator), __PRIVATE_mutableDocumentMap(), __PRIVATE_documentKeySet());\n }\n}\n\n/**\n * A TargetChange specifies the set of changes for a specific target as part of\n * a RemoteEvent. These changes track which documents are added, modified or\n * removed, as well as the target's resume token and whether the target is\n * marked CURRENT.\n * The actual changes *to* documents are not part of the TargetChange since\n * documents may be part of multiple targets.\n */ class TargetChange {\n constructor(\n /**\n * An opaque, server-assigned token that allows watching a query to be resumed\n * after disconnecting without retransmitting all the data that matches the\n * query. The resume token essentially identifies a point in time from which\n * the server should resume sending results.\n */\n e, \n /**\n * The \"current\" (synced) status of this target. Note that \"current\"\n * has special meaning in the RPC protocol that implies that a target is\n * both up-to-date and consistent with the rest of the watch stream.\n */\n t, \n /**\n * The set of documents that were newly assigned to this target as part of\n * this remote event.\n */\n n, \n /**\n * The set of documents that were already assigned to this target but received\n * an update during this remote event.\n */\n r, \n /**\n * The set of documents that were removed from this target as part of this\n * remote event.\n */\n i) {\n this.resumeToken = e, this.current = t, this.addedDocuments = n, this.modifiedDocuments = r, \n this.removedDocuments = i;\n }\n /**\n * This method is used to create a synthesized TargetChanges that can be used to\n * apply a CURRENT status change to a View (for queries executed in a different\n * tab) or for new queries (to raise snapshots with correct CURRENT status).\n */ static createSynthesizedTargetChangeForCurrentChange(e, t, n) {\n return new TargetChange(n, t, __PRIVATE_documentKeySet(), __PRIVATE_documentKeySet(), __PRIVATE_documentKeySet());\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a changed document and a list of target ids to which this change\n * applies.\n *\n * If document has been deleted NoDocument will be provided.\n */ class __PRIVATE_DocumentWatchChange {\n constructor(\n /** The new document applies to all of these targets. */\n e, \n /** The new document is removed from all of these targets. */\n t, \n /** The key of the document for this change. */\n n, \n /**\n * The new document or NoDocument if it was deleted. Is null if the\n * document went out of view without the server sending a new document.\n */\n r) {\n this.Se = e, this.removedTargetIds = t, this.key = n, this.be = r;\n }\n}\n\nclass __PRIVATE_ExistenceFilterChange {\n constructor(e, t) {\n this.targetId = e, this.De = t;\n }\n}\n\nclass __PRIVATE_WatchTargetChange {\n constructor(\n /** What kind of change occurred to the watch target. */\n e, \n /** The target IDs that were added/removed/set. */\n t, \n /**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */\n n = ByteString.EMPTY_BYTE_STRING\n /** An RPC error indicating why the watch failed. */ , r = null) {\n this.state = e, this.targetIds = t, this.resumeToken = n, this.cause = r;\n }\n}\n\n/** Tracks the internal state of a Watch target. */ class __PRIVATE_TargetState {\n constructor() {\n /**\n * The number of pending responses (adds or removes) that we are waiting on.\n * We only consider targets active that have no pending responses.\n */\n this.ve = 0, \n /**\n * Keeps track of the document changes since the last raised snapshot.\n *\n * These changes are continuously updated as we receive document updates and\n * always reflect the current set of changes against the last issued snapshot.\n */\n this.Ce = __PRIVATE_snapshotChangesMap(), \n /** See public getters for explanations of these fields. */\n this.Fe = ByteString.EMPTY_BYTE_STRING, this.Me = false, \n /**\n * Whether this target state should be included in the next snapshot. We\n * initialize to true so that newly-added targets are included in the next\n * RemoteEvent.\n */\n this.xe = true;\n }\n /**\n * Whether this target has been marked 'current'.\n *\n * 'Current' has special meaning in the RPC protocol: It implies that the\n * Watch backend has sent us all changes up to the point at which the target\n * was added and that the target is consistent with the rest of the watch\n * stream.\n */ get current() {\n return this.Me;\n }\n /** The last resume token sent to us for this target. */ get resumeToken() {\n return this.Fe;\n }\n /** Whether this target has pending target adds or target removes. */ get Oe() {\n return 0 !== this.ve;\n }\n /** Whether we have modified any state that should trigger a snapshot. */ get Ne() {\n return this.xe;\n }\n /**\n * Applies the resume token to the TargetChange, but only when it has a new\n * value. Empty resumeTokens are discarded.\n */ Be(e) {\n e.approximateByteSize() > 0 && (this.xe = true, this.Fe = e);\n }\n /**\n * Creates a target change from the current set of changes.\n *\n * To reset the document changes after raising this snapshot, call\n * `clearPendingChanges()`.\n */ Le() {\n let e = __PRIVATE_documentKeySet(), t = __PRIVATE_documentKeySet(), n = __PRIVATE_documentKeySet();\n return this.Ce.forEach(((r, i) => {\n switch (i) {\n case 0 /* ChangeType.Added */ :\n e = e.add(r);\n break;\n\n case 2 /* ChangeType.Modified */ :\n t = t.add(r);\n break;\n\n case 1 /* ChangeType.Removed */ :\n n = n.add(r);\n break;\n\n default:\n fail(38017, {\n changeType: i\n });\n }\n })), new TargetChange(this.Fe, this.Me, e, t, n);\n }\n /**\n * Resets the document changes and sets `hasPendingChanges` to false.\n */ ke() {\n this.xe = false, this.Ce = __PRIVATE_snapshotChangesMap();\n }\n qe(e, t) {\n this.xe = true, this.Ce = this.Ce.insert(e, t);\n }\n Qe(e) {\n this.xe = true, this.Ce = this.Ce.remove(e);\n }\n $e() {\n this.ve += 1;\n }\n Ue() {\n this.ve -= 1, __PRIVATE_hardAssert(this.ve >= 0, 3241, {\n ve: this.ve\n });\n }\n Ke() {\n this.xe = true, this.Me = true;\n }\n}\n\n/**\n * A helper class to accumulate watch changes into a RemoteEvent.\n */\nclass __PRIVATE_WatchChangeAggregator {\n constructor(e) {\n this.We = e, \n /** The internal state of all tracked targets. */\n this.Ge = new Map, \n /** Keeps track of the documents to update since the last raised snapshot. */\n this.ze = __PRIVATE_mutableDocumentMap(), this.je = __PRIVATE_documentTargetMap(), \n /** A mapping of document keys to their set of target IDs. */\n this.Je = __PRIVATE_documentTargetMap(), \n /**\n * A map of targets with existence filter mismatches. These targets are\n * known to be inconsistent and their listens needs to be re-established by\n * RemoteStore.\n */\n this.He = new SortedMap(__PRIVATE_primitiveComparator);\n }\n /**\n * Processes and adds the DocumentWatchChange to the current set of changes.\n */ Ye(e) {\n for (const t of e.Se) e.be && e.be.isFoundDocument() ? this.Ze(t, e.be) : this.Xe(t, e.key, e.be);\n for (const t of e.removedTargetIds) this.Xe(t, e.key, e.be);\n }\n /** Processes and adds the WatchTargetChange to the current set of changes. */ et(e) {\n this.forEachTarget(e, (t => {\n const n = this.tt(t);\n switch (e.state) {\n case 0 /* WatchTargetChangeState.NoChange */ :\n this.nt(t) && n.Be(e.resumeToken);\n break;\n\n case 1 /* WatchTargetChangeState.Added */ :\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n n.Ue(), n.Oe || \n // We have a freshly added target, so we need to reset any state\n // that we had previously. This can happen e.g. when remove and add\n // back a target for existence filter mismatches.\n n.ke(), n.Be(e.resumeToken);\n break;\n\n case 2 /* WatchTargetChangeState.Removed */ :\n // We need to keep track of removed targets to we can post-filter and\n // remove any target changes.\n // We need to decrement the number of pending acks needed from watch\n // for this targetId.\n n.Ue(), n.Oe || this.removeTarget(t);\n break;\n\n case 3 /* WatchTargetChangeState.Current */ :\n this.nt(t) && (n.Ke(), n.Be(e.resumeToken));\n break;\n\n case 4 /* WatchTargetChangeState.Reset */ :\n this.nt(t) && (\n // Reset the target and synthesizes removes for all existing\n // documents. The backend will re-add any documents that still\n // match the target before it sends the next global snapshot.\n this.rt(t), n.Be(e.resumeToken));\n break;\n\n default:\n fail(56790, {\n state: e.state\n });\n }\n }));\n }\n /**\n * Iterates over all targetIds that the watch change applies to: either the\n * targetIds explicitly listed in the change or the targetIds of all currently\n * active targets.\n */ forEachTarget(e, t) {\n e.targetIds.length > 0 ? e.targetIds.forEach(t) : this.Ge.forEach(((e, n) => {\n this.nt(n) && t(n);\n }));\n }\n /**\n * Handles existence filters and synthesizes deletes for filter mismatches.\n * Targets that are invalidated by filter mismatches are added to\n * `pendingTargetResets`.\n */ it(e) {\n const t = e.targetId, n = e.De.count, r = this.st(t);\n if (r) {\n const i = r.target;\n if (__PRIVATE_targetIsDocumentTarget(i)) if (0 === n) {\n // The existence filter told us the document does not exist. We deduce\n // that this document does not exist and apply a deleted document to\n // our updates. Without applying this deleted document there might be\n // another query that will raise this document as part of a snapshot\n // until it is resolved, essentially exposing inconsistency between\n // queries.\n const e = new DocumentKey(i.path);\n this.Xe(t, e, MutableDocument.newNoDocument(e, SnapshotVersion.min()));\n } else __PRIVATE_hardAssert(1 === n, 20013, {\n expectedCount: n\n }); else {\n const r = this.ot(t);\n // Existence filter mismatch. Mark the documents as being in limbo, and\n // raise a snapshot with `isFromCache:true`.\n if (r !== n) {\n // Apply bloom filter to identify and mark removed documents.\n const n = this._t(e), i = n ? this.ut(n, e, r) : 1 /* BloomFilterApplicationStatus.Skipped */;\n if (0 /* BloomFilterApplicationStatus.Success */ !== i) {\n // If bloom filter application fails, we reset the mapping and\n // trigger re-run of the query.\n this.rt(t);\n const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? \"TargetPurposeExistenceFilterMismatchBloom\" /* TargetPurpose.ExistenceFilterMismatchBloom */ : \"TargetPurposeExistenceFilterMismatch\" /* TargetPurpose.ExistenceFilterMismatch */;\n this.He = this.He.insert(t, e);\n }\n }\n }\n }\n }\n /**\n * Parse the bloom filter from the \"unchanged_names\" field of an existence\n * filter.\n */ _t(e) {\n const t = e.De.unchangedNames;\n if (!t || !t.bits) return null;\n const {bits: {bitmap: n = \"\", padding: r = 0}, hashCount: i = 0} = t;\n let s, o;\n try {\n s = __PRIVATE_normalizeByteString(n).toUint8Array();\n } catch (e) {\n if (e instanceof __PRIVATE_Base64DecodeError) return __PRIVATE_logWarn(\"Decoding the base64 bloom filter in existence filter failed (\" + e.message + \"); ignoring the bloom filter and falling back to full re-query.\"), \n null;\n throw e;\n }\n try {\n // BloomFilter throws error if the inputs are invalid.\n o = new BloomFilter(s, r, i);\n } catch (e) {\n return __PRIVATE_logWarn(e instanceof __PRIVATE_BloomFilterError ? \"BloomFilter error: \" : \"Applying bloom filter failed: \", e), \n null;\n }\n return 0 === o.fe ? null : o;\n }\n /**\n * Apply bloom filter to remove the deleted documents, and return the\n * application status.\n */ ut(e, t, n) {\n return t.De.count === n - this.ht(e, t.targetId) ? 0 /* BloomFilterApplicationStatus.Success */ : 2 /* BloomFilterApplicationStatus.FalsePositive */;\n }\n /**\n * Filter out removed documents based on bloom filter membership result and\n * return number of documents removed.\n */ ht(e, t) {\n const n = this.We.getRemoteKeysForTarget(t);\n let r = 0;\n return n.forEach((n => {\n const i = this.We.lt(), s = `projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;\n e.mightContain(s) || (this.Xe(t, n, /*updatedDocument=*/ null), r++);\n })), r;\n }\n /**\n * Converts the currently accumulated state into a remote event at the\n * provided snapshot version. Resets the accumulated changes before returning.\n */ Pt(e) {\n const t = new Map;\n this.Ge.forEach(((n, r) => {\n const i = this.st(r);\n if (i) {\n if (n.current && __PRIVATE_targetIsDocumentTarget(i.target)) {\n // Document queries for document that don't exist can produce an empty\n // result set. To update our local cache, we synthesize a document\n // delete if we have not previously received the document for this\n // target. This resolves the limbo state of the document, removing it\n // from limboDocumentRefs.\n // TODO(dimond): Ideally we would have an explicit lookup target\n // instead resulting in an explicit delete message and we could\n // remove this special logic.\n const t = new DocumentKey(i.target.path);\n this.Tt(t).has(r) || this.It(r, t) || this.Xe(r, t, MutableDocument.newNoDocument(t, e));\n }\n n.Ne && (t.set(r, n.Le()), n.ke());\n }\n }));\n let n = __PRIVATE_documentKeySet();\n // We extract the set of limbo-only document updates as the GC logic\n // special-cases documents that do not appear in the target cache.\n \n // TODO(gsoltis): Expand on this comment once GC is available in the JS\n // client.\n this.Je.forEach(((e, t) => {\n let r = true;\n t.forEachWhile((e => {\n const t = this.st(e);\n return !t || \"TargetPurposeLimboResolution\" /* TargetPurpose.LimboResolution */ === t.purpose || (r = false, \n false);\n })), r && (n = n.add(e));\n })), this.ze.forEach(((t, n) => n.setReadTime(e)));\n const r = new RemoteEvent(e, t, this.He, this.ze, n);\n return this.ze = __PRIVATE_mutableDocumentMap(), this.je = __PRIVATE_documentTargetMap(), \n this.Je = __PRIVATE_documentTargetMap(), this.He = new SortedMap(__PRIVATE_primitiveComparator), \n r;\n }\n /**\n * Adds the provided document to the internal list of document updates and\n * its document key to the given target's mapping.\n */\n // Visible for testing.\n Ze(e, t) {\n if (!this.nt(e)) return;\n const n = this.It(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;\n this.tt(e).qe(t.key, n), this.ze = this.ze.insert(t.key, t), this.je = this.je.insert(t.key, this.Tt(t.key).add(e)), \n this.Je = this.Je.insert(t.key, this.dt(t.key).add(e));\n }\n /**\n * Removes the provided document from the target mapping. If the\n * document no longer matches the target, but the document's state is still\n * known (e.g. we know that the document was deleted or we received the change\n * that caused the filter mismatch), the new document can be provided\n * to update the remote document cache.\n */\n // Visible for testing.\n Xe(e, t, n) {\n if (!this.nt(e)) return;\n const r = this.tt(e);\n this.It(e, t) ? r.qe(t, 1 /* ChangeType.Removed */) : \n // The document may have entered and left the target before we raised a\n // snapshot, so we can just ignore the change.\n r.Qe(t), this.Je = this.Je.insert(t, this.dt(t).delete(e)), this.Je = this.Je.insert(t, this.dt(t).add(e)), \n n && (this.ze = this.ze.insert(t, n));\n }\n removeTarget(e) {\n this.Ge.delete(e);\n }\n /**\n * Returns the current count of documents in the target. This includes both\n * the number of documents that the LocalStore considers to be part of the\n * target as well as any accumulated changes.\n */ ot(e) {\n const t = this.tt(e).Le();\n return this.We.getRemoteKeysForTarget(e).size + t.addedDocuments.size - t.removedDocuments.size;\n }\n /**\n * Increment the number of acks needed from watch before we can consider the\n * server to be 'in-sync' with the client's active targets.\n */ $e(e) {\n this.tt(e).$e();\n }\n tt(e) {\n let t = this.Ge.get(e);\n return t || (t = new __PRIVATE_TargetState, this.Ge.set(e, t)), t;\n }\n dt(e) {\n let t = this.Je.get(e);\n return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Je = this.Je.insert(e, t)), \n t;\n }\n Tt(e) {\n let t = this.je.get(e);\n return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.je = this.je.insert(e, t)), \n t;\n }\n /**\n * Verifies that the user is still interested in this target (by calling\n * `getTargetDataForTarget()`) and that we are not waiting for pending ADDs\n * from watch.\n */ nt(e) {\n const t = null !== this.st(e);\n return t || __PRIVATE_logDebug(\"WatchChangeAggregator\", \"Detected inactive target\", e), \n t;\n }\n /**\n * Returns the TargetData for an active target (i.e. a target that the user\n * is still interested in that has no outstanding target change requests).\n */ st(e) {\n const t = this.Ge.get(e);\n return t && t.Oe ? null : this.We.Et(e);\n }\n /**\n * Resets the state of a Watch target to its initial state (e.g. sets\n * 'current' to false, clears the resume token and removes its target mapping\n * from all documents).\n */ rt(e) {\n this.Ge.set(e, new __PRIVATE_TargetState);\n this.We.getRemoteKeysForTarget(e).forEach((t => {\n this.Xe(e, t, /*updatedDocument=*/ null);\n }));\n }\n /**\n * Returns whether the LocalStore considers the document to be part of the\n * specified target.\n */ It(e, t) {\n return this.We.getRemoteKeysForTarget(e).has(t);\n }\n}\n\nfunction __PRIVATE_documentTargetMap() {\n return new SortedMap(DocumentKey.comparator);\n}\n\nfunction __PRIVATE_snapshotChangesMap() {\n return new SortedMap(DocumentKey.comparator);\n}\n\nconst wt = (() => {\n const e = {\n asc: \"ASCENDING\",\n desc: \"DESCENDING\"\n };\n return e;\n})(), St = (() => {\n const e = {\n \"<\": \"LESS_THAN\",\n \"<=\": \"LESS_THAN_OR_EQUAL\",\n \">\": \"GREATER_THAN\",\n \">=\": \"GREATER_THAN_OR_EQUAL\",\n \"==\": \"EQUAL\",\n \"!=\": \"NOT_EQUAL\",\n \"array-contains\": \"ARRAY_CONTAINS\",\n in: \"IN\",\n \"not-in\": \"NOT_IN\",\n \"array-contains-any\": \"ARRAY_CONTAINS_ANY\"\n };\n return e;\n})(), bt = (() => {\n const e = {\n and: \"AND\",\n or: \"OR\"\n };\n return e;\n})();\n\n/**\n * This class generates JsonObject values for the Datastore API suitable for\n * sending to either GRPC stub methods or via the JSON/HTTP REST API.\n *\n * The serializer supports both Protobuf.js and Proto3 JSON formats. By\n * setting `useProto3Json` to true, the serializer will use the Proto3 JSON\n * format.\n *\n * For a description of the Proto3 JSON format check\n * https://developers.google.com/protocol-buffers/docs/proto3#json\n *\n * TODO(klimt): We can remove the databaseId argument if we keep the full\n * resource name in documents.\n */\nclass JsonProtoSerializer {\n constructor(e, t) {\n this.databaseId = e, this.useProto3Json = t;\n }\n}\n\n/**\n * Returns a value for a number (or null) that's appropriate to put into\n * a google.protobuf.Int32Value proto.\n * DO NOT USE THIS FOR ANYTHING ELSE.\n * This method cheats. It's typed as returning \"number\" because that's what\n * our generated proto interfaces say Int32Value must be. But GRPC actually\n * expects a { value: <number> } struct.\n */\nfunction __PRIVATE_toInt32Proto(e, t) {\n return e.useProto3Json || __PRIVATE_isNullOrUndefined(t) ? t : {\n value: t\n };\n}\n\n/**\n * Returns a number (or null) from a google.protobuf.Int32Value proto.\n */\n/**\n * Returns a value for a Date that's appropriate to put into a proto.\n */\nfunction toTimestamp(e, t) {\n if (e.useProto3Json) {\n return `${new Date(1e3 * t.seconds).toISOString().replace(/\\.\\d*/, \"\").replace(\"Z\", \"\")}.${(\"000000000\" + t.nanoseconds).slice(-9)}Z`;\n }\n return {\n seconds: \"\" + t.seconds,\n nanos: t.nanoseconds\n };\n}\n\n/**\n * Returns a Timestamp typed object given protobuf timestamp value.\n */\n/**\n * Returns a value for bytes that's appropriate to put in a proto.\n *\n * Visible for testing.\n */\nfunction __PRIVATE_toBytes(e, t) {\n return e.useProto3Json ? t.toBase64() : t.toUint8Array();\n}\n\n/**\n * Returns a ByteString based on the proto string value.\n */ function __PRIVATE_toVersion(e, t) {\n return toTimestamp(e, t.toTimestamp());\n}\n\nfunction __PRIVATE_fromVersion(e) {\n return __PRIVATE_hardAssert(!!e, 49232), SnapshotVersion.fromTimestamp(function fromTimestamp(e) {\n const t = __PRIVATE_normalizeTimestamp(e);\n return new Timestamp(t.seconds, t.nanos);\n }(e));\n}\n\nfunction __PRIVATE_toResourceName(e, t) {\n return __PRIVATE_toResourcePath(e, t).canonicalString();\n}\n\nfunction __PRIVATE_toResourcePath(e, t) {\n const n = function __PRIVATE_fullyQualifiedPrefixPath(e) {\n return new ResourcePath([ \"projects\", e.projectId, \"databases\", e.database ]);\n }(e).child(\"documents\");\n return void 0 === t ? n : n.child(t);\n}\n\nfunction __PRIVATE_fromResourceName(e) {\n const t = ResourcePath.fromString(e);\n return __PRIVATE_hardAssert(__PRIVATE_isValidResourceName(t), 10190, {\n key: t.toString()\n }), t;\n}\n\nfunction __PRIVATE_toName(e, t) {\n return __PRIVATE_toResourceName(e.databaseId, t.path);\n}\n\nfunction fromName(e, t) {\n const n = __PRIVATE_fromResourceName(t);\n if (n.get(1) !== e.databaseId.projectId) throw new FirestoreError(N.INVALID_ARGUMENT, \"Tried to deserialize key from different project: \" + n.get(1) + \" vs \" + e.databaseId.projectId);\n if (n.get(3) !== e.databaseId.database) throw new FirestoreError(N.INVALID_ARGUMENT, \"Tried to deserialize key from different database: \" + n.get(3) + \" vs \" + e.databaseId.database);\n return new DocumentKey(__PRIVATE_extractLocalPathFromResourceName(n));\n}\n\nfunction __PRIVATE_toQueryPath(e, t) {\n return __PRIVATE_toResourceName(e.databaseId, t);\n}\n\nfunction __PRIVATE_fromQueryPath(e) {\n const t = __PRIVATE_fromResourceName(e);\n // In v1beta1 queries for collections at the root did not have a trailing\n // \"/documents\". In v1 all resource paths contain \"/documents\". Preserve the\n // ability to read the v1beta1 form for compatibility with queries persisted\n // in the local target cache.\n return 4 === t.length ? ResourcePath.emptyPath() : __PRIVATE_extractLocalPathFromResourceName(t);\n}\n\nfunction __PRIVATE_getEncodedDatabaseId(e) {\n return new ResourcePath([ \"projects\", e.databaseId.projectId, \"databases\", e.databaseId.database ]).canonicalString();\n}\n\nfunction __PRIVATE_extractLocalPathFromResourceName(e) {\n return __PRIVATE_hardAssert(e.length > 4 && \"documents\" === e.get(4), 29091, {\n key: e.toString()\n }), e.popFirst(5);\n}\n\n/** Creates a Document proto from key and fields (but no create/update time) */ function __PRIVATE_toMutationDocument(e, t, n) {\n return {\n name: __PRIVATE_toName(e, t),\n fields: n.value.mapValue.fields\n };\n}\n\nfunction __PRIVATE_fromWatchChange(e, t) {\n let n;\n if (\"targetChange\" in t) {\n t.targetChange;\n // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'\n // if unset\n const r = function __PRIVATE_fromWatchTargetChangeState(e) {\n return \"NO_CHANGE\" === e ? 0 /* WatchTargetChangeState.NoChange */ : \"ADD\" === e ? 1 /* WatchTargetChangeState.Added */ : \"REMOVE\" === e ? 2 /* WatchTargetChangeState.Removed */ : \"CURRENT\" === e ? 3 /* WatchTargetChangeState.Current */ : \"RESET\" === e ? 4 /* WatchTargetChangeState.Reset */ : fail(39313, {\n state: e\n });\n }(t.targetChange.targetChangeType || \"NO_CHANGE\"), i = t.targetChange.targetIds || [], s = function __PRIVATE_fromBytes(e, t) {\n return e.useProto3Json ? (__PRIVATE_hardAssert(void 0 === t || \"string\" == typeof t, 58123), \n ByteString.fromBase64String(t || \"\")) : (__PRIVATE_hardAssert(void 0 === t || \n // Check if the value is an instance of both Buffer and Uint8Array,\n // despite the fact that Buffer extends Uint8Array. In some\n // environments, such as jsdom, the prototype chain of Buffer\n // does not indicate that it extends Uint8Array.\n t instanceof Buffer || t instanceof Uint8Array, 16193), ByteString.fromUint8Array(t || new Uint8Array));\n }(e, t.targetChange.resumeToken), o = t.targetChange.cause, _ = o && function __PRIVATE_fromRpcStatus(e) {\n const t = void 0 === e.code ? N.UNKNOWN : __PRIVATE_mapCodeFromRpcCode(e.code);\n return new FirestoreError(t, e.message || \"\");\n }(o);\n n = new __PRIVATE_WatchTargetChange(r, i, s, _ || null);\n } else if (\"documentChange\" in t) {\n t.documentChange;\n const r = t.documentChange;\n r.document, r.document.name, r.document.updateTime;\n const i = fromName(e, r.document.name), s = __PRIVATE_fromVersion(r.document.updateTime), o = r.document.createTime ? __PRIVATE_fromVersion(r.document.createTime) : SnapshotVersion.min(), _ = new ObjectValue({\n mapValue: {\n fields: r.document.fields\n }\n }), a = MutableDocument.newFoundDocument(i, s, o, _), u = r.targetIds || [], c = r.removedTargetIds || [];\n n = new __PRIVATE_DocumentWatchChange(u, c, a.key, a);\n } else if (\"documentDelete\" in t) {\n t.documentDelete;\n const r = t.documentDelete;\n r.document;\n const i = fromName(e, r.document), s = r.readTime ? __PRIVATE_fromVersion(r.readTime) : SnapshotVersion.min(), o = MutableDocument.newNoDocument(i, s), _ = r.removedTargetIds || [];\n n = new __PRIVATE_DocumentWatchChange([], _, o.key, o);\n } else if (\"documentRemove\" in t) {\n t.documentRemove;\n const r = t.documentRemove;\n r.document;\n const i = fromName(e, r.document), s = r.removedTargetIds || [];\n n = new __PRIVATE_DocumentWatchChange([], s, i, null);\n } else {\n if (!(\"filter\" in t)) return fail(11601, {\n At: t\n });\n {\n t.filter;\n const e = t.filter;\n e.targetId;\n const {count: r = 0, unchangedNames: i} = e, s = new ExistenceFilter(r, i), o = e.targetId;\n n = new __PRIVATE_ExistenceFilterChange(o, s);\n }\n }\n return n;\n}\n\nfunction toMutation(e, t) {\n let n;\n if (t instanceof __PRIVATE_SetMutation) n = {\n update: __PRIVATE_toMutationDocument(e, t.key, t.value)\n }; else if (t instanceof __PRIVATE_DeleteMutation) n = {\n delete: __PRIVATE_toName(e, t.key)\n }; else if (t instanceof __PRIVATE_PatchMutation) n = {\n update: __PRIVATE_toMutationDocument(e, t.key, t.data),\n updateMask: __PRIVATE_toDocumentMask(t.fieldMask)\n }; else {\n if (!(t instanceof __PRIVATE_VerifyMutation)) return fail(16599, {\n Rt: t.type\n });\n n = {\n verify: __PRIVATE_toName(e, t.key)\n };\n }\n return t.fieldTransforms.length > 0 && (n.updateTransforms = t.fieldTransforms.map((e => function __PRIVATE_toFieldTransform(e, t) {\n const n = t.transform;\n if (n instanceof __PRIVATE_ServerTimestampTransform) return {\n fieldPath: t.field.canonicalString(),\n setToServerValue: \"REQUEST_TIME\"\n };\n if (n instanceof __PRIVATE_ArrayUnionTransformOperation) return {\n fieldPath: t.field.canonicalString(),\n appendMissingElements: {\n values: n.elements\n }\n };\n if (n instanceof __PRIVATE_ArrayRemoveTransformOperation) return {\n fieldPath: t.field.canonicalString(),\n removeAllFromArray: {\n values: n.elements\n }\n };\n if (n instanceof __PRIVATE_NumericIncrementTransformOperation) return {\n fieldPath: t.field.canonicalString(),\n increment: n.Ee\n };\n throw fail(20930, {\n transform: t.transform\n });\n }(0, e)))), t.precondition.isNone || (n.currentDocument = function __PRIVATE_toPrecondition(e, t) {\n return void 0 !== t.updateTime ? {\n updateTime: __PRIVATE_toVersion(e, t.updateTime)\n } : void 0 !== t.exists ? {\n exists: t.exists\n } : fail(27497);\n }(e, t.precondition)), n;\n}\n\nfunction __PRIVATE_fromWriteResults(e, t) {\n return e && e.length > 0 ? (__PRIVATE_hardAssert(void 0 !== t, 14353), e.map((e => function __PRIVATE_fromWriteResult(e, t) {\n // NOTE: Deletes don't have an updateTime.\n let n = e.updateTime ? __PRIVATE_fromVersion(e.updateTime) : __PRIVATE_fromVersion(t);\n return n.isEqual(SnapshotVersion.min()) && (\n // The Firestore Emulator currently returns an update time of 0 for\n // deletes of non-existing documents (rather than null). This breaks the\n // test \"get deleted doc while offline with source=cache\" as NoDocuments\n // with version 0 are filtered by IndexedDb's RemoteDocumentCache.\n // TODO(#2149): Remove this when Emulator is fixed\n n = __PRIVATE_fromVersion(t)), new MutationResult(n, e.transformResults || []);\n }(e, t)))) : [];\n}\n\nfunction __PRIVATE_toDocumentsTarget(e, t) {\n return {\n documents: [ __PRIVATE_toQueryPath(e, t.path) ]\n };\n}\n\nfunction __PRIVATE_toQueryTarget(e, t) {\n // Dissect the path into parent, collectionId, and optional key filter.\n const n = {\n structuredQuery: {}\n }, r = t.path;\n let i;\n null !== t.collectionGroup ? (i = r, n.structuredQuery.from = [ {\n collectionId: t.collectionGroup,\n allDescendants: true\n } ]) : (i = r.popLast(), n.structuredQuery.from = [ {\n collectionId: r.lastSegment()\n } ]), n.parent = __PRIVATE_toQueryPath(e, i);\n const s = function __PRIVATE_toFilters(e) {\n if (0 === e.length) return;\n return __PRIVATE_toFilter(CompositeFilter.create(e, \"and\" /* CompositeOperator.AND */));\n }(t.filters);\n s && (n.structuredQuery.where = s);\n const o = function __PRIVATE_toOrder(e) {\n if (0 === e.length) return;\n return e.map((e => \n // visible for testing\n function __PRIVATE_toPropertyOrder(e) {\n return {\n field: __PRIVATE_toFieldPathReference(e.field),\n direction: __PRIVATE_toDirection(e.dir)\n };\n }(e)));\n }(t.orderBy);\n o && (n.structuredQuery.orderBy = o);\n const _ = __PRIVATE_toInt32Proto(e, t.limit);\n return null !== _ && (n.structuredQuery.limit = _), t.startAt && (n.structuredQuery.startAt = function __PRIVATE_toStartAtCursor(e) {\n return {\n before: e.inclusive,\n values: e.position\n };\n }(t.startAt)), t.endAt && (n.structuredQuery.endAt = function __PRIVATE_toEndAtCursor(e) {\n return {\n before: !e.inclusive,\n values: e.position\n };\n }(t.endAt)), {\n Vt: n,\n parent: i\n };\n}\n\nfunction __PRIVATE_convertQueryTargetToQuery(e) {\n let t = __PRIVATE_fromQueryPath(e.parent);\n const n = e.structuredQuery, r = n.from ? n.from.length : 0;\n let i = null;\n if (r > 0) {\n __PRIVATE_hardAssert(1 === r, 65062);\n const e = n.from[0];\n e.allDescendants ? i = e.collectionId : t = t.child(e.collectionId);\n }\n let s = [];\n n.where && (s = function __PRIVATE_fromFilters(e) {\n const t = __PRIVATE_fromFilter(e);\n if (t instanceof CompositeFilter && __PRIVATE_compositeFilterIsFlatConjunction(t)) return t.getFilters();\n return [ t ];\n }(n.where));\n let o = [];\n n.orderBy && (o = function __PRIVATE_fromOrder(e) {\n return e.map((e => function __PRIVATE_fromPropertyOrder(e) {\n return new OrderBy(__PRIVATE_fromFieldPathReference(e.field), \n // visible for testing\n function __PRIVATE_fromDirection(e) {\n switch (e) {\n case \"ASCENDING\":\n return \"asc\" /* Direction.ASCENDING */;\n\n case \"DESCENDING\":\n return \"desc\" /* Direction.DESCENDING */;\n\n default:\n return;\n }\n }\n // visible for testing\n (e.direction));\n }\n // visible for testing\n (e)));\n }(n.orderBy));\n let _ = null;\n n.limit && (_ = function __PRIVATE_fromInt32Proto(e) {\n let t;\n return t = \"object\" == typeof e ? e.value : e, __PRIVATE_isNullOrUndefined(t) ? null : t;\n }(n.limit));\n let a = null;\n n.startAt && (a = function __PRIVATE_fromStartAtCursor(e) {\n const t = !!e.before, n = e.values || [];\n return new Bound(n, t);\n }(n.startAt));\n let u = null;\n return n.endAt && (u = function __PRIVATE_fromEndAtCursor(e) {\n const t = !e.before, n = e.values || [];\n return new Bound(n, t);\n }\n // visible for testing\n (n.endAt)), __PRIVATE_newQuery(t, i, o, s, _, \"F\" /* LimitType.First */ , a, u);\n}\n\nfunction __PRIVATE_toListenRequestLabels(e, t) {\n const n = function __PRIVATE_toLabel(e) {\n switch (e) {\n case \"TargetPurposeListen\" /* TargetPurpose.Listen */ :\n return null;\n\n case \"TargetPurposeExistenceFilterMismatch\" /* TargetPurpose.ExistenceFilterMismatch */ :\n return \"existence-filter-mismatch\";\n\n case \"TargetPurposeExistenceFilterMismatchBloom\" /* TargetPurpose.ExistenceFilterMismatchBloom */ :\n return \"existence-filter-mismatch-bloom\";\n\n case \"TargetPurposeLimboResolution\" /* TargetPurpose.LimboResolution */ :\n return \"limbo-document\";\n\n default:\n return fail(28987, {\n purpose: e\n });\n }\n }(t.purpose);\n return null == n ? null : {\n \"goog-listen-tags\": n\n };\n}\n\nfunction __PRIVATE_fromFilter(e) {\n return void 0 !== e.unaryFilter ? function __PRIVATE_fromUnaryFilter(e) {\n switch (e.unaryFilter.op) {\n case \"IS_NAN\":\n const t = __PRIVATE_fromFieldPathReference(e.unaryFilter.field);\n return FieldFilter.create(t, \"==\" /* Operator.EQUAL */ , {\n doubleValue: NaN\n });\n\n case \"IS_NULL\":\n const n = __PRIVATE_fromFieldPathReference(e.unaryFilter.field);\n return FieldFilter.create(n, \"==\" /* Operator.EQUAL */ , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"IS_NOT_NAN\":\n const r = __PRIVATE_fromFieldPathReference(e.unaryFilter.field);\n return FieldFilter.create(r, \"!=\" /* Operator.NOT_EQUAL */ , {\n doubleValue: NaN\n });\n\n case \"IS_NOT_NULL\":\n const i = __PRIVATE_fromFieldPathReference(e.unaryFilter.field);\n return FieldFilter.create(i, \"!=\" /* Operator.NOT_EQUAL */ , {\n nullValue: \"NULL_VALUE\"\n });\n\n case \"OPERATOR_UNSPECIFIED\":\n return fail(61313);\n\n default:\n return fail(60726);\n }\n }(e) : void 0 !== e.fieldFilter ? function __PRIVATE_fromFieldFilter(e) {\n return FieldFilter.create(__PRIVATE_fromFieldPathReference(e.fieldFilter.field), function __PRIVATE_fromOperatorName(e) {\n switch (e) {\n case \"EQUAL\":\n return \"==\" /* Operator.EQUAL */;\n\n case \"NOT_EQUAL\":\n return \"!=\" /* Operator.NOT_EQUAL */;\n\n case \"GREATER_THAN\":\n return \">\" /* Operator.GREATER_THAN */;\n\n case \"GREATER_THAN_OR_EQUAL\":\n return \">=\" /* Operator.GREATER_THAN_OR_EQUAL */;\n\n case \"LESS_THAN\":\n return \"<\" /* Operator.LESS_THAN */;\n\n case \"LESS_THAN_OR_EQUAL\":\n return \"<=\" /* Operator.LESS_THAN_OR_EQUAL */;\n\n case \"ARRAY_CONTAINS\":\n return \"array-contains\" /* Operator.ARRAY_CONTAINS */;\n\n case \"IN\":\n return \"in\" /* Operator.IN */;\n\n case \"NOT_IN\":\n return \"not-in\" /* Operator.NOT_IN */;\n\n case \"ARRAY_CONTAINS_ANY\":\n return \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */;\n\n case \"OPERATOR_UNSPECIFIED\":\n return fail(58110);\n\n default:\n return fail(50506);\n }\n }(e.fieldFilter.op), e.fieldFilter.value);\n }(e) : void 0 !== e.compositeFilter ? function __PRIVATE_fromCompositeFilter(e) {\n return CompositeFilter.create(e.compositeFilter.filters.map((e => __PRIVATE_fromFilter(e))), function __PRIVATE_fromCompositeOperatorName(e) {\n switch (e) {\n case \"AND\":\n return \"and\" /* CompositeOperator.AND */;\n\n case \"OR\":\n return \"or\" /* CompositeOperator.OR */;\n\n default:\n return fail(1026);\n }\n }(e.compositeFilter.op));\n }(e) : fail(30097, {\n filter: e\n });\n}\n\nfunction __PRIVATE_toDirection(e) {\n return wt[e];\n}\n\nfunction __PRIVATE_toOperatorName(e) {\n return St[e];\n}\n\nfunction __PRIVATE_toCompositeOperatorName(e) {\n return bt[e];\n}\n\nfunction __PRIVATE_toFieldPathReference(e) {\n return {\n fieldPath: e.canonicalString()\n };\n}\n\nfunction __PRIVATE_fromFieldPathReference(e) {\n return FieldPath$1.fromServerFormat(e.fieldPath);\n}\n\nfunction __PRIVATE_toFilter(e) {\n return e instanceof FieldFilter ? function __PRIVATE_toUnaryOrFieldFilter(e) {\n if (\"==\" /* Operator.EQUAL */ === e.op) {\n if (__PRIVATE_isNanValue(e.value)) return {\n unaryFilter: {\n field: __PRIVATE_toFieldPathReference(e.field),\n op: \"IS_NAN\"\n }\n };\n if (__PRIVATE_isNullValue(e.value)) return {\n unaryFilter: {\n field: __PRIVATE_toFieldPathReference(e.field),\n op: \"IS_NULL\"\n }\n };\n } else if (\"!=\" /* Operator.NOT_EQUAL */ === e.op) {\n if (__PRIVATE_isNanValue(e.value)) return {\n unaryFilter: {\n field: __PRIVATE_toFieldPathReference(e.field),\n op: \"IS_NOT_NAN\"\n }\n };\n if (__PRIVATE_isNullValue(e.value)) return {\n unaryFilter: {\n field: __PRIVATE_toFieldPathReference(e.field),\n op: \"IS_NOT_NULL\"\n }\n };\n }\n return {\n fieldFilter: {\n field: __PRIVATE_toFieldPathReference(e.field),\n op: __PRIVATE_toOperatorName(e.op),\n value: e.value\n }\n };\n }(e) : e instanceof CompositeFilter ? function __PRIVATE_toCompositeFilter(e) {\n const t = e.getFilters().map((e => __PRIVATE_toFilter(e)));\n if (1 === t.length) return t[0];\n return {\n compositeFilter: {\n op: __PRIVATE_toCompositeOperatorName(e.op),\n filters: t\n }\n };\n }(e) : fail(54877, {\n filter: e\n });\n}\n\nfunction __PRIVATE_toDocumentMask(e) {\n const t = [];\n return e.fields.forEach((e => t.push(e.canonicalString()))), {\n fieldPaths: t\n };\n}\n\nfunction __PRIVATE_isValidResourceName(e) {\n // Resource names have at least 4 components (project ID, database ID)\n return e.length >= 4 && \"projects\" === e.get(0) && \"databases\" === e.get(2);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An immutable set of metadata that the local store tracks for each target.\n */ class TargetData {\n constructor(\n /** The target being listened to. */\n e, \n /**\n * The target ID to which the target corresponds; Assigned by the\n * LocalStore for user listens and by the SyncEngine for limbo watches.\n */\n t, \n /** The purpose of the target. */\n n, \n /**\n * The sequence number of the last transaction during which this target data\n * was modified.\n */\n r, \n /** The latest snapshot version seen for this target. */\n i = SnapshotVersion.min()\n /**\n * The maximum snapshot version at which the associated view\n * contained no limbo documents.\n */ , s = SnapshotVersion.min()\n /**\n * An opaque, server-assigned token that allows watching a target to be\n * resumed after disconnecting without retransmitting all the data that\n * matches the target. The resume token essentially identifies a point in\n * time from which the server should resume sending results.\n */ , o = ByteString.EMPTY_BYTE_STRING\n /**\n * The number of documents that last matched the query at the resume token or\n * read time. Documents are counted only when making a listen request with\n * resume token or read time, otherwise, keep it null.\n */ , _ = null) {\n this.target = e, this.targetId = t, this.purpose = n, this.sequenceNumber = r, this.snapshotVersion = i, \n this.lastLimboFreeSnapshotVersion = s, this.resumeToken = o, this.expectedCount = _;\n }\n /** Creates a new target data instance with an updated sequence number. */ withSequenceNumber(e) {\n return new TargetData(this.target, this.targetId, this.purpose, e, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken, this.expectedCount);\n }\n /**\n * Creates a new target data instance with an updated resume token and\n * snapshot version.\n */ withResumeToken(e, t) {\n return new TargetData(this.target, this.targetId, this.purpose, this.sequenceNumber, t, this.lastLimboFreeSnapshotVersion, e, \n /* expectedCount= */ null);\n }\n /**\n * Creates a new target data instance with an updated expected count.\n */ withExpectedCount(e) {\n return new TargetData(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, this.lastLimboFreeSnapshotVersion, this.resumeToken, e);\n }\n /**\n * Creates a new target data instance with an updated last limbo free\n * snapshot version number.\n */ withLastLimboFreeSnapshotVersion(e) {\n return new TargetData(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, e, this.resumeToken, this.expectedCount);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Serializer for values stored in the LocalStore. */ class __PRIVATE_LocalSerializer {\n constructor(e) {\n this.gt = e;\n }\n}\n\n/**\n * Encodes a `BundledQuery` from bundle proto to a Query object.\n *\n * This reconstructs the original query used to build the bundle being loaded,\n * including features exists only in SDKs (for example: limit-to-last).\n */\nfunction __PRIVATE_fromBundledQuery(e) {\n const t = __PRIVATE_convertQueryTargetToQuery({\n parent: e.parent,\n structuredQuery: e.structuredQuery\n });\n return \"LAST\" === e.limitType ? __PRIVATE_queryWithLimit(t, t.limit, \"L\" /* LimitType.Last */) : t;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An in-memory implementation of IndexManager.\n */ class __PRIVATE_MemoryIndexManager {\n constructor() {\n this.Dn = new __PRIVATE_MemoryCollectionParentIndex;\n }\n addToCollectionParentIndex(e, t) {\n return this.Dn.add(t), PersistencePromise.resolve();\n }\n getCollectionParents(e, t) {\n return PersistencePromise.resolve(this.Dn.getEntries(t));\n }\n addFieldIndex(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n deleteFieldIndex(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n deleteAllFieldIndexes(e) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n createTargetIndexes(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n getDocumentsMatchingTarget(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve(null);\n }\n getIndexType(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve(0 /* IndexType.NONE */);\n }\n getFieldIndexes(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve([]);\n }\n getNextCollectionGroupToUpdate(e) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve(null);\n }\n getMinOffset(e, t) {\n return PersistencePromise.resolve(IndexOffset.min());\n }\n getMinOffsetFromCollectionGroup(e, t) {\n return PersistencePromise.resolve(IndexOffset.min());\n }\n updateCollectionGroup(e, t, n) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n updateIndexEntries(e, t) {\n // Field indices are not supported with memory persistence.\n return PersistencePromise.resolve();\n }\n}\n\n/**\n * Internal implementation of the collection-parent index exposed by MemoryIndexManager.\n * Also used for in-memory caching by IndexedDbIndexManager and initial index population\n * in indexeddb_schema.ts\n */ class __PRIVATE_MemoryCollectionParentIndex {\n constructor() {\n this.index = {};\n }\n // Returns false if the entry already existed.\n add(e) {\n const t = e.lastSegment(), n = e.popLast(), r = this.index[t] || new SortedSet(ResourcePath.comparator), i = !r.has(n);\n return this.index[t] = r.add(n), i;\n }\n has(e) {\n const t = e.lastSegment(), n = e.popLast(), r = this.index[t];\n return r && r.has(n);\n }\n getEntries(e) {\n return (this.index[e] || new SortedSet(ResourcePath.comparator)).toArray();\n }\n}\n\n/**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Ft = {\n didRun: false,\n sequenceNumbersCollected: 0,\n targetsRemoved: 0,\n documentsRemoved: 0\n}, Mt = 41943040;\n\nclass LruParams {\n static withCacheSize(e) {\n return new LruParams(e, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT);\n }\n constructor(\n // When we attempt to collect, we will only do so if the cache size is greater than this\n // threshold. Passing `COLLECTION_DISABLED` here will cause collection to always be skipped.\n e, \n // The percentage of sequence numbers that we will attempt to collect\n t, \n // A cap on the total number of sequence numbers that will be collected. This prevents\n // us from collecting a huge number of sequence numbers if the cache has grown very large.\n n) {\n this.cacheSizeCollectionThreshold = e, this.percentileToCollect = t, this.maximumSequenceNumbersToCollect = n;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** A mutation queue for a specific user, backed by IndexedDB. */ LruParams.DEFAULT_COLLECTION_PERCENTILE = 10, \nLruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT = 1e3, LruParams.DEFAULT = new LruParams(Mt, LruParams.DEFAULT_COLLECTION_PERCENTILE, LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT), \nLruParams.DISABLED = new LruParams(-1, 0, 0);\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** Offset to ensure non-overlapping target ids. */\n/**\n * Generates monotonically increasing target IDs for sending targets to the\n * watch stream.\n *\n * The client constructs two generators, one for the target cache, and one for\n * for the sync engine (to generate limbo documents targets). These\n * generators produce non-overlapping IDs (by using even and odd IDs\n * respectively).\n *\n * By separating the target ID space, the query cache can generate target IDs\n * that persist across client restarts, while sync engine can independently\n * generate in-memory target IDs that are transient and can be reused after a\n * restart.\n */\nclass __PRIVATE_TargetIdGenerator {\n constructor(e) {\n this._r = e;\n }\n next() {\n return this._r += 2, this._r;\n }\n static ar() {\n // The target cache generator must return '2' in its first call to `next()`\n // as there is no differentiation in the protocol layer between an unset\n // number and the number '0'. If we were to sent a target with target ID\n // '0', the backend would consider it unset and replace it with its own ID.\n return new __PRIVATE_TargetIdGenerator(0);\n }\n static ur() {\n // Sync engine assigns target IDs for limbo document detection.\n return new __PRIVATE_TargetIdGenerator(-1);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const xt = \"LruGarbageCollector\", Ot = 1048576;\n\nfunction __PRIVATE_bufferEntryComparator([e, t], [n, r]) {\n const i = __PRIVATE_primitiveComparator(e, n);\n return 0 === i ? __PRIVATE_primitiveComparator(t, r) : i;\n}\n\n/**\n * Used to calculate the nth sequence number. Keeps a rolling buffer of the\n * lowest n values passed to `addElement`, and finally reports the largest of\n * them in `maxValue`.\n */ class __PRIVATE_RollingSequenceNumberBuffer {\n constructor(e) {\n this.Tr = e, this.buffer = new SortedSet(__PRIVATE_bufferEntryComparator), this.Ir = 0;\n }\n dr() {\n return ++this.Ir;\n }\n Er(e) {\n const t = [ e, this.dr() ];\n if (this.buffer.size < this.Tr) this.buffer = this.buffer.add(t); else {\n const e = this.buffer.last();\n __PRIVATE_bufferEntryComparator(t, e) < 0 && (this.buffer = this.buffer.delete(e).add(t));\n }\n }\n get maxValue() {\n // Guaranteed to be non-empty. If we decide we are not collecting any\n // sequence numbers, nthSequenceNumber below short-circuits. If we have\n // decided that we are collecting n sequence numbers, it's because n is some\n // percentage of the existing sequence numbers. That means we should never\n // be in a situation where we are collecting sequence numbers but don't\n // actually have any.\n return this.buffer.last()[0];\n }\n}\n\n/**\n * This class is responsible for the scheduling of LRU garbage collection. It handles checking\n * whether or not GC is enabled, as well as which delay to use before the next run.\n */ class __PRIVATE_LruScheduler {\n constructor(e, t, n) {\n this.garbageCollector = e, this.asyncQueue = t, this.localStore = n, this.Ar = null;\n }\n start() {\n -1 !== this.garbageCollector.params.cacheSizeCollectionThreshold && this.Rr(6e4);\n }\n stop() {\n this.Ar && (this.Ar.cancel(), this.Ar = null);\n }\n get started() {\n return null !== this.Ar;\n }\n Rr(e) {\n __PRIVATE_logDebug(xt, `Garbage collection scheduled in ${e}ms`), this.Ar = this.asyncQueue.enqueueAfterDelay(\"lru_garbage_collection\" /* TimerId.LruGarbageCollection */ , e, (async () => {\n this.Ar = null;\n try {\n await this.localStore.collectGarbage(this.garbageCollector);\n } catch (e) {\n __PRIVATE_isIndexedDbTransactionError(e) ? __PRIVATE_logDebug(xt, \"Ignoring IndexedDB error during garbage collection: \", e) : await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);\n }\n await this.Rr(3e5);\n }));\n }\n}\n\n/**\n * Implements the steps for LRU garbage collection.\n */ class __PRIVATE_LruGarbageCollectorImpl {\n constructor(e, t) {\n this.Vr = e, this.params = t;\n }\n calculateTargetCount(e, t) {\n return this.Vr.mr(e).next((e => Math.floor(t / 100 * e)));\n }\n nthSequenceNumber(e, t) {\n if (0 === t) return PersistencePromise.resolve(__PRIVATE_ListenSequence.ue);\n const n = new __PRIVATE_RollingSequenceNumberBuffer(t);\n return this.Vr.forEachTarget(e, (e => n.Er(e.sequenceNumber))).next((() => this.Vr.gr(e, (e => n.Er(e))))).next((() => n.maxValue));\n }\n removeTargets(e, t, n) {\n return this.Vr.removeTargets(e, t, n);\n }\n removeOrphanedDocuments(e, t) {\n return this.Vr.removeOrphanedDocuments(e, t);\n }\n collect(e, t) {\n return -1 === this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug(\"LruGarbageCollector\", \"Garbage collection skipped; disabled\"), \n PersistencePromise.resolve(Ft)) : this.getCacheSize(e).next((n => n < this.params.cacheSizeCollectionThreshold ? (__PRIVATE_logDebug(\"LruGarbageCollector\", `Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`), \n Ft) : this.pr(e, t)));\n }\n getCacheSize(e) {\n return this.Vr.getCacheSize(e);\n }\n pr(e, t) {\n let n, r, i, s, o, _, u;\n const c = Date.now();\n return this.calculateTargetCount(e, this.params.percentileToCollect).next((t => (\n // Cap at the configured max\n t > this.params.maximumSequenceNumbersToCollect ? (__PRIVATE_logDebug(\"LruGarbageCollector\", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`), \n r = this.params.maximumSequenceNumbersToCollect) : r = t, s = Date.now(), this.nthSequenceNumber(e, r)))).next((r => (n = r, \n o = Date.now(), this.removeTargets(e, n, t)))).next((t => (i = t, _ = Date.now(), \n this.removeOrphanedDocuments(e, n)))).next((e => {\n if (u = Date.now(), __PRIVATE_getLogLevel() <= LogLevel.DEBUG) {\n __PRIVATE_logDebug(\"LruGarbageCollector\", `LRU Garbage Collection\\n\\tCounted targets in ${s - c}ms\\n\\tDetermined least recently used ${r} in ` + (o - s) + \"ms\\n\" + `\\tRemoved ${i} targets in ` + (_ - o) + \"ms\\n\" + `\\tRemoved ${e} documents in ` + (u - _) + \"ms\\n\" + `Total Duration: ${u - c}ms`);\n }\n return PersistencePromise.resolve({\n didRun: true,\n sequenceNumbersCollected: r,\n targetsRemoved: i,\n documentsRemoved: e\n });\n }));\n }\n}\n\nfunction __PRIVATE_newLruGarbageCollector(e, t) {\n return new __PRIVATE_LruGarbageCollectorImpl(e, t);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An in-memory buffer of entries to be written to a RemoteDocumentCache.\n * It can be used to batch up a set of changes to be written to the cache, but\n * additionally supports reading entries back with the `getEntry()` method,\n * falling back to the underlying RemoteDocumentCache if no entry is\n * buffered.\n *\n * Entries added to the cache *must* be read first. This is to facilitate\n * calculating the size delta of the pending changes.\n *\n * PORTING NOTE: This class was implemented then removed from other platforms.\n * If byte-counting ends up being needed on the other platforms, consider\n * porting this class as part of that implementation work.\n */ class RemoteDocumentChangeBuffer {\n constructor() {\n // A mapping of document key to the new cache entry that should be written.\n this.changes = new ObjectMap((e => e.toString()), ((e, t) => e.isEqual(t))), this.changesApplied = false;\n }\n /**\n * Buffers a `RemoteDocumentCache.addEntry()` call.\n *\n * You can only modify documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */ addEntry(e) {\n this.assertNotApplied(), this.changes.set(e.key, e);\n }\n /**\n * Buffers a `RemoteDocumentCache.removeEntry()` call.\n *\n * You can only remove documents that have already been retrieved via\n * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).\n */ removeEntry(e, t) {\n this.assertNotApplied(), this.changes.set(e, MutableDocument.newInvalidDocument(e).setReadTime(t));\n }\n /**\n * Looks up an entry in the cache. The buffered changes will first be checked,\n * and if no buffered change applies, this will forward to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction - The transaction in which to perform any persistence\n * operations.\n * @param documentKey - The key of the entry to look up.\n * @returns The cached document or an invalid document if we have nothing\n * cached.\n */ getEntry(e, t) {\n this.assertNotApplied();\n const n = this.changes.get(t);\n return void 0 !== n ? PersistencePromise.resolve(n) : this.getFromCache(e, t);\n }\n /**\n * Looks up several entries in the cache, forwarding to\n * `RemoteDocumentCache.getEntry()`.\n *\n * @param transaction - The transaction in which to perform any persistence\n * operations.\n * @param documentKeys - The keys of the entries to look up.\n * @returns A map of cached documents, indexed by key. If an entry cannot be\n * found, the corresponding key will be mapped to an invalid document.\n */ getEntries(e, t) {\n return this.getAllFromCache(e, t);\n }\n /**\n * Applies buffered changes to the underlying RemoteDocumentCache, using\n * the provided transaction.\n */ apply(e) {\n return this.assertNotApplied(), this.changesApplied = true, this.applyChanges(e);\n }\n /** Helper to assert this.changes is not null */ assertNotApplied() {}\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Schema Version for the Web client:\n * 1. Initial version including Mutation Queue, Query Cache, and Remote\n * Document Cache\n * 2. Used to ensure a targetGlobal object exists and add targetCount to it. No\n * longer required because migration 3 unconditionally clears it.\n * 3. Dropped and re-created Query Cache to deal with cache corruption related\n * to limbo resolution. Addresses\n * https://github.com/firebase/firebase-ios-sdk/issues/1548\n * 4. Multi-Tab Support.\n * 5. Removal of held write acks.\n * 6. Create document global for tracking document cache size.\n * 7. Ensure every cached document has a sentinel row with a sequence number.\n * 8. Add collection-parent index for Collection Group queries.\n * 9. Change RemoteDocumentChanges store to be keyed by readTime rather than\n * an auto-incrementing ID. This is required for Index-Free queries.\n * 10. Rewrite the canonical IDs to the explicit Protobuf-based format.\n * 11. Add bundles and named_queries for bundle support.\n * 12. Add document overlays.\n * 13. Rewrite the keys of the remote document cache to allow for efficient\n * document lookup via `getAll()`.\n * 14. Add overlays.\n * 15. Add indexing support.\n * 16. Parse timestamp strings before creating index entries.\n * 17. TODO(tomandersen)\n * 18. Encode key safe representations of IndexEntry in DbIndexEntryStore.\n */\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a local view (overlay) of a document, and the fields that are\n * locally mutated.\n */\nclass OverlayedDocument {\n constructor(e, \n /**\n * The fields that are locally mutated by patch mutations.\n *\n * If the overlayed\tdocument is from set or delete mutations, this is `null`.\n * If there is no overlay (mutation) for the document, this is an empty `FieldMask`.\n */\n t) {\n this.overlayedDocument = e, this.mutatedFields = t;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A readonly view of the local state of all documents we're tracking (i.e. we\n * have a cached version in remoteDocumentCache or local mutations for the\n * document). The view is computed by applying the mutations in the\n * MutationQueue to the RemoteDocumentCache.\n */ class LocalDocumentsView {\n constructor(e, t, n, r) {\n this.remoteDocumentCache = e, this.mutationQueue = t, this.documentOverlayCache = n, \n this.indexManager = r;\n }\n /**\n * Get the local view of the document identified by `key`.\n *\n * @returns Local view of the document or null if we don't have any cached\n * state for it.\n */ getDocument(e, t) {\n let n = null;\n return this.documentOverlayCache.getOverlay(e, t).next((r => (n = r, this.remoteDocumentCache.getEntry(e, t)))).next((e => (null !== n && __PRIVATE_mutationApplyToLocalView(n.mutation, e, FieldMask.empty(), Timestamp.now()), \n e)));\n }\n /**\n * Gets the local view of the documents identified by `keys`.\n *\n * If we don't have cached state for a document in `keys`, a NoDocument will\n * be stored for that key in the resulting set.\n */ getDocuments(e, t) {\n return this.remoteDocumentCache.getEntries(e, t).next((t => this.getLocalViewOfDocuments(e, t, __PRIVATE_documentKeySet()).next((() => t))));\n }\n /**\n * Similar to `getDocuments`, but creates the local view from the given\n * `baseDocs` without retrieving documents from the local store.\n *\n * @param transaction - The transaction this operation is scoped to.\n * @param docs - The documents to apply local mutations to get the local views.\n * @param existenceStateChanged - The set of document keys whose existence state\n * is changed. This is useful to determine if some documents overlay needs\n * to be recalculated.\n */ getLocalViewOfDocuments(e, t, n = __PRIVATE_documentKeySet()) {\n const r = __PRIVATE_newOverlayMap();\n return this.populateOverlays(e, r, t).next((() => this.computeViews(e, t, r, n).next((e => {\n let t = documentMap();\n return e.forEach(((e, n) => {\n t = t.insert(e, n.overlayedDocument);\n })), t;\n }))));\n }\n /**\n * Gets the overlayed documents for the given document map, which will include\n * the local view of those documents and a `FieldMask` indicating which fields\n * are mutated locally, `null` if overlay is a Set or Delete mutation.\n */ getOverlayedDocuments(e, t) {\n const n = __PRIVATE_newOverlayMap();\n return this.populateOverlays(e, n, t).next((() => this.computeViews(e, t, n, __PRIVATE_documentKeySet())));\n }\n /**\n * Fetches the overlays for {@code docs} and adds them to provided overlay map\n * if the map does not already contain an entry for the given document key.\n */ populateOverlays(e, t, n) {\n const r = [];\n return n.forEach((e => {\n t.has(e) || r.push(e);\n })), this.documentOverlayCache.getOverlays(e, r).next((e => {\n e.forEach(((e, n) => {\n t.set(e, n);\n }));\n }));\n }\n /**\n * Computes the local view for the given documents.\n *\n * @param docs - The documents to compute views for. It also has the base\n * version of the documents.\n * @param overlays - The overlays that need to be applied to the given base\n * version of the documents.\n * @param existenceStateChanged - A set of documents whose existence states\n * might have changed. This is used to determine if we need to re-calculate\n * overlays from mutation queues.\n * @return A map represents the local documents view.\n */ computeViews(e, t, n, r) {\n let i = __PRIVATE_mutableDocumentMap();\n const s = __PRIVATE_newDocumentKeyMap(), o = function __PRIVATE_newOverlayedDocumentMap() {\n return __PRIVATE_newDocumentKeyMap();\n }();\n return t.forEach(((e, t) => {\n const o = n.get(t.key);\n // Recalculate an overlay if the document's existence state changed due to\n // a remote event *and* the overlay is a PatchMutation. This is because\n // document existence state can change if some patch mutation's\n // preconditions are met.\n // NOTE: we recalculate when `overlay` is undefined as well, because there\n // might be a patch mutation whose precondition does not match before the\n // change (hence overlay is undefined), but would now match.\n r.has(t.key) && (void 0 === o || o.mutation instanceof __PRIVATE_PatchMutation) ? i = i.insert(t.key, t) : void 0 !== o ? (s.set(t.key, o.mutation.getFieldMask()), \n __PRIVATE_mutationApplyToLocalView(o.mutation, t, o.mutation.getFieldMask(), Timestamp.now())) : \n // no overlay exists\n // Using EMPTY to indicate there is no overlay for the document.\n s.set(t.key, FieldMask.empty());\n })), this.recalculateAndSaveOverlays(e, i).next((e => (e.forEach(((e, t) => s.set(e, t))), \n t.forEach(((e, t) => {\n var n;\n return o.set(e, new OverlayedDocument(t, null !== (n = s.get(e)) && void 0 !== n ? n : null));\n })), o)));\n }\n recalculateAndSaveOverlays(e, t) {\n const n = __PRIVATE_newDocumentKeyMap();\n // A reverse lookup map from batch id to the documents within that batch.\n let r = new SortedMap(((e, t) => e - t)), i = __PRIVATE_documentKeySet();\n return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e, t).next((e => {\n for (const i of e) i.keys().forEach((e => {\n const s = t.get(e);\n if (null === s) return;\n let o = n.get(e) || FieldMask.empty();\n o = i.applyToLocalView(s, o), n.set(e, o);\n const _ = (r.get(i.batchId) || __PRIVATE_documentKeySet()).add(e);\n r = r.insert(i.batchId, _);\n }));\n })).next((() => {\n const s = [], o = r.getReverseIterator();\n // Iterate in descending order of batch IDs, and skip documents that are\n // already saved.\n for (;o.hasNext(); ) {\n const r = o.getNext(), _ = r.key, a = r.value, u = __PRIVATE_newMutationMap();\n a.forEach((e => {\n if (!i.has(e)) {\n const r = __PRIVATE_calculateOverlayMutation(t.get(e), n.get(e));\n null !== r && u.set(e, r), i = i.add(e);\n }\n })), s.push(this.documentOverlayCache.saveOverlays(e, _, u));\n }\n return PersistencePromise.waitFor(s);\n })).next((() => n));\n }\n /**\n * Recalculates overlays by reading the documents from remote document cache\n * first, and saves them after they are calculated.\n */ recalculateAndSaveOverlaysForDocumentKeys(e, t) {\n return this.remoteDocumentCache.getEntries(e, t).next((t => this.recalculateAndSaveOverlays(e, t)));\n }\n /**\n * Performs a query against the local view of all documents.\n *\n * @param transaction - The persistence transaction.\n * @param query - The query to match documents against.\n * @param offset - Read time and key to start scanning by (exclusive).\n * @param context - A optional tracker to keep a record of important details\n * during database local query execution.\n */ getDocumentsMatchingQuery(e, t, n, r) {\n /**\n * Returns whether the query matches a single document by path (rather than a\n * collection).\n */\n return function __PRIVATE_isDocumentQuery$1(e) {\n return DocumentKey.isDocumentKey(e.path) && null === e.collectionGroup && 0 === e.filters.length;\n }(t) ? this.getDocumentsMatchingDocumentQuery(e, t.path) : __PRIVATE_isCollectionGroupQuery(t) ? this.getDocumentsMatchingCollectionGroupQuery(e, t, n, r) : this.getDocumentsMatchingCollectionQuery(e, t, n, r);\n }\n /**\n * Given a collection group, returns the next documents that follow the provided offset, along\n * with an updated batch ID.\n *\n * <p>The documents returned by this method are ordered by remote version from the provided\n * offset. If there are no more remote documents after the provided offset, documents with\n * mutations in order of batch id from the offset are returned. Since all documents in a batch are\n * returned together, the total number of documents returned can exceed {@code count}.\n *\n * @param transaction\n * @param collectionGroup The collection group for the documents.\n * @param offset The offset to index into.\n * @param count The number of documents to return\n * @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id.\n */ getNextDocuments(e, t, n, r) {\n return this.remoteDocumentCache.getAllFromCollectionGroup(e, t, n, r).next((i => {\n const s = r - i.size > 0 ? this.documentOverlayCache.getOverlaysForCollectionGroup(e, t, n.largestBatchId, r - i.size) : PersistencePromise.resolve(__PRIVATE_newOverlayMap());\n // The callsite will use the largest batch ID together with the latest read time to create\n // a new index offset. Since we only process batch IDs if all remote documents have been read,\n // no overlay will increase the overall read time. This is why we only need to special case\n // the batch id.\n let o = Q$1, _ = i;\n return s.next((t => PersistencePromise.forEach(t, ((t, n) => (o < n.largestBatchId && (o = n.largestBatchId), \n i.get(t) ? PersistencePromise.resolve() : this.remoteDocumentCache.getEntry(e, t).next((e => {\n _ = _.insert(t, e);\n }))))).next((() => this.populateOverlays(e, t, i))).next((() => this.computeViews(e, _, t, __PRIVATE_documentKeySet()))).next((e => ({\n batchId: o,\n changes: __PRIVATE_convertOverlayedDocumentMapToDocumentMap(e)\n })))));\n }));\n }\n getDocumentsMatchingDocumentQuery(e, t) {\n // Just do a simple document lookup.\n return this.getDocument(e, new DocumentKey(t)).next((e => {\n let t = documentMap();\n return e.isFoundDocument() && (t = t.insert(e.key, e)), t;\n }));\n }\n getDocumentsMatchingCollectionGroupQuery(e, t, n, r) {\n const i = t.collectionGroup;\n let s = documentMap();\n return this.indexManager.getCollectionParents(e, i).next((o => PersistencePromise.forEach(o, (o => {\n const _ = function __PRIVATE_asCollectionQueryAtPath(e, t) {\n return new __PRIVATE_QueryImpl(t, \n /*collectionGroup=*/ null, e.explicitOrderBy.slice(), e.filters.slice(), e.limit, e.limitType, e.startAt, e.endAt);\n }(t, o.child(i));\n return this.getDocumentsMatchingCollectionQuery(e, _, n, r).next((e => {\n e.forEach(((e, t) => {\n s = s.insert(e, t);\n }));\n }));\n })).next((() => s))));\n }\n getDocumentsMatchingCollectionQuery(e, t, n, r) {\n // Query the remote documents and overlay mutations.\n let i;\n return this.documentOverlayCache.getOverlaysForCollection(e, t.path, n.largestBatchId).next((s => (i = s, \n this.remoteDocumentCache.getDocumentsMatchingQuery(e, t, n, i, r)))).next((e => {\n // As documents might match the query because of their overlay we need to\n // include documents for all overlays in the initial document set.\n i.forEach(((t, n) => {\n const r = n.getKey();\n null === e.get(r) && (e = e.insert(r, MutableDocument.newInvalidDocument(r)));\n }));\n // Apply the overlays and match against the query.\n let n = documentMap();\n return e.forEach(((e, r) => {\n const s = i.get(e);\n void 0 !== s && __PRIVATE_mutationApplyToLocalView(s.mutation, r, FieldMask.empty(), Timestamp.now()), \n // Finally, insert the documents that still match the query\n __PRIVATE_queryMatches(t, r) && (n = n.insert(e, r));\n })), n;\n }));\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_MemoryBundleCache {\n constructor(e) {\n this.serializer = e, this.Br = new Map, this.Lr = new Map;\n }\n getBundleMetadata(e, t) {\n return PersistencePromise.resolve(this.Br.get(t));\n }\n saveBundleMetadata(e, t) {\n return this.Br.set(t.id, \n /** Decodes a BundleMetadata proto into a BundleMetadata object. */\n function __PRIVATE_fromBundleMetadata(e) {\n return {\n id: e.id,\n version: e.version,\n createTime: __PRIVATE_fromVersion(e.createTime)\n };\n }(t)), PersistencePromise.resolve();\n }\n getNamedQuery(e, t) {\n return PersistencePromise.resolve(this.Lr.get(t));\n }\n saveNamedQuery(e, t) {\n return this.Lr.set(t.name, function __PRIVATE_fromProtoNamedQuery(e) {\n return {\n name: e.name,\n query: __PRIVATE_fromBundledQuery(e.bundledQuery),\n readTime: __PRIVATE_fromVersion(e.readTime)\n };\n }(t)), PersistencePromise.resolve();\n }\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An in-memory implementation of DocumentOverlayCache.\n */ class __PRIVATE_MemoryDocumentOverlayCache {\n constructor() {\n // A map sorted by DocumentKey, whose value is a pair of the largest batch id\n // for the overlay and the overlay itself.\n this.overlays = new SortedMap(DocumentKey.comparator), this.kr = new Map;\n }\n getOverlay(e, t) {\n return PersistencePromise.resolve(this.overlays.get(t));\n }\n getOverlays(e, t) {\n const n = __PRIVATE_newOverlayMap();\n return PersistencePromise.forEach(t, (t => this.getOverlay(e, t).next((e => {\n null !== e && n.set(t, e);\n })))).next((() => n));\n }\n saveOverlays(e, t, n) {\n return n.forEach(((n, r) => {\n this.wt(e, t, r);\n })), PersistencePromise.resolve();\n }\n removeOverlaysForBatchId(e, t, n) {\n const r = this.kr.get(n);\n return void 0 !== r && (r.forEach((e => this.overlays = this.overlays.remove(e))), \n this.kr.delete(n)), PersistencePromise.resolve();\n }\n getOverlaysForCollection(e, t, n) {\n const r = __PRIVATE_newOverlayMap(), i = t.length + 1, s = new DocumentKey(t.child(\"\")), o = this.overlays.getIteratorFrom(s);\n for (;o.hasNext(); ) {\n const e = o.getNext().value, s = e.getKey();\n if (!t.isPrefixOf(s.path)) break;\n // Documents from sub-collections\n s.path.length === i && (e.largestBatchId > n && r.set(e.getKey(), e));\n }\n return PersistencePromise.resolve(r);\n }\n getOverlaysForCollectionGroup(e, t, n, r) {\n let i = new SortedMap(((e, t) => e - t));\n const s = this.overlays.getIterator();\n for (;s.hasNext(); ) {\n const e = s.getNext().value;\n if (e.getKey().getCollectionGroup() === t && e.largestBatchId > n) {\n let t = i.get(e.largestBatchId);\n null === t && (t = __PRIVATE_newOverlayMap(), i = i.insert(e.largestBatchId, t)), \n t.set(e.getKey(), e);\n }\n }\n const o = __PRIVATE_newOverlayMap(), _ = i.getIterator();\n for (;_.hasNext(); ) {\n if (_.getNext().value.forEach(((e, t) => o.set(e, t))), o.size() >= r) break;\n }\n return PersistencePromise.resolve(o);\n }\n wt(e, t, n) {\n // Remove the association of the overlay to its batch id.\n const r = this.overlays.get(n.key);\n if (null !== r) {\n const e = this.kr.get(r.largestBatchId).delete(n.key);\n this.kr.set(r.largestBatchId, e);\n }\n this.overlays = this.overlays.insert(n.key, new Overlay(t, n));\n // Create the association of this overlay to the given largestBatchId.\n let i = this.kr.get(t);\n void 0 === i && (i = __PRIVATE_documentKeySet(), this.kr.set(t, i)), this.kr.set(t, i.add(n.key));\n }\n}\n\n/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_MemoryGlobalsCache {\n constructor() {\n this.sessionToken = ByteString.EMPTY_BYTE_STRING;\n }\n getSessionToken(e) {\n return PersistencePromise.resolve(this.sessionToken);\n }\n setSessionToken(e, t) {\n return this.sessionToken = t, PersistencePromise.resolve();\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A collection of references to a document from some kind of numbered entity\n * (either a target ID or batch ID). As references are added to or removed from\n * the set corresponding events are emitted to a registered garbage collector.\n *\n * Each reference is represented by a DocumentReference object. Each of them\n * contains enough information to uniquely identify the reference. They are all\n * stored primarily in a set sorted by key. A document is considered garbage if\n * there's no references in that set (this can be efficiently checked thanks to\n * sorting by key).\n *\n * ReferenceSet also keeps a secondary set that contains references sorted by\n * IDs. This one is used to efficiently implement removal of all references by\n * some target ID.\n */ class __PRIVATE_ReferenceSet {\n constructor() {\n // A set of outstanding references to a document sorted by key.\n this.qr = new SortedSet(__PRIVATE_DocReference.Qr), \n // A set of outstanding references to a document sorted by target id.\n this.$r = new SortedSet(__PRIVATE_DocReference.Ur);\n }\n /** Returns true if the reference set contains no references. */ isEmpty() {\n return this.qr.isEmpty();\n }\n /** Adds a reference to the given document key for the given ID. */ addReference(e, t) {\n const n = new __PRIVATE_DocReference(e, t);\n this.qr = this.qr.add(n), this.$r = this.$r.add(n);\n }\n /** Add references to the given document keys for the given ID. */ Kr(e, t) {\n e.forEach((e => this.addReference(e, t)));\n }\n /**\n * Removes a reference to the given document key for the given\n * ID.\n */ removeReference(e, t) {\n this.Wr(new __PRIVATE_DocReference(e, t));\n }\n Gr(e, t) {\n e.forEach((e => this.removeReference(e, t)));\n }\n /**\n * Clears all references with a given ID. Calls removeRef() for each key\n * removed.\n */ zr(e) {\n const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1), i = [];\n return this.$r.forEachInRange([ n, r ], (e => {\n this.Wr(e), i.push(e.key);\n })), i;\n }\n jr() {\n this.qr.forEach((e => this.Wr(e)));\n }\n Wr(e) {\n this.qr = this.qr.delete(e), this.$r = this.$r.delete(e);\n }\n Jr(e) {\n const t = new DocumentKey(new ResourcePath([])), n = new __PRIVATE_DocReference(t, e), r = new __PRIVATE_DocReference(t, e + 1);\n let i = __PRIVATE_documentKeySet();\n return this.$r.forEachInRange([ n, r ], (e => {\n i = i.add(e.key);\n })), i;\n }\n containsKey(e) {\n const t = new __PRIVATE_DocReference(e, 0), n = this.qr.firstAfterOrEqual(t);\n return null !== n && e.isEqual(n.key);\n }\n}\n\nclass __PRIVATE_DocReference {\n constructor(e, t) {\n this.key = e, this.Hr = t;\n }\n /** Compare by key then by ID */ static Qr(e, t) {\n return DocumentKey.comparator(e.key, t.key) || __PRIVATE_primitiveComparator(e.Hr, t.Hr);\n }\n /** Compare by ID then by key */ static Ur(e, t) {\n return __PRIVATE_primitiveComparator(e.Hr, t.Hr) || DocumentKey.comparator(e.key, t.key);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_MemoryMutationQueue {\n constructor(e, t) {\n this.indexManager = e, this.referenceDelegate = t, \n /**\n * The set of all mutations that have been sent but not yet been applied to\n * the backend.\n */\n this.mutationQueue = [], \n /** Next value to use when assigning sequential IDs to each mutation batch. */\n this.er = 1, \n /** An ordered mapping between documents and the mutations batch IDs. */\n this.Yr = new SortedSet(__PRIVATE_DocReference.Qr);\n }\n checkEmpty(e) {\n return PersistencePromise.resolve(0 === this.mutationQueue.length);\n }\n addMutationBatch(e, t, n, r) {\n const i = this.er;\n this.er++, this.mutationQueue.length > 0 && this.mutationQueue[this.mutationQueue.length - 1];\n const s = new MutationBatch(i, t, n, r);\n this.mutationQueue.push(s);\n // Track references by document key and index collection parents.\n for (const t of r) this.Yr = this.Yr.add(new __PRIVATE_DocReference(t.key, i)), \n this.indexManager.addToCollectionParentIndex(e, t.key.path.popLast());\n return PersistencePromise.resolve(s);\n }\n lookupMutationBatch(e, t) {\n return PersistencePromise.resolve(this.Zr(t));\n }\n getNextMutationBatchAfterBatchId(e, t) {\n const n = t + 1, r = this.Xr(n), i = r < 0 ? 0 : r;\n // The requested batchId may still be out of range so normalize it to the\n // start of the queue.\n return PersistencePromise.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null);\n }\n getHighestUnacknowledgedBatchId() {\n return PersistencePromise.resolve(0 === this.mutationQueue.length ? G : this.er - 1);\n }\n getAllMutationBatches(e) {\n return PersistencePromise.resolve(this.mutationQueue.slice());\n }\n getAllMutationBatchesAffectingDocumentKey(e, t) {\n const n = new __PRIVATE_DocReference(t, 0), r = new __PRIVATE_DocReference(t, Number.POSITIVE_INFINITY), i = [];\n return this.Yr.forEachInRange([ n, r ], (e => {\n const t = this.Zr(e.Hr);\n i.push(t);\n })), PersistencePromise.resolve(i);\n }\n getAllMutationBatchesAffectingDocumentKeys(e, t) {\n let n = new SortedSet(__PRIVATE_primitiveComparator);\n return t.forEach((e => {\n const t = new __PRIVATE_DocReference(e, 0), r = new __PRIVATE_DocReference(e, Number.POSITIVE_INFINITY);\n this.Yr.forEachInRange([ t, r ], (e => {\n n = n.add(e.Hr);\n }));\n })), PersistencePromise.resolve(this.ei(n));\n }\n getAllMutationBatchesAffectingQuery(e, t) {\n // Use the query path as a prefix for testing if a document matches the\n // query.\n const n = t.path, r = n.length + 1;\n // Construct a document reference for actually scanning the index. Unlike\n // the prefix the document key in this reference must have an even number of\n // segments. The empty segment can be used a suffix of the query path\n // because it precedes all other segments in an ordered traversal.\n let i = n;\n DocumentKey.isDocumentKey(i) || (i = i.child(\"\"));\n const s = new __PRIVATE_DocReference(new DocumentKey(i), 0);\n // Find unique batchIDs referenced by all documents potentially matching the\n // query.\n let o = new SortedSet(__PRIVATE_primitiveComparator);\n return this.Yr.forEachWhile((e => {\n const t = e.key.path;\n return !!n.isPrefixOf(t) && (\n // Rows with document keys more than one segment longer than the query\n // path can't be matches. For example, a query on 'rooms' can't match\n // the document /rooms/abc/messages/xyx.\n // TODO(mcg): we'll need a different scanner when we implement\n // ancestor queries.\n t.length === r && (o = o.add(e.Hr)), true);\n }), s), PersistencePromise.resolve(this.ei(o));\n }\n ei(e) {\n // Construct an array of matching batches, sorted by batchID to ensure that\n // multiple mutations affecting the same document key are applied in order.\n const t = [];\n return e.forEach((e => {\n const n = this.Zr(e);\n null !== n && t.push(n);\n })), t;\n }\n removeMutationBatch(e, t) {\n __PRIVATE_hardAssert(0 === this.ti(t.batchId, \"removed\"), 55003), this.mutationQueue.shift();\n let n = this.Yr;\n return PersistencePromise.forEach(t.mutations, (r => {\n const i = new __PRIVATE_DocReference(r.key, t.batchId);\n return n = n.delete(i), this.referenceDelegate.markPotentiallyOrphaned(e, r.key);\n })).next((() => {\n this.Yr = n;\n }));\n }\n rr(e) {\n // No-op since the memory mutation queue does not maintain a separate cache.\n }\n containsKey(e, t) {\n const n = new __PRIVATE_DocReference(t, 0), r = this.Yr.firstAfterOrEqual(n);\n return PersistencePromise.resolve(t.isEqual(r && r.key));\n }\n performConsistencyCheck(e) {\n return this.mutationQueue.length, PersistencePromise.resolve();\n }\n /**\n * Finds the index of the given batchId in the mutation queue and asserts that\n * the resulting index is within the bounds of the queue.\n *\n * @param batchId - The batchId to search for\n * @param action - A description of what the caller is doing, phrased in passive\n * form (e.g. \"acknowledged\" in a routine that acknowledges batches).\n */ ti(e, t) {\n return this.Xr(e);\n }\n /**\n * Finds the index of the given batchId in the mutation queue. This operation\n * is O(1).\n *\n * @returns The computed index of the batch with the given batchId, based on\n * the state of the queue. Note this index can be negative if the requested\n * batchId has already been removed from the queue or past the end of the\n * queue if the batchId is larger than the last added batch.\n */ Xr(e) {\n if (0 === this.mutationQueue.length) \n // As an index this is past the end of the queue\n return 0;\n // Examine the front of the queue to figure out the difference between the\n // batchId and indexes in the array. Note that since the queue is ordered\n // by batchId, if the first batch has a larger batchId then the requested\n // batchId doesn't exist in the queue.\n return e - this.mutationQueue[0].batchId;\n }\n /**\n * A version of lookupMutationBatch that doesn't return a promise, this makes\n * other functions that uses this code easier to read and more efficient.\n */ Zr(e) {\n const t = this.Xr(e);\n if (t < 0 || t >= this.mutationQueue.length) return null;\n return this.mutationQueue[t];\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The smallest value representable by a 64-bit signed integer (long).\n */\n/**\n * The memory-only RemoteDocumentCache for IndexedDb. To construct, invoke\n * `newMemoryRemoteDocumentCache()`.\n */\nclass __PRIVATE_MemoryRemoteDocumentCacheImpl {\n /**\n * @param sizer - Used to assess the size of a document. For eager GC, this is\n * expected to just return 0 to avoid unnecessarily doing the work of\n * calculating the size.\n */\n constructor(e) {\n this.ni = e, \n /** Underlying cache of documents and their read times. */\n this.docs = function __PRIVATE_documentEntryMap() {\n return new SortedMap(DocumentKey.comparator);\n }(), \n /** Size of all cached documents. */\n this.size = 0;\n }\n setIndexManager(e) {\n this.indexManager = e;\n }\n /**\n * Adds the supplied entry to the cache and updates the cache size as appropriate.\n *\n * All calls of `addEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */ addEntry(e, t) {\n const n = t.key, r = this.docs.get(n), i = r ? r.size : 0, s = this.ni(t);\n return this.docs = this.docs.insert(n, {\n document: t.mutableCopy(),\n size: s\n }), this.size += s - i, this.indexManager.addToCollectionParentIndex(e, n.path.popLast());\n }\n /**\n * Removes the specified entry from the cache and updates the cache size as appropriate.\n *\n * All calls of `removeEntry` are required to go through the RemoteDocumentChangeBuffer\n * returned by `newChangeBuffer()`.\n */ removeEntry(e) {\n const t = this.docs.get(e);\n t && (this.docs = this.docs.remove(e), this.size -= t.size);\n }\n getEntry(e, t) {\n const n = this.docs.get(t);\n return PersistencePromise.resolve(n ? n.document.mutableCopy() : MutableDocument.newInvalidDocument(t));\n }\n getEntries(e, t) {\n let n = __PRIVATE_mutableDocumentMap();\n return t.forEach((e => {\n const t = this.docs.get(e);\n n = n.insert(e, t ? t.document.mutableCopy() : MutableDocument.newInvalidDocument(e));\n })), PersistencePromise.resolve(n);\n }\n getDocumentsMatchingQuery(e, t, n, r) {\n let i = __PRIVATE_mutableDocumentMap();\n // Documents are ordered by key, so we can use a prefix scan to narrow down\n // the documents we need to match the query against.\n const s = t.path, o = new DocumentKey(s.child(\"__id-9223372036854775808__\")), _ = this.docs.getIteratorFrom(o);\n // Document keys are ordered first by numeric value (\"__id<Long>__\"),\n // then lexicographically by string value. Start the iterator at the minimum\n // possible Document key value.\n for (;_.hasNext(); ) {\n const {key: e, value: {document: o}} = _.getNext();\n if (!s.isPrefixOf(e.path)) break;\n e.path.length > s.length + 1 || (__PRIVATE_indexOffsetComparator(__PRIVATE_newIndexOffsetFromDocument(o), n) <= 0 || (r.has(o.key) || __PRIVATE_queryMatches(t, o)) && (i = i.insert(o.key, o.mutableCopy())));\n }\n return PersistencePromise.resolve(i);\n }\n getAllFromCollectionGroup(e, t, n, r) {\n // This method should only be called from the IndexBackfiller if persistence\n // is enabled.\n fail(9500);\n }\n ri(e, t) {\n return PersistencePromise.forEach(this.docs, (e => t(e)));\n }\n newChangeBuffer(e) {\n // `trackRemovals` is ignores since the MemoryRemoteDocumentCache keeps\n // a separate changelog and does not need special handling for removals.\n return new __PRIVATE_MemoryRemoteDocumentChangeBuffer(this);\n }\n getSize(e) {\n return PersistencePromise.resolve(this.size);\n }\n}\n\n/**\n * Creates a new memory-only RemoteDocumentCache.\n *\n * @param sizer - Used to assess the size of a document. For eager GC, this is\n * expected to just return 0 to avoid unnecessarily doing the work of\n * calculating the size.\n */\n/**\n * Handles the details of adding and updating documents in the MemoryRemoteDocumentCache.\n */\nclass __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuffer {\n constructor(e) {\n super(), this.Or = e;\n }\n applyChanges(e) {\n const t = [];\n return this.changes.forEach(((n, r) => {\n r.isValidDocument() ? t.push(this.Or.addEntry(e, r)) : this.Or.removeEntry(n);\n })), PersistencePromise.waitFor(t);\n }\n getFromCache(e, t) {\n return this.Or.getEntry(e, t);\n }\n getAllFromCache(e, t) {\n return this.Or.getEntries(e, t);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_MemoryTargetCache {\n constructor(e) {\n this.persistence = e, \n /**\n * Maps a target to the data about that target\n */\n this.ii = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals), \n /** The last received snapshot version. */\n this.lastRemoteSnapshotVersion = SnapshotVersion.min(), \n /** The highest numbered target ID encountered. */\n this.highestTargetId = 0, \n /** The highest sequence number encountered. */\n this.si = 0, \n /**\n * A ordered bidirectional mapping between documents and the remote target\n * IDs.\n */\n this.oi = new __PRIVATE_ReferenceSet, this.targetCount = 0, this._i = __PRIVATE_TargetIdGenerator.ar();\n }\n forEachTarget(e, t) {\n return this.ii.forEach(((e, n) => t(n))), PersistencePromise.resolve();\n }\n getLastRemoteSnapshotVersion(e) {\n return PersistencePromise.resolve(this.lastRemoteSnapshotVersion);\n }\n getHighestSequenceNumber(e) {\n return PersistencePromise.resolve(this.si);\n }\n allocateTargetId(e) {\n return this.highestTargetId = this._i.next(), PersistencePromise.resolve(this.highestTargetId);\n }\n setTargetsMetadata(e, t, n) {\n return n && (this.lastRemoteSnapshotVersion = n), t > this.si && (this.si = t), \n PersistencePromise.resolve();\n }\n hr(e) {\n this.ii.set(e.target, e);\n const t = e.targetId;\n t > this.highestTargetId && (this._i = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t), \n e.sequenceNumber > this.si && (this.si = e.sequenceNumber);\n }\n addTargetData(e, t) {\n return this.hr(t), this.targetCount += 1, PersistencePromise.resolve();\n }\n updateTargetData(e, t) {\n return this.hr(t), PersistencePromise.resolve();\n }\n removeTargetData(e, t) {\n return this.ii.delete(t.target), this.oi.zr(t.targetId), this.targetCount -= 1, \n PersistencePromise.resolve();\n }\n removeTargets(e, t, n) {\n let r = 0;\n const i = [];\n return this.ii.forEach(((s, o) => {\n o.sequenceNumber <= t && null === n.get(o.targetId) && (this.ii.delete(s), i.push(this.removeMatchingKeysForTargetId(e, o.targetId)), \n r++);\n })), PersistencePromise.waitFor(i).next((() => r));\n }\n getTargetCount(e) {\n return PersistencePromise.resolve(this.targetCount);\n }\n getTargetData(e, t) {\n const n = this.ii.get(t) || null;\n return PersistencePromise.resolve(n);\n }\n addMatchingKeys(e, t, n) {\n return this.oi.Kr(t, n), PersistencePromise.resolve();\n }\n removeMatchingKeys(e, t, n) {\n this.oi.Gr(t, n);\n const r = this.persistence.referenceDelegate, i = [];\n return r && t.forEach((t => {\n i.push(r.markPotentiallyOrphaned(e, t));\n })), PersistencePromise.waitFor(i);\n }\n removeMatchingKeysForTargetId(e, t) {\n return this.oi.zr(t), PersistencePromise.resolve();\n }\n getMatchingKeysForTargetId(e, t) {\n const n = this.oi.Jr(t);\n return PersistencePromise.resolve(n);\n }\n containsKey(e, t) {\n return PersistencePromise.resolve(this.oi.containsKey(t));\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A memory-backed instance of Persistence. Data is stored only in RAM and\n * not persisted across sessions.\n */\nclass __PRIVATE_MemoryPersistence {\n /**\n * The constructor accepts a factory for creating a reference delegate. This\n * allows both the delegate and this instance to have strong references to\n * each other without having nullable fields that would then need to be\n * checked or asserted on every access.\n */\n constructor(e, t) {\n this.ai = {}, this.overlays = {}, this.ui = new __PRIVATE_ListenSequence(0), this.ci = false, \n this.ci = true, this.li = new __PRIVATE_MemoryGlobalsCache, this.referenceDelegate = e(this), \n this.hi = new __PRIVATE_MemoryTargetCache(this);\n this.indexManager = new __PRIVATE_MemoryIndexManager, this.remoteDocumentCache = function __PRIVATE_newMemoryRemoteDocumentCache(e) {\n return new __PRIVATE_MemoryRemoteDocumentCacheImpl(e);\n }((e => this.referenceDelegate.Pi(e))), this.serializer = new __PRIVATE_LocalSerializer(t), \n this.Ti = new __PRIVATE_MemoryBundleCache(this.serializer);\n }\n start() {\n return Promise.resolve();\n }\n shutdown() {\n // No durable state to ensure is closed on shutdown.\n return this.ci = false, Promise.resolve();\n }\n get started() {\n return this.ci;\n }\n setDatabaseDeletedListener() {\n // No op.\n }\n setNetworkEnabled() {\n // No op.\n }\n getIndexManager(e) {\n // We do not currently support indices for memory persistence, so we can\n // return the same shared instance of the memory index manager.\n return this.indexManager;\n }\n getDocumentOverlayCache(e) {\n let t = this.overlays[e.toKey()];\n return t || (t = new __PRIVATE_MemoryDocumentOverlayCache, this.overlays[e.toKey()] = t), \n t;\n }\n getMutationQueue(e, t) {\n let n = this.ai[e.toKey()];\n return n || (n = new __PRIVATE_MemoryMutationQueue(t, this.referenceDelegate), this.ai[e.toKey()] = n), \n n;\n }\n getGlobalsCache() {\n return this.li;\n }\n getTargetCache() {\n return this.hi;\n }\n getRemoteDocumentCache() {\n return this.remoteDocumentCache;\n }\n getBundleCache() {\n return this.Ti;\n }\n runTransaction(e, t, n) {\n __PRIVATE_logDebug(\"MemoryPersistence\", \"Starting transaction:\", e);\n const r = new __PRIVATE_MemoryTransaction(this.ui.next());\n return this.referenceDelegate.Ii(), n(r).next((e => this.referenceDelegate.di(r).next((() => e)))).toPromise().then((e => (r.raiseOnCommittedEvent(), \n e)));\n }\n Ei(e, t) {\n return PersistencePromise.or(Object.values(this.ai).map((n => () => n.containsKey(e, t))));\n }\n}\n\n/**\n * Memory persistence is not actually transactional, but future implementations\n * may have transaction-scoped state.\n */ class __PRIVATE_MemoryTransaction extends PersistenceTransaction {\n constructor(e) {\n super(), this.currentSequenceNumber = e;\n }\n}\n\nclass __PRIVATE_MemoryEagerDelegate {\n constructor(e) {\n this.persistence = e, \n /** Tracks all documents that are active in Query views. */\n this.Ai = new __PRIVATE_ReferenceSet, \n /** The list of documents that are potentially GCed after each transaction. */\n this.Ri = null;\n }\n static Vi(e) {\n return new __PRIVATE_MemoryEagerDelegate(e);\n }\n get mi() {\n if (this.Ri) return this.Ri;\n throw fail(60996);\n }\n addReference(e, t, n) {\n return this.Ai.addReference(n, t), this.mi.delete(n.toString()), PersistencePromise.resolve();\n }\n removeReference(e, t, n) {\n return this.Ai.removeReference(n, t), this.mi.add(n.toString()), PersistencePromise.resolve();\n }\n markPotentiallyOrphaned(e, t) {\n return this.mi.add(t.toString()), PersistencePromise.resolve();\n }\n removeTarget(e, t) {\n this.Ai.zr(t.targetId).forEach((e => this.mi.add(e.toString())));\n const n = this.persistence.getTargetCache();\n return n.getMatchingKeysForTargetId(e, t.targetId).next((e => {\n e.forEach((e => this.mi.add(e.toString())));\n })).next((() => n.removeTargetData(e, t)));\n }\n Ii() {\n this.Ri = new Set;\n }\n di(e) {\n // Remove newly orphaned documents.\n const t = this.persistence.getRemoteDocumentCache().newChangeBuffer();\n return PersistencePromise.forEach(this.mi, (n => {\n const r = DocumentKey.fromPath(n);\n return this.fi(e, r).next((e => {\n e || t.removeEntry(r, SnapshotVersion.min());\n }));\n })).next((() => (this.Ri = null, t.apply(e))));\n }\n updateLimboDocument(e, t) {\n return this.fi(e, t).next((e => {\n e ? this.mi.delete(t.toString()) : this.mi.add(t.toString());\n }));\n }\n Pi(e) {\n // For eager GC, we don't care about the document size, there are no size thresholds.\n return 0;\n }\n fi(e, t) {\n return PersistencePromise.or([ () => PersistencePromise.resolve(this.Ai.containsKey(t)), () => this.persistence.getTargetCache().containsKey(e, t), () => this.persistence.Ei(e, t) ]);\n }\n}\n\nclass __PRIVATE_MemoryLruDelegate {\n constructor(e, t) {\n this.persistence = e, this.gi = new ObjectMap((e => __PRIVATE_encodeResourcePath(e.path)), ((e, t) => e.isEqual(t))), \n this.garbageCollector = __PRIVATE_newLruGarbageCollector(this, t);\n }\n static Vi(e, t) {\n return new __PRIVATE_MemoryLruDelegate(e, t);\n }\n // No-ops, present so memory persistence doesn't have to care which delegate\n // it has.\n Ii() {}\n di(e) {\n return PersistencePromise.resolve();\n }\n forEachTarget(e, t) {\n return this.persistence.getTargetCache().forEachTarget(e, t);\n }\n mr(e) {\n const t = this.yr(e);\n return this.persistence.getTargetCache().getTargetCount(e).next((e => t.next((t => e + t))));\n }\n yr(e) {\n let t = 0;\n return this.gr(e, (e => {\n t++;\n })).next((() => t));\n }\n gr(e, t) {\n return PersistencePromise.forEach(this.gi, ((n, r) => this.Sr(e, n, r).next((e => e ? PersistencePromise.resolve() : t(r)))));\n }\n removeTargets(e, t, n) {\n return this.persistence.getTargetCache().removeTargets(e, t, n);\n }\n removeOrphanedDocuments(e, t) {\n let n = 0;\n const r = this.persistence.getRemoteDocumentCache(), i = r.newChangeBuffer();\n return r.ri(e, (r => this.Sr(e, r, t).next((e => {\n e || (n++, i.removeEntry(r, SnapshotVersion.min()));\n })))).next((() => i.apply(e))).next((() => n));\n }\n markPotentiallyOrphaned(e, t) {\n return this.gi.set(t, e.currentSequenceNumber), PersistencePromise.resolve();\n }\n removeTarget(e, t) {\n const n = t.withSequenceNumber(e.currentSequenceNumber);\n return this.persistence.getTargetCache().updateTargetData(e, n);\n }\n addReference(e, t, n) {\n return this.gi.set(n, e.currentSequenceNumber), PersistencePromise.resolve();\n }\n removeReference(e, t, n) {\n return this.gi.set(n, e.currentSequenceNumber), PersistencePromise.resolve();\n }\n updateLimboDocument(e, t) {\n return this.gi.set(t, e.currentSequenceNumber), PersistencePromise.resolve();\n }\n Pi(e) {\n let t = e.key.toString().length;\n return e.isFoundDocument() && (t += __PRIVATE_estimateByteSize(e.data.value)), t;\n }\n Sr(e, t, n) {\n return PersistencePromise.or([ () => this.persistence.Ei(e, t), () => this.persistence.getTargetCache().containsKey(e, t), () => {\n const e = this.gi.get(t);\n return PersistencePromise.resolve(void 0 !== e && e > n);\n } ]);\n }\n getCacheSize(e) {\n return this.persistence.getRemoteDocumentCache().getSize(e);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A set of changes to what documents are currently in view and out of view for\n * a given query. These changes are sent to the LocalStore by the View (via\n * the SyncEngine) and are used to pin / unpin documents as appropriate.\n */\nclass __PRIVATE_LocalViewChanges {\n constructor(e, t, n, r) {\n this.targetId = e, this.fromCache = t, this.Is = n, this.ds = r;\n }\n static Es(e, t) {\n let n = __PRIVATE_documentKeySet(), r = __PRIVATE_documentKeySet();\n for (const e of t.docChanges) switch (e.type) {\n case 0 /* ChangeType.Added */ :\n n = n.add(e.doc.key);\n break;\n\n case 1 /* ChangeType.Removed */ :\n r = r.add(e.doc.key);\n // do nothing\n }\n return new __PRIVATE_LocalViewChanges(e, t.fromCache, n, r);\n }\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A tracker to keep a record of important details during database local query\n * execution.\n */ class QueryContext {\n constructor() {\n /**\n * Counts the number of documents passed through during local query execution.\n */\n this._documentReadCount = 0;\n }\n get documentReadCount() {\n return this._documentReadCount;\n }\n incrementDocumentReadCount(e) {\n this._documentReadCount += e;\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The Firestore query engine.\n *\n * Firestore queries can be executed in three modes. The Query Engine determines\n * what mode to use based on what data is persisted. The mode only determines\n * the runtime complexity of the query - the result set is equivalent across all\n * implementations.\n *\n * The Query engine will use indexed-based execution if a user has configured\n * any index that can be used to execute query (via `setIndexConfiguration()`).\n * Otherwise, the engine will try to optimize the query by re-using a previously\n * persisted query result. If that is not possible, the query will be executed\n * via a full collection scan.\n *\n * Index-based execution is the default when available. The query engine\n * supports partial indexed execution and merges the result from the index\n * lookup with documents that have not yet been indexed. The index evaluation\n * matches the backend's format and as such, the SDK can use indexing for all\n * queries that the backend supports.\n *\n * If no index exists, the query engine tries to take advantage of the target\n * document mapping in the TargetCache. These mappings exists for all queries\n * that have been synced with the backend at least once and allow the query\n * engine to only read documents that previously matched a query plus any\n * documents that were edited after the query was last listened to.\n *\n * There are some cases when this optimization is not guaranteed to produce\n * the same results as full collection scans. In these cases, query\n * processing falls back to full scans. These cases are:\n *\n * - Limit queries where a document that matched the query previously no longer\n * matches the query.\n *\n * - Limit queries where a document edit may cause the document to sort below\n * another document that is in the local cache.\n *\n * - Queries that have never been CURRENT or free of limbo documents.\n */\nclass __PRIVATE_QueryEngine {\n constructor() {\n this.As = false, this.Rs = false, \n /**\n * SDK only decides whether it should create index when collection size is\n * larger than this.\n */\n this.Vs = 100, this.fs = \n /**\n * This cost represents the evaluation result of\n * (([index, docKey] + [docKey, docContent]) per document in the result set)\n * / ([docKey, docContent] per documents in full collection scan) coming from\n * experiment [enter PR experiment URL here].\n */\n function __PRIVATE_getDefaultRelativeIndexReadCostPerDocument() {\n // These values were derived from an experiment where several members of the\n // Firestore SDK team ran a performance test in various environments.\n // Googlers can see b/299284287 for details.\n return isSafari() ? 8 : __PRIVATE_getAndroidVersion(getUA()) > 0 ? 6 : 4;\n }();\n }\n /** Sets the document view to query against. */ initialize(e, t) {\n this.gs = e, this.indexManager = t, this.As = true;\n }\n /** Returns all local documents matching the specified query. */ getDocumentsMatchingQuery(e, t, n, r) {\n // Stores the result from executing the query; using this object is more\n // convenient than passing the result between steps of the persistence\n // transaction and improves readability comparatively.\n const i = {\n result: null\n };\n return this.ps(e, t).next((e => {\n i.result = e;\n })).next((() => {\n if (!i.result) return this.ys(e, t, r, n).next((e => {\n i.result = e;\n }));\n })).next((() => {\n if (i.result) return;\n const n = new QueryContext;\n return this.ws(e, t, n).next((r => {\n if (i.result = r, this.Rs) return this.Ss(e, t, n, r.size);\n }));\n })).next((() => i.result));\n }\n Ss(e, t, n, r) {\n return n.documentReadCount < this.Vs ? (__PRIVATE_getLogLevel() <= LogLevel.DEBUG && __PRIVATE_logDebug(\"QueryEngine\", \"SDK will not create cache indexes for query:\", __PRIVATE_stringifyQuery(t), \"since it only creates cache indexes for collection contains\", \"more than or equal to\", this.Vs, \"documents\"), \n PersistencePromise.resolve()) : (__PRIVATE_getLogLevel() <= LogLevel.DEBUG && __PRIVATE_logDebug(\"QueryEngine\", \"Query:\", __PRIVATE_stringifyQuery(t), \"scans\", n.documentReadCount, \"local documents and returns\", r, \"documents as results.\"), \n n.documentReadCount > this.fs * r ? (__PRIVATE_getLogLevel() <= LogLevel.DEBUG && __PRIVATE_logDebug(\"QueryEngine\", \"The SDK decides to create cache indexes for query:\", __PRIVATE_stringifyQuery(t), \"as using cache indexes may help improve performance.\"), \n this.indexManager.createTargetIndexes(e, __PRIVATE_queryToTarget(t))) : PersistencePromise.resolve());\n }\n /**\n * Performs an indexed query that evaluates the query based on a collection's\n * persisted index values. Returns `null` if an index is not available.\n */ ps(e, t) {\n if (__PRIVATE_queryMatchesAllDocuments(t)) \n // Queries that match all documents don't benefit from using\n // key-based lookups. It is more efficient to scan all documents in a\n // collection, rather than to perform individual lookups.\n return PersistencePromise.resolve(null);\n let n = __PRIVATE_queryToTarget(t);\n return this.indexManager.getIndexType(e, n).next((r => 0 /* IndexType.NONE */ === r ? null : (null !== t.limit && 1 /* IndexType.PARTIAL */ === r && (\n // We cannot apply a limit for targets that are served using a partial\n // index. If a partial index will be used to serve the target, the\n // query may return a superset of documents that match the target\n // (e.g. if the index doesn't include all the target's filters), or\n // may return the correct set of documents in the wrong order (e.g. if\n // the index doesn't include a segment for one of the orderBys).\n // Therefore, a limit should not be applied in such cases.\n t = __PRIVATE_queryWithLimit(t, null, \"F\" /* LimitType.First */), n = __PRIVATE_queryToTarget(t)), \n this.indexManager.getDocumentsMatchingTarget(e, n).next((r => {\n const i = __PRIVATE_documentKeySet(...r);\n return this.gs.getDocuments(e, i).next((r => this.indexManager.getMinOffset(e, n).next((n => {\n const s = this.bs(t, r);\n return this.Ds(t, s, i, n.readTime) ? this.ps(e, __PRIVATE_queryWithLimit(t, null, \"F\" /* LimitType.First */)) : this.vs(e, s, t, n);\n }))));\n })))));\n }\n /**\n * Performs a query based on the target's persisted query mapping. Returns\n * `null` if the mapping is not available or cannot be used.\n */ ys(e, t, n, r) {\n return __PRIVATE_queryMatchesAllDocuments(t) || r.isEqual(SnapshotVersion.min()) ? PersistencePromise.resolve(null) : this.gs.getDocuments(e, n).next((i => {\n const s = this.bs(t, i);\n return this.Ds(t, s, n, r) ? PersistencePromise.resolve(null) : (__PRIVATE_getLogLevel() <= LogLevel.DEBUG && __PRIVATE_logDebug(\"QueryEngine\", \"Re-using previous result from %s to execute query: %s\", r.toString(), __PRIVATE_stringifyQuery(t)), \n this.vs(e, s, t, __PRIVATE_newIndexOffsetSuccessorFromReadTime(r, Q$1)).next((e => e)));\n }));\n // Queries that have never seen a snapshot without limbo free documents\n // should also be run as a full collection scan.\n }\n /** Applies the query filter and sorting to the provided documents. */ bs(e, t) {\n // Sort the documents and re-apply the query filter since previously\n // matching documents do not necessarily still match the query.\n let n = new SortedSet(__PRIVATE_newQueryComparator(e));\n return t.forEach(((t, r) => {\n __PRIVATE_queryMatches(e, r) && (n = n.add(r));\n })), n;\n }\n /**\n * Determines if a limit query needs to be refilled from cache, making it\n * ineligible for index-free execution.\n *\n * @param query - The query.\n * @param sortedPreviousResults - The documents that matched the query when it\n * was last synchronized, sorted by the query's comparator.\n * @param remoteKeys - The document keys that matched the query at the last\n * snapshot.\n * @param limboFreeSnapshotVersion - The version of the snapshot when the\n * query was last synchronized.\n */ Ds(e, t, n, r) {\n if (null === e.limit) \n // Queries without limits do not need to be refilled.\n return false;\n if (n.size !== t.size) \n // The query needs to be refilled if a previously matching document no\n // longer matches.\n return true;\n // Limit queries are not eligible for index-free query execution if there is\n // a potential that an older document from cache now sorts before a document\n // that was previously part of the limit. This, however, can only happen if\n // the document at the edge of the limit goes out of limit.\n // If a document that is not the limit boundary sorts differently,\n // the boundary of the limit itself did not change and documents from cache\n // will continue to be \"rejected\" by this boundary. Therefore, we can ignore\n // any modifications that don't affect the last document.\n const i = \"F\" /* LimitType.First */ === e.limitType ? t.last() : t.first();\n return !!i && (i.hasPendingWrites || i.version.compareTo(r) > 0);\n }\n ws(e, t, n) {\n return __PRIVATE_getLogLevel() <= LogLevel.DEBUG && __PRIVATE_logDebug(\"QueryEngine\", \"Using full collection scan to execute query:\", __PRIVATE_stringifyQuery(t)), \n this.gs.getDocumentsMatchingQuery(e, t, IndexOffset.min(), n);\n }\n /**\n * Combines the results from an indexed execution with the remaining documents\n * that have not yet been indexed.\n */ vs(e, t, n, r) {\n // Retrieve all results for documents that were updated since the offset.\n return this.gs.getDocumentsMatchingQuery(e, n, r).next((e => (\n // Merge with existing results\n t.forEach((t => {\n e = e.insert(t.key, t);\n })), e)));\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Qt = \"LocalStore\", $t = 3e8;\n\n/**\n * The maximum time to leave a resume token buffered without writing it out.\n * This value is arbitrary: it's long enough to avoid several writes\n * (possibly indefinitely if updates come more frequently than this) but\n * short enough that restarting after crashing will still have a pretty\n * recent resume token.\n */\n/**\n * Implements `LocalStore` interface.\n *\n * Note: some field defined in this class might have public access level, but\n * the class is not exported so they are only accessible from this module.\n * This is useful to implement optional features (like bundles) in free\n * functions, such that they are tree-shakeable.\n */\nclass __PRIVATE_LocalStoreImpl {\n constructor(\n /** Manages our in-memory or durable persistence. */\n e, t, n, r) {\n this.persistence = e, this.Cs = t, this.serializer = r, \n /**\n * Maps a targetID to data about its target.\n *\n * PORTING NOTE: We are using an immutable data structure on Web to make re-runs\n * of `applyRemoteEvent()` idempotent.\n */\n this.Fs = new SortedMap(__PRIVATE_primitiveComparator), \n /** Maps a target to its targetID. */\n // TODO(wuandy): Evaluate if TargetId can be part of Target.\n this.Ms = new ObjectMap((e => __PRIVATE_canonifyTarget(e)), __PRIVATE_targetEquals), \n /**\n * A per collection group index of the last read time processed by\n * `getNewDocumentChanges()`.\n *\n * PORTING NOTE: This is only used for multi-tab synchronization.\n */\n this.xs = new Map, this.Os = e.getRemoteDocumentCache(), this.hi = e.getTargetCache(), \n this.Ti = e.getBundleCache(), this.Ns(n);\n }\n Ns(e) {\n // TODO(indexing): Add spec tests that test these components change after a\n // user change\n this.documentOverlayCache = this.persistence.getDocumentOverlayCache(e), this.indexManager = this.persistence.getIndexManager(e), \n this.mutationQueue = this.persistence.getMutationQueue(e, this.indexManager), this.localDocuments = new LocalDocumentsView(this.Os, this.mutationQueue, this.documentOverlayCache, this.indexManager), \n this.Os.setIndexManager(this.indexManager), this.Cs.initialize(this.localDocuments, this.indexManager);\n }\n collectGarbage(e) {\n return this.persistence.runTransaction(\"Collect garbage\", \"readwrite-primary\", (t => e.collect(t, this.Fs)));\n }\n}\n\nfunction __PRIVATE_newLocalStore(\n/** Manages our in-memory or durable persistence. */\ne, t, n, r) {\n return new __PRIVATE_LocalStoreImpl(e, t, n, r);\n}\n\n/**\n * Tells the LocalStore that the currently authenticated user has changed.\n *\n * In response the local store switches the mutation queue to the new user and\n * returns any resulting document changes.\n */\n// PORTING NOTE: Android and iOS only return the documents affected by the\n// change.\nasync function __PRIVATE_localStoreHandleUserChange(e, t) {\n const n = __PRIVATE_debugCast(e);\n return await n.persistence.runTransaction(\"Handle user change\", \"readonly\", (e => {\n // Swap out the mutation queue, grabbing the pending mutation batches\n // before and after.\n let r;\n return n.mutationQueue.getAllMutationBatches(e).next((i => (r = i, n.Ns(t), n.mutationQueue.getAllMutationBatches(e)))).next((t => {\n const i = [], s = [];\n // Union the old/new changed keys.\n let o = __PRIVATE_documentKeySet();\n for (const e of r) {\n i.push(e.batchId);\n for (const t of e.mutations) o = o.add(t.key);\n }\n for (const e of t) {\n s.push(e.batchId);\n for (const t of e.mutations) o = o.add(t.key);\n }\n // Return the set of all (potentially) changed documents and the list\n // of mutation batch IDs that were affected by change.\n return n.localDocuments.getDocuments(e, o).next((e => ({\n Bs: e,\n removedBatchIds: i,\n addedBatchIds: s\n })));\n }));\n }));\n}\n\n/* Accepts locally generated Mutations and commit them to storage. */\n/**\n * Acknowledges the given batch.\n *\n * On the happy path when a batch is acknowledged, the local store will\n *\n * + remove the batch from the mutation queue;\n * + apply the changes to the remote document cache;\n * + recalculate the latency compensated view implied by those changes (there\n * may be mutations in the queue that affect the documents but haven't been\n * acknowledged yet); and\n * + give the changed documents back the sync engine\n *\n * @returns The resulting (modified) documents.\n */\nfunction __PRIVATE_localStoreAcknowledgeBatch(e, t) {\n const n = __PRIVATE_debugCast(e);\n return n.persistence.runTransaction(\"Acknowledge batch\", \"readwrite-primary\", (e => {\n const r = t.batch.keys(), i = n.Os.newChangeBuffer({\n trackRemovals: true\n });\n return function __PRIVATE_applyWriteToRemoteDocuments(e, t, n, r) {\n const i = n.batch, s = i.keys();\n let o = PersistencePromise.resolve();\n return s.forEach((e => {\n o = o.next((() => r.getEntry(t, e))).next((t => {\n const s = n.docVersions.get(e);\n __PRIVATE_hardAssert(null !== s, 48541), t.version.compareTo(s) < 0 && (i.applyToRemoteDocument(t, n), \n t.isValidDocument() && (\n // We use the commitVersion as the readTime rather than the\n // document's updateTime since the updateTime is not advanced\n // for updates that do not modify the underlying document.\n t.setReadTime(n.commitVersion), r.addEntry(t)));\n }));\n })), o.next((() => e.mutationQueue.removeMutationBatch(t, i)));\n }\n /** Returns the local view of the documents affected by a mutation batch. */\n // PORTING NOTE: Multi-Tab only.\n (n, e, t, i).next((() => i.apply(e))).next((() => n.mutationQueue.performConsistencyCheck(e))).next((() => n.documentOverlayCache.removeOverlaysForBatchId(e, r, t.batch.batchId))).next((() => n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e, function __PRIVATE_getKeysWithTransformResults(e) {\n let t = __PRIVATE_documentKeySet();\n for (let n = 0; n < e.mutationResults.length; ++n) {\n e.mutationResults[n].transformResults.length > 0 && (t = t.add(e.batch.mutations[n].key));\n }\n return t;\n }\n /**\n * Removes mutations from the MutationQueue for the specified batch;\n * LocalDocuments will be recalculated.\n *\n * @returns The resulting modified documents.\n */ (t)))).next((() => n.localDocuments.getDocuments(e, r)));\n }));\n}\n\n/**\n * Returns the last consistent snapshot processed (used by the RemoteStore to\n * determine whether to buffer incoming snapshots from the backend).\n */\nfunction __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {\n const t = __PRIVATE_debugCast(e);\n return t.persistence.runTransaction(\"Get last remote snapshot version\", \"readonly\", (e => t.hi.getLastRemoteSnapshotVersion(e)));\n}\n\n/**\n * Updates the \"ground-state\" (remote) documents. We assume that the remote\n * event reflects any write batches that have been acknowledged or rejected\n * (i.e. we do not re-apply local mutations to updates from this event).\n *\n * LocalDocuments are re-calculated if there are remaining mutations in the\n * queue.\n */ function __PRIVATE_localStoreApplyRemoteEventToLocalCache(e, t) {\n const n = __PRIVATE_debugCast(e), r = t.snapshotVersion;\n let i = n.Fs;\n return n.persistence.runTransaction(\"Apply remote event\", \"readwrite-primary\", (e => {\n const s = n.Os.newChangeBuffer({\n trackRemovals: true\n });\n // Reset newTargetDataByTargetMap in case this transaction gets re-run.\n i = n.Fs;\n const o = [];\n t.targetChanges.forEach(((s, _) => {\n const a = i.get(_);\n if (!a) return;\n // Only update the remote keys if the target is still active. This\n // ensures that we can persist the updated target data along with\n // the updated assignment.\n o.push(n.hi.removeMatchingKeys(e, s.removedDocuments, _).next((() => n.hi.addMatchingKeys(e, s.addedDocuments, _))));\n let u = a.withSequenceNumber(e.currentSequenceNumber);\n null !== t.targetMismatches.get(_) ? u = u.withResumeToken(ByteString.EMPTY_BYTE_STRING, SnapshotVersion.min()).withLastLimboFreeSnapshotVersion(SnapshotVersion.min()) : s.resumeToken.approximateByteSize() > 0 && (u = u.withResumeToken(s.resumeToken, r)), \n i = i.insert(_, u), \n // Update the target data if there are target changes (or if\n // sufficient time has passed since the last update).\n /**\n * Returns true if the newTargetData should be persisted during an update of\n * an active target. TargetData should always be persisted when a target is\n * being released and should not call this function.\n *\n * While the target is active, TargetData updates can be omitted when nothing\n * about the target has changed except metadata like the resume token or\n * snapshot version. Occasionally it's worth the extra write to prevent these\n * values from getting too stale after a crash, but this doesn't have to be\n * too frequent.\n */\n function __PRIVATE_shouldPersistTargetData(e, t, n) {\n // Always persist target data if we don't already have a resume token.\n if (0 === e.resumeToken.approximateByteSize()) return true;\n // Don't allow resume token changes to be buffered indefinitely. This\n // allows us to be reasonably up-to-date after a crash and avoids needing\n // to loop over all active queries on shutdown. Especially in the browser\n // we may not get time to do anything interesting while the current tab is\n // closing.\n const r = t.snapshotVersion.toMicroseconds() - e.snapshotVersion.toMicroseconds();\n if (r >= $t) return true;\n // Otherwise if the only thing that has changed about a target is its resume\n // token it's not worth persisting. Note that the RemoteStore keeps an\n // in-memory view of the currently active targets which includes the current\n // resume token, so stream failure or user changes will still use an\n // up-to-date resume token regardless of what we do here.\n const i = n.addedDocuments.size + n.modifiedDocuments.size + n.removedDocuments.size;\n return i > 0;\n }\n /**\n * Notifies local store of the changed views to locally pin documents.\n */ (a, u, s) && o.push(n.hi.updateTargetData(e, u));\n }));\n let _ = __PRIVATE_mutableDocumentMap(), a = __PRIVATE_documentKeySet();\n // HACK: The only reason we allow a null snapshot version is so that we\n // can synthesize remote events when we get permission denied errors while\n // trying to resolve the state of a locally cached document that is in\n // limbo.\n if (t.documentUpdates.forEach((r => {\n t.resolvedLimboDocuments.has(r) && o.push(n.persistence.referenceDelegate.updateLimboDocument(e, r));\n })), \n // Each loop iteration only affects its \"own\" doc, so it's safe to get all\n // the remote documents in advance in a single call.\n o.push(__PRIVATE_populateDocumentChangeBuffer(e, s, t.documentUpdates).next((e => {\n _ = e.Ls, a = e.ks;\n }))), !r.isEqual(SnapshotVersion.min())) {\n const t = n.hi.getLastRemoteSnapshotVersion(e).next((t => n.hi.setTargetsMetadata(e, e.currentSequenceNumber, r)));\n o.push(t);\n }\n return PersistencePromise.waitFor(o).next((() => s.apply(e))).next((() => n.localDocuments.getLocalViewOfDocuments(e, _, a))).next((() => _));\n })).then((e => (n.Fs = i, e)));\n}\n\n/**\n * Populates document change buffer with documents from backend or a bundle.\n * Returns the document changes resulting from applying those documents, and\n * also a set of documents whose existence state are changed as a result.\n *\n * @param txn - Transaction to use to read existing documents from storage.\n * @param documentBuffer - Document buffer to collect the resulted changes to be\n * applied to storage.\n * @param documents - Documents to be applied.\n */ function __PRIVATE_populateDocumentChangeBuffer(e, t, n) {\n let r = __PRIVATE_documentKeySet(), i = __PRIVATE_documentKeySet();\n return n.forEach((e => r = r.add(e))), t.getEntries(e, r).next((e => {\n let r = __PRIVATE_mutableDocumentMap();\n return n.forEach(((n, s) => {\n const o = e.get(n);\n // Check if see if there is a existence state change for this document.\n s.isFoundDocument() !== o.isFoundDocument() && (i = i.add(n)), \n // Note: The order of the steps below is important, since we want\n // to ensure that rejected limbo resolutions (which fabricate\n // NoDocuments with SnapshotVersion.min()) never add documents to\n // cache.\n s.isNoDocument() && s.version.isEqual(SnapshotVersion.min()) ? (\n // NoDocuments with SnapshotVersion.min() are used in manufactured\n // events. We remove these documents from cache since we lost\n // access.\n t.removeEntry(n, s.readTime), r = r.insert(n, s)) : !o.isValidDocument() || s.version.compareTo(o.version) > 0 || 0 === s.version.compareTo(o.version) && o.hasPendingWrites ? (t.addEntry(s), \n r = r.insert(n, s)) : __PRIVATE_logDebug(Qt, \"Ignoring outdated watch update for \", n, \". Current version:\", o.version, \" Watch version:\", s.version);\n })), {\n Ls: r,\n ks: i\n };\n }));\n}\n\n/**\n * Gets the mutation batch after the passed in batchId in the mutation queue\n * or null if empty.\n * @param afterBatchId - If provided, the batch to search after.\n * @returns The next mutation or null if there wasn't one.\n */\nfunction __PRIVATE_localStoreGetNextMutationBatch(e, t) {\n const n = __PRIVATE_debugCast(e);\n return n.persistence.runTransaction(\"Get next mutation batch\", \"readonly\", (e => (void 0 === t && (t = G), \n n.mutationQueue.getNextMutationBatchAfterBatchId(e, t))));\n}\n\n/**\n * Reads the current value of a Document with a given key or null if not\n * found - used for testing.\n */\n/**\n * Assigns the given target an internal ID so that its results can be pinned so\n * they don't get GC'd. A target must be allocated in the local store before\n * the store can be used to manage its view.\n *\n * Allocating an already allocated `Target` will return the existing `TargetData`\n * for that `Target`.\n */\nfunction __PRIVATE_localStoreAllocateTarget(e, t) {\n const n = __PRIVATE_debugCast(e);\n return n.persistence.runTransaction(\"Allocate target\", \"readwrite\", (e => {\n let r;\n return n.hi.getTargetData(e, t).next((i => i ? (\n // This target has been listened to previously, so reuse the\n // previous targetID.\n // TODO(mcg): freshen last accessed date?\n r = i, PersistencePromise.resolve(r)) : n.hi.allocateTargetId(e).next((i => (r = new TargetData(t, i, \"TargetPurposeListen\" /* TargetPurpose.Listen */ , e.currentSequenceNumber), \n n.hi.addTargetData(e, r).next((() => r)))))));\n })).then((e => {\n // If Multi-Tab is enabled, the existing target data may be newer than\n // the in-memory data\n const r = n.Fs.get(e.targetId);\n return (null === r || e.snapshotVersion.compareTo(r.snapshotVersion) > 0) && (n.Fs = n.Fs.insert(e.targetId, e), \n n.Ms.set(t, e.targetId)), e;\n }));\n}\n\n/**\n * Returns the TargetData as seen by the LocalStore, including updates that may\n * have not yet been persisted to the TargetCache.\n */\n// Visible for testing.\n/**\n * Unpins all the documents associated with the given target. If\n * `keepPersistedTargetData` is set to false and Eager GC enabled, the method\n * directly removes the associated target data from the target cache.\n *\n * Releasing a non-existing `Target` is a no-op.\n */\n// PORTING NOTE: `keepPersistedTargetData` is multi-tab only.\nasync function __PRIVATE_localStoreReleaseTarget(e, t, n) {\n const r = __PRIVATE_debugCast(e), i = r.Fs.get(t), s = n ? \"readwrite\" : \"readwrite-primary\";\n try {\n n || await r.persistence.runTransaction(\"Release target\", s, (e => r.persistence.referenceDelegate.removeTarget(e, i)));\n } catch (e) {\n if (!__PRIVATE_isIndexedDbTransactionError(e)) throw e;\n // All `releaseTarget` does is record the final metadata state for the\n // target, but we've been recording this periodically during target\n // activity. If we lose this write this could cause a very slight\n // difference in the order of target deletion during GC, but we\n // don't define exact LRU semantics so this is acceptable.\n __PRIVATE_logDebug(Qt, `Failed to update sequence numbers for target ${t}: ${e}`);\n }\n r.Fs = r.Fs.remove(t), r.Ms.delete(i.target);\n}\n\n/**\n * Runs the specified query against the local store and returns the results,\n * potentially taking advantage of query data from previous executions (such\n * as the set of remote keys).\n *\n * @param usePreviousResults - Whether results from previous executions can\n * be used to optimize this query execution.\n */ function __PRIVATE_localStoreExecuteQuery(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n let i = SnapshotVersion.min(), s = __PRIVATE_documentKeySet();\n return r.persistence.runTransaction(\"Execute query\", \"readwrite\", (// Use readwrite instead of readonly so indexes can be created\n // Use readwrite instead of readonly so indexes can be created\n e => function __PRIVATE_localStoreGetTargetData(e, t, n) {\n const r = __PRIVATE_debugCast(e), i = r.Ms.get(n);\n return void 0 !== i ? PersistencePromise.resolve(r.Fs.get(i)) : r.hi.getTargetData(t, n);\n }(r, e, __PRIVATE_queryToTarget(t)).next((t => {\n if (t) return i = t.lastLimboFreeSnapshotVersion, r.hi.getMatchingKeysForTargetId(e, t.targetId).next((e => {\n s = e;\n }));\n })).next((() => r.Cs.getDocumentsMatchingQuery(e, t, n ? i : SnapshotVersion.min(), n ? s : __PRIVATE_documentKeySet()))).next((e => (__PRIVATE_setMaxReadTime(r, __PRIVATE_queryCollectionGroup(t), e), \n {\n documents: e,\n qs: s\n })))));\n}\n\n/** Sets the collection group's maximum read time from the given documents. */\n// PORTING NOTE: Multi-Tab only.\nfunction __PRIVATE_setMaxReadTime(e, t, n) {\n let r = e.xs.get(t) || SnapshotVersion.min();\n n.forEach(((e, t) => {\n t.readTime.compareTo(r) > 0 && (r = t.readTime);\n })), e.xs.set(t, r);\n}\n\n/**\n * Metadata state of the local client. Unlike `RemoteClientState`, this class is\n * mutable and keeps track of all pending mutations, which allows us to\n * update the range of pending mutation batch IDs as new mutations are added or\n * removed.\n *\n * The data in `LocalClientState` is not read from WebStorage and instead\n * updated via its instance methods. The updated state can be serialized via\n * `toWebStorageJSON()`.\n */\n// Visible for testing.\nclass __PRIVATE_LocalClientState {\n constructor() {\n this.activeTargetIds = __PRIVATE_targetIdSet();\n }\n Gs(e) {\n this.activeTargetIds = this.activeTargetIds.add(e);\n }\n zs(e) {\n this.activeTargetIds = this.activeTargetIds.delete(e);\n }\n /**\n * Converts this entry into a JSON-encoded format we can use for WebStorage.\n * Does not encode `clientId` as it is part of the key in WebStorage.\n */ Ws() {\n const e = {\n activeTargetIds: this.activeTargetIds.toArray(),\n updateTimeMs: Date.now()\n };\n return JSON.stringify(e);\n }\n}\n\nclass __PRIVATE_MemorySharedClientState {\n constructor() {\n this.Fo = new __PRIVATE_LocalClientState, this.Mo = {}, this.onlineStateHandler = null, \n this.sequenceNumberHandler = null;\n }\n addPendingMutation(e) {\n // No op.\n }\n updateMutationState(e, t, n) {\n // No op.\n }\n addLocalQueryTarget(e, t = true) {\n return t && this.Fo.Gs(e), this.Mo[e] || \"not-current\";\n }\n updateQueryState(e, t, n) {\n this.Mo[e] = t;\n }\n removeLocalQueryTarget(e) {\n this.Fo.zs(e);\n }\n isLocalQueryTarget(e) {\n return this.Fo.activeTargetIds.has(e);\n }\n clearQueryState(e) {\n delete this.Mo[e];\n }\n getAllActiveQueryTargets() {\n return this.Fo.activeTargetIds;\n }\n isActiveQueryTarget(e) {\n return this.Fo.activeTargetIds.has(e);\n }\n start() {\n return this.Fo = new __PRIVATE_LocalClientState, Promise.resolve();\n }\n handleUserChange(e, t, n) {\n // No op.\n }\n setOnlineState(e) {\n // No op.\n }\n shutdown() {}\n writeSequenceNumber(e) {}\n notifyBundleLoaded(e) {\n // No op.\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ class __PRIVATE_NoopConnectivityMonitor {\n xo(e) {\n // No-op.\n }\n shutdown() {\n // No-op.\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// References to `window` are guarded by BrowserConnectivityMonitor.isAvailable()\n/* eslint-disable no-restricted-globals */ const zt = \"ConnectivityMonitor\";\n\n/**\n * Browser implementation of ConnectivityMonitor.\n */ class __PRIVATE_BrowserConnectivityMonitor {\n constructor() {\n this.Oo = () => this.No(), this.Bo = () => this.Lo(), this.ko = [], this.qo();\n }\n xo(e) {\n this.ko.push(e);\n }\n shutdown() {\n window.removeEventListener(\"online\", this.Oo), window.removeEventListener(\"offline\", this.Bo);\n }\n qo() {\n window.addEventListener(\"online\", this.Oo), window.addEventListener(\"offline\", this.Bo);\n }\n No() {\n __PRIVATE_logDebug(zt, \"Network connectivity changed: AVAILABLE\");\n for (const e of this.ko) e(0 /* NetworkStatus.AVAILABLE */);\n }\n Lo() {\n __PRIVATE_logDebug(zt, \"Network connectivity changed: UNAVAILABLE\");\n for (const e of this.ko) e(1 /* NetworkStatus.UNAVAILABLE */);\n }\n // TODO(chenbrian): Consider passing in window either into this component or\n // here for testing via FakeWindow.\n /** Checks that all used attributes of window are available. */\n static C() {\n return \"undefined\" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;\n }\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The value returned from the most recent invocation of\n * `generateUniqueDebugId()`, or null if it has never been invoked.\n */ let jt = null;\n\n/**\n * Generates and returns an initial value for `lastUniqueDebugId`.\n *\n * The returned value is randomly selected from a range of integers that are\n * represented as 8 hexadecimal digits. This means that (within reason) any\n * numbers generated by incrementing the returned number by 1 will also be\n * represented by 8 hexadecimal digits. This leads to all \"IDs\" having the same\n * length when converted to a hexadecimal string, making reading logs containing\n * these IDs easier to follow. And since the return value is randomly selected\n * it will help to differentiate between logs from different executions.\n */\n/**\n * Generates and returns a unique ID as a hexadecimal string.\n *\n * The returned ID is intended to be used in debug logging messages to help\n * correlate log messages that may be spatially separated in the logs, but\n * logically related. For example, a network connection could include the same\n * \"debug ID\" string in all of its log messages to help trace a specific\n * connection over time.\n *\n * @return the 10-character generated ID (e.g. \"0xa1b2c3d4\").\n */\nfunction __PRIVATE_generateUniqueDebugId() {\n return null === jt ? jt = function __PRIVATE_generateInitialUniqueDebugId() {\n return 268435456 + Math.round(2147483648 * Math.random());\n }() : jt++, \"0x\" + jt.toString(16);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Jt = \"RestConnection\", Ht = {\n BatchGetDocuments: \"batchGet\",\n Commit: \"commit\",\n RunQuery: \"runQuery\",\n RunAggregationQuery: \"runAggregationQuery\"\n};\n\n/**\n * Maps RPC names to the corresponding REST endpoint name.\n *\n * We use array notation to avoid mangling.\n */\n/**\n * Base class for all Rest-based connections to the backend (WebChannel and\n * HTTP).\n */\nclass __PRIVATE_RestConnection {\n get Qo() {\n // Both `invokeRPC()` and `invokeStreamingRPC()` use their `path` arguments to determine\n // where to run the query, and expect the `request` to NOT specify the \"path\".\n return false;\n }\n constructor(e) {\n this.databaseInfo = e, this.databaseId = e.databaseId;\n const t = e.ssl ? \"https\" : \"http\", n = encodeURIComponent(this.databaseId.projectId), r = encodeURIComponent(this.databaseId.database);\n this.$o = t + \"://\" + e.host, this.Uo = `projects/${n}/databases/${r}`, this.Ko = this.databaseId.database === ut ? `project_id=${n}` : `project_id=${n}&database_id=${r}`;\n }\n Wo(e, t, n, r, i) {\n const s = __PRIVATE_generateUniqueDebugId(), o = this.Go(e, t.toUriEncodedString());\n __PRIVATE_logDebug(Jt, `Sending RPC '${e}' ${s}:`, o, n);\n const _ = {\n \"google-cloud-resource-prefix\": this.Uo,\n \"x-goog-request-params\": this.Ko\n };\n this.zo(_, r, i);\n const {host: a} = new URL(o), u = isCloudWorkstation(a);\n return this.jo(e, o, _, n, u).then((t => (__PRIVATE_logDebug(Jt, `Received RPC '${e}' ${s}: `, t), \n t)), (t => {\n throw __PRIVATE_logWarn(Jt, `RPC '${e}' ${s} failed with error: `, t, \"url: \", o, \"request:\", n), \n t;\n }));\n }\n Jo(e, t, n, r, i, s) {\n // The REST API automatically aggregates all of the streamed results, so we\n // can just use the normal invoke() method.\n return this.Wo(e, t, n, r, i);\n }\n /**\n * Modifies the headers for a request, adding any authorization token if\n * present and any additional headers for the request.\n */ zo(e, t, n) {\n e[\"X-Goog-Api-Client\"] = \n // SDK_VERSION is updated to different value at runtime depending on the entry point,\n // so we need to get its value when we need it in a function.\n function __PRIVATE_getGoogApiClientValue() {\n return \"gl-js/ fire/\" + x;\n }(), \n // Content-Type: text/plain will avoid preflight requests which might\n // mess with CORS and redirects by proxies. If we add custom headers\n // we will need to change this code to potentially use the $httpOverwrite\n // parameter supported by ESF to avoid triggering preflight requests.\n e[\"Content-Type\"] = \"text/plain\", this.databaseInfo.appId && (e[\"X-Firebase-GMPID\"] = this.databaseInfo.appId), \n t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));\n }\n Go(e, t) {\n const n = Ht[e];\n return `${this.$o}/v1/${t}:${n}`;\n }\n /**\n * Closes and cleans up any resources associated with the connection. This\n * implementation is a no-op because there are no resources associated\n * with the RestConnection that need to be cleaned up.\n */ terminate() {\n // No-op\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provides a simple helper class that implements the Stream interface to\n * bridge to other implementations that are streams but do not implement the\n * interface. The stream callbacks are invoked with the callOn... methods.\n */ class __PRIVATE_StreamBridge {\n constructor(e) {\n this.Ho = e.Ho, this.Yo = e.Yo;\n }\n Zo(e) {\n this.Xo = e;\n }\n e_(e) {\n this.t_ = e;\n }\n n_(e) {\n this.r_ = e;\n }\n onMessage(e) {\n this.i_ = e;\n }\n close() {\n this.Yo();\n }\n send(e) {\n this.Ho(e);\n }\n s_() {\n this.Xo();\n }\n o_() {\n this.t_();\n }\n __(e) {\n this.r_(e);\n }\n a_(e) {\n this.i_(e);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Yt = \"WebChannelConnection\";\n\nclass __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {\n constructor(e) {\n super(e), \n /** A collection of open WebChannel instances */\n this.u_ = [], this.forceLongPolling = e.forceLongPolling, this.autoDetectLongPolling = e.autoDetectLongPolling, \n this.useFetchStreams = e.useFetchStreams, this.longPollingOptions = e.longPollingOptions;\n }\n jo(e, t, n, r, i) {\n const s = __PRIVATE_generateUniqueDebugId();\n return new Promise(((i, o) => {\n const _ = new XhrIo;\n _.setWithCredentials(true), _.listenOnce(EventType.COMPLETE, (() => {\n try {\n switch (_.getLastErrorCode()) {\n case ErrorCode.NO_ERROR:\n const t = _.getResponseJson();\n __PRIVATE_logDebug(Yt, `XHR for RPC '${e}' ${s} received:`, JSON.stringify(t)), \n i(t);\n break;\n\n case ErrorCode.TIMEOUT:\n __PRIVATE_logDebug(Yt, `RPC '${e}' ${s} timed out`), o(new FirestoreError(N.DEADLINE_EXCEEDED, \"Request time out\"));\n break;\n\n case ErrorCode.HTTP_ERROR:\n const n = _.getStatus();\n if (__PRIVATE_logDebug(Yt, `RPC '${e}' ${s} failed with status:`, n, \"response text:\", _.getResponseText()), \n n > 0) {\n let e = _.getResponseJson();\n Array.isArray(e) && (e = e[0]);\n const t = null == e ? void 0 : e.error;\n if (t && t.status && t.message) {\n const e = function __PRIVATE_mapCodeFromHttpResponseErrorStatus(e) {\n const t = e.toLowerCase().replace(/_/g, \"-\");\n return Object.values(N).indexOf(t) >= 0 ? t : N.UNKNOWN;\n }(t.status);\n o(new FirestoreError(e, t.message));\n } else o(new FirestoreError(N.UNKNOWN, \"Server responded with status \" + _.getStatus()));\n } else \n // If we received an HTTP_ERROR but there's no status code,\n // it's most probably a connection issue\n o(new FirestoreError(N.UNAVAILABLE, \"Connection failed.\"));\n break;\n\n default:\n fail(9055, {\n c_: e,\n streamId: s,\n l_: _.getLastErrorCode(),\n h_: _.getLastError()\n });\n }\n } finally {\n __PRIVATE_logDebug(Yt, `RPC '${e}' ${s} completed.`);\n }\n }));\n const a = JSON.stringify(r);\n __PRIVATE_logDebug(Yt, `RPC '${e}' ${s} sending request:`, r), _.send(t, \"POST\", a, n, 15);\n }));\n }\n P_(e, t, n) {\n const r = __PRIVATE_generateUniqueDebugId(), i = [ this.$o, \"/\", \"google.firestore.v1.Firestore\", \"/\", e, \"/channel\" ], s = createWebChannelTransport(), o = getStatEventTarget(), _ = {\n // Required for backend stickiness, routing behavior is based on this\n // parameter.\n httpSessionIdParam: \"gsessionid\",\n initMessageHeaders: {},\n messageUrlParams: {\n // This param is used to improve routing and project isolation by the\n // backend and must be included in every request.\n database: `projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`\n },\n sendRawJson: true,\n supportsCrossDomainXhr: true,\n internalChannelParams: {\n // Override the default timeout (randomized between 10-20 seconds) since\n // a large write batch on a slow internet connection may take a long\n // time to send to the backend. Rather than have WebChannel impose a\n // tight timeout which could lead to infinite timeouts and retries, we\n // set it very large (5-10 minutes) and rely on the browser's builtin\n // timeouts to kick in if the request isn't working.\n forwardChannelRequestTimeoutMs: 6e5\n },\n forceLongPolling: this.forceLongPolling,\n detectBufferingProxy: this.autoDetectLongPolling\n }, a = this.longPollingOptions.timeoutSeconds;\n void 0 !== a && (_.longPollingTimeout = Math.round(1e3 * a)), this.useFetchStreams && (_.useFetchStreams = true), \n this.zo(_.initMessageHeaders, t, n), \n // Sending the custom headers we just added to request.initMessageHeaders\n // (Authorization, etc.) will trigger the browser to make a CORS preflight\n // request because the XHR will no longer meet the criteria for a \"simple\"\n // CORS request:\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests\n // Therefore to avoid the CORS preflight request (an extra network\n // roundtrip), we use the encodeInitMessageHeaders option to specify that\n // the headers should instead be encoded in the request's POST payload,\n // which is recognized by the webchannel backend.\n _.encodeInitMessageHeaders = true;\n const u = i.join(\"\");\n __PRIVATE_logDebug(Yt, `Creating RPC '${e}' stream ${r}: ${u}`, _);\n const c = s.createWebChannel(u, _);\n this.T_(c);\n // WebChannel supports sending the first message with the handshake - saving\n // a network round trip. However, it will have to call send in the same\n // JS event loop as open. In order to enforce this, we delay actually\n // opening the WebChannel until send is called. Whether we have called\n // open is tracked with this variable.\n let l = false, h = false;\n // A flag to determine whether the stream was closed (by us or through an\n // error/close event) to avoid delivering multiple close events or sending\n // on a closed stream\n const P = new __PRIVATE_StreamBridge({\n Ho: t => {\n h ? __PRIVATE_logDebug(Yt, `Not sending because RPC '${e}' stream ${r} is closed:`, t) : (l || (__PRIVATE_logDebug(Yt, `Opening RPC '${e}' stream ${r} transport.`), \n c.open(), l = true), __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} sending:`, t), \n c.send(t));\n },\n Yo: () => c.close()\n }), __PRIVATE_unguardedEventListen = (e, t, n) => {\n // TODO(dimond): closure typing seems broken because WebChannel does\n // not implement goog.events.Listenable\n e.listen(t, (e => {\n try {\n n(e);\n } catch (e) {\n setTimeout((() => {\n throw e;\n }), 0);\n }\n }));\n };\n // Closure events are guarded and exceptions are swallowed, so catch any\n // exception and rethrow using a setTimeout so they become visible again.\n // Note that eventually this function could go away if we are confident\n // enough the code is exception free.\n return __PRIVATE_unguardedEventListen(c, WebChannel.EventType.OPEN, (() => {\n h || (__PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} transport opened.`), P.s_());\n })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {\n h || (h = !0, __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} transport closed`), \n P.__(), this.I_(c));\n })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {\n h || (h = !0, __PRIVATE_logWarn(Yt, `RPC '${e}' stream ${r} transport errored. Name:`, t.name, \"Message:\", t.message), \n P.__(new FirestoreError(N.UNAVAILABLE, \"The operation could not be completed\")));\n })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {\n var n;\n if (!h) {\n const i = t.data[0];\n __PRIVATE_hardAssert(!!i, 16349);\n // TODO(b/35143891): There is a bug in One Platform that caused errors\n // (and only errors) to be wrapped in an extra array. To be forward\n // compatible with the bug we need to check either condition. The latter\n // can be removed once the fix has been rolled out.\n // Use any because msgData.error is not typed.\n const s = i, o = (null == s ? void 0 : s.error) || (null === (n = s[0]) || void 0 === n ? void 0 : n.error);\n if (o) {\n __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} received error:`, o);\n // error.status will be a string like 'OK' or 'NOT_FOUND'.\n const t = o.status;\n let n = \n /**\n * Maps an error Code from a GRPC status identifier like 'NOT_FOUND'.\n *\n * @returns The Code equivalent to the given status string or undefined if\n * there is no match.\n */\n function __PRIVATE_mapCodeFromRpcStatus(e) {\n // lookup by string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const t = ft[e];\n if (void 0 !== t) return __PRIVATE_mapCodeFromRpcCode(t);\n }(t), i = o.message;\n void 0 === n && (n = N.INTERNAL, i = \"Unknown error status: \" + t + \" with message \" + o.message), \n // Mark closed so no further events are propagated\n h = !0, P.__(new FirestoreError(n, i)), c.close();\n } else __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} received:`, i), P.a_(i);\n }\n })), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {\n t.stat === Stat.PROXY ? __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === Stat.NOPROXY && __PRIVATE_logDebug(Yt, `RPC '${e}' stream ${r} detected no buffering proxy`);\n })), setTimeout((() => {\n // Technically we could/should wait for the WebChannel opened event,\n // but because we want to send the first message with the WebChannel\n // handshake we pretend the channel opened here (asynchronously), and\n // then delay the actual open until the first message is sent.\n P.o_();\n }), 0), P;\n }\n /**\n * Closes and cleans up any resources associated with the connection.\n */ terminate() {\n // If the Firestore instance is terminated, we will explicitly\n // close any remaining open WebChannel instances.\n this.u_.forEach((e => e.close())), this.u_ = [];\n }\n /**\n * Add a WebChannel instance to the collection of open instances.\n * @param webChannel\n */ T_(e) {\n this.u_.push(e);\n }\n /**\n * Remove a WebChannel instance from the collection of open instances.\n * @param webChannel\n */ I_(e) {\n this.u_ = this.u_.filter((t => t === e));\n }\n}\n\n/** The Platform's 'document' implementation or null if not available. */ function getDocument() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document : null;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function __PRIVATE_newSerializer(e) {\n return new JsonProtoSerializer(e, /* useProto3Json= */ true);\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A helper for running delayed tasks following an exponential backoff curve\n * between attempts.\n *\n * Each delay is made up of a \"base\" delay which follows the exponential\n * backoff curve, and a +/- 50% \"jitter\" that is calculated and added to the\n * base delay. This prevents clients from accidentally synchronizing their\n * delays causing spikes of load to the backend.\n */\nclass __PRIVATE_ExponentialBackoff {\n constructor(\n /**\n * The AsyncQueue to run backoff operations on.\n */\n e, \n /**\n * The ID to use when scheduling backoff operations on the AsyncQueue.\n */\n t, \n /**\n * The initial delay (used as the base delay on the first retry attempt).\n * Note that jitter will still be applied, so the actual delay could be as\n * little as 0.5*initialDelayMs.\n */\n n = 1e3\n /**\n * The multiplier to use to determine the extended base delay after each\n * attempt.\n */ , r = 1.5\n /**\n * The maximum base delay after which no further backoff is performed.\n * Note that jitter will still be applied, so the actual delay could be as\n * much as 1.5*maxDelayMs.\n */ , i = 6e4) {\n this.Fi = e, this.timerId = t, this.d_ = n, this.E_ = r, this.A_ = i, this.R_ = 0, \n this.V_ = null, \n /** The last backoff attempt, as epoch milliseconds. */\n this.m_ = Date.now(), this.reset();\n }\n /**\n * Resets the backoff delay.\n *\n * The very next backoffAndWait() will have no delay. If it is called again\n * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and\n * subsequent ones will increase according to the backoffFactor.\n */ reset() {\n this.R_ = 0;\n }\n /**\n * Resets the backoff delay to the maximum delay (e.g. for use after a\n * RESOURCE_EXHAUSTED error).\n */ f_() {\n this.R_ = this.A_;\n }\n /**\n * Returns a promise that resolves after currentDelayMs, and increases the\n * delay for any subsequent attempts. If there was a pending backoff operation\n * already, it will be canceled.\n */ g_(e) {\n // Cancel any pending backoff operation.\n this.cancel();\n // First schedule using the current base (which may be 0 and should be\n // honored as such).\n const t = Math.floor(this.R_ + this.p_()), n = Math.max(0, Date.now() - this.m_), r = Math.max(0, t - n);\n // Guard against lastAttemptTime being in the future due to a clock change.\n r > 0 && __PRIVATE_logDebug(\"ExponentialBackoff\", `Backing off for ${r} ms (base delay: ${this.R_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`), \n this.V_ = this.Fi.enqueueAfterDelay(this.timerId, r, (() => (this.m_ = Date.now(), \n e()))), \n // Apply backoff factor to determine next delay and ensure it is within\n // bounds.\n this.R_ *= this.E_, this.R_ < this.d_ && (this.R_ = this.d_), this.R_ > this.A_ && (this.R_ = this.A_);\n }\n y_() {\n null !== this.V_ && (this.V_.skipDelay(), this.V_ = null);\n }\n cancel() {\n null !== this.V_ && (this.V_.cancel(), this.V_ = null);\n }\n /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ p_() {\n return (Math.random() - .5) * this.R_;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Zt = \"PersistentStream\";\n\n/** The time a stream stays open after it is marked idle. */\n/**\n * A PersistentStream is an abstract base class that represents a streaming RPC\n * to the Firestore backend. It's built on top of the connections own support\n * for streaming RPCs, and adds several critical features for our clients:\n *\n * - Exponential backoff on failure\n * - Authentication via CredentialsProvider\n * - Dispatching all callbacks into the shared worker queue\n * - Closing idle streams after 60 seconds of inactivity\n *\n * Subclasses of PersistentStream implement serialization of models to and\n * from the JSON representation of the protocol buffers for a specific\n * streaming RPC.\n *\n * ## Starting and Stopping\n *\n * Streaming RPCs are stateful and need to be start()ed before messages can\n * be sent and received. The PersistentStream will call the onOpen() function\n * of the listener once the stream is ready to accept requests.\n *\n * Should a start() fail, PersistentStream will call the registered onClose()\n * listener with a FirestoreError indicating what went wrong.\n *\n * A PersistentStream can be started and stopped repeatedly.\n *\n * Generic types:\n * SendType: The type of the outgoing message of the underlying\n * connection stream\n * ReceiveType: The type of the incoming message of the underlying\n * connection stream\n * ListenerType: The type of the listener that will be used for callbacks\n */\nclass __PRIVATE_PersistentStream {\n constructor(e, t, n, r, i, s, o, _) {\n this.Fi = e, this.w_ = n, this.S_ = r, this.connection = i, this.authCredentialsProvider = s, \n this.appCheckCredentialsProvider = o, this.listener = _, this.state = 0 /* PersistentStreamState.Initial */ , \n /**\n * A close count that's incremented every time the stream is closed; used by\n * getCloseGuardedDispatcher() to invalidate callbacks that happen after\n * close.\n */\n this.b_ = 0, this.D_ = null, this.v_ = null, this.stream = null, \n /**\n * Count of response messages received.\n */\n this.C_ = 0, this.F_ = new __PRIVATE_ExponentialBackoff(e, t);\n }\n /**\n * Returns true if start() has been called and no error has occurred. True\n * indicates the stream is open or in the process of opening (which\n * encompasses respecting backoff, getting auth tokens, and starting the\n * actual RPC). Use isOpen() to determine if the stream is open and ready for\n * outbound requests.\n */ M_() {\n return 1 /* PersistentStreamState.Starting */ === this.state || 5 /* PersistentStreamState.Backoff */ === this.state || this.x_();\n }\n /**\n * Returns true if the underlying RPC is open (the onOpen() listener has been\n * called) and the stream is ready for outbound requests.\n */ x_() {\n return 2 /* PersistentStreamState.Open */ === this.state || 3 /* PersistentStreamState.Healthy */ === this.state;\n }\n /**\n * Starts the RPC. Only allowed if isStarted() returns false. The stream is\n * not immediately ready for use: onOpen() will be invoked when the RPC is\n * ready for outbound requests, at which point isOpen() will return true.\n *\n * When start returns, isStarted() will return true.\n */ start() {\n this.C_ = 0, 4 /* PersistentStreamState.Error */ !== this.state ? this.auth() : this.O_();\n }\n /**\n * Stops the RPC. This call is idempotent and allowed regardless of the\n * current isStarted() state.\n *\n * When stop returns, isStarted() and isOpen() will both return false.\n */ async stop() {\n this.M_() && await this.close(0 /* PersistentStreamState.Initial */);\n }\n /**\n * After an error the stream will usually back off on the next attempt to\n * start it. If the error warrants an immediate restart of the stream, the\n * sender can use this to indicate that the receiver should not back off.\n *\n * Each error will call the onClose() listener. That function can decide to\n * inhibit backoff if required.\n */ N_() {\n this.state = 0 /* PersistentStreamState.Initial */ , this.F_.reset();\n }\n /**\n * Marks this stream as idle. If no further actions are performed on the\n * stream for one minute, the stream will automatically close itself and\n * notify the stream's onClose() handler with Status.OK. The stream will then\n * be in a !isStarted() state, requiring the caller to start the stream again\n * before further use.\n *\n * Only streams that are in state 'Open' can be marked idle, as all other\n * states imply pending network operations.\n */ B_() {\n // Starts the idle time if we are in state 'Open' and are not yet already\n // running a timer (in which case the previous idle timeout still applies).\n this.x_() && null === this.D_ && (this.D_ = this.Fi.enqueueAfterDelay(this.w_, 6e4, (() => this.L_())));\n }\n /** Sends a message to the underlying stream. */ k_(e) {\n this.q_(), this.stream.send(e);\n }\n /** Called by the idle timer when the stream should close due to inactivity. */ async L_() {\n if (this.x_()) \n // When timing out an idle stream there's no reason to force the stream into backoff when\n // it restarts so set the stream state to Initial instead of Error.\n return this.close(0 /* PersistentStreamState.Initial */);\n }\n /** Marks the stream as active again. */ q_() {\n this.D_ && (this.D_.cancel(), this.D_ = null);\n }\n /** Cancels the health check delayed operation. */ Q_() {\n this.v_ && (this.v_.cancel(), this.v_ = null);\n }\n /**\n * Closes the stream and cleans up as necessary:\n *\n * * closes the underlying GRPC stream;\n * * calls the onClose handler with the given 'error';\n * * sets internal stream state to 'finalState';\n * * adjusts the backoff timer based on the error\n *\n * A new stream can be opened by calling start().\n *\n * @param finalState - the intended state of the stream after closing.\n * @param error - the error the connection was closed with.\n */ async close(e, t) {\n // Cancel any outstanding timers (they're guaranteed not to execute).\n this.q_(), this.Q_(), this.F_.cancel(), \n // Invalidates any stream-related callbacks (e.g. from auth or the\n // underlying stream), guaranteeing they won't execute.\n this.b_++, 4 /* PersistentStreamState.Error */ !== e ? \n // If this is an intentional close ensure we don't delay our next connection attempt.\n this.F_.reset() : t && t.code === N.RESOURCE_EXHAUSTED ? (\n // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)\n __PRIVATE_logError(t.toString()), __PRIVATE_logError(\"Using maximum backoff delay to prevent overloading the backend.\"), \n this.F_.f_()) : t && t.code === N.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (\n // \"unauthenticated\" error means the token was rejected. This should rarely\n // happen since both Auth and AppCheck ensure a sufficient TTL when we\n // request a token. If a user manually resets their system clock this can\n // fail, however. In this case, we should get a Code.UNAUTHENTICATED error\n // before we received the first message and we need to invalidate the token\n // to ensure that we fetch a new token.\n this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()), \n // Clean up the underlying stream because we are no longer interested in events.\n null !== this.stream && (this.U_(), this.stream.close(), this.stream = null), \n // This state must be assigned before calling onClose() to allow the callback to\n // inhibit backoff or otherwise manipulate the state in its non-started state.\n this.state = e, \n // Notify the listener that the stream closed.\n await this.listener.n_(t);\n }\n /**\n * Can be overridden to perform additional cleanup before the stream is closed.\n * Calling super.tearDown() is not required.\n */ U_() {}\n auth() {\n this.state = 1 /* PersistentStreamState.Starting */;\n const e = this.K_(this.b_), t = this.b_;\n // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.\n Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((([e, n]) => {\n // Stream can be stopped while waiting for authentication.\n // TODO(mikelehen): We really should just use dispatchIfNotClosed\n // and let this dispatch onto the queue, but that opened a spec test can\n // of worms that I don't want to deal with in this PR.\n this.b_ === t && \n // Normally we'd have to schedule the callback on the AsyncQueue.\n // However, the following calls are safe to be called outside the\n // AsyncQueue since they don't chain asynchronous calls\n this.W_(e, n);\n }), (t => {\n e((() => {\n const e = new FirestoreError(N.UNKNOWN, \"Fetching auth token failed: \" + t.message);\n return this.G_(e);\n }));\n }));\n }\n W_(e, t) {\n const n = this.K_(this.b_);\n this.stream = this.z_(e, t), this.stream.Zo((() => {\n n((() => this.listener.Zo()));\n })), this.stream.e_((() => {\n n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.v_ = this.Fi.enqueueAfterDelay(this.S_, 1e4, (() => (this.x_() && (this.state = 3 /* PersistentStreamState.Healthy */), \n Promise.resolve()))), this.listener.e_())));\n })), this.stream.n_((e => {\n n((() => this.G_(e)));\n })), this.stream.onMessage((e => {\n n((() => 1 == ++this.C_ ? this.j_(e) : this.onNext(e)));\n }));\n }\n O_() {\n this.state = 5 /* PersistentStreamState.Backoff */ , this.F_.g_((async () => {\n this.state = 0 /* PersistentStreamState.Initial */ , this.start();\n }));\n }\n // Visible for tests\n G_(e) {\n // In theory the stream could close cleanly, however, in our current model\n // we never expect this to happen because if we stop a stream ourselves,\n // this callback will never be called. To prevent cases where we retry\n // without a backoff accidentally, we set the stream to error in all cases.\n return __PRIVATE_logDebug(Zt, `close with error: ${e}`), this.stream = null, this.close(4 /* PersistentStreamState.Error */ , e);\n }\n /**\n * Returns a \"dispatcher\" function that dispatches operations onto the\n * AsyncQueue but only runs them if closeCount remains unchanged. This allows\n * us to turn auth / stream callbacks into no-ops if the stream is closed /\n * re-opened, etc.\n */ K_(e) {\n return t => {\n this.Fi.enqueueAndForget((() => this.b_ === e ? t() : (__PRIVATE_logDebug(Zt, \"stream callback skipped by getCloseGuardedDispatcher.\"), \n Promise.resolve())));\n };\n }\n}\n\n/**\n * A PersistentStream that implements the Listen RPC.\n *\n * Once the Listen stream has called the onOpen() listener, any number of\n * listen() and unlisten() calls can be made to control what changes will be\n * sent from the server for ListenResponses.\n */ class __PRIVATE_PersistentListenStream extends __PRIVATE_PersistentStream {\n constructor(e, t, n, r, i, s) {\n super(e, \"listen_stream_connection_backoff\" /* TimerId.ListenStreamConnectionBackoff */ , \"listen_stream_idle\" /* TimerId.ListenStreamIdle */ , \"health_check_timeout\" /* TimerId.HealthCheckTimeout */ , t, n, r, s), \n this.serializer = i;\n }\n z_(e, t) {\n return this.connection.P_(\"Listen\", e, t);\n }\n j_(e) {\n return this.onNext(e);\n }\n onNext(e) {\n // A successful response means the stream is healthy\n this.F_.reset();\n const t = __PRIVATE_fromWatchChange(this.serializer, e), n = function __PRIVATE_versionFromListenResponse(e) {\n // We have only reached a consistent snapshot for the entire stream if there\n // is a read_time set and it applies to all targets (i.e. the list of\n // targets is empty). The backend is guaranteed to send such responses.\n if (!(\"targetChange\" in e)) return SnapshotVersion.min();\n const t = e.targetChange;\n return t.targetIds && t.targetIds.length ? SnapshotVersion.min() : t.readTime ? __PRIVATE_fromVersion(t.readTime) : SnapshotVersion.min();\n }(e);\n return this.listener.J_(t, n);\n }\n /**\n * Registers interest in the results of the given target. If the target\n * includes a resumeToken it will be included in the request. Results that\n * affect the target will be streamed back as WatchChange messages that\n * reference the targetId.\n */ H_(e) {\n const t = {};\n t.database = __PRIVATE_getEncodedDatabaseId(this.serializer), t.addTarget = function __PRIVATE_toTarget(e, t) {\n let n;\n const r = t.target;\n if (n = __PRIVATE_targetIsDocumentTarget(r) ? {\n documents: __PRIVATE_toDocumentsTarget(e, r)\n } : {\n query: __PRIVATE_toQueryTarget(e, r).Vt\n }, n.targetId = t.targetId, t.resumeToken.approximateByteSize() > 0) {\n n.resumeToken = __PRIVATE_toBytes(e, t.resumeToken);\n const r = __PRIVATE_toInt32Proto(e, t.expectedCount);\n null !== r && (n.expectedCount = r);\n } else if (t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {\n // TODO(wuandy): Consider removing above check because it is most likely true.\n // Right now, many tests depend on this behaviour though (leaving min() out\n // of serialization).\n n.readTime = toTimestamp(e, t.snapshotVersion.toTimestamp());\n const r = __PRIVATE_toInt32Proto(e, t.expectedCount);\n null !== r && (n.expectedCount = r);\n }\n return n;\n }(this.serializer, e);\n const n = __PRIVATE_toListenRequestLabels(this.serializer, e);\n n && (t.labels = n), this.k_(t);\n }\n /**\n * Unregisters interest in the results of the target associated with the\n * given targetId.\n */ Y_(e) {\n const t = {};\n t.database = __PRIVATE_getEncodedDatabaseId(this.serializer), t.removeTarget = e, \n this.k_(t);\n }\n}\n\n/**\n * A Stream that implements the Write RPC.\n *\n * The Write RPC requires the caller to maintain special streamToken\n * state in between calls, to help the server understand which responses the\n * client has processed by the time the next request is made. Every response\n * will contain a streamToken; this value must be passed to the next\n * request.\n *\n * After calling start() on this stream, the next request must be a handshake,\n * containing whatever streamToken is on hand. Once a response to this\n * request is received, all pending mutations may be submitted. When\n * submitting multiple batches of mutations at the same time, it's\n * okay to use the same streamToken for the calls to writeMutations.\n *\n * TODO(b/33271235): Use proto types\n */ class __PRIVATE_PersistentWriteStream extends __PRIVATE_PersistentStream {\n constructor(e, t, n, r, i, s) {\n super(e, \"write_stream_connection_backoff\" /* TimerId.WriteStreamConnectionBackoff */ , \"write_stream_idle\" /* TimerId.WriteStreamIdle */ , \"health_check_timeout\" /* TimerId.HealthCheckTimeout */ , t, n, r, s), \n this.serializer = i;\n }\n /**\n * Tracks whether or not a handshake has been successfully exchanged and\n * the stream is ready to accept mutations.\n */ get Z_() {\n return this.C_ > 0;\n }\n // Override of PersistentStream.start\n start() {\n this.lastStreamToken = void 0, super.start();\n }\n U_() {\n this.Z_ && this.X_([]);\n }\n z_(e, t) {\n return this.connection.P_(\"Write\", e, t);\n }\n j_(e) {\n // Always capture the last stream token.\n return __PRIVATE_hardAssert(!!e.streamToken, 31322), this.lastStreamToken = e.streamToken, \n // The first response is always the handshake response\n __PRIVATE_hardAssert(!e.writeResults || 0 === e.writeResults.length, 55816), this.listener.ea();\n }\n onNext(e) {\n // Always capture the last stream token.\n __PRIVATE_hardAssert(!!e.streamToken, 12678), this.lastStreamToken = e.streamToken, \n // A successful first write response means the stream is healthy,\n // Note, that we could consider a successful handshake healthy, however,\n // the write itself might be causing an error we want to back off from.\n this.F_.reset();\n const t = __PRIVATE_fromWriteResults(e.writeResults, e.commitTime), n = __PRIVATE_fromVersion(e.commitTime);\n return this.listener.ta(n, t);\n }\n /**\n * Sends an initial streamToken to the server, performing the handshake\n * required to make the StreamingWrite RPC work. Subsequent\n * calls should wait until onHandshakeComplete was called.\n */ na() {\n // TODO(dimond): Support stream resumption. We intentionally do not set the\n // stream token on the handshake, ignoring any stream token we might have.\n const e = {};\n e.database = __PRIVATE_getEncodedDatabaseId(this.serializer), this.k_(e);\n }\n /** Sends a group of mutations to the Firestore backend to apply. */ X_(e) {\n const t = {\n streamToken: this.lastStreamToken,\n writes: e.map((e => toMutation(this.serializer, e)))\n };\n this.k_(t);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Datastore and its related methods are a wrapper around the external Google\n * Cloud Datastore grpc API, which provides an interface that is more convenient\n * for the rest of the client SDK architecture to consume.\n */ class Datastore {}\n\n/**\n * An implementation of Datastore that exposes additional state for internal\n * consumption.\n */ class __PRIVATE_DatastoreImpl extends Datastore {\n constructor(e, t, n, r) {\n super(), this.authCredentials = e, this.appCheckCredentials = t, this.connection = n, \n this.serializer = r, this.ra = false;\n }\n ia() {\n if (this.ra) throw new FirestoreError(N.FAILED_PRECONDITION, \"The client has already been terminated.\");\n }\n /** Invokes the provided RPC with auth and AppCheck tokens. */ Wo(e, t, n, r) {\n return this.ia(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, s]) => this.connection.Wo(e, __PRIVATE_toResourcePath(t, n), r, i, s))).catch((e => {\n throw \"FirebaseError\" === e.name ? (e.code === N.UNAUTHENTICATED && (this.authCredentials.invalidateToken(), \n this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(N.UNKNOWN, e.toString());\n }));\n }\n /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ Jo(e, t, n, r, i) {\n return this.ia(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, o]) => this.connection.Jo(e, __PRIVATE_toResourcePath(t, n), r, s, o, i))).catch((e => {\n throw \"FirebaseError\" === e.name ? (e.code === N.UNAUTHENTICATED && (this.authCredentials.invalidateToken(), \n this.appCheckCredentials.invalidateToken()), e) : new FirestoreError(N.UNKNOWN, e.toString());\n }));\n }\n terminate() {\n this.ra = true, this.connection.terminate();\n }\n}\n\n// TODO(firestorexp): Make sure there is only one Datastore instance per\n// firestore-exp client.\n/**\n * A component used by the RemoteStore to track the OnlineState (that is,\n * whether or not the client as a whole should be considered to be online or\n * offline), implementing the appropriate heuristics.\n *\n * In particular, when the client is trying to connect to the backend, we\n * allow up to MAX_WATCH_STREAM_FAILURES within ONLINE_STATE_TIMEOUT_MS for\n * a connection to succeed. If we have too many failures or the timeout elapses,\n * then we set the OnlineState to Offline, and the client will behave as if\n * it is offline (get()s will return cached data, etc.).\n */\nclass __PRIVATE_OnlineStateTracker {\n constructor(e, t) {\n this.asyncQueue = e, this.onlineStateHandler = t, \n /** The current OnlineState. */\n this.state = \"Unknown\" /* OnlineState.Unknown */ , \n /**\n * A count of consecutive failures to open the stream. If it reaches the\n * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to\n * Offline.\n */\n this.sa = 0, \n /**\n * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we\n * transition from OnlineState.Unknown to OnlineState.Offline without waiting\n * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).\n */\n this.oa = null, \n /**\n * Whether the client should log a warning message if it fails to connect to\n * the backend (initially true, cleared after a successful stream, or if we've\n * logged the message already).\n */\n this._a = true;\n }\n /**\n * Called by RemoteStore when a watch stream is started (including on each\n * backoff attempt).\n *\n * If this is the first attempt, it sets the OnlineState to Unknown and starts\n * the onlineStateTimer.\n */ aa() {\n 0 === this.sa && (this.ua(\"Unknown\" /* OnlineState.Unknown */), this.oa = this.asyncQueue.enqueueAfterDelay(\"online_state_timeout\" /* TimerId.OnlineStateTimeout */ , 1e4, (() => (this.oa = null, \n this.ca(\"Backend didn't respond within 10 seconds.\"), this.ua(\"Offline\" /* OnlineState.Offline */), \n Promise.resolve()))));\n }\n /**\n * Updates our OnlineState as appropriate after the watch stream reports a\n * failure. The first failure moves us to the 'Unknown' state. We then may\n * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we\n * actually transition to the 'Offline' state.\n */ la(e) {\n \"Online\" /* OnlineState.Online */ === this.state ? this.ua(\"Unknown\" /* OnlineState.Unknown */) : (this.sa++, \n this.sa >= 1 && (this.ha(), this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`), \n this.ua(\"Offline\" /* OnlineState.Offline */)));\n }\n /**\n * Explicitly sets the OnlineState to the specified state.\n *\n * Note that this resets our timers / failure counters, etc. used by our\n * Offline heuristics, so must not be used in place of\n * handleWatchStreamStart() and handleWatchStreamFailure().\n */ set(e) {\n this.ha(), this.sa = 0, \"Online\" /* OnlineState.Online */ === e && (\n // We've connected to watch at least once. Don't warn the developer\n // about being offline going forward.\n this._a = false), this.ua(e);\n }\n ua(e) {\n e !== this.state && (this.state = e, this.onlineStateHandler(e));\n }\n ca(e) {\n const t = `Could not reach Cloud Firestore backend. ${e}\\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;\n this._a ? (__PRIVATE_logError(t), this._a = false) : __PRIVATE_logDebug(\"OnlineStateTracker\", t);\n }\n ha() {\n null !== this.oa && (this.oa.cancel(), this.oa = null);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const Xt = \"RemoteStore\";\n\n// TODO(b/35853402): Negotiate this with the stream.\nclass __PRIVATE_RemoteStoreImpl {\n constructor(\n /**\n * The local store, used to fill the write pipeline with outbound mutations.\n */\n e, \n /** The client-side proxy for interacting with the backend. */\n t, n, r, i) {\n this.localStore = e, this.datastore = t, this.asyncQueue = n, this.remoteSyncer = {}, \n /**\n * A list of up to MAX_PENDING_WRITES writes that we have fetched from the\n * LocalStore via fillWritePipeline() and have or will send to the write\n * stream.\n *\n * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or\n * restart the write stream. When the stream is established the writes in the\n * pipeline will be sent in order.\n *\n * Writes remain in writePipeline until they are acknowledged by the backend\n * and thus will automatically be re-sent if the stream is interrupted /\n * restarted before they're acknowledged.\n *\n * Write responses from the backend are linked to their originating request\n * purely based on order, and so we can just shift() writes from the front of\n * the writePipeline as we receive responses.\n */\n this.Pa = [], \n /**\n * A mapping of watched targets that the client cares about tracking and the\n * user has explicitly called a 'listen' for this target.\n *\n * These targets may or may not have been sent to or acknowledged by the\n * server. On re-establishing the listen stream, these targets should be sent\n * to the server. The targets removed with unlistens are removed eagerly\n * without waiting for confirmation from the listen stream.\n */\n this.Ta = new Map, \n /**\n * A set of reasons for why the RemoteStore may be offline. If empty, the\n * RemoteStore may start its network connections.\n */\n this.Ia = new Set, \n /**\n * Event handlers that get called when the network is disabled or enabled.\n *\n * PORTING NOTE: These functions are used on the Web client to create the\n * underlying streams (to support tree-shakeable streams). On Android and iOS,\n * the streams are created during construction of RemoteStore.\n */\n this.da = [], this.Ea = i, this.Ea.xo((e => {\n n.enqueueAndForget((async () => {\n // Porting Note: Unlike iOS, `restartNetwork()` is called even when the\n // network becomes unreachable as we don't have any other way to tear\n // down our streams.\n __PRIVATE_canUseNetwork(this) && (__PRIVATE_logDebug(Xt, \"Restarting streams for network reachability change.\"), \n await async function __PRIVATE_restartNetwork(e) {\n const t = __PRIVATE_debugCast(e);\n t.Ia.add(4 /* OfflineCause.ConnectivityChange */), await __PRIVATE_disableNetworkInternal(t), \n t.Aa.set(\"Unknown\" /* OnlineState.Unknown */), t.Ia.delete(4 /* OfflineCause.ConnectivityChange */), \n await __PRIVATE_enableNetworkInternal(t);\n }(this));\n }));\n })), this.Aa = new __PRIVATE_OnlineStateTracker(n, r);\n }\n}\n\nasync function __PRIVATE_enableNetworkInternal(e) {\n if (__PRIVATE_canUseNetwork(e)) for (const t of e.da) await t(/* enabled= */ true);\n}\n\n/**\n * Temporarily disables the network. The network can be re-enabled using\n * enableNetwork().\n */ async function __PRIVATE_disableNetworkInternal(e) {\n for (const t of e.da) await t(/* enabled= */ false);\n}\n\n/**\n * Starts new listen for the given target. Uses resume token if provided. It\n * is a no-op if the target of given `TargetData` is already being listened to.\n */\nfunction __PRIVATE_remoteStoreListen(e, t) {\n const n = __PRIVATE_debugCast(e);\n n.Ta.has(t.targetId) || (\n // Mark this as something the client is currently listening for.\n n.Ta.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ? \n // The listen will be sent in onWatchStreamOpen\n __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).x_() && __PRIVATE_sendWatchRequest(n, t));\n}\n\n/**\n * Removes the listen from server. It is a no-op if the given target id is\n * not being listened to.\n */ function __PRIVATE_remoteStoreUnlisten(e, t) {\n const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);\n n.Ta.delete(t), r.x_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.Ta.size && (r.x_() ? r.B_() : __PRIVATE_canUseNetwork(n) && \n // Revert to OnlineState.Unknown if the watch stream is not open and we\n // have no listeners, since without any listens to send we cannot\n // confirm if the stream is healthy and upgrade to OnlineState.Online.\n n.Aa.set(\"Unknown\" /* OnlineState.Unknown */));\n}\n\n/**\n * We need to increment the expected number of pending responses we're due\n * from watch so we wait for the ack to process any messages from this target.\n */ function __PRIVATE_sendWatchRequest(e, t) {\n if (e.Ra.$e(t.targetId), t.resumeToken.approximateByteSize() > 0 || t.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {\n const n = e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;\n t = t.withExpectedCount(n);\n }\n __PRIVATE_ensureWatchStream(e).H_(t);\n}\n\n/**\n * We need to increment the expected number of pending responses we're due\n * from watch so we wait for the removal on the server before we process any\n * messages from this target.\n */ function __PRIVATE_sendUnwatchRequest(e, t) {\n e.Ra.$e(t), __PRIVATE_ensureWatchStream(e).Y_(t);\n}\n\nfunction __PRIVATE_startWatchStream(e) {\n e.Ra = new __PRIVATE_WatchChangeAggregator({\n getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),\n Et: t => e.Ta.get(t) || null,\n lt: () => e.datastore.serializer.databaseId\n }), __PRIVATE_ensureWatchStream(e).start(), e.Aa.aa();\n}\n\n/**\n * Returns whether the watch stream should be started because it's necessary\n * and has not yet been started.\n */ function __PRIVATE_shouldStartWatchStream(e) {\n return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).M_() && e.Ta.size > 0;\n}\n\nfunction __PRIVATE_canUseNetwork(e) {\n return 0 === __PRIVATE_debugCast(e).Ia.size;\n}\n\nfunction __PRIVATE_cleanUpWatchStreamState(e) {\n e.Ra = void 0;\n}\n\nasync function __PRIVATE_onWatchStreamConnected(e) {\n // Mark the client as online since we got a \"connected\" notification.\n e.Aa.set(\"Online\" /* OnlineState.Online */);\n}\n\nasync function __PRIVATE_onWatchStreamOpen(e) {\n e.Ta.forEach(((t, n) => {\n __PRIVATE_sendWatchRequest(e, t);\n }));\n}\n\nasync function __PRIVATE_onWatchStreamClose(e, t) {\n __PRIVATE_cleanUpWatchStreamState(e), \n // If we still need the watch stream, retry the connection.\n __PRIVATE_shouldStartWatchStream(e) ? (e.Aa.la(t), __PRIVATE_startWatchStream(e)) : \n // No need to restart watch stream because there are no active targets.\n // The online state is set to unknown because there is no active attempt\n // at establishing a connection\n e.Aa.set(\"Unknown\" /* OnlineState.Unknown */);\n}\n\nasync function __PRIVATE_onWatchStreamChange(e, t, n) {\n if (\n // Mark the client as online since we got a message from the server\n e.Aa.set(\"Online\" /* OnlineState.Online */), t instanceof __PRIVATE_WatchTargetChange && 2 /* WatchTargetChangeState.Removed */ === t.state && t.cause) \n // There was an error on a target, don't wait for a consistent snapshot\n // to raise events\n try {\n /** Handles an error on a target */\n await async function __PRIVATE_handleTargetError(e, t) {\n const n = t.cause;\n for (const r of t.targetIds) \n // A watched target might have been removed already.\n e.Ta.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.Ta.delete(r), e.Ra.removeTarget(r));\n }\n /**\n * Attempts to fill our write pipeline with writes from the LocalStore.\n *\n * Called internally to bootstrap or refill the write pipeline and by\n * SyncEngine whenever there are new mutations to process.\n *\n * Starts the write stream if necessary.\n */ (e, t);\n } catch (n) {\n __PRIVATE_logDebug(Xt, \"Failed to remove targets %s: %s \", t.targetIds.join(\",\"), n), \n await __PRIVATE_disableNetworkUntilRecovery(e, n);\n } else if (t instanceof __PRIVATE_DocumentWatchChange ? e.Ra.Ye(t) : t instanceof __PRIVATE_ExistenceFilterChange ? e.Ra.it(t) : e.Ra.et(t), \n !n.isEqual(SnapshotVersion.min())) try {\n const t = await __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore);\n n.compareTo(t) >= 0 && \n // We have received a target change with a global snapshot if the snapshot\n // version is not equal to SnapshotVersion.min().\n /**\n * Takes a batch of changes from the Datastore, repackages them as a\n * RemoteEvent, and passes that on to the listener, which is typically the\n * SyncEngine.\n */\n await function __PRIVATE_raiseWatchSnapshot(e, t) {\n const n = e.Ra.Pt(t);\n // Update in-memory resume tokens. LocalStore will update the\n // persistent view of these when applying the completed RemoteEvent.\n return n.targetChanges.forEach(((n, r) => {\n if (n.resumeToken.approximateByteSize() > 0) {\n const i = e.Ta.get(r);\n // A watched target might have been removed already.\n i && e.Ta.set(r, i.withResumeToken(n.resumeToken, t));\n }\n })), \n // Re-establish listens for the targets that have been invalidated by\n // existence filter mismatches.\n n.targetMismatches.forEach(((t, n) => {\n const r = e.Ta.get(t);\n if (!r) \n // A watched target might have been removed already.\n return;\n // Clear the resume token for the target, since we're in a known mismatch\n // state.\n e.Ta.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)), \n // Cause a hard reset by unwatching and rewatching immediately, but\n // deliberately don't send a resume token so that we get a full update.\n __PRIVATE_sendUnwatchRequest(e, t);\n // Mark the target we send as being on behalf of an existence filter\n // mismatch, but don't actually retain that in listenTargets. This ensures\n // that we flag the first re-listen this way without impacting future\n // listens of this target (that might happen e.g. on reconnect).\n const i = new TargetData(r.target, t, n, r.sequenceNumber);\n __PRIVATE_sendWatchRequest(e, i);\n })), e.remoteSyncer.applyRemoteEvent(n);\n }(e, n);\n } catch (t) {\n __PRIVATE_logDebug(Xt, \"Failed to raise snapshot:\", t), await __PRIVATE_disableNetworkUntilRecovery(e, t);\n }\n}\n\n/**\n * Recovery logic for IndexedDB errors that takes the network offline until\n * `op` succeeds. Retries are scheduled with backoff using\n * `enqueueRetryable()`. If `op()` is not provided, IndexedDB access is\n * validated via a generic operation.\n *\n * The returned Promise is resolved once the network is disabled and before\n * any retry attempt.\n */ async function __PRIVATE_disableNetworkUntilRecovery(e, t, n) {\n if (!__PRIVATE_isIndexedDbTransactionError(t)) throw t;\n e.Ia.add(1 /* OfflineCause.IndexedDbFailed */), \n // Disable network and raise offline snapshots\n await __PRIVATE_disableNetworkInternal(e), e.Aa.set(\"Offline\" /* OnlineState.Offline */), \n n || (\n // Use a simple read operation to determine if IndexedDB recovered.\n // Ideally, we would expose a health check directly on SimpleDb, but\n // RemoteStore only has access to persistence through LocalStore.\n n = () => __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e.localStore)), \n // Probe IndexedDB periodically and re-enable network\n e.asyncQueue.enqueueRetryable((async () => {\n __PRIVATE_logDebug(Xt, \"Retrying IndexedDB access\"), await n(), e.Ia.delete(1 /* OfflineCause.IndexedDbFailed */), \n await __PRIVATE_enableNetworkInternal(e);\n }));\n}\n\n/**\n * Executes `op`. If `op` fails, takes the network offline until `op`\n * succeeds. Returns after the first attempt.\n */ function __PRIVATE_executeWithRecovery(e, t) {\n return t().catch((n => __PRIVATE_disableNetworkUntilRecovery(e, n, t)));\n}\n\nasync function __PRIVATE_fillWritePipeline(e) {\n const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);\n let r = t.Pa.length > 0 ? t.Pa[t.Pa.length - 1].batchId : G;\n for (;__PRIVATE_canAddToWritePipeline(t); ) try {\n const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);\n if (null === e) {\n 0 === t.Pa.length && n.B_();\n break;\n }\n r = e.batchId, __PRIVATE_addToWritePipeline(t, e);\n } catch (e) {\n await __PRIVATE_disableNetworkUntilRecovery(t, e);\n }\n __PRIVATE_shouldStartWriteStream(t) && __PRIVATE_startWriteStream(t);\n}\n\n/**\n * Returns true if we can add to the write pipeline (i.e. the network is\n * enabled and the write pipeline is not full).\n */ function __PRIVATE_canAddToWritePipeline(e) {\n return __PRIVATE_canUseNetwork(e) && e.Pa.length < 10;\n}\n\n/**\n * Queues additional writes to be sent to the write stream, sending them\n * immediately if the write stream is established.\n */ function __PRIVATE_addToWritePipeline(e, t) {\n e.Pa.push(t);\n const n = __PRIVATE_ensureWriteStream(e);\n n.x_() && n.Z_ && n.X_(t.mutations);\n}\n\nfunction __PRIVATE_shouldStartWriteStream(e) {\n return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).M_() && e.Pa.length > 0;\n}\n\nfunction __PRIVATE_startWriteStream(e) {\n __PRIVATE_ensureWriteStream(e).start();\n}\n\nasync function __PRIVATE_onWriteStreamOpen(e) {\n __PRIVATE_ensureWriteStream(e).na();\n}\n\nasync function __PRIVATE_onWriteHandshakeComplete(e) {\n const t = __PRIVATE_ensureWriteStream(e);\n // Send the write pipeline now that the stream is established.\n for (const n of e.Pa) t.X_(n.mutations);\n}\n\nasync function __PRIVATE_onMutationResult(e, t, n) {\n const r = e.Pa.shift(), i = MutationBatchResult.from(r, t, n);\n await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))), \n // It's possible that with the completion of this mutation another\n // slot has freed up.\n await __PRIVATE_fillWritePipeline(e);\n}\n\nasync function __PRIVATE_onWriteStreamClose(e, t) {\n // If the write stream closed after the write handshake completes, a write\n // operation failed and we fail the pending operation.\n t && __PRIVATE_ensureWriteStream(e).Z_ && \n // This error affects the actual write.\n await async function __PRIVATE_handleWriteError(e, t) {\n // Only handle permanent errors here. If it's transient, just let the retry\n // logic kick in.\n if (function __PRIVATE_isPermanentWriteError(e) {\n return __PRIVATE_isPermanentError(e) && e !== N.ABORTED;\n }(t.code)) {\n // This was a permanent error, the request itself was the problem\n // so it's not going to succeed if we resend it.\n const n = e.Pa.shift();\n // In this case it's also unlikely that the server itself is melting\n // down -- this was just a bad request so inhibit backoff on the next\n // restart.\n __PRIVATE_ensureWriteStream(e).N_(), await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.rejectFailedWrite(n.batchId, t))), \n // It's possible that with the completion of this mutation\n // another slot has freed up.\n await __PRIVATE_fillWritePipeline(e);\n }\n }(e, t), \n // The write stream might have been started by refilling the write\n // pipeline for failed writes\n __PRIVATE_shouldStartWriteStream(e) && __PRIVATE_startWriteStream(e);\n}\n\nasync function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {\n const n = __PRIVATE_debugCast(e);\n n.asyncQueue.verifyOperationInProgress(), __PRIVATE_logDebug(Xt, \"RemoteStore received new credentials\");\n const r = __PRIVATE_canUseNetwork(n);\n // Tear down and re-create our network streams. This will ensure we get a\n // fresh auth token for the new user and re-fill the write pipeline with\n // new mutations from the LocalStore (since mutations are per-user).\n n.Ia.add(3 /* OfflineCause.CredentialChange */), await __PRIVATE_disableNetworkInternal(n), \n r && \n // Don't set the network status to Unknown if we are offline.\n n.Aa.set(\"Unknown\" /* OnlineState.Unknown */), await n.remoteSyncer.handleCredentialChange(t), \n n.Ia.delete(3 /* OfflineCause.CredentialChange */), await __PRIVATE_enableNetworkInternal(n);\n}\n\n/**\n * Toggles the network state when the client gains or loses its primary lease.\n */ async function __PRIVATE_remoteStoreApplyPrimaryState(e, t) {\n const n = __PRIVATE_debugCast(e);\n t ? (n.Ia.delete(2 /* OfflineCause.IsSecondary */), await __PRIVATE_enableNetworkInternal(n)) : t || (n.Ia.add(2 /* OfflineCause.IsSecondary */), \n await __PRIVATE_disableNetworkInternal(n), n.Aa.set(\"Unknown\" /* OnlineState.Unknown */));\n}\n\n/**\n * If not yet initialized, registers the WatchStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */ function __PRIVATE_ensureWatchStream(e) {\n return e.Va || (\n // Create stream (but note that it is not started yet).\n e.Va = function __PRIVATE_newPersistentWatchStream(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n return r.ia(), new __PRIVATE_PersistentListenStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);\n }\n /**\n * @license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ (e.datastore, e.asyncQueue, {\n Zo: __PRIVATE_onWatchStreamConnected.bind(null, e),\n e_: __PRIVATE_onWatchStreamOpen.bind(null, e),\n n_: __PRIVATE_onWatchStreamClose.bind(null, e),\n J_: __PRIVATE_onWatchStreamChange.bind(null, e)\n }), e.da.push((async t => {\n t ? (e.Va.N_(), __PRIVATE_shouldStartWatchStream(e) ? __PRIVATE_startWatchStream(e) : e.Aa.set(\"Unknown\" /* OnlineState.Unknown */)) : (await e.Va.stop(), \n __PRIVATE_cleanUpWatchStreamState(e));\n }))), e.Va;\n}\n\n/**\n * If not yet initialized, registers the WriteStream and its network state\n * callback with `remoteStoreImpl`. Returns the existing stream if one is\n * already available.\n *\n * PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.\n * This is not done on Web to allow it to be tree-shaken.\n */ function __PRIVATE_ensureWriteStream(e) {\n return e.ma || (\n // Create stream (but note that it is not started yet).\n e.ma = function __PRIVATE_newPersistentWriteStream(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n return r.ia(), new __PRIVATE_PersistentWriteStream(t, r.connection, r.authCredentials, r.appCheckCredentials, r.serializer, n);\n }(e.datastore, e.asyncQueue, {\n Zo: () => Promise.resolve(),\n e_: __PRIVATE_onWriteStreamOpen.bind(null, e),\n n_: __PRIVATE_onWriteStreamClose.bind(null, e),\n ea: __PRIVATE_onWriteHandshakeComplete.bind(null, e),\n ta: __PRIVATE_onMutationResult.bind(null, e)\n }), e.da.push((async t => {\n t ? (e.ma.N_(), \n // This will start the write stream if necessary.\n await __PRIVATE_fillWritePipeline(e)) : (await e.ma.stop(), e.Pa.length > 0 && (__PRIVATE_logDebug(Xt, `Stopping write stream with ${e.Pa.length} pending writes`), \n e.Pa = []));\n }))), e.ma;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents an operation scheduled to be run in the future on an AsyncQueue.\n *\n * It is created via DelayedOperation.createAndSchedule().\n *\n * Supports cancellation (via cancel()) and early execution (via skipDelay()).\n *\n * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type\n * in newer versions of TypeScript defines `finally`, which is not available in\n * IE.\n */\nclass DelayedOperation {\n constructor(e, t, n, r, i) {\n this.asyncQueue = e, this.timerId = t, this.targetTimeMs = n, this.op = r, this.removalCallback = i, \n this.deferred = new __PRIVATE_Deferred, this.then = this.deferred.promise.then.bind(this.deferred.promise), \n // It's normal for the deferred promise to be canceled (due to cancellation)\n // and so we attach a dummy catch callback to avoid\n // 'UnhandledPromiseRejectionWarning' log spam.\n this.deferred.promise.catch((e => {}));\n }\n get promise() {\n return this.deferred.promise;\n }\n /**\n * Creates and returns a DelayedOperation that has been scheduled to be\n * executed on the provided asyncQueue after the provided delayMs.\n *\n * @param asyncQueue - The queue to schedule the operation on.\n * @param id - A Timer ID identifying the type of operation this is.\n * @param delayMs - The delay (ms) before the operation should be scheduled.\n * @param op - The operation to run.\n * @param removalCallback - A callback to be called synchronously once the\n * operation is executed or canceled, notifying the AsyncQueue to remove it\n * from its delayedOperations list.\n * PORTING NOTE: This exists to prevent making removeDelayedOperation() and\n * the DelayedOperation class public.\n */ static createAndSchedule(e, t, n, r, i) {\n const s = Date.now() + n, o = new DelayedOperation(e, t, s, r, i);\n return o.start(n), o;\n }\n /**\n * Starts the timer. This is called immediately after construction by\n * createAndSchedule().\n */ start(e) {\n this.timerHandle = setTimeout((() => this.handleDelayElapsed()), e);\n }\n /**\n * Queues the operation to run immediately (if it hasn't already been run or\n * canceled).\n */ skipDelay() {\n return this.handleDelayElapsed();\n }\n /**\n * Cancels the operation if it hasn't already been executed or canceled. The\n * promise will be rejected.\n *\n * As long as the operation has not yet been run, calling cancel() provides a\n * guarantee that the operation will not be run.\n */ cancel(e) {\n null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new FirestoreError(N.CANCELLED, \"Operation cancelled\" + (e ? \": \" + e : \"\"))));\n }\n handleDelayElapsed() {\n this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(), \n this.op().then((e => this.deferred.resolve(e)))) : Promise.resolve()));\n }\n clearTimeout() {\n null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle), \n this.timerHandle = null);\n }\n}\n\n/**\n * Returns a FirestoreError that can be surfaced to the user if the provided\n * error is an IndexedDbTransactionError. Re-throws the error otherwise.\n */ function __PRIVATE_wrapInUserErrorIfRecoverable(e, t) {\n if (__PRIVATE_logError(\"AsyncQueue\", `${t}: ${e}`), __PRIVATE_isIndexedDbTransactionError(e)) return new FirestoreError(N.UNAVAILABLE, `${t}: ${e}`);\n throw e;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * DocumentSet is an immutable (copy-on-write) collection that holds documents\n * in order specified by the provided comparator. We always add a document key\n * comparator on top of what is provided to guarantee document equality based on\n * the key.\n */ class DocumentSet {\n /**\n * Returns an empty copy of the existing DocumentSet, using the same\n * comparator.\n */\n static emptySet(e) {\n return new DocumentSet(e.comparator);\n }\n /** The default ordering is by key if the comparator is omitted */ constructor(e) {\n // We are adding document key comparator to the end as it's the only\n // guaranteed unique property of a document.\n this.comparator = e ? (t, n) => e(t, n) || DocumentKey.comparator(t.key, n.key) : (e, t) => DocumentKey.comparator(e.key, t.key), \n this.keyedMap = documentMap(), this.sortedSet = new SortedMap(this.comparator);\n }\n has(e) {\n return null != this.keyedMap.get(e);\n }\n get(e) {\n return this.keyedMap.get(e);\n }\n first() {\n return this.sortedSet.minKey();\n }\n last() {\n return this.sortedSet.maxKey();\n }\n isEmpty() {\n return this.sortedSet.isEmpty();\n }\n /**\n * Returns the index of the provided key in the document set, or -1 if the\n * document key is not present in the set;\n */ indexOf(e) {\n const t = this.keyedMap.get(e);\n return t ? this.sortedSet.indexOf(t) : -1;\n }\n get size() {\n return this.sortedSet.size;\n }\n /** Iterates documents in order defined by \"comparator\" */ forEach(e) {\n this.sortedSet.inorderTraversal(((t, n) => (e(t), false)));\n }\n /** Inserts or updates a document with the same key */ add(e) {\n // First remove the element if we have it.\n const t = this.delete(e.key);\n return t.copy(t.keyedMap.insert(e.key, e), t.sortedSet.insert(e, null));\n }\n /** Deletes a document with a given key */ delete(e) {\n const t = this.get(e);\n return t ? this.copy(this.keyedMap.remove(e), this.sortedSet.remove(t)) : this;\n }\n isEqual(e) {\n if (!(e instanceof DocumentSet)) return false;\n if (this.size !== e.size) return false;\n const t = this.sortedSet.getIterator(), n = e.sortedSet.getIterator();\n for (;t.hasNext(); ) {\n const e = t.getNext().key, r = n.getNext().key;\n if (!e.isEqual(r)) return false;\n }\n return true;\n }\n toString() {\n const e = [];\n return this.forEach((t => {\n e.push(t.toString());\n })), 0 === e.length ? \"DocumentSet ()\" : \"DocumentSet (\\n \" + e.join(\" \\n\") + \"\\n)\";\n }\n copy(e, t) {\n const n = new DocumentSet;\n return n.comparator = this.comparator, n.keyedMap = e, n.sortedSet = t, n;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * DocumentChangeSet keeps track of a set of changes to docs in a query, merging\n * duplicate events for the same doc.\n */ class __PRIVATE_DocumentChangeSet {\n constructor() {\n this.fa = new SortedMap(DocumentKey.comparator);\n }\n track(e) {\n const t = e.doc.key, n = this.fa.get(t);\n n ? \n // Merge the new change with the existing change.\n 0 /* ChangeType.Added */ !== e.type && 3 /* ChangeType.Metadata */ === n.type ? this.fa = this.fa.insert(t, e) : 3 /* ChangeType.Metadata */ === e.type && 1 /* ChangeType.Removed */ !== n.type ? this.fa = this.fa.insert(t, {\n type: n.type,\n doc: e.doc\n }) : 2 /* ChangeType.Modified */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.fa = this.fa.insert(t, {\n type: 2 /* ChangeType.Modified */ ,\n doc: e.doc\n }) : 2 /* ChangeType.Modified */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.fa = this.fa.insert(t, {\n type: 0 /* ChangeType.Added */ ,\n doc: e.doc\n }) : 1 /* ChangeType.Removed */ === e.type && 0 /* ChangeType.Added */ === n.type ? this.fa = this.fa.remove(t) : 1 /* ChangeType.Removed */ === e.type && 2 /* ChangeType.Modified */ === n.type ? this.fa = this.fa.insert(t, {\n type: 1 /* ChangeType.Removed */ ,\n doc: n.doc\n }) : 0 /* ChangeType.Added */ === e.type && 1 /* ChangeType.Removed */ === n.type ? this.fa = this.fa.insert(t, {\n type: 2 /* ChangeType.Modified */ ,\n doc: e.doc\n }) : \n // This includes these cases, which don't make sense:\n // Added->Added\n // Removed->Removed\n // Modified->Added\n // Removed->Modified\n // Metadata->Added\n // Removed->Metadata\n fail(63341, {\n At: e,\n ga: n\n }) : this.fa = this.fa.insert(t, e);\n }\n pa() {\n const e = [];\n return this.fa.inorderTraversal(((t, n) => {\n e.push(n);\n })), e;\n }\n}\n\nclass ViewSnapshot {\n constructor(e, t, n, r, i, s, o, _, a) {\n this.query = e, this.docs = t, this.oldDocs = n, this.docChanges = r, this.mutatedKeys = i, \n this.fromCache = s, this.syncStateChanged = o, this.excludesMetadataChanges = _, \n this.hasCachedResults = a;\n }\n /** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(e, t, n, r, i) {\n const s = [];\n return t.forEach((e => {\n s.push({\n type: 0 /* ChangeType.Added */ ,\n doc: e\n });\n })), new ViewSnapshot(e, t, DocumentSet.emptySet(t), s, n, r, \n /* syncStateChanged= */ true, \n /* excludesMetadataChanges= */ false, i);\n }\n get hasPendingWrites() {\n return !this.mutatedKeys.isEmpty();\n }\n isEqual(e) {\n if (!(this.fromCache === e.fromCache && this.hasCachedResults === e.hasCachedResults && this.syncStateChanged === e.syncStateChanged && this.mutatedKeys.isEqual(e.mutatedKeys) && __PRIVATE_queryEquals(this.query, e.query) && this.docs.isEqual(e.docs) && this.oldDocs.isEqual(e.oldDocs))) return false;\n const t = this.docChanges, n = e.docChanges;\n if (t.length !== n.length) return false;\n for (let e = 0; e < t.length; e++) if (t[e].type !== n[e].type || !t[e].doc.isEqual(n[e].doc)) return false;\n return true;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Holds the listeners and the last received ViewSnapshot for a query being\n * tracked by EventManager.\n */ class __PRIVATE_QueryListenersInfo {\n constructor() {\n this.ya = void 0, this.wa = [];\n }\n // Helper methods that checks if the query has listeners that listening to remote store\n Sa() {\n return this.wa.some((e => e.ba()));\n }\n}\n\nclass __PRIVATE_EventManagerImpl {\n constructor() {\n this.queries = __PRIVATE_newQueriesObjectMap(), this.onlineState = \"Unknown\" /* OnlineState.Unknown */ , \n this.Da = new Set;\n }\n terminate() {\n !function __PRIVATE_errorAllTargets(e, t) {\n const n = __PRIVATE_debugCast(e), r = n.queries;\n // Prevent further access by clearing ObjectMap.\n n.queries = __PRIVATE_newQueriesObjectMap(), r.forEach(((e, n) => {\n for (const e of n.wa) e.onError(t);\n }));\n }\n // Call all global snapshot listeners that have been set.\n (this, new FirestoreError(N.ABORTED, \"Firestore shutting down\"));\n }\n}\n\nfunction __PRIVATE_newQueriesObjectMap() {\n return new ObjectMap((e => __PRIVATE_canonifyQuery(e)), __PRIVATE_queryEquals);\n}\n\nasync function __PRIVATE_eventManagerListen(e, t) {\n const n = __PRIVATE_debugCast(e);\n let r = 3 /* ListenerSetupAction.NoActionRequired */;\n const i = t.query;\n let s = n.queries.get(i);\n s ? !s.Sa() && t.ba() && (\n // Query has been listening to local cache, and tries to add a new listener sourced from watch.\n r = 2 /* ListenerSetupAction.RequireWatchConnectionOnly */) : (s = new __PRIVATE_QueryListenersInfo, \n r = t.ba() ? 0 /* ListenerSetupAction.InitializeLocalListenAndRequireWatchConnection */ : 1 /* ListenerSetupAction.InitializeLocalListenOnly */);\n try {\n switch (r) {\n case 0 /* ListenerSetupAction.InitializeLocalListenAndRequireWatchConnection */ :\n s.ya = await n.onListen(i, \n /** enableRemoteListen= */ !0);\n break;\n\n case 1 /* ListenerSetupAction.InitializeLocalListenOnly */ :\n s.ya = await n.onListen(i, \n /** enableRemoteListen= */ !1);\n break;\n\n case 2 /* ListenerSetupAction.RequireWatchConnectionOnly */ :\n await n.onFirstRemoteStoreListen(i);\n }\n } catch (e) {\n const n = __PRIVATE_wrapInUserErrorIfRecoverable(e, `Initialization of query '${__PRIVATE_stringifyQuery(t.query)}' failed`);\n return void t.onError(n);\n }\n if (n.queries.set(i, s), s.wa.push(t), \n // Run global snapshot listeners if a consistent snapshot has been emitted.\n t.va(n.onlineState), s.ya) {\n t.Ca(s.ya) && __PRIVATE_raiseSnapshotsInSyncEvent(n);\n }\n}\n\nasync function __PRIVATE_eventManagerUnlisten(e, t) {\n const n = __PRIVATE_debugCast(e), r = t.query;\n let i = 3 /* ListenerRemovalAction.NoActionRequired */;\n const s = n.queries.get(r);\n if (s) {\n const e = s.wa.indexOf(t);\n e >= 0 && (s.wa.splice(e, 1), 0 === s.wa.length ? i = t.ba() ? 0 /* ListenerRemovalAction.TerminateLocalListenAndRequireWatchDisconnection */ : 1 /* ListenerRemovalAction.TerminateLocalListenOnly */ : !s.Sa() && t.ba() && (\n // The removed listener is the last one that sourced from watch.\n i = 2 /* ListenerRemovalAction.RequireWatchDisconnectionOnly */));\n }\n switch (i) {\n case 0 /* ListenerRemovalAction.TerminateLocalListenAndRequireWatchDisconnection */ :\n return n.queries.delete(r), n.onUnlisten(r, \n /** disableRemoteListen= */ true);\n\n case 1 /* ListenerRemovalAction.TerminateLocalListenOnly */ :\n return n.queries.delete(r), n.onUnlisten(r, \n /** disableRemoteListen= */ false);\n\n case 2 /* ListenerRemovalAction.RequireWatchDisconnectionOnly */ :\n return n.onLastRemoteStoreUnlisten(r);\n\n default:\n return;\n }\n}\n\nfunction __PRIVATE_eventManagerOnWatchChange(e, t) {\n const n = __PRIVATE_debugCast(e);\n let r = false;\n for (const e of t) {\n const t = e.query, i = n.queries.get(t);\n if (i) {\n for (const t of i.wa) t.Ca(e) && (r = true);\n i.ya = e;\n }\n }\n r && __PRIVATE_raiseSnapshotsInSyncEvent(n);\n}\n\nfunction __PRIVATE_eventManagerOnWatchError(e, t, n) {\n const r = __PRIVATE_debugCast(e), i = r.queries.get(t);\n if (i) for (const e of i.wa) e.onError(n);\n // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()\n // after an error.\n r.queries.delete(t);\n}\n\nfunction __PRIVATE_raiseSnapshotsInSyncEvent(e) {\n e.Da.forEach((e => {\n e.next();\n }));\n}\n\nvar en$1, tn;\n\n/** Listen to both cache and server changes */\n(tn = en$1 || (en$1 = {})).Fa = \"default\", \n/** Listen to changes in cache only */\ntn.Cache = \"cache\";\n\n/**\n * QueryListener takes a series of internal view snapshots and determines\n * when to raise the event.\n *\n * It uses an Observer to dispatch events.\n */\nclass __PRIVATE_QueryListener {\n constructor(e, t, n) {\n this.query = e, this.Ma = t, \n /**\n * Initial snapshots (e.g. from cache) may not be propagated to the wrapped\n * observer. This flag is set to true once we've actually raised an event.\n */\n this.xa = false, this.Oa = null, this.onlineState = \"Unknown\" /* OnlineState.Unknown */ , \n this.options = n || {};\n }\n /**\n * Applies the new ViewSnapshot to this listener, raising a user-facing event\n * if applicable (depending on what changed, whether the user has opted into\n * metadata-only changes, etc.). Returns true if a user-facing event was\n * indeed raised.\n */ Ca(e) {\n if (!this.options.includeMetadataChanges) {\n // Remove the metadata only changes.\n const t = [];\n for (const n of e.docChanges) 3 /* ChangeType.Metadata */ !== n.type && t.push(n);\n e = new ViewSnapshot(e.query, e.docs, e.oldDocs, t, e.mutatedKeys, e.fromCache, e.syncStateChanged, \n /* excludesMetadataChanges= */ true, e.hasCachedResults);\n }\n let t = false;\n return this.xa ? this.Na(e) && (this.Ma.next(e), t = true) : this.Ba(e, this.onlineState) && (this.La(e), \n t = true), this.Oa = e, t;\n }\n onError(e) {\n this.Ma.error(e);\n }\n /** Returns whether a snapshot was raised. */ va(e) {\n this.onlineState = e;\n let t = false;\n return this.Oa && !this.xa && this.Ba(this.Oa, e) && (this.La(this.Oa), t = true), \n t;\n }\n Ba(e, t) {\n // Always raise the first event when we're synced\n if (!e.fromCache) return true;\n // Always raise event if listening to cache\n if (!this.ba()) return true;\n // NOTE: We consider OnlineState.Unknown as online (it should become Offline\n // or Online if we wait long enough).\n const n = \"Offline\" /* OnlineState.Offline */ !== t;\n // Don't raise the event if we're online, aren't synced yet (checked\n // above) and are waiting for a sync.\n return (!this.options.ka || !n) && (!e.docs.isEmpty() || e.hasCachedResults || \"Offline\" /* OnlineState.Offline */ === t);\n // Raise data from cache if we have any documents, have cached results before,\n // or we are offline.\n }\n Na(e) {\n // We don't need to handle includeDocumentMetadataChanges here because\n // the Metadata only changes have already been stripped out if needed.\n // At this point the only changes we will see are the ones we should\n // propagate.\n if (e.docChanges.length > 0) return true;\n const t = this.Oa && this.Oa.hasPendingWrites !== e.hasPendingWrites;\n return !(!e.syncStateChanged && !t) && true === this.options.includeMetadataChanges;\n // Generally we should have hit one of the cases above, but it's possible\n // to get here if there were only metadata docChanges and they got\n // stripped out.\n }\n La(e) {\n e = ViewSnapshot.fromInitialDocuments(e.query, e.docs, e.mutatedKeys, e.fromCache, e.hasCachedResults), \n this.xa = true, this.Ma.next(e);\n }\n ba() {\n return this.options.source !== en$1.Cache;\n }\n}\n\n/**\n * Returns a `LoadBundleTaskProgress` representing the progress that the loading\n * has succeeded.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass __PRIVATE_AddedLimboDocument {\n constructor(e) {\n this.key = e;\n }\n}\n\nclass __PRIVATE_RemovedLimboDocument {\n constructor(e) {\n this.key = e;\n }\n}\n\n/**\n * View is responsible for computing the final merged truth of what docs are in\n * a query. It gets notified of local and remote changes to docs, and applies\n * the query filters and limits to determine the most correct possible results.\n */ class __PRIVATE_View {\n constructor(e, \n /** Documents included in the remote target */\n t) {\n this.query = e, this.Ha = t, this.Ya = null, this.hasCachedResults = false, \n /**\n * A flag whether the view is current with the backend. A view is considered\n * current after it has seen the current flag from the backend and did not\n * lose consistency within the watch stream (e.g. because of an existence\n * filter mismatch).\n */\n this.current = false, \n /** Documents in the view but not in the remote target */\n this.Za = __PRIVATE_documentKeySet(), \n /** Document Keys that have local changes */\n this.mutatedKeys = __PRIVATE_documentKeySet(), this.Xa = __PRIVATE_newQueryComparator(e), \n this.eu = new DocumentSet(this.Xa);\n }\n /**\n * The set of remote documents that the server has told us belongs to the target associated with\n * this view.\n */ get tu() {\n return this.Ha;\n }\n /**\n * Iterates over a set of doc changes, applies the query limit, and computes\n * what the new results should be, what the changes were, and whether we may\n * need to go back to the local cache for more results. Does not make any\n * changes to the view.\n * @param docChanges - The doc changes to apply to this view.\n * @param previousChanges - If this is being called with a refill, then start\n * with this set of docs and changes instead of the current view.\n * @returns a new set of docs, changes, and refill flag.\n */ nu(e, t) {\n const n = t ? t.ru : new __PRIVATE_DocumentChangeSet, r = t ? t.eu : this.eu;\n let i = t ? t.mutatedKeys : this.mutatedKeys, s = r, o = false;\n // Track the last doc in a (full) limit. This is necessary, because some\n // update (a delete, or an update moving a doc past the old limit) might\n // mean there is some other document in the local cache that either should\n // come (1) between the old last limit doc and the new last document, in the\n // case of updates, or (2) after the new last document, in the case of\n // deletes. So we keep this doc at the old limit to compare the updates to.\n // Note that this should never get used in a refill (when previousChanges is\n // set), because there will only be adds -- no deletes or updates.\n const _ = \"F\" /* LimitType.First */ === this.query.limitType && r.size === this.query.limit ? r.last() : null, a = \"L\" /* LimitType.Last */ === this.query.limitType && r.size === this.query.limit ? r.first() : null;\n // Drop documents out to meet limit/limitToLast requirement.\n if (e.inorderTraversal(((e, t) => {\n const u = r.get(e), c = __PRIVATE_queryMatches(this.query, t) ? t : null, l = !!u && this.mutatedKeys.has(u.key), h = !!c && (c.hasLocalMutations || \n // We only consider committed mutations for documents that were\n // mutated during the lifetime of the view.\n this.mutatedKeys.has(c.key) && c.hasCommittedMutations);\n let P = false;\n // Calculate change\n if (u && c) {\n u.data.isEqual(c.data) ? l !== h && (n.track({\n type: 3 /* ChangeType.Metadata */ ,\n doc: c\n }), P = true) : this.iu(u, c) || (n.track({\n type: 2 /* ChangeType.Modified */ ,\n doc: c\n }), P = true, (_ && this.Xa(c, _) > 0 || a && this.Xa(c, a) < 0) && (\n // This doc moved from inside the limit to outside the limit.\n // That means there may be some other doc in the local cache\n // that should be included instead.\n o = true));\n } else !u && c ? (n.track({\n type: 0 /* ChangeType.Added */ ,\n doc: c\n }), P = true) : u && !c && (n.track({\n type: 1 /* ChangeType.Removed */ ,\n doc: u\n }), P = true, (_ || a) && (\n // A doc was removed from a full limit query. We'll need to\n // requery from the local cache to see if we know about some other\n // doc that should be in the results.\n o = true));\n P && (c ? (s = s.add(c), i = h ? i.add(e) : i.delete(e)) : (s = s.delete(e), i = i.delete(e)));\n })), null !== this.query.limit) for (;s.size > this.query.limit; ) {\n const e = \"F\" /* LimitType.First */ === this.query.limitType ? s.last() : s.first();\n s = s.delete(e.key), i = i.delete(e.key), n.track({\n type: 1 /* ChangeType.Removed */ ,\n doc: e\n });\n }\n return {\n eu: s,\n ru: n,\n Ds: o,\n mutatedKeys: i\n };\n }\n iu(e, t) {\n // We suppress the initial change event for documents that were modified as\n // part of a write acknowledgment (e.g. when the value of a server transform\n // is applied) as Watch will send us the same document again.\n // By suppressing the event, we only raise two user visible events (one with\n // `hasPendingWrites` and the final state of the document) instead of three\n // (one with `hasPendingWrites`, the modified document with\n // `hasPendingWrites` and the final state of the document).\n return e.hasLocalMutations && t.hasCommittedMutations && !t.hasLocalMutations;\n }\n /**\n * Updates the view with the given ViewDocumentChanges and optionally updates\n * limbo docs and sync state from the provided target change.\n * @param docChanges - The set of changes to make to the view's docs.\n * @param limboResolutionEnabled - Whether to update limbo documents based on\n * this change.\n * @param targetChange - A target change to apply for computing limbo docs and\n * sync state.\n * @param targetIsPendingReset - Whether the target is pending to reset due to\n * existence filter mismatch. If not explicitly specified, it is treated\n * equivalently to `false`.\n * @returns A new ViewChange with the given docs, changes, and sync state.\n */\n // PORTING NOTE: The iOS/Android clients always compute limbo document changes.\n applyChanges(e, t, n, r) {\n const i = this.eu;\n this.eu = e.eu, this.mutatedKeys = e.mutatedKeys;\n // Sort changes based on type and query comparator\n const s = e.ru.pa();\n s.sort(((e, t) => function __PRIVATE_compareChangeType(e, t) {\n const order = e => {\n switch (e) {\n case 0 /* ChangeType.Added */ :\n return 1;\n\n case 2 /* ChangeType.Modified */ :\n case 3 /* ChangeType.Metadata */ :\n // A metadata change is converted to a modified change at the public\n // api layer. Since we sort by document key and then change type,\n // metadata and modified changes must be sorted equivalently.\n return 2;\n\n case 1 /* ChangeType.Removed */ :\n return 0;\n\n default:\n return fail(20277, {\n At: e\n });\n }\n };\n return order(e) - order(t);\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ (e.type, t.type) || this.Xa(e.doc, t.doc))), this.su(n), r = null != r && r;\n const o = t && !r ? this.ou() : [], _ = 0 === this.Za.size && this.current && !r ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , a = _ !== this.Ya;\n // We are at synced state if there is no limbo docs are waiting to be resolved, view is current\n // with the backend, and the query is not pending to reset due to existence filter mismatch.\n if (this.Ya = _, 0 !== s.length || a) {\n return {\n snapshot: new ViewSnapshot(this.query, e.eu, i, s, e.mutatedKeys, 0 /* SyncState.Local */ === _, a, \n /* excludesMetadataChanges= */ false, !!n && n.resumeToken.approximateByteSize() > 0),\n _u: o\n };\n }\n // no changes\n return {\n _u: o\n };\n }\n /**\n * Applies an OnlineState change to the view, potentially generating a\n * ViewChange if the view's syncState changes as a result.\n */ va(e) {\n return this.current && \"Offline\" /* OnlineState.Offline */ === e ? (\n // If we're offline, set `current` to false and then call applyChanges()\n // to refresh our syncState and generate a ViewChange as appropriate. We\n // are guaranteed to get a new TargetChange that sets `current` back to\n // true once the client is back online.\n this.current = false, this.applyChanges({\n eu: this.eu,\n ru: new __PRIVATE_DocumentChangeSet,\n mutatedKeys: this.mutatedKeys,\n Ds: false\n }, \n /* limboResolutionEnabled= */ false)) : {\n _u: []\n };\n }\n /**\n * Returns whether the doc for the given key should be in limbo.\n */ au(e) {\n // If the remote end says it's part of this query, it's not in limbo.\n return !this.Ha.has(e) && (\n // The local store doesn't think it's a result, so it shouldn't be in limbo.\n !!this.eu.has(e) && !this.eu.get(e).hasLocalMutations);\n }\n /**\n * Updates syncedDocuments, current, and limbo docs based on the given change.\n * Returns the list of changes to which docs are in limbo.\n */ su(e) {\n e && (e.addedDocuments.forEach((e => this.Ha = this.Ha.add(e))), e.modifiedDocuments.forEach((e => {})), \n e.removedDocuments.forEach((e => this.Ha = this.Ha.delete(e))), this.current = e.current);\n }\n ou() {\n // We can only determine limbo documents when we're in-sync with the server.\n if (!this.current) return [];\n // TODO(klimt): Do this incrementally so that it's not quadratic when\n // updating many documents.\n const e = this.Za;\n this.Za = __PRIVATE_documentKeySet(), this.eu.forEach((e => {\n this.au(e.key) && (this.Za = this.Za.add(e.key));\n }));\n // Diff the new limbo docs with the old limbo docs.\n const t = [];\n return e.forEach((e => {\n this.Za.has(e) || t.push(new __PRIVATE_RemovedLimboDocument(e));\n })), this.Za.forEach((n => {\n e.has(n) || t.push(new __PRIVATE_AddedLimboDocument(n));\n })), t;\n }\n /**\n * Update the in-memory state of the current view with the state read from\n * persistence.\n *\n * We update the query view whenever a client's primary status changes:\n * - When a client transitions from primary to secondary, it can miss\n * LocalStorage updates and its query views may temporarily not be\n * synchronized with the state on disk.\n * - For secondary to primary transitions, the client needs to update the list\n * of `syncedDocuments` since secondary clients update their query views\n * based purely on synthesized RemoteEvents.\n *\n * @param queryResult.documents - The documents that match the query according\n * to the LocalStore.\n * @param queryResult.remoteKeys - The keys of the documents that match the\n * query according to the backend.\n *\n * @returns The ViewChange that resulted from this synchronization.\n */\n // PORTING NOTE: Multi-tab only.\n uu(e) {\n this.Ha = e.qs, this.Za = __PRIVATE_documentKeySet();\n const t = this.nu(e.documents);\n return this.applyChanges(t, /* limboResolutionEnabled= */ true);\n }\n /**\n * Returns a view snapshot as if this query was just listened to. Contains\n * a document add for every existing document and the `fromCache` and\n * `hasPendingWrites` status of the already established view.\n */\n // PORTING NOTE: Multi-tab only.\n cu() {\n return ViewSnapshot.fromInitialDocuments(this.query, this.eu, this.mutatedKeys, 0 /* SyncState.Local */ === this.Ya, this.hasCachedResults);\n }\n}\n\nconst nn = \"SyncEngine\";\n\n/**\n * QueryView contains all of the data that SyncEngine needs to keep track of for\n * a particular query.\n */ class __PRIVATE_QueryView {\n constructor(\n /**\n * The query itself.\n */\n e, \n /**\n * The target number created by the client that is used in the watch\n * stream to identify this query.\n */\n t, \n /**\n * The view is responsible for computing the final merged truth of what\n * docs are in the query. It gets notified of local and remote changes,\n * and applies the query filters and limits to determine the most correct\n * possible results.\n */\n n) {\n this.query = e, this.targetId = t, this.view = n;\n }\n}\n\n/** Tracks a limbo resolution. */ class LimboResolution {\n constructor(e) {\n this.key = e, \n /**\n * Set to true once we've received a document. This is used in\n * getRemoteKeysForTarget() and ultimately used by WatchChangeAggregator to\n * decide whether it needs to manufacture a delete event for the target once\n * the target is CURRENT.\n */\n this.lu = false;\n }\n}\n\n/**\n * An implementation of `SyncEngine` coordinating with other parts of SDK.\n *\n * The parts of SyncEngine that act as a callback to RemoteStore need to be\n * registered individually. This is done in `syncEngineWrite()` and\n * `syncEngineListen()` (as well as `applyPrimaryState()`) as these methods\n * serve as entry points to RemoteStore's functionality.\n *\n * Note: some field defined in this class might have public access level, but\n * the class is not exported so they are only accessible from this module.\n * This is useful to implement optional features (like bundles) in free\n * functions, such that they are tree-shakeable.\n */ class __PRIVATE_SyncEngineImpl {\n constructor(e, t, n, \n // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, s) {\n this.localStore = e, this.remoteStore = t, this.eventManager = n, this.sharedClientState = r, \n this.currentUser = i, this.maxConcurrentLimboResolutions = s, this.hu = {}, this.Pu = new ObjectMap((e => __PRIVATE_canonifyQuery(e)), __PRIVATE_queryEquals), \n this.Tu = new Map, \n /**\n * The keys of documents that are in limbo for which we haven't yet started a\n * limbo resolution query. The strings in this set are the result of calling\n * `key.path.canonicalString()` where `key` is a `DocumentKey` object.\n *\n * The `Set` type was chosen because it provides efficient lookup and removal\n * of arbitrary elements and it also maintains insertion order, providing the\n * desired queue-like FIFO semantics.\n */\n this.Iu = new Set, \n /**\n * Keeps track of the target ID for each document that is in limbo with an\n * active target.\n */\n this.du = new SortedMap(DocumentKey.comparator), \n /**\n * Keeps track of the information about an active limbo resolution for each\n * active target ID that was started for the purpose of limbo resolution.\n */\n this.Eu = new Map, this.Au = new __PRIVATE_ReferenceSet, \n /** Stores user completion handlers, indexed by User and BatchId. */\n this.Ru = {}, \n /** Stores user callbacks waiting for all pending writes to be acknowledged. */\n this.Vu = new Map, this.mu = __PRIVATE_TargetIdGenerator.ur(), this.onlineState = \"Unknown\" /* OnlineState.Unknown */ , \n // The primary state is set to `true` or `false` immediately after Firestore\n // startup. In the interim, a client should only be considered primary if\n // `isPrimary` is true.\n this.fu = void 0;\n }\n get isPrimaryClient() {\n return true === this.fu;\n }\n}\n\n/**\n * Initiates the new listen, resolves promise when listen enqueued to the\n * server. All the subsequent view snapshots or errors are sent to the\n * subscribed handlers. Returns the initial snapshot.\n */\nasync function __PRIVATE_syncEngineListen(e, t, n = true) {\n const r = __PRIVATE_ensureWatchCallbacks(e);\n let i;\n const s = r.Pu.get(t);\n return s ? (\n // PORTING NOTE: With Multi-Tab Web, it is possible that a query view\n // already exists when EventManager calls us for the first time. This\n // happens when the primary tab is already listening to this query on\n // behalf of another tab and the user of the primary also starts listening\n // to the query. EventManager will not have an assigned target ID in this\n // case and calls `listen` to obtain this ID.\n r.sharedClientState.addLocalQueryTarget(s.targetId), i = s.view.cu()) : i = await __PRIVATE_allocateTargetAndMaybeListen(r, t, n, \n /** shouldInitializeView= */ true), i;\n}\n\n/** Query has been listening to the cache, and tries to initiate the remote store listen */ async function __PRIVATE_triggerRemoteStoreListen(e, t) {\n const n = __PRIVATE_ensureWatchCallbacks(e);\n await __PRIVATE_allocateTargetAndMaybeListen(n, t, \n /** shouldListenToRemote= */ true, \n /** shouldInitializeView= */ false);\n}\n\nasync function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {\n const i = await __PRIVATE_localStoreAllocateTarget(e.localStore, __PRIVATE_queryToTarget(t)), s = i.targetId, o = e.sharedClientState.addLocalQueryTarget(s, n);\n let _;\n return r && (_ = await __PRIVATE_initializeViewAndComputeSnapshot(e, t, s, \"current\" === o, i.resumeToken)), \n e.isPrimaryClient && n && __PRIVATE_remoteStoreListen(e.remoteStore, i), _;\n}\n\n/**\n * Registers a view for a previously unknown query and computes its initial\n * snapshot.\n */ async function __PRIVATE_initializeViewAndComputeSnapshot(e, t, n, r, i) {\n // PORTING NOTE: On Web only, we inject the code that registers new Limbo\n // targets based on view changes. This allows us to only depend on Limbo\n // changes when user code includes queries.\n e.gu = (t, n, r) => async function __PRIVATE_applyDocChanges(e, t, n, r) {\n let i = t.view.nu(n);\n i.Ds && (\n // The query has a limit and some docs were removed, so we need\n // to re-run the query against the local store to make sure we\n // didn't lose any good docs that had been past the limit.\n i = await __PRIVATE_localStoreExecuteQuery(e.localStore, t.query, \n /* usePreviousResults= */ false).then((({documents: e}) => t.view.nu(e, i))));\n const s = r && r.targetChanges.get(t.targetId), o = r && null != r.targetMismatches.get(t.targetId), _ = t.view.applyChanges(i, \n /* limboResolutionEnabled= */ e.isPrimaryClient, s, o);\n return __PRIVATE_updateTrackedLimbos(e, t.targetId, _._u), _.snapshot;\n }(e, t, n, r);\n const s = await __PRIVATE_localStoreExecuteQuery(e.localStore, t, \n /* usePreviousResults= */ true), o = new __PRIVATE_View(t, s.qs), _ = o.nu(s.documents), a = TargetChange.createSynthesizedTargetChangeForCurrentChange(n, r && \"Offline\" /* OnlineState.Offline */ !== e.onlineState, i), u = o.applyChanges(_, \n /* limboResolutionEnabled= */ e.isPrimaryClient, a);\n __PRIVATE_updateTrackedLimbos(e, n, u._u);\n const c = new __PRIVATE_QueryView(t, n, o);\n return e.Pu.set(t, c), e.Tu.has(n) ? e.Tu.get(n).push(t) : e.Tu.set(n, [ t ]), u.snapshot;\n}\n\n/** Stops listening to the query. */ async function __PRIVATE_syncEngineUnlisten(e, t, n) {\n const r = __PRIVATE_debugCast(e), i = r.Pu.get(t), s = r.Tu.get(i.targetId);\n if (s.length > 1) return r.Tu.set(i.targetId, s.filter((e => !__PRIVATE_queryEquals(e, t)))), \n void r.Pu.delete(t);\n // No other queries are mapped to the target, clean up the query and the target.\n if (r.isPrimaryClient) {\n // We need to remove the local query target first to allow us to verify\n // whether any other client is still interested in this target.\n r.sharedClientState.removeLocalQueryTarget(i.targetId);\n r.sharedClientState.isActiveQueryTarget(i.targetId) || await __PRIVATE_localStoreReleaseTarget(r.localStore, i.targetId, \n /*keepPersistedTargetData=*/ false).then((() => {\n r.sharedClientState.clearQueryState(i.targetId), n && __PRIVATE_remoteStoreUnlisten(r.remoteStore, i.targetId), \n __PRIVATE_removeAndCleanupTarget(r, i.targetId);\n })).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);\n } else __PRIVATE_removeAndCleanupTarget(r, i.targetId), await __PRIVATE_localStoreReleaseTarget(r.localStore, i.targetId, \n /*keepPersistedTargetData=*/ true);\n}\n\n/** Unlistens to the remote store while still listening to the cache. */ async function __PRIVATE_triggerRemoteStoreUnlisten(e, t) {\n const n = __PRIVATE_debugCast(e), r = n.Pu.get(t), i = n.Tu.get(r.targetId);\n n.isPrimaryClient && 1 === i.length && (\n // PORTING NOTE: Unregister the target ID with local Firestore client as\n // watch target.\n n.sharedClientState.removeLocalQueryTarget(r.targetId), __PRIVATE_remoteStoreUnlisten(n.remoteStore, r.targetId));\n}\n\n/**\n * Initiates the write of local mutation batch which involves adding the\n * writes to the mutation queue, notifying the remote store about new\n * mutations and raising events for any changes this write caused.\n *\n * The promise returned by this call is resolved when the above steps\n * have completed, *not* when the write was acked by the backend. The\n * userCallback is resolved once the write was acked/rejected by the\n * backend (or failed locally for any other reason).\n */ async function __PRIVATE_syncEngineWrite(e, t, n) {\n const r = __PRIVATE_syncEngineEnsureWriteCallbacks(e);\n try {\n const e = await function __PRIVATE_localStoreWriteLocally(e, t) {\n const n = __PRIVATE_debugCast(e), r = Timestamp.now(), i = t.reduce(((e, t) => e.add(t.key)), __PRIVATE_documentKeySet());\n let s, o;\n return n.persistence.runTransaction(\"Locally write mutations\", \"readwrite\", (e => {\n // Figure out which keys do not have a remote version in the cache, this\n // is needed to create the right overlay mutation: if no remote version\n // presents, we do not need to create overlays as patch mutations.\n // TODO(Overlay): Is there a better way to determine this? Using the\n // document version does not work because local mutations set them back\n // to 0.\n let _ = __PRIVATE_mutableDocumentMap(), a = __PRIVATE_documentKeySet();\n return n.Os.getEntries(e, i).next((e => {\n _ = e, _.forEach(((e, t) => {\n t.isValidDocument() || (a = a.add(e));\n }));\n })).next((() => n.localDocuments.getOverlayedDocuments(e, _))).next((i => {\n s = i;\n // For non-idempotent mutations (such as `FieldValue.increment()`),\n // we record the base state in a separate patch mutation. This is\n // later used to guarantee consistent values and prevents flicker\n // even if the backend sends us an update that already includes our\n // transform.\n const o = [];\n for (const e of t) {\n const t = __PRIVATE_mutationExtractBaseValue(e, s.get(e.key).overlayedDocument);\n null != t && \n // NOTE: The base state should only be applied if there's some\n // existing document to override, so use a Precondition of\n // exists=true\n o.push(new __PRIVATE_PatchMutation(e.key, t, __PRIVATE_extractFieldMask(t.value.mapValue), Precondition.exists(!0)));\n }\n return n.mutationQueue.addMutationBatch(e, r, o, t);\n })).next((t => {\n o = t;\n const r = t.applyToLocalDocumentSet(s, a);\n return n.documentOverlayCache.saveOverlays(e, t.batchId, r);\n }));\n })).then((() => ({\n batchId: o.batchId,\n changes: __PRIVATE_convertOverlayedDocumentMapToDocumentMap(s)\n })));\n }(r.localStore, t);\n r.sharedClientState.addPendingMutation(e.batchId), function __PRIVATE_addMutationCallback(e, t, n) {\n let r = e.Ru[e.currentUser.toKey()];\n r || (r = new SortedMap(__PRIVATE_primitiveComparator));\n r = r.insert(t, n), e.Ru[e.currentUser.toKey()] = r;\n }\n /**\n * Resolves or rejects the user callback for the given batch and then discards\n * it.\n */ (r, e.batchId, n), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(r, e.changes), \n await __PRIVATE_fillWritePipeline(r.remoteStore);\n } catch (e) {\n // If we can't persist the mutation, we reject the user callback and\n // don't send the mutation. The user can then retry the write.\n const t = __PRIVATE_wrapInUserErrorIfRecoverable(e, \"Failed to persist write\");\n n.reject(t);\n }\n}\n\n/**\n * Applies one remote event to the sync engine, notifying any views of the\n * changes, and releasing any pending mutation batches that would become\n * visible because of the snapshot version the remote event contains.\n */ async function __PRIVATE_syncEngineApplyRemoteEvent(e, t) {\n const n = __PRIVATE_debugCast(e);\n try {\n const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);\n // Update `receivedDocument` as appropriate for any limbo targets.\n t.targetChanges.forEach(((e, t) => {\n const r = n.Eu.get(t);\n r && (\n // Since this is a limbo resolution lookup, it's for a single document\n // and it could be added, modified, or removed, but not a combination.\n __PRIVATE_hardAssert(e.addedDocuments.size + e.modifiedDocuments.size + e.removedDocuments.size <= 1, 22616), \n e.addedDocuments.size > 0 ? r.lu = !0 : e.modifiedDocuments.size > 0 ? __PRIVATE_hardAssert(r.lu, 14607) : e.removedDocuments.size > 0 && (__PRIVATE_hardAssert(r.lu, 42227), \n r.lu = !1));\n })), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e, t);\n } catch (e) {\n await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);\n }\n}\n\n/**\n * Applies an OnlineState change to the sync engine and notifies any views of\n * the change.\n */ function __PRIVATE_syncEngineApplyOnlineStateChange(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n // If we are the secondary client, we explicitly ignore the remote store's\n // online state (the local client may go offline, even though the primary\n // tab remains online) and only apply the primary tab's online state from\n // SharedClientState.\n if (r.isPrimaryClient && 0 /* OnlineStateSource.RemoteStore */ === n || !r.isPrimaryClient && 1 /* OnlineStateSource.SharedClientState */ === n) {\n const e = [];\n r.Pu.forEach(((n, r) => {\n const i = r.view.va(t);\n i.snapshot && e.push(i.snapshot);\n })), function __PRIVATE_eventManagerOnOnlineStateChange(e, t) {\n const n = __PRIVATE_debugCast(e);\n n.onlineState = t;\n let r = false;\n n.queries.forEach(((e, n) => {\n for (const e of n.wa) \n // Run global snapshot listeners if a consistent snapshot has been emitted.\n e.va(t) && (r = true);\n })), r && __PRIVATE_raiseSnapshotsInSyncEvent(n);\n }(r.eventManager, t), e.length && r.hu.J_(e), r.onlineState = t, r.isPrimaryClient && r.sharedClientState.setOnlineState(t);\n }\n}\n\n/**\n * Rejects the listen for the given targetID. This can be triggered by the\n * backend for any active target.\n *\n * @param syncEngine - The sync engine implementation.\n * @param targetId - The targetID corresponds to one previously initiated by the\n * user as part of TargetData passed to listen() on RemoteStore.\n * @param err - A description of the condition that has forced the rejection.\n * Nearly always this will be an indication that the user is no longer\n * authorized to see the data matching the target.\n */ async function __PRIVATE_syncEngineRejectListen(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n // PORTING NOTE: Multi-tab only.\n r.sharedClientState.updateQueryState(t, \"rejected\", n);\n const i = r.Eu.get(t), s = i && i.key;\n if (s) {\n // TODO(klimt): We really only should do the following on permission\n // denied errors, but we don't have the cause code here.\n // It's a limbo doc. Create a synthetic event saying it was deleted.\n // This is kind of a hack. Ideally, we would have a method in the local\n // store to purge a document. However, it would be tricky to keep all of\n // the local store's invariants with another method.\n let e = new SortedMap(DocumentKey.comparator);\n // TODO(b/217189216): This limbo document should ideally have a read time,\n // so that it is picked up by any read-time based scans. The backend,\n // however, does not send a read time for target removals.\n e = e.insert(s, MutableDocument.newNoDocument(s, SnapshotVersion.min()));\n const n = __PRIVATE_documentKeySet().add(s), i = new RemoteEvent(SnapshotVersion.min(), \n /* targetChanges= */ new Map, \n /* targetMismatches= */ new SortedMap(__PRIVATE_primitiveComparator), e, n);\n await __PRIVATE_syncEngineApplyRemoteEvent(r, i), \n // Since this query failed, we won't want to manually unlisten to it.\n // We only remove it from bookkeeping after we successfully applied the\n // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to\n // this query when the RemoteStore restarts the Watch stream, which should\n // re-trigger the target failure.\n r.du = r.du.remove(s), r.Eu.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);\n } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t, \n /* keepPersistedTargetData */ false).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);\n}\n\nasync function __PRIVATE_syncEngineApplySuccessfulWrite(e, t) {\n const n = __PRIVATE_debugCast(e), r = t.batch.batchId;\n try {\n const e = await __PRIVATE_localStoreAcknowledgeBatch(n.localStore, t);\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught\n // up), so we raise user callbacks first so that they consistently happen\n // before listen events.\n __PRIVATE_processUserCallback(n, r, /*error=*/ null), __PRIVATE_triggerPendingWritesCallbacks(n, r), \n n.sharedClientState.updateMutationState(r, \"acknowledged\"), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e);\n } catch (e) {\n await __PRIVATE_ignoreIfPrimaryLeaseLoss(e);\n }\n}\n\nasync function __PRIVATE_syncEngineRejectFailedWrite(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n try {\n const e = await function __PRIVATE_localStoreRejectBatch(e, t) {\n const n = __PRIVATE_debugCast(e);\n return n.persistence.runTransaction(\"Reject batch\", \"readwrite-primary\", (e => {\n let r;\n return n.mutationQueue.lookupMutationBatch(e, t).next((t => (__PRIVATE_hardAssert(null !== t, 37113), \n r = t.keys(), n.mutationQueue.removeMutationBatch(e, t)))).next((() => n.mutationQueue.performConsistencyCheck(e))).next((() => n.documentOverlayCache.removeOverlaysForBatchId(e, r, t))).next((() => n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e, r))).next((() => n.localDocuments.getDocuments(e, r)));\n }));\n }\n /**\n * Returns the largest (latest) batch id in mutation queue that is pending\n * server response.\n *\n * Returns `BATCHID_UNKNOWN` if the queue is empty.\n */ (r.localStore, t);\n // The local store may or may not be able to apply the write result and\n // raise events immediately (depending on whether the watcher is caught up),\n // so we raise user callbacks first so that they consistently happen before\n // listen events.\n __PRIVATE_processUserCallback(r, t, n), __PRIVATE_triggerPendingWritesCallbacks(r, t), \n r.sharedClientState.updateMutationState(t, \"rejected\", n), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(r, e);\n } catch (n) {\n await __PRIVATE_ignoreIfPrimaryLeaseLoss(n);\n }\n}\n\n/**\n * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,\n * if there are any.\n */ function __PRIVATE_triggerPendingWritesCallbacks(e, t) {\n (e.Vu.get(t) || []).forEach((e => {\n e.resolve();\n })), e.Vu.delete(t);\n}\n\n/** Reject all outstanding callbacks waiting for pending writes to complete. */ function __PRIVATE_processUserCallback(e, t, n) {\n const r = __PRIVATE_debugCast(e);\n let i = r.Ru[r.currentUser.toKey()];\n // NOTE: Mutations restored from persistence won't have callbacks, so it's\n // okay for there to be no callback for this ID.\n if (i) {\n const e = i.get(t);\n e && (n ? e.reject(n) : e.resolve(), i = i.remove(t)), r.Ru[r.currentUser.toKey()] = i;\n }\n}\n\nfunction __PRIVATE_removeAndCleanupTarget(e, t, n = null) {\n e.sharedClientState.removeLocalQueryTarget(t);\n for (const r of e.Tu.get(t)) e.Pu.delete(r), n && e.hu.pu(r, n);\n if (e.Tu.delete(t), e.isPrimaryClient) {\n e.Au.zr(t).forEach((t => {\n e.Au.containsKey(t) || \n // We removed the last reference for this key\n __PRIVATE_removeLimboTarget(e, t);\n }));\n }\n}\n\nfunction __PRIVATE_removeLimboTarget(e, t) {\n e.Iu.delete(t.path.canonicalString());\n // It's possible that the target already got removed because the query failed. In that case,\n // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.\n const n = e.du.get(t);\n null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.du = e.du.remove(t), \n e.Eu.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));\n}\n\nfunction __PRIVATE_updateTrackedLimbos(e, t, n) {\n for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Au.addReference(r.key, t), \n __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {\n __PRIVATE_logDebug(nn, \"Document no longer in limbo: \" + r.key), e.Au.removeReference(r.key, t);\n e.Au.containsKey(r.key) || \n // We removed the last reference for this key\n __PRIVATE_removeLimboTarget(e, r.key);\n } else fail(19791, {\n yu: r\n });\n}\n\nfunction __PRIVATE_trackLimboChange(e, t) {\n const n = t.key, r = n.path.canonicalString();\n e.du.get(n) || e.Iu.has(r) || (__PRIVATE_logDebug(nn, \"New document in limbo: \" + n), \n e.Iu.add(r), __PRIVATE_pumpEnqueuedLimboResolutions(e));\n}\n\n/**\n * Starts listens for documents in limbo that are enqueued for resolution,\n * subject to a maximum number of concurrent resolutions.\n *\n * Without bounding the number of concurrent resolutions, the server can fail\n * with \"resource exhausted\" errors which can lead to pathological client\n * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.\n */ function __PRIVATE_pumpEnqueuedLimboResolutions(e) {\n for (;e.Iu.size > 0 && e.du.size < e.maxConcurrentLimboResolutions; ) {\n const t = e.Iu.values().next().value;\n e.Iu.delete(t);\n const n = new DocumentKey(ResourcePath.fromString(t)), r = e.mu.next();\n e.Eu.set(r, new LimboResolution(n)), e.du = e.du.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, \"TargetPurposeLimboResolution\" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ue));\n }\n}\n\nasync function __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(e, t, n) {\n const r = __PRIVATE_debugCast(e), i = [], s = [], o = [];\n r.Pu.isEmpty() || (r.Pu.forEach(((e, _) => {\n o.push(r.gu(_, t, n).then((e => {\n var t;\n // If there are changes, or we are handling a global snapshot, notify\n // secondary clients to update query state.\n if ((e || n) && r.isPrimaryClient) {\n // Query state is set to `current` if:\n // - There is a view change and it is up-to-date, or,\n // - There is a global snapshot, the Target is current, and no changes to be resolved\n const i = e ? !e.fromCache : null === (t = null == n ? void 0 : n.targetChanges.get(_.targetId)) || void 0 === t ? void 0 : t.current;\n r.sharedClientState.updateQueryState(_.targetId, i ? \"current\" : \"not-current\");\n }\n // Update views if there are actual changes.\n if (e) {\n i.push(e);\n const t = __PRIVATE_LocalViewChanges.Es(_.targetId, e);\n s.push(t);\n }\n })));\n })), await Promise.all(o), r.hu.J_(i), await async function __PRIVATE_localStoreNotifyLocalViewChanges(e, t) {\n const n = __PRIVATE_debugCast(e);\n try {\n await n.persistence.runTransaction(\"notifyLocalViewChanges\", \"readwrite\", (e => PersistencePromise.forEach(t, (t => PersistencePromise.forEach(t.Is, (r => n.persistence.referenceDelegate.addReference(e, t.targetId, r))).next((() => PersistencePromise.forEach(t.ds, (r => n.persistence.referenceDelegate.removeReference(e, t.targetId, r)))))))));\n } catch (e) {\n if (!__PRIVATE_isIndexedDbTransactionError(e)) throw e;\n // If `notifyLocalViewChanges` fails, we did not advance the sequence\n // number for the documents that were included in this transaction.\n // This might trigger them to be deleted earlier than they otherwise\n // would have, but it should not invalidate the integrity of the data.\n __PRIVATE_logDebug(Qt, \"Failed to update sequence numbers: \" + e);\n }\n for (const e of t) {\n const t = e.targetId;\n if (!e.fromCache) {\n const e = n.Fs.get(t), r = e.snapshotVersion, i = e.withLastLimboFreeSnapshotVersion(r);\n // Advance the last limbo free snapshot version\n n.Fs = n.Fs.insert(t, i);\n }\n }\n }(r.localStore, s));\n}\n\nasync function __PRIVATE_syncEngineHandleCredentialChange(e, t) {\n const n = __PRIVATE_debugCast(e);\n if (!n.currentUser.isEqual(t)) {\n __PRIVATE_logDebug(nn, \"User change. New user:\", t.toKey());\n const e = await __PRIVATE_localStoreHandleUserChange(n.localStore, t);\n n.currentUser = t, \n // Fails tasks waiting for pending writes requested by previous user.\n function __PRIVATE_rejectOutstandingPendingWritesCallbacks(e, t) {\n e.Vu.forEach((e => {\n e.forEach((e => {\n e.reject(new FirestoreError(N.CANCELLED, t));\n }));\n })), e.Vu.clear();\n }(n, \"'waitForPendingWrites' promise is rejected due to a user change.\"), \n // TODO(b/114226417): Consider calling this only in the primary tab.\n n.sharedClientState.handleUserChange(t, e.removedBatchIds, e.addedBatchIds), await __PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore(n, e.Bs);\n }\n}\n\nfunction __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {\n const n = __PRIVATE_debugCast(e), r = n.Eu.get(t);\n if (r && r.lu) return __PRIVATE_documentKeySet().add(r.key);\n {\n let e = __PRIVATE_documentKeySet();\n const r = n.Tu.get(t);\n if (!r) return e;\n for (const t of r) {\n const r = n.Pu.get(t);\n e = e.unionWith(r.view.tu);\n }\n return e;\n }\n}\n\nfunction __PRIVATE_ensureWatchCallbacks(e) {\n const t = __PRIVATE_debugCast(e);\n return t.remoteStore.remoteSyncer.applyRemoteEvent = __PRIVATE_syncEngineApplyRemoteEvent.bind(null, t), \n t.remoteStore.remoteSyncer.getRemoteKeysForTarget = __PRIVATE_syncEngineGetRemoteKeysForTarget.bind(null, t), \n t.remoteStore.remoteSyncer.rejectListen = __PRIVATE_syncEngineRejectListen.bind(null, t), \n t.hu.J_ = __PRIVATE_eventManagerOnWatchChange.bind(null, t.eventManager), t.hu.pu = __PRIVATE_eventManagerOnWatchError.bind(null, t.eventManager), \n t;\n}\n\nfunction __PRIVATE_syncEngineEnsureWriteCallbacks(e) {\n const t = __PRIVATE_debugCast(e);\n return t.remoteStore.remoteSyncer.applySuccessfulWrite = __PRIVATE_syncEngineApplySuccessfulWrite.bind(null, t), \n t.remoteStore.remoteSyncer.rejectFailedWrite = __PRIVATE_syncEngineRejectFailedWrite.bind(null, t), \n t;\n}\n\nclass __PRIVATE_MemoryOfflineComponentProvider {\n constructor() {\n this.kind = \"memory\", this.synchronizeTabs = false;\n }\n async initialize(e) {\n this.serializer = __PRIVATE_newSerializer(e.databaseInfo.databaseId), this.sharedClientState = this.bu(e), \n this.persistence = this.Du(e), await this.persistence.start(), this.localStore = this.vu(e), \n this.gcScheduler = this.Cu(e, this.localStore), this.indexBackfillerScheduler = this.Fu(e, this.localStore);\n }\n Cu(e, t) {\n return null;\n }\n Fu(e, t) {\n return null;\n }\n vu(e) {\n return __PRIVATE_newLocalStore(this.persistence, new __PRIVATE_QueryEngine, e.initialUser, this.serializer);\n }\n Du(e) {\n return new __PRIVATE_MemoryPersistence(__PRIVATE_MemoryEagerDelegate.Vi, this.serializer);\n }\n bu(e) {\n return new __PRIVATE_MemorySharedClientState;\n }\n async terminate() {\n var e, t;\n null === (e = this.gcScheduler) || void 0 === e || e.stop(), null === (t = this.indexBackfillerScheduler) || void 0 === t || t.stop(), \n this.sharedClientState.shutdown(), await this.persistence.shutdown();\n }\n}\n\n__PRIVATE_MemoryOfflineComponentProvider.provider = {\n build: () => new __PRIVATE_MemoryOfflineComponentProvider\n};\n\nclass __PRIVATE_LruGcMemoryOfflineComponentProvider extends __PRIVATE_MemoryOfflineComponentProvider {\n constructor(e) {\n super(), this.cacheSizeBytes = e;\n }\n Cu(e, t) {\n __PRIVATE_hardAssert(this.persistence.referenceDelegate instanceof __PRIVATE_MemoryLruDelegate, 46915);\n const n = this.persistence.referenceDelegate.garbageCollector;\n return new __PRIVATE_LruScheduler(n, e.asyncQueue, t);\n }\n Du(e) {\n const t = void 0 !== this.cacheSizeBytes ? LruParams.withCacheSize(this.cacheSizeBytes) : LruParams.DEFAULT;\n return new __PRIVATE_MemoryPersistence((e => __PRIVATE_MemoryLruDelegate.Vi(e, t)), this.serializer);\n }\n}\n\n/**\n * Initializes and wires the components that are needed to interface with the\n * network.\n */ class OnlineComponentProvider {\n async initialize(e, t) {\n this.localStore || (this.localStore = e.localStore, this.sharedClientState = e.sharedClientState, \n this.datastore = this.createDatastore(t), this.remoteStore = this.createRemoteStore(t), \n this.eventManager = this.createEventManager(t), this.syncEngine = this.createSyncEngine(t, \n /* startAsPrimary=*/ !e.synchronizeTabs), this.sharedClientState.onlineStateHandler = e => __PRIVATE_syncEngineApplyOnlineStateChange(this.syncEngine, e, 1 /* OnlineStateSource.SharedClientState */), \n this.remoteStore.remoteSyncer.handleCredentialChange = __PRIVATE_syncEngineHandleCredentialChange.bind(null, this.syncEngine), \n await __PRIVATE_remoteStoreApplyPrimaryState(this.remoteStore, this.syncEngine.isPrimaryClient));\n }\n createEventManager(e) {\n return function __PRIVATE_newEventManager() {\n return new __PRIVATE_EventManagerImpl;\n }();\n }\n createDatastore(e) {\n const t = __PRIVATE_newSerializer(e.databaseInfo.databaseId), n = function __PRIVATE_newConnection(e) {\n return new __PRIVATE_WebChannelConnection(e);\n }\n /** Return the Platform-specific connectivity monitor. */ (e.databaseInfo);\n return function __PRIVATE_newDatastore(e, t, n, r) {\n return new __PRIVATE_DatastoreImpl(e, t, n, r);\n }(e.authCredentials, e.appCheckCredentials, n, t);\n }\n createRemoteStore(e) {\n return function __PRIVATE_newRemoteStore(e, t, n, r, i) {\n return new __PRIVATE_RemoteStoreImpl(e, t, n, r, i);\n }\n /** Re-enables the network. Idempotent. */ (this.localStore, this.datastore, e.asyncQueue, (e => __PRIVATE_syncEngineApplyOnlineStateChange(this.syncEngine, e, 0 /* OnlineStateSource.RemoteStore */)), function __PRIVATE_newConnectivityMonitor() {\n return __PRIVATE_BrowserConnectivityMonitor.C() ? new __PRIVATE_BrowserConnectivityMonitor : new __PRIVATE_NoopConnectivityMonitor;\n }());\n }\n createSyncEngine(e, t) {\n return function __PRIVATE_newSyncEngine(e, t, n, \n // PORTING NOTE: Manages state synchronization in multi-tab environments.\n r, i, s, o) {\n const _ = new __PRIVATE_SyncEngineImpl(e, t, n, r, i, s);\n return o && (_.fu = true), _;\n }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, e.initialUser, e.maxConcurrentLimboResolutions, t);\n }\n async terminate() {\n var e, t;\n await async function __PRIVATE_remoteStoreShutdown(e) {\n const t = __PRIVATE_debugCast(e);\n __PRIVATE_logDebug(Xt, \"RemoteStore shutting down.\"), t.Ia.add(5 /* OfflineCause.Shutdown */), \n await __PRIVATE_disableNetworkInternal(t), t.Ea.shutdown(), \n // Set the OnlineState to Unknown (rather than Offline) to avoid potentially\n // triggering spurious listener events with cached data, etc.\n t.Aa.set(\"Unknown\" /* OnlineState.Unknown */);\n }(this.remoteStore), null === (e = this.datastore) || void 0 === e || e.terminate(), \n null === (t = this.eventManager) || void 0 === t || t.terminate();\n }\n}\n\nOnlineComponentProvider.provider = {\n build: () => new OnlineComponentProvider\n};\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * On web, a `ReadableStream` is wrapped around by a `ByteStreamReader`.\n */\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/*\n * A wrapper implementation of Observer<T> that will dispatch events\n * asynchronously. To allow immediate silencing, a mute call is added which\n * causes events scheduled to no longer be raised.\n */\nclass __PRIVATE_AsyncObserver {\n constructor(e) {\n this.observer = e, \n /**\n * When set to true, will not raise future events. Necessary to deal with\n * async detachment of listener.\n */\n this.muted = false;\n }\n next(e) {\n this.muted || this.observer.next && this.xu(this.observer.next, e);\n }\n error(e) {\n this.muted || (this.observer.error ? this.xu(this.observer.error, e) : __PRIVATE_logError(\"Uncaught Error in snapshot listener:\", e.toString()));\n }\n Ou() {\n this.muted = true;\n }\n xu(e, t) {\n setTimeout((() => {\n this.muted || e(t);\n }), 0);\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const rn = \"FirestoreClient\";\n\n/**\n * FirestoreClient is a top-level class that constructs and owns all of the //\n * pieces of the client SDK architecture. It is responsible for creating the //\n * async queue that is shared by all of the other components in the system. //\n */\nclass FirestoreClient {\n constructor(e, t, \n /**\n * Asynchronous queue responsible for all of our internal processing. When\n * we get incoming work from the user (via public API) or the network\n * (incoming GRPC messages), we should always schedule onto this queue.\n * This ensures all of our work is properly serialized (e.g. we don't\n * start processing a new operation while the previous one is waiting for\n * an async I/O to complete).\n */\n n, r, i) {\n this.authCredentials = e, this.appCheckCredentials = t, this.asyncQueue = n, this.databaseInfo = r, \n this.user = User.UNAUTHENTICATED, this.clientId = __PRIVATE_AutoId.newId(), this.authCredentialListener = () => Promise.resolve(), \n this.appCheckCredentialListener = () => Promise.resolve(), this._uninitializedComponentsProvider = i, \n this.authCredentials.start(n, (async e => {\n __PRIVATE_logDebug(rn, \"Received user=\", e.uid), await this.authCredentialListener(e), \n this.user = e;\n })), this.appCheckCredentials.start(n, (e => (__PRIVATE_logDebug(rn, \"Received new app check token=\", e), \n this.appCheckCredentialListener(e, this.user))));\n }\n get configuration() {\n return {\n asyncQueue: this.asyncQueue,\n databaseInfo: this.databaseInfo,\n clientId: this.clientId,\n authCredentials: this.authCredentials,\n appCheckCredentials: this.appCheckCredentials,\n initialUser: this.user,\n maxConcurrentLimboResolutions: 100\n };\n }\n setCredentialChangeListener(e) {\n this.authCredentialListener = e;\n }\n setAppCheckTokenChangeListener(e) {\n this.appCheckCredentialListener = e;\n }\n terminate() {\n this.asyncQueue.enterRestrictedMode();\n const e = new __PRIVATE_Deferred;\n return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async () => {\n try {\n this._onlineComponents && await this._onlineComponents.terminate(), this._offlineComponents && await this._offlineComponents.terminate(), \n // The credentials provider must be terminated after shutting down the\n // RemoteStore as it will prevent the RemoteStore from retrieving auth\n // tokens.\n this.authCredentials.shutdown(), this.appCheckCredentials.shutdown(), e.resolve();\n } catch (t) {\n const n = __PRIVATE_wrapInUserErrorIfRecoverable(t, \"Failed to shutdown persistence\");\n e.reject(n);\n }\n })), e.promise;\n }\n}\n\nasync function __PRIVATE_setOfflineComponentProvider(e, t) {\n e.asyncQueue.verifyOperationInProgress(), __PRIVATE_logDebug(rn, \"Initializing OfflineComponentProvider\");\n const n = e.configuration;\n await t.initialize(n);\n let r = n.initialUser;\n e.setCredentialChangeListener((async e => {\n r.isEqual(e) || (await __PRIVATE_localStoreHandleUserChange(t.localStore, e), r = e);\n })), t.persistence.setDatabaseDeletedListener((() => {\n __PRIVATE_logWarn(\"Terminating Firestore due to IndexedDb database deletion\"), e.terminate().then((() => {\n __PRIVATE_logDebug(\"Terminating Firestore due to IndexedDb database deletion completed successfully\");\n })).catch((e => {\n __PRIVATE_logWarn(\"Terminating Firestore due to IndexedDb database deletion failed\", e);\n }));\n })), e._offlineComponents = t;\n}\n\nasync function __PRIVATE_setOnlineComponentProvider(e, t) {\n e.asyncQueue.verifyOperationInProgress();\n const n = await __PRIVATE_ensureOfflineComponents(e);\n __PRIVATE_logDebug(rn, \"Initializing OnlineComponentProvider\"), await t.initialize(n, e.configuration), \n // The CredentialChangeListener of the online component provider takes\n // precedence over the offline component provider.\n e.setCredentialChangeListener((e => __PRIVATE_remoteStoreHandleCredentialChange(t.remoteStore, e))), \n e.setAppCheckTokenChangeListener(((e, n) => __PRIVATE_remoteStoreHandleCredentialChange(t.remoteStore, n))), \n e._onlineComponents = t;\n}\n\n/**\n * Decides whether the provided error allows us to gracefully disable\n * persistence (as opposed to crashing the client).\n */ async function __PRIVATE_ensureOfflineComponents(e) {\n if (!e._offlineComponents) if (e._uninitializedComponentsProvider) {\n __PRIVATE_logDebug(rn, \"Using user provided OfflineComponentProvider\");\n try {\n await __PRIVATE_setOfflineComponentProvider(e, e._uninitializedComponentsProvider._offline);\n } catch (t) {\n const n = t;\n if (!function __PRIVATE_canFallbackFromIndexedDbError(e) {\n return \"FirebaseError\" === e.name ? e.code === N.FAILED_PRECONDITION || e.code === N.UNIMPLEMENTED : !(\"undefined\" != typeof DOMException && e instanceof DOMException) || \n // When the browser is out of quota we could get either quota exceeded\n // or an aborted error depending on whether the error happened during\n // schema migration.\n 22 === e.code || 20 === e.code || \n // Firefox Private Browsing mode disables IndexedDb and returns\n // INVALID_STATE for any usage.\n 11 === e.code;\n }(n)) throw n;\n __PRIVATE_logWarn(\"Error using user provided cache. Falling back to memory cache: \" + n), \n await __PRIVATE_setOfflineComponentProvider(e, new __PRIVATE_MemoryOfflineComponentProvider);\n }\n } else __PRIVATE_logDebug(rn, \"Using default OfflineComponentProvider\"), await __PRIVATE_setOfflineComponentProvider(e, new __PRIVATE_LruGcMemoryOfflineComponentProvider(void 0));\n return e._offlineComponents;\n}\n\nasync function __PRIVATE_ensureOnlineComponents(e) {\n return e._onlineComponents || (e._uninitializedComponentsProvider ? (__PRIVATE_logDebug(rn, \"Using user provided OnlineComponentProvider\"), \n await __PRIVATE_setOnlineComponentProvider(e, e._uninitializedComponentsProvider._online)) : (__PRIVATE_logDebug(rn, \"Using default OnlineComponentProvider\"), \n await __PRIVATE_setOnlineComponentProvider(e, new OnlineComponentProvider))), e._onlineComponents;\n}\n\nfunction __PRIVATE_getSyncEngine(e) {\n return __PRIVATE_ensureOnlineComponents(e).then((e => e.syncEngine));\n}\n\nasync function __PRIVATE_getEventManager(e) {\n const t = await __PRIVATE_ensureOnlineComponents(e), n = t.eventManager;\n return n.onListen = __PRIVATE_syncEngineListen.bind(null, t.syncEngine), n.onUnlisten = __PRIVATE_syncEngineUnlisten.bind(null, t.syncEngine), \n n.onFirstRemoteStoreListen = __PRIVATE_triggerRemoteStoreListen.bind(null, t.syncEngine), \n n.onLastRemoteStoreUnlisten = __PRIVATE_triggerRemoteStoreUnlisten.bind(null, t.syncEngine), \n n;\n}\n\nfunction __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(e, t, n = {}) {\n const r = new __PRIVATE_Deferred;\n return e.asyncQueue.enqueueAndForget((async () => function __PRIVATE_readDocumentViaSnapshotListener(e, t, n, r, i) {\n const s = new __PRIVATE_AsyncObserver({\n next: _ => {\n // Mute and remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n s.Ou(), t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o)));\n const a = _.docs.has(n);\n !a && _.fromCache ? \n // TODO(dimond): If we're online and the document doesn't\n // exist then we resolve with a doc.exists set to false. If\n // we're offline however, we reject the Promise in this\n // case. Two options: 1) Cache the negative response from\n // the server so we can deliver that even when you're\n // offline 2) Actually reject the Promise in the online case\n // if the document doesn't exist.\n i.reject(new FirestoreError(N.UNAVAILABLE, \"Failed to get document because the client is offline.\")) : a && _.fromCache && r && \"server\" === r.source ? i.reject(new FirestoreError(N.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to \"server\" to retrieve the cached document.)')) : i.resolve(_);\n },\n error: e => i.reject(e)\n }), o = new __PRIVATE_QueryListener(__PRIVATE_newQueryForPath(n.path), s, {\n includeMetadataChanges: true,\n ka: true\n });\n return __PRIVATE_eventManagerListen(e, o);\n }(await __PRIVATE_getEventManager(e), e.asyncQueue, t, n, r))), r.promise;\n}\n\nfunction __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(e, t, n = {}) {\n const r = new __PRIVATE_Deferred;\n return e.asyncQueue.enqueueAndForget((async () => function __PRIVATE_executeQueryViaSnapshotListener(e, t, n, r, i) {\n const s = new __PRIVATE_AsyncObserver({\n next: n => {\n // Mute and remove query first before passing event to user to avoid\n // user actions affecting the now stale query.\n s.Ou(), t.enqueueAndForget((() => __PRIVATE_eventManagerUnlisten(e, o))), n.fromCache && \"server\" === r.source ? i.reject(new FirestoreError(N.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to \"server\" to retrieve the cached documents.)')) : i.resolve(n);\n },\n error: e => i.reject(e)\n }), o = new __PRIVATE_QueryListener(n, s, {\n includeMetadataChanges: true,\n ka: true\n });\n return __PRIVATE_eventManagerListen(e, o);\n }(await __PRIVATE_getEventManager(e), e.asyncQueue, t, n, r))), r.promise;\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Compares two `ExperimentalLongPollingOptions` objects for equality.\n */\n/**\n * Creates and returns a new `ExperimentalLongPollingOptions` with the same\n * option values as the given instance.\n */\nfunction __PRIVATE_cloneLongPollingOptions(e) {\n const t = {};\n return void 0 !== e.timeoutSeconds && (t.timeoutSeconds = e.timeoutSeconds), t;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const sn = new Map;\n\n/**\n * An instance map that ensures only one Datastore exists per Firestore\n * instance.\n */\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// settings() defaults:\nconst on = \"firestore.googleapis.com\", _n = true;\n\n/**\n * A concrete type describing all the values that can be applied via a\n * user-supplied `FirestoreSettings` object. This is a separate type so that\n * defaults can be supplied and the value can be checked for equality.\n */\nclass FirestoreSettingsImpl {\n constructor(e) {\n var t, n;\n if (void 0 === e.host) {\n if (void 0 !== e.ssl) throw new FirestoreError(N.INVALID_ARGUMENT, \"Can't provide ssl option if host option is not set\");\n this.host = on, this.ssl = _n;\n } else this.host = e.host, this.ssl = null !== (t = e.ssl) && void 0 !== t ? t : _n;\n if (this.isUsingEmulator = void 0 !== e.emulatorOptions, this.credentials = e.credentials, \n this.ignoreUndefinedProperties = !!e.ignoreUndefinedProperties, this.localCache = e.localCache, \n void 0 === e.cacheSizeBytes) this.cacheSizeBytes = Mt; else {\n if (-1 !== e.cacheSizeBytes && e.cacheSizeBytes < Ot) throw new FirestoreError(N.INVALID_ARGUMENT, \"cacheSizeBytes must be at least 1048576\");\n this.cacheSizeBytes = e.cacheSizeBytes;\n }\n __PRIVATE_validateIsNotUsedTogether(\"experimentalForceLongPolling\", e.experimentalForceLongPolling, \"experimentalAutoDetectLongPolling\", e.experimentalAutoDetectLongPolling), \n this.experimentalForceLongPolling = !!e.experimentalForceLongPolling, this.experimentalForceLongPolling ? this.experimentalAutoDetectLongPolling = false : void 0 === e.experimentalAutoDetectLongPolling ? this.experimentalAutoDetectLongPolling = true : \n // For backwards compatibility, coerce the value to boolean even though\n // the TypeScript compiler has narrowed the type to boolean already.\n // noinspection PointlessBooleanExpressionJS\n this.experimentalAutoDetectLongPolling = !!e.experimentalAutoDetectLongPolling, \n this.experimentalLongPollingOptions = __PRIVATE_cloneLongPollingOptions(null !== (n = e.experimentalLongPollingOptions) && void 0 !== n ? n : {}), \n function __PRIVATE_validateLongPollingOptions(e) {\n if (void 0 !== e.timeoutSeconds) {\n if (isNaN(e.timeoutSeconds)) throw new FirestoreError(N.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);\n if (e.timeoutSeconds < 5) throw new FirestoreError(N.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);\n if (e.timeoutSeconds > 30) throw new FirestoreError(N.INVALID_ARGUMENT, `invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`);\n }\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * The Cloud Firestore service interface.\n *\n * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.\n */ (this.experimentalLongPollingOptions), this.useFetchStreams = !!e.useFetchStreams;\n }\n isEqual(e) {\n return this.host === e.host && this.ssl === e.ssl && this.credentials === e.credentials && this.cacheSizeBytes === e.cacheSizeBytes && this.experimentalForceLongPolling === e.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === e.experimentalAutoDetectLongPolling && function __PRIVATE_longPollingOptionsEqual(e, t) {\n return e.timeoutSeconds === t.timeoutSeconds;\n }(this.experimentalLongPollingOptions, e.experimentalLongPollingOptions) && this.ignoreUndefinedProperties === e.ignoreUndefinedProperties && this.useFetchStreams === e.useFetchStreams;\n }\n}\n\nclass Firestore$1 {\n /** @hideconstructor */\n constructor(e, t, n, r) {\n this._authCredentials = e, this._appCheckCredentials = t, this._databaseId = n, \n this._app = r, \n /**\n * Whether it's a Firestore or Firestore Lite instance.\n */\n this.type = \"firestore-lite\", this._persistenceKey = \"(lite)\", this._settings = new FirestoreSettingsImpl({}), \n this._settingsFrozen = false, this._emulatorOptions = {}, \n // A task that is assigned when the terminate() is invoked and resolved when\n // all components have shut down. Otherwise, Firestore is not terminated,\n // which can mean either the FirestoreClient is in the process of starting,\n // or restarting.\n this._terminateTask = \"notTerminated\";\n }\n /**\n * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service\n * instance.\n */ get app() {\n if (!this._app) throw new FirestoreError(N.FAILED_PRECONDITION, \"Firestore was not initialized using the Firebase SDK. 'app' is not available\");\n return this._app;\n }\n get _initialized() {\n return this._settingsFrozen;\n }\n get _terminated() {\n return \"notTerminated\" !== this._terminateTask;\n }\n _setSettings(e) {\n if (this._settingsFrozen) throw new FirestoreError(N.FAILED_PRECONDITION, \"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.\");\n this._settings = new FirestoreSettingsImpl(e), this._emulatorOptions = e.emulatorOptions || {}, \n void 0 !== e.credentials && (this._authCredentials = function __PRIVATE_makeAuthCredentialsProvider(e) {\n if (!e) return new __PRIVATE_EmptyAuthCredentialsProvider;\n switch (e.type) {\n case \"firstParty\":\n return new __PRIVATE_FirstPartyAuthCredentialsProvider(e.sessionIndex || \"0\", e.iamToken || null, e.authTokenFactory || null);\n\n case \"provider\":\n return e.client;\n\n default:\n throw new FirestoreError(N.INVALID_ARGUMENT, \"makeAuthCredentialsProvider failed due to invalid credential type\");\n }\n }(e.credentials));\n }\n _getSettings() {\n return this._settings;\n }\n _getEmulatorOptions() {\n return this._emulatorOptions;\n }\n _freezeSettings() {\n return this._settingsFrozen = true, this._settings;\n }\n _delete() {\n // The `_terminateTask` must be assigned future that completes when\n // terminate is complete. The existence of this future puts SDK in state\n // that will not accept further API interaction.\n return \"notTerminated\" === this._terminateTask && (this._terminateTask = this._terminate()), \n this._terminateTask;\n }\n async _restart() {\n // The `_terminateTask` must equal 'notTerminated' after restart to\n // signal that client is in a state that accepts API calls.\n \"notTerminated\" === this._terminateTask ? await this._terminate() : this._terminateTask = \"notTerminated\";\n }\n /** Returns a JSON-serializable representation of this `Firestore` instance. */ toJSON() {\n return {\n app: this._app,\n databaseId: this._databaseId,\n settings: this._settings\n };\n }\n /**\n * Terminates all components used by this client. Subclasses can override\n * this method to clean up their own dependencies, but must also call this\n * method.\n *\n * Only ever called once.\n */ _terminate() {\n /**\n * Removes all components associated with the provided instance. Must be called\n * when the `Firestore` instance is terminated.\n */\n return function __PRIVATE_removeComponents(e) {\n const t = sn.get(e);\n t && (__PRIVATE_logDebug(\"ComponentProvider\", \"Removing Datastore\"), sn.delete(e), \n t.terminate());\n }(this), Promise.resolve();\n }\n}\n\n/**\n * Modify this instance to communicate with the Cloud Firestore emulator.\n *\n * Note: This must be called before this instance has been used to do any\n * operations.\n *\n * @param firestore - The `Firestore` instance to configure to connect to the\n * emulator.\n * @param host - the emulator host (ex: localhost).\n * @param port - the emulator port (ex: 9000).\n * @param options.mockUserToken - the mock auth token to use for unit testing\n * Security Rules.\n */ function connectFirestoreEmulator(e, t, n, r = {}) {\n var i;\n e = __PRIVATE_cast(e, Firestore$1);\n const s = isCloudWorkstation(t), o = e._getSettings(), _ = Object.assign(Object.assign({}, o), {\n emulatorOptions: e._getEmulatorOptions()\n }), a = `${t}:${n}`;\n s && (pingServer(`https://${a}`), updateEmulatorBanner(\"Firestore\", true)), o.host !== on && o.host !== a && __PRIVATE_logWarn(\"Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.\");\n const u = Object.assign(Object.assign({}, o), {\n host: a,\n ssl: s,\n emulatorOptions: r\n });\n // No-op if the new configuration matches the current configuration. This supports SSR\n // enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.\n if (!deepEqual(u, _) && (e._setSettings(u), r.mockUserToken)) {\n let t, n;\n if (\"string\" == typeof r.mockUserToken) t = r.mockUserToken, n = User.MOCK_USER; else {\n // Let createMockUserToken validate first (catches common mistakes like\n // invalid field \"uid\" and missing field \"sub\" / \"user_id\".)\n t = createMockUserToken(r.mockUserToken, null === (i = e._app) || void 0 === i ? void 0 : i.options.projectId);\n const s = r.mockUserToken.sub || r.mockUserToken.user_id;\n if (!s) throw new FirestoreError(N.INVALID_ARGUMENT, \"mockUserToken must contain 'sub' or 'user_id' field!\");\n n = new User(s);\n }\n e._authCredentials = new __PRIVATE_EmulatorAuthCredentialsProvider(new __PRIVATE_OAuthToken(t, n));\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A `Query` refers to a query which you can read or listen to. You can also\n * construct refined `Query` objects by adding filters and ordering.\n */ class Query {\n // This is the lite version of the Query class in the main SDK.\n /** @hideconstructor protected */\n constructor(e, \n /**\n * If provided, the `FirestoreDataConverter` associated with this instance.\n */\n t, n) {\n this.converter = t, this._query = n, \n /** The type of this Firestore reference. */\n this.type = \"query\", this.firestore = e;\n }\n withConverter(e) {\n return new Query(this.firestore, e, this._query);\n }\n}\n\n/**\n * A `DocumentReference` refers to a document location in a Firestore database\n * and can be used to write, read, or listen to the location. The document at\n * the referenced location may or may not exist.\n */ class DocumentReference {\n /** @hideconstructor */\n constructor(e, \n /**\n * If provided, the `FirestoreDataConverter` associated with this instance.\n */\n t, n) {\n this.converter = t, this._key = n, \n /** The type of this Firestore reference. */\n this.type = \"document\", this.firestore = e;\n }\n get _path() {\n return this._key.path;\n }\n /**\n * The document's identifier within its collection.\n */ get id() {\n return this._key.path.lastSegment();\n }\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */ get path() {\n return this._key.path.canonicalString();\n }\n /**\n * The collection this `DocumentReference` belongs to.\n */ get parent() {\n return new CollectionReference(this.firestore, this.converter, this._key.path.popLast());\n }\n withConverter(e) {\n return new DocumentReference(this.firestore, e, this._key);\n }\n /**\n * Returns a JSON-serializable representation of this `DocumentReference` instance.\n *\n * @returns a JSON representation of this object.\n */ toJSON() {\n return {\n type: DocumentReference._jsonSchemaVersion,\n referencePath: this._key.toString()\n };\n }\n static fromJSON(e, t, n) {\n if (__PRIVATE_validateJSON(t, DocumentReference._jsonSchema)) return new DocumentReference(e, n || null, new DocumentKey(ResourcePath.fromString(t.referencePath)));\n }\n}\n\nDocumentReference._jsonSchemaVersion = \"firestore/documentReference/1.0\", DocumentReference._jsonSchema = {\n type: property(\"string\", DocumentReference._jsonSchemaVersion),\n referencePath: property(\"string\")\n};\n\n/**\n * A `CollectionReference` object can be used for adding documents, getting\n * document references, and querying for documents (using {@link (query:1)}).\n */\nclass CollectionReference extends Query {\n /** @hideconstructor */\n constructor(e, t, n) {\n super(e, t, __PRIVATE_newQueryForPath(n)), this._path = n, \n /** The type of this Firestore reference. */\n this.type = \"collection\";\n }\n /** The collection's identifier. */ get id() {\n return this._query.path.lastSegment();\n }\n /**\n * A string representing the path of the referenced collection (relative\n * to the root of the database).\n */ get path() {\n return this._query.path.canonicalString();\n }\n /**\n * A reference to the containing `DocumentReference` if this is a\n * subcollection. If this isn't a subcollection, the reference is null.\n */ get parent() {\n const e = this._path.popLast();\n return e.isEmpty() ? null : new DocumentReference(this.firestore, \n /* converter= */ null, new DocumentKey(e));\n }\n withConverter(e) {\n return new CollectionReference(this.firestore, e, this._path);\n }\n}\n\nfunction collection(e, t, ...n) {\n if (e = getModularInstance(e), __PRIVATE_validateNonEmptyArgument(\"collection\", \"path\", t), e instanceof Firestore$1) {\n const r = ResourcePath.fromString(t, ...n);\n return __PRIVATE_validateCollectionPath(r), new CollectionReference(e, /* converter= */ null, r);\n }\n {\n if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(N.INVALID_ARGUMENT, \"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore\");\n const r = e._path.child(ResourcePath.fromString(t, ...n));\n return __PRIVATE_validateCollectionPath(r), new CollectionReference(e.firestore, \n /* converter= */ null, r);\n }\n}\n\nfunction doc(e, t, ...n) {\n if (e = getModularInstance(e), \n // We allow omission of 'pathString' but explicitly prohibit passing in both\n // 'undefined' and 'null'.\n 1 === arguments.length && (t = __PRIVATE_AutoId.newId()), __PRIVATE_validateNonEmptyArgument(\"doc\", \"path\", t), \n e instanceof Firestore$1) {\n const r = ResourcePath.fromString(t, ...n);\n return __PRIVATE_validateDocumentPath(r), new DocumentReference(e, \n /* converter= */ null, new DocumentKey(r));\n }\n {\n if (!(e instanceof DocumentReference || e instanceof CollectionReference)) throw new FirestoreError(N.INVALID_ARGUMENT, \"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore\");\n const r = e._path.child(ResourcePath.fromString(t, ...n));\n return __PRIVATE_validateDocumentPath(r), new DocumentReference(e.firestore, e instanceof CollectionReference ? e.converter : null, new DocumentKey(r));\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ const an = \"AsyncQueue\";\n\nclass __PRIVATE_AsyncQueueImpl {\n constructor(e = Promise.resolve()) {\n // A list of retryable operations. Retryable operations are run in order and\n // retried with backoff.\n this.Zu = [], \n // Is this AsyncQueue being shut down? Once it is set to true, it will not\n // be changed again.\n this.Xu = false, \n // Operations scheduled to be queued in the future. Operations are\n // automatically removed after they are run or canceled.\n this.ec = [], \n // visible for testing\n this.tc = null, \n // Flag set while there's an outstanding AsyncQueue operation, used for\n // assertion sanity-checks.\n this.nc = false, \n // Enabled during shutdown on Safari to prevent future access to IndexedDB.\n this.rc = false, \n // List of TimerIds to fast-forward delays for.\n this.sc = [], \n // Backoff timer used to schedule retries for retryable operations\n this.F_ = new __PRIVATE_ExponentialBackoff(this, \"async_queue_retry\" /* TimerId.AsyncQueueRetry */), \n // Visibility handler that triggers an immediate retry of all retryable\n // operations. Meant to speed up recovery when we regain file system access\n // after page comes into foreground.\n this.oc = () => {\n const e = getDocument();\n e && __PRIVATE_logDebug(an, \"Visibility state changed to \" + e.visibilityState), \n this.F_.y_();\n }, this._c = e;\n const t = getDocument();\n t && \"function\" == typeof t.addEventListener && t.addEventListener(\"visibilitychange\", this.oc);\n }\n get isShuttingDown() {\n return this.Xu;\n }\n /**\n * Adds a new operation to the queue without waiting for it to complete (i.e.\n * we ignore the Promise result).\n */ enqueueAndForget(e) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.enqueue(e);\n }\n enqueueAndForgetEvenWhileRestricted(e) {\n this.ac(), \n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.uc(e);\n }\n enterRestrictedMode(e) {\n if (!this.Xu) {\n this.Xu = true, this.rc = e || false;\n const t = getDocument();\n t && \"function\" == typeof t.removeEventListener && t.removeEventListener(\"visibilitychange\", this.oc);\n }\n }\n enqueue(e) {\n if (this.ac(), this.Xu) \n // Return a Promise which never resolves.\n return new Promise((() => {}));\n // Create a deferred Promise that we can return to the callee. This\n // allows us to return a \"hanging Promise\" only to the callee and still\n // advance the queue even when the operation is not run.\n const t = new __PRIVATE_Deferred;\n return this.uc((() => this.Xu && this.rc ? Promise.resolve() : (e().then(t.resolve, t.reject), \n t.promise))).then((() => t.promise));\n }\n enqueueRetryable(e) {\n this.enqueueAndForget((() => (this.Zu.push(e), this.cc())));\n }\n /**\n * Runs the next operation from the retryable queue. If the operation fails,\n * reschedules with backoff.\n */ async cc() {\n if (0 !== this.Zu.length) {\n try {\n await this.Zu[0](), this.Zu.shift(), this.F_.reset();\n } catch (e) {\n if (!__PRIVATE_isIndexedDbTransactionError(e)) throw e;\n // Failure will be handled by AsyncQueue\n __PRIVATE_logDebug(an, \"Operation failed with retryable error: \" + e);\n }\n this.Zu.length > 0 && \n // If there are additional operations, we re-schedule `retryNextOp()`.\n // This is necessary to run retryable operations that failed during\n // their initial attempt since we don't know whether they are already\n // enqueued. If, for example, `op1`, `op2`, `op3` are enqueued and `op1`\n // needs to be re-run, we will run `op1`, `op1`, `op2` using the\n // already enqueued calls to `retryNextOp()`. `op3()` will then run in the\n // call scheduled here.\n // Since `backoffAndRun()` cancels an existing backoff and schedules a\n // new backoff on every call, there is only ever a single additional\n // operation in the queue.\n this.F_.g_((() => this.cc()));\n }\n }\n uc(e) {\n const t = this._c.then((() => (this.nc = true, e().catch((e => {\n this.tc = e, this.nc = false;\n // Re-throw the error so that this.tail becomes a rejected Promise and\n // all further attempts to chain (via .then) will just short-circuit\n // and return the rejected Promise.\n throw __PRIVATE_logError(\"INTERNAL UNHANDLED ERROR: \", __PRIVATE_getMessageOrStack(e)), \n e;\n })).then((e => (this.nc = false, e))))));\n return this._c = t, t;\n }\n enqueueAfterDelay(e, t, n) {\n this.ac(), \n // Fast-forward delays for timerIds that have been overridden.\n this.sc.indexOf(e) > -1 && (t = 0);\n const r = DelayedOperation.createAndSchedule(this, e, t, n, (e => this.lc(e)));\n return this.ec.push(r), r;\n }\n ac() {\n this.tc && fail(47125, {\n hc: __PRIVATE_getMessageOrStack(this.tc)\n });\n }\n verifyOperationInProgress() {}\n /**\n * Waits until all currently queued tasks are finished executing. Delayed\n * operations are not run.\n */ async Pc() {\n // Operations in the queue prior to draining may have enqueued additional\n // operations. Keep draining the queue until the tail is no longer advanced,\n // which indicates that no more new operations were enqueued and that all\n // operations were executed.\n let e;\n do {\n e = this._c, await e;\n } while (e !== this._c);\n }\n /**\n * For Tests: Determine if a delayed operation with a particular TimerId\n * exists.\n */ Tc(e) {\n for (const t of this.ec) if (t.timerId === e) return true;\n return false;\n }\n /**\n * For Tests: Runs some or all delayed operations early.\n *\n * @param lastTimerId - Delayed operations up to and including this TimerId\n * will be drained. Pass TimerId.All to run all delayed operations.\n * @returns a Promise that resolves once all operations have been run.\n */ Ic(e) {\n // Note that draining may generate more delayed ops, so we do that first.\n return this.Pc().then((() => {\n // Run ops in the same order they'd run if they ran naturally.\n /* eslint-disable-next-line @typescript-eslint/no-floating-promises */\n this.ec.sort(((e, t) => e.targetTimeMs - t.targetTimeMs));\n for (const t of this.ec) if (t.skipDelay(), \"all\" /* TimerId.All */ !== e && t.timerId === e) break;\n return this.Pc();\n }));\n }\n /**\n * For Tests: Skip all subsequent delays for a timer id.\n */ dc(e) {\n this.sc.push(e);\n }\n /** Called once a DelayedOperation is run or canceled. */ lc(e) {\n // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.\n const t = this.ec.indexOf(e);\n /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ this.ec.splice(t, 1);\n }\n}\n\n/**\n * Chrome includes Error.message in Error.stack. Other browsers do not.\n * This returns expected output of message + stack when available.\n * @param error - Error or FirestoreError\n */ function __PRIVATE_getMessageOrStack(e) {\n let t = e.message || \"\";\n return e.stack && (t = e.stack.includes(e.message) ? e.stack : e.message + \"\\n\" + e.stack), \n t;\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function __PRIVATE_isPartialObserver(e) {\n /**\n * Returns true if obj is an object and contains at least one of the specified\n * methods.\n */\n return function __PRIVATE_implementsAnyMethods(e, t) {\n if (\"object\" != typeof e || null === e) return false;\n const n = e;\n for (const e of t) if (e in n && \"function\" == typeof n[e]) return true;\n return false;\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * Represents the task of loading a Firestore bundle. It provides progress of bundle\n * loading, as well as task completion and error events.\n *\n * The API is compatible with `Promise<LoadBundleTaskProgress>`.\n */ (e, [ \"next\", \"error\", \"complete\" ]);\n}\n\n/**\n * The Cloud Firestore service interface.\n *\n * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.\n */ class Firestore extends Firestore$1 {\n /** @hideconstructor */\n constructor(e, t, n, r) {\n super(e, t, n, r), \n /**\n * Whether it's a {@link Firestore} or Firestore Lite instance.\n */\n this.type = \"firestore\", this._queue = new __PRIVATE_AsyncQueueImpl, this._persistenceKey = (null == r ? void 0 : r.name) || \"[DEFAULT]\";\n }\n async _terminate() {\n if (this._firestoreClient) {\n const e = this._firestoreClient.terminate();\n this._queue = new __PRIVATE_AsyncQueueImpl(e), this._firestoreClient = void 0, await e;\n }\n }\n}\n\nfunction getFirestore(e, n) {\n const r = \"object\" == typeof e ? e : getApp(), i = \"string\" == typeof e ? e : ut, s = _getProvider(r, \"firestore\").getImmediate({\n identifier: i\n });\n if (!s._initialized) {\n const e = getDefaultEmulatorHostnameAndPort(\"firestore\");\n e && connectFirestoreEmulator(s, ...e);\n }\n return s;\n}\n\n/**\n * @internal\n */ function ensureFirestoreConfigured(e) {\n if (e._terminated) throw new FirestoreError(N.FAILED_PRECONDITION, \"The client has already been terminated.\");\n return e._firestoreClient || __PRIVATE_configureFirestore(e), e._firestoreClient;\n}\n\nfunction __PRIVATE_configureFirestore(e) {\n var t, n, r;\n const i = e._freezeSettings(), s = function __PRIVATE_makeDatabaseInfo(e, t, n, r) {\n return new DatabaseInfo(e, t, n, r.host, r.ssl, r.experimentalForceLongPolling, r.experimentalAutoDetectLongPolling, __PRIVATE_cloneLongPollingOptions(r.experimentalLongPollingOptions), r.useFetchStreams, r.isUsingEmulator);\n }(e._databaseId, (null === (t = e._app) || void 0 === t ? void 0 : t.options.appId) || \"\", e._persistenceKey, i);\n e._componentsProvider || (null === (n = i.localCache) || void 0 === n ? void 0 : n._offlineComponentProvider) && (null === (r = i.localCache) || void 0 === r ? void 0 : r._onlineComponentProvider) && (e._componentsProvider = {\n _offline: i.localCache._offlineComponentProvider,\n _online: i.localCache._onlineComponentProvider\n }), e._firestoreClient = new FirestoreClient(e._authCredentials, e._appCheckCredentials, e._queue, s, e._componentsProvider && function __PRIVATE_buildComponentProvider(e) {\n const t = null == e ? void 0 : e._online.build();\n return {\n _offline: null == e ? void 0 : e._offline.build(t),\n _online: t\n };\n }\n /**\n * Attempts to enable persistent storage, if possible.\n *\n * On failure, `enableIndexedDbPersistence()` will reject the promise or\n * throw an exception. There are several reasons why this can fail, which can be\n * identified by the `code` on the error.\n *\n * * failed-precondition: The app is already open in another browser tab.\n * * unimplemented: The browser is incompatible with the offline persistence\n * implementation.\n *\n * Note that even after a failure, the {@link Firestore} instance will remain\n * usable, however offline persistence will be disabled.\n *\n * Note: `enableIndexedDbPersistence()` must be called before any other functions\n * (other than {@link initializeFirestore}, {@link (getFirestore:1)} or\n * {@link clearIndexedDbPersistence}.\n *\n * Persistence cannot be used in a Node.js environment.\n *\n * @param firestore - The {@link Firestore} instance to enable persistence for.\n * @param persistenceSettings - Optional settings object to configure\n * persistence.\n * @returns A `Promise` that represents successfully enabling persistent storage.\n * @deprecated This function will be removed in a future major release. Instead, set\n * `FirestoreSettings.localCache` to an instance of `PersistentLocalCache` to\n * turn on IndexedDb cache. Calling this function when `FirestoreSettings.localCache`\n * is already specified will throw an exception.\n */ (e._componentsProvider));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An immutable object representing an array of bytes.\n */ class Bytes {\n /** @hideconstructor */\n constructor(e) {\n this._byteString = e;\n }\n /**\n * Creates a new `Bytes` object from the given Base64 string, converting it to\n * bytes.\n *\n * @param base64 - The Base64 string used to create the `Bytes` object.\n */ static fromBase64String(e) {\n try {\n return new Bytes(ByteString.fromBase64String(e));\n } catch (e) {\n throw new FirestoreError(N.INVALID_ARGUMENT, \"Failed to construct data from Base64 string: \" + e);\n }\n }\n /**\n * Creates a new `Bytes` object from the given Uint8Array.\n *\n * @param array - The Uint8Array used to create the `Bytes` object.\n */ static fromUint8Array(e) {\n return new Bytes(ByteString.fromUint8Array(e));\n }\n /**\n * Returns the underlying bytes as a Base64-encoded string.\n *\n * @returns The Base64-encoded string created from the `Bytes` object.\n */ toBase64() {\n return this._byteString.toBase64();\n }\n /**\n * Returns the underlying bytes in a new `Uint8Array`.\n *\n * @returns The Uint8Array created from the `Bytes` object.\n */ toUint8Array() {\n return this._byteString.toUint8Array();\n }\n /**\n * Returns a string representation of the `Bytes` object.\n *\n * @returns A string representation of the `Bytes` object.\n */ toString() {\n return \"Bytes(base64: \" + this.toBase64() + \")\";\n }\n /**\n * Returns true if this `Bytes` object is equal to the provided one.\n *\n * @param other - The `Bytes` object to compare against.\n * @returns true if this `Bytes` object is equal to the provided one.\n */ isEqual(e) {\n return this._byteString.isEqual(e._byteString);\n }\n /**\n * Returns a JSON-serializable representation of this `Bytes` instance.\n *\n * @returns a JSON representation of this object.\n */ toJSON() {\n return {\n type: Bytes._jsonSchemaVersion,\n bytes: this.toBase64()\n };\n }\n /**\n * Builds a `Bytes` instance from a JSON object created by {@link Bytes.toJSON}.\n *\n * @param json a JSON object represention of a `Bytes` instance\n * @returns an instance of {@link Bytes} if the JSON object could be parsed. Throws a\n * {@link FirestoreError} if an error occurs.\n */ static fromJSON(e) {\n if (__PRIVATE_validateJSON(e, Bytes._jsonSchema)) return Bytes.fromBase64String(e.bytes);\n }\n}\n\nBytes._jsonSchemaVersion = \"firestore/bytes/1.0\", Bytes._jsonSchema = {\n type: property(\"string\", Bytes._jsonSchemaVersion),\n bytes: property(\"string\")\n};\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A `FieldPath` refers to a field in a document. The path may consist of a\n * single field name (referring to a top-level field in the document), or a\n * list of field names (referring to a nested field in the document).\n *\n * Create a `FieldPath` by providing field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n */\nclass FieldPath {\n /**\n * Creates a `FieldPath` from the provided field names. If more than one field\n * name is provided, the path will point to a nested field in a document.\n *\n * @param fieldNames - A list of field names.\n */\n constructor(...e) {\n for (let t = 0; t < e.length; ++t) if (0 === e[t].length) throw new FirestoreError(N.INVALID_ARGUMENT, \"Invalid field name at argument $(i + 1). Field names must not be empty.\");\n this._internalPath = new FieldPath$1(e);\n }\n /**\n * Returns true if this `FieldPath` is equal to the provided one.\n *\n * @param other - The `FieldPath` to compare against.\n * @returns true if this `FieldPath` is equal to the provided one.\n */ isEqual(e) {\n return this._internalPath.isEqual(e._internalPath);\n }\n}\n\n/**\n * Returns a special sentinel `FieldPath` to refer to the ID of a document.\n * It can be used in queries to sort or filter by the document ID.\n */ function documentId() {\n return new FieldPath(B);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Sentinel values that can be used when writing document fields with `set()`\n * or `update()`.\n */ class FieldValue {\n /**\n * @param _methodName - The public API endpoint that returns this class.\n * @hideconstructor\n */\n constructor(e) {\n this._methodName = e;\n }\n}\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * An immutable object representing a geographic location in Firestore. The\n * location is represented as latitude/longitude pair.\n *\n * Latitude values are in the range of [-90, 90].\n * Longitude values are in the range of [-180, 180].\n */ class GeoPoint {\n /**\n * Creates a new immutable `GeoPoint` object with the provided latitude and\n * longitude values.\n * @param latitude - The latitude as number between -90 and 90.\n * @param longitude - The longitude as number between -180 and 180.\n */\n constructor(e, t) {\n if (!isFinite(e) || e < -90 || e > 90) throw new FirestoreError(N.INVALID_ARGUMENT, \"Latitude must be a number between -90 and 90, but was: \" + e);\n if (!isFinite(t) || t < -180 || t > 180) throw new FirestoreError(N.INVALID_ARGUMENT, \"Longitude must be a number between -180 and 180, but was: \" + t);\n this._lat = e, this._long = t;\n }\n /**\n * The latitude of this `GeoPoint` instance.\n */ get latitude() {\n return this._lat;\n }\n /**\n * The longitude of this `GeoPoint` instance.\n */ get longitude() {\n return this._long;\n }\n /**\n * Returns true if this `GeoPoint` is equal to the provided one.\n *\n * @param other - The `GeoPoint` to compare against.\n * @returns true if this `GeoPoint` is equal to the provided one.\n */ isEqual(e) {\n return this._lat === e._lat && this._long === e._long;\n }\n /**\n * Actually private to JS consumers of our API, so this function is prefixed\n * with an underscore.\n */ _compareTo(e) {\n return __PRIVATE_primitiveComparator(this._lat, e._lat) || __PRIVATE_primitiveComparator(this._long, e._long);\n }\n /**\n * Returns a JSON-serializable representation of this `GeoPoint` instance.\n *\n * @returns a JSON representation of this object.\n */ toJSON() {\n return {\n latitude: this._lat,\n longitude: this._long,\n type: GeoPoint._jsonSchemaVersion\n };\n }\n /**\n * Builds a `GeoPoint` instance from a JSON object created by {@link GeoPoint.toJSON}.\n *\n * @param json a JSON object represention of a `GeoPoint` instance\n * @returns an instance of {@link GeoPoint} if the JSON object could be parsed. Throws a\n * {@link FirestoreError} if an error occurs.\n */ static fromJSON(e) {\n if (__PRIVATE_validateJSON(e, GeoPoint._jsonSchema)) return new GeoPoint(e.latitude, e.longitude);\n }\n}\n\nGeoPoint._jsonSchemaVersion = \"firestore/geoPoint/1.0\", GeoPoint._jsonSchema = {\n type: property(\"string\", GeoPoint._jsonSchemaVersion),\n latitude: property(\"number\"),\n longitude: property(\"number\")\n};\n\n/**\n * @license\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Represents a vector type in Firestore documents.\n * Create an instance with <code>{@link vector}</code>.\n *\n * @class VectorValue\n */\nclass VectorValue {\n /**\n * @private\n * @internal\n */\n constructor(e) {\n // Making a copy of the parameter.\n this._values = (e || []).map((e => e));\n }\n /**\n * Returns a copy of the raw number array form of the vector.\n */ toArray() {\n return this._values.map((e => e));\n }\n /**\n * Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.\n */ isEqual(e) {\n return function __PRIVATE_isPrimitiveArrayEqual(e, t) {\n if (e.length !== t.length) return false;\n for (let n = 0; n < e.length; ++n) if (e[n] !== t[n]) return false;\n return true;\n }(this._values, e._values);\n }\n /**\n * Returns a JSON-serializable representation of this `VectorValue` instance.\n *\n * @returns a JSON representation of this object.\n */ toJSON() {\n return {\n type: VectorValue._jsonSchemaVersion,\n vectorValues: this._values\n };\n }\n /**\n * Builds a `VectorValue` instance from a JSON object created by {@link VectorValue.toJSON}.\n *\n * @param json a JSON object represention of a `VectorValue` instance.\n * @returns an instance of {@link VectorValue} if the JSON object could be parsed. Throws a\n * {@link FirestoreError} if an error occurs.\n */ static fromJSON(e) {\n if (__PRIVATE_validateJSON(e, VectorValue._jsonSchema)) {\n if (Array.isArray(e.vectorValues) && e.vectorValues.every((e => \"number\" == typeof e))) return new VectorValue(e.vectorValues);\n throw new FirestoreError(N.INVALID_ARGUMENT, \"Expected 'vectorValues' field to be a number array\");\n }\n }\n}\n\nVectorValue._jsonSchemaVersion = \"firestore/vectorValue/1.0\", VectorValue._jsonSchema = {\n type: property(\"string\", VectorValue._jsonSchemaVersion),\n vectorValues: property(\"object\")\n};\n\n/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst cn = /^__.*__$/;\n\n/** The result of parsing document data (e.g. for a setData call). */ class ParsedSetData {\n constructor(e, t, n) {\n this.data = e, this.fieldMask = t, this.fieldTransforms = n;\n }\n toMutation(e, t) {\n return null !== this.fieldMask ? new __PRIVATE_PatchMutation(e, this.data, this.fieldMask, t, this.fieldTransforms) : new __PRIVATE_SetMutation(e, this.data, t, this.fieldTransforms);\n }\n}\n\nfunction __PRIVATE_isWrite(e) {\n switch (e) {\n case 0 /* UserDataSource.Set */ :\n // fall through\n case 2 /* UserDataSource.MergeSet */ :\n // fall through\n case 1 /* UserDataSource.Update */ :\n return true;\n\n case 3 /* UserDataSource.Argument */ :\n case 4 /* UserDataSource.ArrayArgument */ :\n return false;\n\n default:\n throw fail(40011, {\n Ec: e\n });\n }\n}\n\n/** A \"context\" object passed around while parsing user data. */ class __PRIVATE_ParseContextImpl {\n /**\n * Initializes a ParseContext with the given source and path.\n *\n * @param settings - The settings for the parser.\n * @param databaseId - The database ID of the Firestore instance.\n * @param serializer - The serializer to use to generate the Value proto.\n * @param ignoreUndefinedProperties - Whether to ignore undefined properties\n * rather than throw.\n * @param fieldTransforms - A mutable list of field transforms encountered\n * while parsing the data.\n * @param fieldMask - A mutable list of field paths encountered while parsing\n * the data.\n *\n * TODO(b/34871131): We don't support array paths right now, so path can be\n * null to indicate the context represents any location within an array (in\n * which case certain features will not work and errors will be somewhat\n * compromised).\n */\n constructor(e, t, n, r, i, s) {\n this.settings = e, this.databaseId = t, this.serializer = n, this.ignoreUndefinedProperties = r, \n // Minor hack: If fieldTransforms is undefined, we assume this is an\n // external call and we need to validate the entire path.\n void 0 === i && this.Ac(), this.fieldTransforms = i || [], this.fieldMask = s || [];\n }\n get path() {\n return this.settings.path;\n }\n get Ec() {\n return this.settings.Ec;\n }\n /** Returns a new context with the specified settings overwritten. */ Rc(e) {\n return new __PRIVATE_ParseContextImpl(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.serializer, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);\n }\n Vc(e) {\n var t;\n const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.Rc({\n path: n,\n mc: false\n });\n return r.fc(e), r;\n }\n gc(e) {\n var t;\n const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.Rc({\n path: n,\n mc: false\n });\n return r.Ac(), r;\n }\n yc(e) {\n // TODO(b/34871131): We don't support array paths right now; so make path\n // undefined.\n return this.Rc({\n path: void 0,\n mc: true\n });\n }\n wc(e) {\n return __PRIVATE_createError(e, this.settings.methodName, this.settings.Sc || false, this.path, this.settings.bc);\n }\n /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(e) {\n return void 0 !== this.fieldMask.find((t => e.isPrefixOf(t))) || void 0 !== this.fieldTransforms.find((t => e.isPrefixOf(t.field)));\n }\n Ac() {\n // TODO(b/34871131): Remove null check once we have proper paths for fields\n // within arrays.\n if (this.path) for (let e = 0; e < this.path.length; e++) this.fc(this.path.get(e));\n }\n fc(e) {\n if (0 === e.length) throw this.wc(\"Document fields must not be empty\");\n if (__PRIVATE_isWrite(this.Ec) && cn.test(e)) throw this.wc('Document fields cannot begin and end with \"__\"');\n }\n}\n\n/**\n * Helper for parsing raw user input (provided via the API) into internal model\n * classes.\n */ class __PRIVATE_UserDataReader {\n constructor(e, t, n) {\n this.databaseId = e, this.ignoreUndefinedProperties = t, this.serializer = n || __PRIVATE_newSerializer(e);\n }\n /** Creates a new top-level parse context. */ Dc(e, t, n, r = false) {\n return new __PRIVATE_ParseContextImpl({\n Ec: e,\n methodName: t,\n bc: n,\n path: FieldPath$1.emptyPath(),\n mc: false,\n Sc: r\n }, this.databaseId, this.serializer, this.ignoreUndefinedProperties);\n }\n}\n\nfunction __PRIVATE_newUserDataReader(e) {\n const t = e._freezeSettings(), n = __PRIVATE_newSerializer(e._databaseId);\n return new __PRIVATE_UserDataReader(e._databaseId, !!t.ignoreUndefinedProperties, n);\n}\n\n/** Parse document data from a set() call. */ function __PRIVATE_parseSetData(e, t, n, r, i, s = {}) {\n const o = e.Dc(s.merge || s.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , t, n, i);\n __PRIVATE_validatePlainObject(\"Data must be an object, but it was:\", o, r);\n const _ = __PRIVATE_parseObject(r, o);\n let a, u;\n if (s.merge) a = new FieldMask(o.fieldMask), u = o.fieldTransforms; else if (s.mergeFields) {\n const e = [];\n for (const r of s.mergeFields) {\n const i = __PRIVATE_fieldPathFromArgument$1(t, r, n);\n if (!o.contains(i)) throw new FirestoreError(N.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);\n __PRIVATE_fieldMaskContains(e, i) || e.push(i);\n }\n a = new FieldMask(e), u = o.fieldTransforms.filter((e => a.covers(e.field)));\n } else a = null, u = o.fieldTransforms;\n return new ParsedSetData(new ObjectValue(_), a, u);\n}\n\n/**\n * Parse a \"query value\" (e.g. value in a where filter or a value in a cursor\n * bound).\n *\n * @param allowArrays - Whether the query value is an array that may directly\n * contain additional arrays (e.g. the operand of an `in` query).\n */ function __PRIVATE_parseQueryValue(e, t, n, r = false) {\n return __PRIVATE_parseData(n, e.Dc(r ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , t));\n}\n\n/**\n * Parses user data to Protobuf Values.\n *\n * @param input - Data to be parsed.\n * @param context - A context object representing the current path being parsed,\n * the source of the data being parsed, etc.\n * @returns The parsed value, or null if the value was a FieldValue sentinel\n * that should not be included in the resulting parsed data.\n */ function __PRIVATE_parseData(e, t) {\n if (__PRIVATE_looksLikeJsonObject(\n // Unwrap the API type from the Compat SDK. This will return the API type\n // from firestore-exp.\n e = getModularInstance(e))) return __PRIVATE_validatePlainObject(\"Unsupported field value:\", t, e), \n __PRIVATE_parseObject(e, t);\n if (e instanceof FieldValue) \n // FieldValues usually parse into transforms (except deleteField())\n // in which case we do not want to include this field in our parsed data\n // (as doing so will overwrite the field directly prior to the transform\n // trying to transform it). So we don't add this location to\n // context.fieldMask and we return null as our parsing result.\n /**\n * \"Parses\" the provided FieldValueImpl, adding any necessary transforms to\n * context.fieldTransforms.\n */\n return function __PRIVATE_parseSentinelFieldValue(e, t) {\n // Sentinels are only supported with writes, and not within arrays.\n if (!__PRIVATE_isWrite(t.Ec)) throw t.wc(`${e._methodName}() can only be used with update() and set()`);\n if (!t.path) throw t.wc(`${e._methodName}() is not currently supported inside arrays`);\n const n = e._toFieldTransform(t);\n n && t.fieldTransforms.push(n);\n }\n /**\n * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue)\n *\n * @returns The parsed value\n */ (e, t), null;\n if (void 0 === e && t.ignoreUndefinedProperties) \n // If the input is undefined it can never participate in the fieldMask, so\n // don't handle this below. If `ignoreUndefinedProperties` is false,\n // `parseScalarValue` will reject an undefined value.\n return null;\n if (\n // If context.path is null we are inside an array and we don't support\n // field mask paths more granular than the top-level array.\n t.path && t.fieldMask.push(t.path), e instanceof Array) {\n // TODO(b/34871131): Include the path containing the array in the error\n // message.\n // In the case of IN queries, the parsed data is an array (representing\n // the set of values to be included for the IN query) that may directly\n // contain additional arrays (each representing an individual field\n // value), so we disable this validation.\n if (t.settings.mc && 4 /* UserDataSource.ArrayArgument */ !== t.Ec) throw t.wc(\"Nested arrays are not supported\");\n return function __PRIVATE_parseArray(e, t) {\n const n = [];\n let r = 0;\n for (const i of e) {\n let e = __PRIVATE_parseData(i, t.yc(r));\n null == e && (\n // Just include nulls in the array for fields being replaced with a\n // sentinel.\n e = {\n nullValue: \"NULL_VALUE\"\n }), n.push(e), r++;\n }\n return {\n arrayValue: {\n values: n\n }\n };\n }(e, t);\n }\n return function __PRIVATE_parseScalarValue(e, t) {\n if (null === (e = getModularInstance(e))) return {\n nullValue: \"NULL_VALUE\"\n };\n if (\"number\" == typeof e) return toNumber(t.serializer, e);\n if (\"boolean\" == typeof e) return {\n booleanValue: e\n };\n if (\"string\" == typeof e) return {\n stringValue: e\n };\n if (e instanceof Date) {\n const n = Timestamp.fromDate(e);\n return {\n timestampValue: toTimestamp(t.serializer, n)\n };\n }\n if (e instanceof Timestamp) {\n // Firestore backend truncates precision down to microseconds. To ensure\n // offline mode works the same with regards to truncation, perform the\n // truncation immediately without waiting for the backend to do that.\n const n = new Timestamp(e.seconds, 1e3 * Math.floor(e.nanoseconds / 1e3));\n return {\n timestampValue: toTimestamp(t.serializer, n)\n };\n }\n if (e instanceof GeoPoint) return {\n geoPointValue: {\n latitude: e.latitude,\n longitude: e.longitude\n }\n };\n if (e instanceof Bytes) return {\n bytesValue: __PRIVATE_toBytes(t.serializer, e._byteString)\n };\n if (e instanceof DocumentReference) {\n const n = t.databaseId, r = e.firestore._databaseId;\n if (!r.isEqual(n)) throw t.wc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);\n return {\n referenceValue: __PRIVATE_toResourceName(e.firestore._databaseId || t.databaseId, e._key.path)\n };\n }\n if (e instanceof VectorValue) \n /**\n * Creates a new VectorValue proto value (using the internal format).\n */\n return function __PRIVATE_parseVectorValue(e, t) {\n const n = {\n fields: {\n [ct]: {\n stringValue: Pt\n },\n [Tt]: {\n arrayValue: {\n values: e.toArray().map((e => {\n if (\"number\" != typeof e) throw t.wc(\"VectorValues must only contain numeric values.\");\n return __PRIVATE_toDouble(t.serializer, e);\n }))\n }\n }\n }\n };\n return {\n mapValue: n\n };\n }\n /**\n * Checks whether an object looks like a JSON object that should be converted\n * into a struct. Normal class/prototype instances are considered to look like\n * JSON objects since they should be converted to a struct value. Arrays, Dates,\n * GeoPoints, etc. are not considered to look like JSON objects since they map\n * to specific FieldValue types other than ObjectValue.\n */ (e, t);\n throw t.wc(`Unsupported field value: ${__PRIVATE_valueDescription(e)}`);\n }(e, t);\n}\n\nfunction __PRIVATE_parseObject(e, t) {\n const n = {};\n return isEmpty(e) ? \n // If we encounter an empty object, we explicitly add it to the update\n // mask to ensure that the server creates a map entry.\n t.path && t.path.length > 0 && t.fieldMask.push(t.path) : forEach(e, ((e, r) => {\n const i = __PRIVATE_parseData(r, t.Vc(e));\n null != i && (n[e] = i);\n })), {\n mapValue: {\n fields: n\n }\n };\n}\n\nfunction __PRIVATE_looksLikeJsonObject(e) {\n return !(\"object\" != typeof e || null === e || e instanceof Array || e instanceof Date || e instanceof Timestamp || e instanceof GeoPoint || e instanceof Bytes || e instanceof DocumentReference || e instanceof FieldValue || e instanceof VectorValue);\n}\n\nfunction __PRIVATE_validatePlainObject(e, t, n) {\n if (!__PRIVATE_looksLikeJsonObject(n) || !__PRIVATE_isPlainObject(n)) {\n const r = __PRIVATE_valueDescription(n);\n throw \"an object\" === r ? t.wc(e + \" a custom object\") : t.wc(e + \" \" + r);\n }\n}\n\n/**\n * Helper that calls fromDotSeparatedString() but wraps any error thrown.\n */ function __PRIVATE_fieldPathFromArgument$1(e, t, n) {\n if ((\n // If required, replace the FieldPath Compat class with the firestore-exp\n // FieldPath.\n t = getModularInstance(t)) instanceof FieldPath) return t._internalPath;\n if (\"string\" == typeof t) return __PRIVATE_fieldPathFromDotSeparatedString(e, t);\n throw __PRIVATE_createError(\"Field path arguments must be of type string or \", e, \n /* hasConverter= */ false, \n /* path= */ void 0, n);\n}\n\n/**\n * Matches any characters in a field path string that are reserved.\n */ const ln = new RegExp(\"[~\\\\*/\\\\[\\\\]]\");\n\n/**\n * Wraps fromDotSeparatedString with an error message about the method that\n * was thrown.\n * @param methodName - The publicly visible method name\n * @param path - The dot-separated string form of a field path which will be\n * split on dots.\n * @param targetDoc - The document against which the field path will be\n * evaluated.\n */ function __PRIVATE_fieldPathFromDotSeparatedString(e, t, n) {\n if (t.search(ln) >= 0) throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`, e, \n /* hasConverter= */ false, \n /* path= */ void 0, n);\n try {\n return new FieldPath(...t.split(\".\"))._internalPath;\n } catch (r) {\n throw __PRIVATE_createError(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, e, \n /* hasConverter= */ false, \n /* path= */ void 0, n);\n }\n}\n\nfunction __PRIVATE_createError(e, t, n, r, i) {\n const s = r && !r.isEmpty(), o = void 0 !== i;\n let _ = `Function ${t}() called with invalid data`;\n n && (_ += \" (via `toFirestore()`)\"), _ += \". \";\n let a = \"\";\n return (s || o) && (a += \" (found\", s && (a += ` in field ${r}`), o && (a += ` in document ${i}`), \n a += \")\"), new FirestoreError(N.INVALID_ARGUMENT, _ + e + a);\n}\n\n/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function __PRIVATE_fieldMaskContains(e, t) {\n return e.some((e => e.isEqual(t)));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A `DocumentSnapshot` contains data read from a document in your Firestore\n * database. The data can be extracted with `.data()` or `.get(<field>)` to\n * get a specific field.\n *\n * For a `DocumentSnapshot` that points to a non-existing document, any data\n * access will return 'undefined'. You can use the `exists()` method to\n * explicitly verify a document's existence.\n */ class DocumentSnapshot$1 {\n // Note: This class is stripped down version of the DocumentSnapshot in\n // the legacy SDK. The changes are:\n // - No support for SnapshotMetadata.\n // - No support for SnapshotOptions.\n /** @hideconstructor protected */\n constructor(e, t, n, r, i) {\n this._firestore = e, this._userDataWriter = t, this._key = n, this._document = r, \n this._converter = i;\n }\n /** Property of the `DocumentSnapshot` that provides the document's ID. */ get id() {\n return this._key.path.lastSegment();\n }\n /**\n * The `DocumentReference` for the document included in the `DocumentSnapshot`.\n */ get ref() {\n return new DocumentReference(this._firestore, this._converter, this._key);\n }\n /**\n * Signals whether or not the document at the snapshot's location exists.\n *\n * @returns true if the document exists.\n */ exists() {\n return null !== this._document;\n }\n /**\n * Retrieves all fields in the document as an `Object`. Returns `undefined` if\n * the document doesn't exist.\n *\n * @returns An `Object` containing all fields in the document or `undefined`\n * if the document doesn't exist.\n */ data() {\n if (this._document) {\n if (this._converter) {\n // We only want to use the converter and create a new DocumentSnapshot\n // if a converter has been provided.\n const e = new QueryDocumentSnapshot$1(this._firestore, this._userDataWriter, this._key, this._document, \n /* converter= */ null);\n return this._converter.fromFirestore(e);\n }\n return this._userDataWriter.convertValue(this._document.data.value);\n }\n }\n /**\n * Retrieves the field specified by `fieldPath`. Returns `undefined` if the\n * document or field doesn't exist.\n *\n * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific\n * field.\n * @returns The data at the specified field location or undefined if no such\n * field exists in the document.\n */\n // We are using `any` here to avoid an explicit cast by our users.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(e) {\n if (this._document) {\n const t = this._document.data.field(__PRIVATE_fieldPathFromArgument(\"DocumentSnapshot.get\", e));\n if (null !== t) return this._userDataWriter.convertValue(t);\n }\n }\n}\n\n/**\n * A `QueryDocumentSnapshot` contains data read from a document in your\n * Firestore database as part of a query. The document is guaranteed to exist\n * and its data can be extracted with `.data()` or `.get(<field>)` to get a\n * specific field.\n *\n * A `QueryDocumentSnapshot` offers the same API surface as a\n * `DocumentSnapshot`. Since query results contain only existing documents, the\n * `exists` property will always be true and `data()` will never return\n * 'undefined'.\n */ class QueryDocumentSnapshot$1 extends DocumentSnapshot$1 {\n /**\n * Retrieves all fields in the document as an `Object`.\n *\n * @override\n * @returns An `Object` containing all fields in the document.\n */\n data() {\n return super.data();\n }\n}\n\n/**\n * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.\n */ function __PRIVATE_fieldPathFromArgument(e, t) {\n return \"string\" == typeof t ? __PRIVATE_fieldPathFromDotSeparatedString(e, t) : t instanceof FieldPath ? t._internalPath : t._delegate._internalPath;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */ function __PRIVATE_validateHasExplicitOrderByForLimitToLast(e) {\n if (\"L\" /* LimitType.Last */ === e.limitType && 0 === e.explicitOrderBy.length) throw new FirestoreError(N.UNIMPLEMENTED, \"limitToLast() queries require specifying at least one orderBy() clause\");\n}\n\n/**\n * An `AppliableConstraint` is an abstraction of a constraint that can be applied\n * to a Firestore query.\n */ class AppliableConstraint {}\n\n/**\n * A `QueryConstraint` is used to narrow the set of documents returned by a\n * Firestore query. `QueryConstraint`s are created by invoking {@link where},\n * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link\n * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and\n * can then be passed to {@link (query:1)} to create a new query instance that\n * also contains this `QueryConstraint`.\n */ class QueryConstraint extends AppliableConstraint {}\n\nfunction query(e, t, ...n) {\n let r = [];\n t instanceof AppliableConstraint && r.push(t), r = r.concat(n), function __PRIVATE_validateQueryConstraintArray(e) {\n const t = e.filter((e => e instanceof QueryCompositeFilterConstraint)).length, n = e.filter((e => e instanceof QueryFieldFilterConstraint)).length;\n if (t > 1 || t > 0 && n > 0) throw new FirestoreError(N.INVALID_ARGUMENT, \"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.\");\n }\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * Converts Firestore's internal types to the JavaScript types that we expose\n * to the user.\n *\n * @internal\n */ (r);\n for (const t of r) e = t._apply(e);\n return e;\n}\n\n/**\n * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by\n * a Firestore query by filtering on one or more document fields.\n * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then\n * be passed to {@link (query:1)} to create a new query instance that also contains\n * this `QueryFieldFilterConstraint`.\n */ class QueryFieldFilterConstraint extends QueryConstraint {\n /**\n * @internal\n */\n constructor(e, t, n) {\n super(), this._field = e, this._op = t, this._value = n, \n /** The type of this query constraint */\n this.type = \"where\";\n }\n static _create(e, t, n) {\n return new QueryFieldFilterConstraint(e, t, n);\n }\n _apply(e) {\n const t = this._parse(e);\n return __PRIVATE_validateNewFieldFilter(e._query, t), new Query(e.firestore, e.converter, __PRIVATE_queryWithAddedFilter(e._query, t));\n }\n _parse(e) {\n const t = __PRIVATE_newUserDataReader(e.firestore), n = function __PRIVATE_newQueryFilter(e, t, n, r, i, s, o) {\n let _;\n if (i.isKeyField()) {\n if (\"array-contains\" /* Operator.ARRAY_CONTAINS */ === s || \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ === s) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid Query. You can't perform '${s}' queries on documentId().`);\n if (\"in\" /* Operator.IN */ === s || \"not-in\" /* Operator.NOT_IN */ === s) {\n __PRIVATE_validateDisjunctiveFilterElements(o, s);\n const t = [];\n for (const n of o) t.push(__PRIVATE_parseDocumentIdValue(r, e, n));\n _ = {\n arrayValue: {\n values: t\n }\n };\n } else _ = __PRIVATE_parseDocumentIdValue(r, e, o);\n } else \"in\" /* Operator.IN */ !== s && \"not-in\" /* Operator.NOT_IN */ !== s && \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ !== s || __PRIVATE_validateDisjunctiveFilterElements(o, s), \n _ = __PRIVATE_parseQueryValue(n, t, o, \n /* allowArrays= */ \"in\" /* Operator.IN */ === s || \"not-in\" /* Operator.NOT_IN */ === s);\n const a = FieldFilter.create(i, s, _);\n return a;\n }(e._query, \"where\", t, e.firestore._databaseId, this._field, this._op, this._value);\n return n;\n }\n}\n\n/**\n * Creates a {@link QueryFieldFilterConstraint} that enforces that documents\n * must contain the specified field and that the value should satisfy the\n * relation constraint provided.\n *\n * @param fieldPath - The path to compare\n * @param opStr - The operation string (e.g \"&lt;\", \"&lt;=\", \"==\", \"&lt;\",\n * \"&lt;=\", \"!=\").\n * @param value - The value for comparison\n * @returns The created {@link QueryFieldFilterConstraint}.\n */ function where(e, t, n) {\n const r = t, i = __PRIVATE_fieldPathFromArgument(\"where\", e);\n return QueryFieldFilterConstraint._create(i, r, n);\n}\n\n/**\n * A `QueryCompositeFilterConstraint` is used to narrow the set of documents\n * returned by a Firestore query by performing the logical OR or AND of multiple\n * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.\n * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or\n * {@link and} and can then be passed to {@link (query:1)} to create a new query\n * instance that also contains the `QueryCompositeFilterConstraint`.\n */ class QueryCompositeFilterConstraint extends AppliableConstraint {\n /**\n * @internal\n */\n constructor(\n /** The type of this query constraint */\n e, t) {\n super(), this.type = e, this._queryConstraints = t;\n }\n static _create(e, t) {\n return new QueryCompositeFilterConstraint(e, t);\n }\n _parse(e) {\n const t = this._queryConstraints.map((t => t._parse(e))).filter((e => e.getFilters().length > 0));\n return 1 === t.length ? t[0] : CompositeFilter.create(t, this._getOperator());\n }\n _apply(e) {\n const t = this._parse(e);\n return 0 === t.getFilters().length ? e : (function __PRIVATE_validateNewFilter(e, t) {\n let n = e;\n const r = t.getFlattenedFilters();\n for (const e of r) __PRIVATE_validateNewFieldFilter(n, e), n = __PRIVATE_queryWithAddedFilter(n, e);\n }\n // Checks if any of the provided filter operators are included in the given list of filters and\n // returns the first one that is, or null if none are.\n (e._query, t), new Query(e.firestore, e.converter, __PRIVATE_queryWithAddedFilter(e._query, t)));\n }\n _getQueryConstraints() {\n return this._queryConstraints;\n }\n _getOperator() {\n return \"and\" === this.type ? \"and\" /* CompositeOperator.AND */ : \"or\" /* CompositeOperator.OR */;\n }\n}\n\nfunction __PRIVATE_parseDocumentIdValue(e, t, n) {\n if (\"string\" == typeof (n = getModularInstance(n))) {\n if (\"\" === n) throw new FirestoreError(N.INVALID_ARGUMENT, \"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.\");\n if (!__PRIVATE_isCollectionGroupQuery(t) && -1 !== n.indexOf(\"/\")) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);\n const r = t.path.child(ResourcePath.fromString(n));\n if (!DocumentKey.isDocumentKey(r)) throw new FirestoreError(N.INVALID_ARGUMENT, `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}).`);\n return __PRIVATE_refValue(e, new DocumentKey(r));\n }\n if (n instanceof DocumentReference) return __PRIVATE_refValue(e, n._key);\n throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${__PRIVATE_valueDescription(n)}.`);\n}\n\n/**\n * Validates that the value passed into a disjunctive filter satisfies all\n * array requirements.\n */ function __PRIVATE_validateDisjunctiveFilterElements(e, t) {\n if (!Array.isArray(e) || 0 === e.length) throw new FirestoreError(N.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);\n}\n\n/**\n * Given an operator, returns the set of operators that cannot be used with it.\n *\n * This is not a comprehensive check, and this function should be removed in the\n * long term. Validations should occur in the Firestore backend.\n *\n * Operators in a query must adhere to the following set of rules:\n * 1. Only one inequality per query.\n * 2. `NOT_IN` cannot be used with array, disjunctive, or `NOT_EQUAL` operators.\n */ function __PRIVATE_validateNewFieldFilter(e, t) {\n const n = function __PRIVATE_findOpInsideFilters(e, t) {\n for (const n of e) for (const e of n.getFlattenedFilters()) if (t.indexOf(e.op) >= 0) return e.op;\n return null;\n }(e.filters, function __PRIVATE_conflictingOps(e) {\n switch (e) {\n case \"!=\" /* Operator.NOT_EQUAL */ :\n return [ \"!=\" /* Operator.NOT_EQUAL */ , \"not-in\" /* Operator.NOT_IN */ ];\n\n case \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ :\n case \"in\" /* Operator.IN */ :\n return [ \"not-in\" /* Operator.NOT_IN */ ];\n\n case \"not-in\" /* Operator.NOT_IN */ :\n return [ \"array-contains-any\" /* Operator.ARRAY_CONTAINS_ANY */ , \"in\" /* Operator.IN */ , \"not-in\" /* Operator.NOT_IN */ , \"!=\" /* Operator.NOT_EQUAL */ ];\n\n default:\n return [];\n }\n }(t.op));\n if (null !== n) \n // Special case when it's a duplicate op to give a slightly clearer error message.\n throw n === t.op ? new FirestoreError(N.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${t.op.toString()}' filter.`) : new FirestoreError(N.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`);\n}\n\nclass AbstractUserDataWriter {\n convertValue(e, t = \"none\") {\n switch (__PRIVATE_typeOrder(e)) {\n case 0 /* TypeOrder.NullValue */ :\n return null;\n\n case 1 /* TypeOrder.BooleanValue */ :\n return e.booleanValue;\n\n case 2 /* TypeOrder.NumberValue */ :\n return __PRIVATE_normalizeNumber(e.integerValue || e.doubleValue);\n\n case 3 /* TypeOrder.TimestampValue */ :\n return this.convertTimestamp(e.timestampValue);\n\n case 4 /* TypeOrder.ServerTimestampValue */ :\n return this.convertServerTimestamp(e, t);\n\n case 5 /* TypeOrder.StringValue */ :\n return e.stringValue;\n\n case 6 /* TypeOrder.BlobValue */ :\n return this.convertBytes(__PRIVATE_normalizeByteString(e.bytesValue));\n\n case 7 /* TypeOrder.RefValue */ :\n return this.convertReference(e.referenceValue);\n\n case 8 /* TypeOrder.GeoPointValue */ :\n return this.convertGeoPoint(e.geoPointValue);\n\n case 9 /* TypeOrder.ArrayValue */ :\n return this.convertArray(e.arrayValue, t);\n\n case 11 /* TypeOrder.ObjectValue */ :\n return this.convertObject(e.mapValue, t);\n\n case 10 /* TypeOrder.VectorValue */ :\n return this.convertVectorValue(e.mapValue);\n\n default:\n throw fail(62114, {\n value: e\n });\n }\n }\n convertObject(e, t) {\n return this.convertObjectMap(e.fields, t);\n }\n /**\n * @internal\n */ convertObjectMap(e, t = \"none\") {\n const n = {};\n return forEach(e, ((e, r) => {\n n[e] = this.convertValue(r, t);\n })), n;\n }\n /**\n * @internal\n */ convertVectorValue(e) {\n var t, n, r;\n const i = null === (r = null === (n = null === (t = e.fields) || void 0 === t ? void 0 : t[Tt].arrayValue) || void 0 === n ? void 0 : n.values) || void 0 === r ? void 0 : r.map((e => __PRIVATE_normalizeNumber(e.doubleValue)));\n return new VectorValue(i);\n }\n convertGeoPoint(e) {\n return new GeoPoint(__PRIVATE_normalizeNumber(e.latitude), __PRIVATE_normalizeNumber(e.longitude));\n }\n convertArray(e, t) {\n return (e.values || []).map((e => this.convertValue(e, t)));\n }\n convertServerTimestamp(e, t) {\n switch (t) {\n case \"previous\":\n const n = __PRIVATE_getPreviousValue(e);\n return null == n ? null : this.convertValue(n, t);\n\n case \"estimate\":\n return this.convertTimestamp(__PRIVATE_getLocalWriteTime(e));\n\n default:\n return null;\n }\n }\n convertTimestamp(e) {\n const t = __PRIVATE_normalizeTimestamp(e);\n return new Timestamp(t.seconds, t.nanos);\n }\n convertDocumentKey(e, t) {\n const n = ResourcePath.fromString(e);\n __PRIVATE_hardAssert(__PRIVATE_isValidResourceName(n), 9688, {\n name: e\n });\n const r = new DatabaseId(n.get(1), n.get(3)), i = new DocumentKey(n.popFirst(5));\n return r.isEqual(t) || \n // TODO(b/64130202): Somehow support foreign references.\n __PRIVATE_logError(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`), \n i;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Converts custom model object of type T into `DocumentData` by applying the\n * converter if it exists.\n *\n * This function is used when converting user objects to `DocumentData`\n * because we want to provide the user with a more specific error message if\n * their `set()` or fails due to invalid data originating from a `toFirestore()`\n * call.\n */ function __PRIVATE_applyFirestoreDataConverter(e, t, n) {\n let r;\n // Cast to `any` in order to satisfy the union type constraint on\n // toFirestore().\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return r = e ? n && (n.merge || n.mergeFields) ? e.toFirestore(t, n) : e.toFirestore(t) : t, \n r;\n}\n\n/**\n * Metadata about a snapshot, describing the state of the snapshot.\n */ class SnapshotMetadata {\n /** @hideconstructor */\n constructor(e, t) {\n this.hasPendingWrites = e, this.fromCache = t;\n }\n /**\n * Returns true if this `SnapshotMetadata` is equal to the provided one.\n *\n * @param other - The `SnapshotMetadata` to compare against.\n * @returns true if this `SnapshotMetadata` is equal to the provided one.\n */ isEqual(e) {\n return this.hasPendingWrites === e.hasPendingWrites && this.fromCache === e.fromCache;\n }\n}\n\n/**\n * A `DocumentSnapshot` contains data read from a document in your Firestore\n * database. The data can be extracted with `.data()` or `.get(<field>)` to\n * get a specific field.\n *\n * For a `DocumentSnapshot` that points to a non-existing document, any data\n * access will return 'undefined'. You can use the `exists()` method to\n * explicitly verify a document's existence.\n */ class DocumentSnapshot extends DocumentSnapshot$1 {\n /** @hideconstructor protected */\n constructor(e, t, n, r, i, s) {\n super(e, t, n, r, s), this._firestore = e, this._firestoreImpl = e, this.metadata = i;\n }\n /**\n * Returns whether or not the data exists. True if the document exists.\n */ exists() {\n return super.exists();\n }\n /**\n * Retrieves all fields in the document as an `Object`. Returns `undefined` if\n * the document doesn't exist.\n *\n * By default, `serverTimestamp()` values that have not yet been\n * set to their final value will be returned as `null`. You can override\n * this by passing an options object.\n *\n * @param options - An options object to configure how data is retrieved from\n * the snapshot (for example the desired behavior for server timestamps that\n * have not yet been set to their final value).\n * @returns An `Object` containing all fields in the document or `undefined` if\n * the document doesn't exist.\n */ data(e = {}) {\n if (this._document) {\n if (this._converter) {\n // We only want to use the converter and create a new DocumentSnapshot\n // if a converter has been provided.\n const t = new QueryDocumentSnapshot(this._firestore, this._userDataWriter, this._key, this._document, this.metadata, \n /* converter= */ null);\n return this._converter.fromFirestore(t, e);\n }\n return this._userDataWriter.convertValue(this._document.data.value, e.serverTimestamps);\n }\n }\n /**\n * Retrieves the field specified by `fieldPath`. Returns `undefined` if the\n * document or field doesn't exist.\n *\n * By default, a `serverTimestamp()` that has not yet been set to\n * its final value will be returned as `null`. You can override this by\n * passing an options object.\n *\n * @param fieldPath - The path (for example 'foo' or 'foo.bar') to a specific\n * field.\n * @param options - An options object to configure how the field is retrieved\n * from the snapshot (for example the desired behavior for server timestamps\n * that have not yet been set to their final value).\n * @returns The data at the specified field location or undefined if no such\n * field exists in the document.\n */\n // We are using `any` here to avoid an explicit cast by our users.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(e, t = {}) {\n if (this._document) {\n const n = this._document.data.field(__PRIVATE_fieldPathFromArgument(\"DocumentSnapshot.get\", e));\n if (null !== n) return this._userDataWriter.convertValue(n, t.serverTimestamps);\n }\n }\n /**\n * Returns a JSON-serializable representation of this `DocumentSnapshot` instance.\n *\n * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this\n * `DocumentSnapshot` has pending writes.\n */ toJSON() {\n if (this.metadata.hasPendingWrites) throw new FirestoreError(N.FAILED_PRECONDITION, \"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().\");\n const e = this._document, t = {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (t.type = DocumentSnapshot._jsonSchemaVersion, t.bundle = \"\", t.bundleSource = \"DocumentSnapshot\", \n t.bundleName = this._key.toString(), !e || !e.isValidDocument() || !e.isFoundDocument()) return t;\n this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields, \"previous\");\n return t.bundle = (this._firestore, this.ref.path, \"NOT SUPPORTED\"), t;\n }\n}\n\n/**\n * A `QueryDocumentSnapshot` contains data read from a document in your\n * Firestore database as part of a query. The document is guaranteed to exist\n * and its data can be extracted with `.data()` or `.get(<field>)` to get a\n * specific field.\n *\n * A `QueryDocumentSnapshot` offers the same API surface as a\n * `DocumentSnapshot`. Since query results contain only existing documents, the\n * `exists` property will always be true and `data()` will never return\n * 'undefined'.\n */ DocumentSnapshot._jsonSchemaVersion = \"firestore/documentSnapshot/1.0\", DocumentSnapshot._jsonSchema = {\n type: property(\"string\", DocumentSnapshot._jsonSchemaVersion),\n bundleSource: property(\"string\", \"DocumentSnapshot\"),\n bundleName: property(\"string\"),\n bundle: property(\"string\")\n};\n\nclass QueryDocumentSnapshot extends DocumentSnapshot {\n /**\n * Retrieves all fields in the document as an `Object`.\n *\n * By default, `serverTimestamp()` values that have not yet been\n * set to their final value will be returned as `null`. You can override\n * this by passing an options object.\n *\n * @override\n * @param options - An options object to configure how data is retrieved from\n * the snapshot (for example the desired behavior for server timestamps that\n * have not yet been set to their final value).\n * @returns An `Object` containing all fields in the document.\n */\n data(e = {}) {\n return super.data(e);\n }\n}\n\n/**\n * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects\n * representing the results of a query. The documents can be accessed as an\n * array via the `docs` property or enumerated using the `forEach` method. The\n * number of documents can be determined via the `empty` and `size`\n * properties.\n */ class QuerySnapshot {\n /** @hideconstructor */\n constructor(e, t, n, r) {\n this._firestore = e, this._userDataWriter = t, this._snapshot = r, this.metadata = new SnapshotMetadata(r.hasPendingWrites, r.fromCache), \n this.query = n;\n }\n /** An array of all the documents in the `QuerySnapshot`. */ get docs() {\n const e = [];\n return this.forEach((t => e.push(t))), e;\n }\n /** The number of documents in the `QuerySnapshot`. */ get size() {\n return this._snapshot.docs.size;\n }\n /** True if there are no documents in the `QuerySnapshot`. */ get empty() {\n return 0 === this.size;\n }\n /**\n * Enumerates all of the documents in the `QuerySnapshot`.\n *\n * @param callback - A callback to be called with a `QueryDocumentSnapshot` for\n * each document in the snapshot.\n * @param thisArg - The `this` binding for the callback.\n */ forEach(e, t) {\n this._snapshot.docs.forEach((n => {\n e.call(t, new QueryDocumentSnapshot(this._firestore, this._userDataWriter, n.key, n, new SnapshotMetadata(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));\n }));\n }\n /**\n * Returns an array of the documents changes since the last snapshot. If this\n * is the first snapshot, all documents will be in the list as 'added'\n * changes.\n *\n * @param options - `SnapshotListenOptions` that control whether metadata-only\n * changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger\n * snapshot events.\n */ docChanges(e = {}) {\n const t = !!e.includeMetadataChanges;\n if (t && this._snapshot.excludesMetadataChanges) throw new FirestoreError(N.INVALID_ARGUMENT, \"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().\");\n return this._cachedChanges && this._cachedChangesIncludeMetadataChanges === t || (this._cachedChanges = \n /** Calculates the array of `DocumentChange`s for a given `ViewSnapshot`. */\n function __PRIVATE_changesFromSnapshot(e, t) {\n if (e._snapshot.oldDocs.isEmpty()) {\n let t = 0;\n return e._snapshot.docChanges.map((n => {\n const r = new QueryDocumentSnapshot(e._firestore, e._userDataWriter, n.doc.key, n.doc, new SnapshotMetadata(e._snapshot.mutatedKeys.has(n.doc.key), e._snapshot.fromCache), e.query.converter);\n return n.doc, {\n type: \"added\",\n doc: r,\n oldIndex: -1,\n newIndex: t++\n };\n }));\n }\n {\n // A `DocumentSet` that is updated incrementally as changes are applied to use\n // to lookup the index of a document.\n let n = e._snapshot.oldDocs;\n return e._snapshot.docChanges.filter((e => t || 3 /* ChangeType.Metadata */ !== e.type)).map((t => {\n const r = new QueryDocumentSnapshot(e._firestore, e._userDataWriter, t.doc.key, t.doc, new SnapshotMetadata(e._snapshot.mutatedKeys.has(t.doc.key), e._snapshot.fromCache), e.query.converter);\n let i = -1, s = -1;\n return 0 /* ChangeType.Added */ !== t.type && (i = n.indexOf(t.doc.key), n = n.delete(t.doc.key)), \n 1 /* ChangeType.Removed */ !== t.type && (n = n.add(t.doc), s = n.indexOf(t.doc.key)), \n {\n type: __PRIVATE_resultChangeType(t.type),\n doc: r,\n oldIndex: i,\n newIndex: s\n };\n }));\n }\n }(this, t), this._cachedChangesIncludeMetadataChanges = t), this._cachedChanges;\n }\n /**\n * Returns a JSON-serializable representation of this `QuerySnapshot` instance.\n *\n * @returns a JSON representation of this object. Throws a {@link FirestoreError} if this\n * `QuerySnapshot` has pending writes.\n */ toJSON() {\n if (this.metadata.hasPendingWrites) throw new FirestoreError(N.FAILED_PRECONDITION, \"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().\");\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const e = {};\n e.type = QuerySnapshot._jsonSchemaVersion, e.bundleSource = \"QuerySnapshot\", e.bundleName = __PRIVATE_AutoId.newId(), \n this._firestore._databaseId.database, this._firestore._databaseId.projectId;\n const t = [], n = [], r = [];\n return this.docs.forEach((e => {\n null !== e._document && (t.push(e._document), n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields, \"previous\")), \n r.push(e.ref.path));\n })), e.bundle = (this._firestore, this.query._query, e.bundleName, \"NOT SUPPORTED\"), \n e;\n }\n}\n\nfunction __PRIVATE_resultChangeType(e) {\n switch (e) {\n case 0 /* ChangeType.Added */ :\n return \"added\";\n\n case 2 /* ChangeType.Modified */ :\n case 3 /* ChangeType.Metadata */ :\n return \"modified\";\n\n case 1 /* ChangeType.Removed */ :\n return \"removed\";\n\n default:\n return fail(61501, {\n type: e\n });\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Reads the document referred to by this `DocumentReference`.\n *\n * Note: `getDoc()` attempts to provide up-to-date data when possible by waiting\n * for data from the server, but it may return cached data or fail if you are\n * offline and the server cannot be reached. To specify this behavior, invoke\n * {@link getDocFromCache} or {@link getDocFromServer}.\n *\n * @param reference - The reference of the document to fetch.\n * @returns A Promise resolved with a `DocumentSnapshot` containing the\n * current document contents.\n */ function getDoc(e) {\n e = __PRIVATE_cast(e, DocumentReference);\n const t = __PRIVATE_cast(e.firestore, Firestore);\n return __PRIVATE_firestoreClientGetDocumentViaSnapshotListener(ensureFirestoreConfigured(t), e._key).then((n => __PRIVATE_convertToDocSnapshot(t, e, n)));\n}\n\nQuerySnapshot._jsonSchemaVersion = \"firestore/querySnapshot/1.0\", QuerySnapshot._jsonSchema = {\n type: property(\"string\", QuerySnapshot._jsonSchemaVersion),\n bundleSource: property(\"string\", \"QuerySnapshot\"),\n bundleName: property(\"string\"),\n bundle: property(\"string\")\n};\n\nclass __PRIVATE_ExpUserDataWriter extends AbstractUserDataWriter {\n constructor(e) {\n super(), this.firestore = e;\n }\n convertBytes(e) {\n return new Bytes(e);\n }\n convertReference(e) {\n const t = this.convertDocumentKey(e, this.firestore._databaseId);\n return new DocumentReference(this.firestore, /* converter= */ null, t);\n }\n}\n\n/**\n * Executes the query and returns the results as a `QuerySnapshot`.\n *\n * Note: `getDocs()` attempts to provide up-to-date data when possible by\n * waiting for data from the server, but it may return cached data or fail if\n * you are offline and the server cannot be reached. To specify this behavior,\n * invoke {@link getDocsFromCache} or {@link getDocsFromServer}.\n *\n * @returns A `Promise` that will be resolved with the results of the query.\n */ function getDocs(e) {\n e = __PRIVATE_cast(e, Query);\n const t = __PRIVATE_cast(e.firestore, Firestore), n = ensureFirestoreConfigured(t), r = new __PRIVATE_ExpUserDataWriter(t);\n return __PRIVATE_validateHasExplicitOrderByForLimitToLast(e._query), __PRIVATE_firestoreClientGetDocumentsViaSnapshotListener(n, e._query).then((n => new QuerySnapshot(t, r, e, n)));\n}\n\nfunction setDoc(e, t, n) {\n e = __PRIVATE_cast(e, DocumentReference);\n const r = __PRIVATE_cast(e.firestore, Firestore), i = __PRIVATE_applyFirestoreDataConverter(e.converter, t, n);\n return executeWrite(r, [ __PRIVATE_parseSetData(__PRIVATE_newUserDataReader(r), \"setDoc\", e._key, i, null !== e.converter, n).toMutation(e._key, Precondition.none()) ]);\n}\n\nfunction onSnapshot(e, ...t) {\n var n, r, i;\n // onSnapshot for Query or Document.\n e = getModularInstance(e);\n let s = {\n includeMetadataChanges: false,\n source: \"default\"\n }, o = 0;\n \"object\" != typeof t[o] || __PRIVATE_isPartialObserver(t[o]) || (s = t[o++]);\n const _ = {\n includeMetadataChanges: s.includeMetadataChanges,\n source: s.source\n };\n if (__PRIVATE_isPartialObserver(t[o])) {\n const e = t[o];\n t[o] = null === (n = e.next) || void 0 === n ? void 0 : n.bind(e), t[o + 1] = null === (r = e.error) || void 0 === r ? void 0 : r.bind(e), \n t[o + 2] = null === (i = e.complete) || void 0 === i ? void 0 : i.bind(e);\n }\n let a, u, c;\n if (e instanceof DocumentReference) u = __PRIVATE_cast(e.firestore, Firestore), \n c = __PRIVATE_newQueryForPath(e._key.path), a = {\n next: n => {\n t[o] && t[o](__PRIVATE_convertToDocSnapshot(u, e, n));\n },\n error: t[o + 1],\n complete: t[o + 2]\n }; else {\n const n = __PRIVATE_cast(e, Query);\n u = __PRIVATE_cast(n.firestore, Firestore), c = n._query;\n const r = new __PRIVATE_ExpUserDataWriter(u);\n a = {\n next: e => {\n t[o] && t[o](new QuerySnapshot(u, r, n, e));\n },\n error: t[o + 1],\n complete: t[o + 2]\n }, __PRIVATE_validateHasExplicitOrderByForLimitToLast(e._query);\n }\n return function __PRIVATE_firestoreClientListen(e, t, n, r) {\n const i = new __PRIVATE_AsyncObserver(r), s = new __PRIVATE_QueryListener(t, i, n);\n return e.asyncQueue.enqueueAndForget((async () => __PRIVATE_eventManagerListen(await __PRIVATE_getEventManager(e), s))), \n () => {\n i.Ou(), e.asyncQueue.enqueueAndForget((async () => __PRIVATE_eventManagerUnlisten(await __PRIVATE_getEventManager(e), s)));\n };\n }(ensureFirestoreConfigured(u), c, _, a);\n}\n\n/**\n * Locally writes `mutations` on the async queue.\n * @internal\n */ function executeWrite(e, t) {\n return function __PRIVATE_firestoreClientWrite(e, t) {\n const n = new __PRIVATE_Deferred;\n return e.asyncQueue.enqueueAndForget((async () => __PRIVATE_syncEngineWrite(await __PRIVATE_getSyncEngine(e), t, n))), \n n.promise;\n }(ensureFirestoreConfigured(e), t);\n}\n\n/**\n * Converts a {@link ViewSnapshot} that contains the single document specified by `ref`\n * to a {@link DocumentSnapshot}.\n */ function __PRIVATE_convertToDocSnapshot(e, t, n) {\n const r = n.docs.get(t._key), i = new __PRIVATE_ExpUserDataWriter(e);\n return new DocumentSnapshot(e, i, t._key, r, new SnapshotMetadata(n.hasPendingWrites, n.fromCache), t.converter);\n}\n\n/**\n * Cloud Firestore\n *\n * @packageDocumentation\n */ !function __PRIVATE_registerFirestore(e, t = true) {\n !function __PRIVATE_setSDKVersion(e) {\n x = e;\n }(SDK_VERSION), _registerComponent(new Component(\"firestore\", ((e, {instanceIdentifier: n, options: r}) => {\n const i = e.getProvider(\"app\").getImmediate(), s = new Firestore(new __PRIVATE_FirebaseAuthCredentialsProvider(e.getProvider(\"auth-internal\")), new __PRIVATE_FirebaseAppCheckTokenProvider(i, e.getProvider(\"app-check-internal\")), function __PRIVATE_databaseIdFromApp(e, t) {\n if (!Object.prototype.hasOwnProperty.apply(e.options, [ \"projectId\" ])) throw new FirestoreError(N.INVALID_ARGUMENT, '\"projectId\" not provided in firebase.initializeApp.');\n return new DatabaseId(e.options.projectId, t);\n }(i, n), i);\n return r = Object.assign({\n useFetchStreams: t\n }, r), s._setSettings(r), s;\n }), \"PUBLIC\").setMultipleInstances(true)), registerVersion(F, M$1, e), \n // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation\n registerVersion(F, M$1, \"esm2017\");\n}();\n\nvar name$1 = \"firebase\";\nvar version$1 = \"11.10.0\";\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nregisterVersion(name$1, version$1, 'app');\n\nclass Config {\n constructor() { }\n static getInstance() {\n if (!Config.instance)\n Config.instance = new Config();\n return Config.instance;\n }\n setEnv(env) {\n switch (env) {\n case 'production':\n case 'prod':\n this.env = 'prod';\n break;\n case 'development':\n case 'dev':\n default:\n this.env = 'dev';\n }\n }\n get firebase() {\n if (this.env === 'prod')\n return prodKeys.firebase;\n return devKeys.firebase;\n }\n get api() {\n if (this.env === 'prod')\n return prodKeys.api;\n return devKeys.api;\n }\n get config() {\n if (this.env === 'prod')\n return prodKeys.config;\n return devKeys.config;\n }\n}\nconst devKeys = {\n firebase: {\n apiKey: \"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8\",\n authDomain: \"fittingroom-dev-5d248.firebaseapp.com\",\n projectId: \"fittingroom-dev-5d248\",\n storageBucket: \"fittingroom-dev-5d248.appspot.com\",\n messagingSenderId: \"2298664147\",\n appId: \"1:2298664147:web:340bda75cd5d25f3997026\",\n },\n api: {\n url: \"https://tfr.dev.thefittingroom.xyz\",\n },\n config: {\n avatarTimeout: Number(\"120000\"),\n vtoTimeout: Number(\"120000\"),\n },\n};\nconst prodKeys = {\n firebase: {\n apiKey: \"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y\",\n authDomain: \"fittingroom-prod.firebaseapp.com\",\n projectId: \"fittingroom-prod\",\n storageBucket: \"fittingroom-prod.appspot.com\",\n messagingSenderId: \"965656825574\",\n appId: \"1:965656825574:web:933493cddc73213bd43527\",\n },\n api: {\n url: \"https://tfr.p.thefittingroom.xyz\",\n },\n config: {\n avatarTimeout: Number(\"120000\"),\n vtoTimeout: Number(\"120000\"),\n },\n};\n\nvar SECONDS_A_MINUTE = 60;\nvar SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;\nvar SECONDS_A_DAY = SECONDS_A_HOUR * 24;\nvar SECONDS_A_WEEK = SECONDS_A_DAY * 7;\nvar MILLISECONDS_A_SECOND = 1e3;\nvar MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;\nvar MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;\nvar MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;\nvar MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales\n\nvar MS = 'millisecond';\nvar S = 'second';\nvar MIN = 'minute';\nvar H = 'hour';\nvar D = 'day';\nvar W = 'week';\nvar M = 'month';\nvar Q = 'quarter';\nvar Y = 'year';\nvar DATE = 'date';\nvar FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';\nvar INVALID_DATE_STRING = 'Invalid Date'; // regex\n\nvar REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/;\nvar REGEX_FORMAT = /\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;\n\n// English [en]\n// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale\nvar en = {\n name: 'en',\n weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),\n ordinal: function ordinal(n) {\n var s = ['th', 'st', 'nd', 'rd'];\n var v = n % 100;\n return \"[\" + n + (s[(v - 20) % 10] || s[v] || s[0]) + \"]\";\n }\n};\n\nvar padStart = function padStart(string, length, pad) {\n var s = String(string);\n if (!s || s.length >= length) return string;\n return \"\" + Array(length + 1 - s.length).join(pad) + string;\n};\n\nvar padZoneStr = function padZoneStr(instance) {\n var negMinutes = -instance.utcOffset();\n var minutes = Math.abs(negMinutes);\n var hourOffset = Math.floor(minutes / 60);\n var minuteOffset = minutes % 60;\n return \"\" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + \":\" + padStart(minuteOffset, 2, '0');\n};\n\nvar monthDiff = function monthDiff(a, b) {\n // function from moment.js in order to keep the same result\n if (a.date() < b.date()) return -monthDiff(b, a);\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());\n var anchor = a.clone().add(wholeMonthDiff, M);\n var c = b - anchor < 0;\n var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M);\n return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);\n};\n\nvar absFloor = function absFloor(n) {\n return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);\n};\n\nvar prettyUnit = function prettyUnit(u) {\n var special = {\n M: M,\n y: Y,\n w: W,\n d: D,\n D: DATE,\n h: H,\n m: MIN,\n s: S,\n ms: MS,\n Q: Q\n };\n return special[u] || String(u || '').toLowerCase().replace(/s$/, '');\n};\n\nvar isUndefined = function isUndefined(s) {\n return s === undefined;\n};\n\nvar U = {\n s: padStart,\n z: padZoneStr,\n m: monthDiff,\n a: absFloor,\n p: prettyUnit,\n u: isUndefined\n};\n\nvar L = 'en'; // global locale\n\nvar Ls = {}; // global loaded locale\n\nLs[L] = en;\nvar IS_DAYJS = '$isDayjsObject'; // eslint-disable-next-line no-use-before-define\n\nvar isDayjs = function isDayjs(d) {\n return d instanceof Dayjs || !!(d && d[IS_DAYJS]);\n};\n\nvar parseLocale = function parseLocale(preset, object, isLocal) {\n var l;\n if (!preset) return L;\n\n if (typeof preset === 'string') {\n var presetLower = preset.toLowerCase();\n\n if (Ls[presetLower]) {\n l = presetLower;\n }\n\n if (object) {\n Ls[presetLower] = object;\n l = presetLower;\n }\n\n var presetSplit = preset.split('-');\n\n if (!l && presetSplit.length > 1) {\n return parseLocale(presetSplit[0]);\n }\n } else {\n var name = preset.name;\n Ls[name] = preset;\n l = name;\n }\n\n if (!isLocal && l) L = l;\n return l || !isLocal && L;\n};\n\nvar dayjs = function dayjs(date, c) {\n if (isDayjs(date)) {\n return date.clone();\n } // eslint-disable-next-line no-nested-ternary\n\n\n var cfg = typeof c === 'object' ? c : {};\n cfg.date = date;\n cfg.args = arguments; // eslint-disable-line prefer-rest-params\n\n return new Dayjs(cfg); // eslint-disable-line no-use-before-define\n};\n\nvar wrapper = function wrapper(date, instance) {\n return dayjs(date, {\n locale: instance.$L,\n utc: instance.$u,\n x: instance.$x,\n $offset: instance.$offset // todo: refactor; do not use this.$offset in you code\n\n });\n};\n\nvar Utils = U; // for plugin use\n\nUtils.l = parseLocale;\nUtils.i = isDayjs;\nUtils.w = wrapper;\n\nvar parseDate = function parseDate(cfg) {\n var date = cfg.date,\n utc = cfg.utc;\n if (date === null) return new Date(NaN); // null is invalid\n\n if (Utils.u(date)) return new Date(); // today\n\n if (date instanceof Date) return new Date(date);\n\n if (typeof date === 'string' && !/Z$/i.test(date)) {\n var d = date.match(REGEX_PARSE);\n\n if (d) {\n var m = d[2] - 1 || 0;\n var ms = (d[7] || '0').substring(0, 3);\n\n if (utc) {\n return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));\n }\n\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n\n return new Date(date); // everything else\n};\n\nvar Dayjs = /*#__PURE__*/function () {\n function Dayjs(cfg) {\n this.$L = parseLocale(cfg.locale, null, true);\n this.parse(cfg); // for plugin\n\n this.$x = this.$x || cfg.x || {};\n this[IS_DAYJS] = true;\n }\n\n var _proto = Dayjs.prototype;\n\n _proto.parse = function parse(cfg) {\n this.$d = parseDate(cfg);\n this.init();\n };\n\n _proto.init = function init() {\n var $d = this.$d;\n this.$y = $d.getFullYear();\n this.$M = $d.getMonth();\n this.$D = $d.getDate();\n this.$W = $d.getDay();\n this.$H = $d.getHours();\n this.$m = $d.getMinutes();\n this.$s = $d.getSeconds();\n this.$ms = $d.getMilliseconds();\n } // eslint-disable-next-line class-methods-use-this\n ;\n\n _proto.$utils = function $utils() {\n return Utils;\n };\n\n _proto.isValid = function isValid() {\n return !(this.$d.toString() === INVALID_DATE_STRING);\n };\n\n _proto.isSame = function isSame(that, units) {\n var other = dayjs(that);\n return this.startOf(units) <= other && other <= this.endOf(units);\n };\n\n _proto.isAfter = function isAfter(that, units) {\n return dayjs(that) < this.startOf(units);\n };\n\n _proto.isBefore = function isBefore(that, units) {\n return this.endOf(units) < dayjs(that);\n };\n\n _proto.$g = function $g(input, get, set) {\n if (Utils.u(input)) return this[get];\n return this.set(set, input);\n };\n\n _proto.unix = function unix() {\n return Math.floor(this.valueOf() / 1000);\n };\n\n _proto.valueOf = function valueOf() {\n // timezone(hour) * 60 * 60 * 1000 => ms\n return this.$d.getTime();\n };\n\n _proto.startOf = function startOf(units, _startOf) {\n var _this = this;\n\n // startOf -> endOf\n var isStartOf = !Utils.u(_startOf) ? _startOf : true;\n var unit = Utils.p(units);\n\n var instanceFactory = function instanceFactory(d, m) {\n var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);\n return isStartOf ? ins : ins.endOf(D);\n };\n\n var instanceFactorySet = function instanceFactorySet(method, slice) {\n var argumentStart = [0, 0, 0, 0];\n var argumentEnd = [23, 59, 59, 999];\n return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread\n _this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);\n };\n\n var $W = this.$W,\n $M = this.$M,\n $D = this.$D;\n var utcPad = \"set\" + (this.$u ? 'UTC' : '');\n\n switch (unit) {\n case Y:\n return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);\n\n case M:\n return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);\n\n case W:\n {\n var weekStart = this.$locale().weekStart || 0;\n var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;\n return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);\n }\n\n case D:\n case DATE:\n return instanceFactorySet(utcPad + \"Hours\", 0);\n\n case H:\n return instanceFactorySet(utcPad + \"Minutes\", 1);\n\n case MIN:\n return instanceFactorySet(utcPad + \"Seconds\", 2);\n\n case S:\n return instanceFactorySet(utcPad + \"Milliseconds\", 3);\n\n default:\n return this.clone();\n }\n };\n\n _proto.endOf = function endOf(arg) {\n return this.startOf(arg, false);\n };\n\n _proto.$set = function $set(units, _int) {\n var _C$D$C$DATE$C$M$C$Y$C;\n\n // private set\n var unit = Utils.p(units);\n var utcPad = \"set\" + (this.$u ? 'UTC' : '');\n var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + \"Date\", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + \"Date\", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + \"Month\", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + \"FullYear\", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + \"Hours\", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + \"Minutes\", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + \"Seconds\", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + \"Milliseconds\", _C$D$C$DATE$C$M$C$Y$C)[unit];\n var arg = unit === D ? this.$D + (_int - this.$W) : _int;\n\n if (unit === M || unit === Y) {\n // clone is for badMutable plugin\n var date = this.clone().set(DATE, 1);\n date.$d[name](arg);\n date.init();\n this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d;\n } else if (name) this.$d[name](arg);\n\n this.init();\n return this;\n };\n\n _proto.set = function set(string, _int2) {\n return this.clone().$set(string, _int2);\n };\n\n _proto.get = function get(unit) {\n return this[Utils.p(unit)]();\n };\n\n _proto.add = function add(number, units) {\n var _this2 = this,\n _C$MIN$C$H$C$S$unit;\n\n number = Number(number); // eslint-disable-line no-param-reassign\n\n var unit = Utils.p(units);\n\n var instanceFactorySet = function instanceFactorySet(n) {\n var d = dayjs(_this2);\n return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);\n };\n\n if (unit === M) {\n return this.set(M, this.$M + number);\n }\n\n if (unit === Y) {\n return this.set(Y, this.$y + number);\n }\n\n if (unit === D) {\n return instanceFactorySet(1);\n }\n\n if (unit === W) {\n return instanceFactorySet(7);\n }\n\n var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms\n\n var nextTimeStamp = this.$d.getTime() + number * step;\n return Utils.w(nextTimeStamp, this);\n };\n\n _proto.subtract = function subtract(number, string) {\n return this.add(number * -1, string);\n };\n\n _proto.format = function format(formatStr) {\n var _this3 = this;\n\n var locale = this.$locale();\n if (!this.isValid()) return locale.invalidDate || INVALID_DATE_STRING;\n var str = formatStr || FORMAT_DEFAULT;\n var zoneStr = Utils.z(this);\n var $H = this.$H,\n $m = this.$m,\n $M = this.$M;\n var weekdays = locale.weekdays,\n months = locale.months,\n meridiem = locale.meridiem;\n\n var getShort = function getShort(arr, index, full, length) {\n return arr && (arr[index] || arr(_this3, str)) || full[index].slice(0, length);\n };\n\n var get$H = function get$H(num) {\n return Utils.s($H % 12 || 12, num, '0');\n };\n\n var meridiemFunc = meridiem || function (hour, minute, isLowercase) {\n var m = hour < 12 ? 'AM' : 'PM';\n return isLowercase ? m.toLowerCase() : m;\n };\n\n var matches = function matches(match) {\n switch (match) {\n case 'YY':\n return String(_this3.$y).slice(-2);\n\n case 'YYYY':\n return Utils.s(_this3.$y, 4, '0');\n\n case 'M':\n return $M + 1;\n\n case 'MM':\n return Utils.s($M + 1, 2, '0');\n\n case 'MMM':\n return getShort(locale.monthsShort, $M, months, 3);\n\n case 'MMMM':\n return getShort(months, $M);\n\n case 'D':\n return _this3.$D;\n\n case 'DD':\n return Utils.s(_this3.$D, 2, '0');\n\n case 'd':\n return String(_this3.$W);\n\n case 'dd':\n return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);\n\n case 'ddd':\n return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);\n\n case 'dddd':\n return weekdays[_this3.$W];\n\n case 'H':\n return String($H);\n\n case 'HH':\n return Utils.s($H, 2, '0');\n\n case 'h':\n return get$H(1);\n\n case 'hh':\n return get$H(2);\n\n case 'a':\n return meridiemFunc($H, $m, true);\n\n case 'A':\n return meridiemFunc($H, $m, false);\n\n case 'm':\n return String($m);\n\n case 'mm':\n return Utils.s($m, 2, '0');\n\n case 's':\n return String(_this3.$s);\n\n case 'ss':\n return Utils.s(_this3.$s, 2, '0');\n\n case 'SSS':\n return Utils.s(_this3.$ms, 3, '0');\n\n case 'Z':\n return zoneStr;\n }\n\n return null;\n };\n\n return str.replace(REGEX_FORMAT, function (match, $1) {\n return $1 || matches(match) || zoneStr.replace(':', '');\n }); // 'ZZ'\n };\n\n _proto.utcOffset = function utcOffset() {\n // Because a bug at FF24, we're rounding the timezone offset around 15 minutes\n // https://github.com/moment/moment/pull/1871\n return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;\n };\n\n _proto.diff = function diff(input, units, _float) {\n var _this4 = this;\n\n var unit = Utils.p(units);\n var that = dayjs(input);\n var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE;\n var diff = this - that;\n\n var getMonth = function getMonth() {\n return Utils.m(_this4, that);\n };\n\n var result;\n\n switch (unit) {\n case Y:\n result = getMonth() / 12;\n break;\n\n case M:\n result = getMonth();\n break;\n\n case Q:\n result = getMonth() / 3;\n break;\n\n case W:\n result = (diff - zoneDelta) / MILLISECONDS_A_WEEK;\n break;\n\n case D:\n result = (diff - zoneDelta) / MILLISECONDS_A_DAY;\n break;\n\n case H:\n result = diff / MILLISECONDS_A_HOUR;\n break;\n\n case MIN:\n result = diff / MILLISECONDS_A_MINUTE;\n break;\n\n case S:\n result = diff / MILLISECONDS_A_SECOND;\n break;\n\n default:\n result = diff; // milliseconds\n\n break;\n }\n\n return _float ? result : Utils.a(result);\n };\n\n _proto.daysInMonth = function daysInMonth() {\n return this.endOf(M).$D;\n };\n\n _proto.$locale = function $locale() {\n // get locale object\n return Ls[this.$L];\n };\n\n _proto.locale = function locale(preset, object) {\n if (!preset) return this.$L;\n var that = this.clone();\n var nextLocaleName = parseLocale(preset, object, true);\n if (nextLocaleName) that.$L = nextLocaleName;\n return that;\n };\n\n _proto.clone = function clone() {\n return Utils.w(this.$d, this);\n };\n\n _proto.toDate = function toDate() {\n return new Date(this.valueOf());\n };\n\n _proto.toJSON = function toJSON() {\n return this.isValid() ? this.toISOString() : null;\n };\n\n _proto.toISOString = function toISOString() {\n // ie 8 return\n // new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)\n // .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')\n return this.$d.toISOString();\n };\n\n _proto.toString = function toString() {\n return this.$d.toUTCString();\n };\n\n return Dayjs;\n}();\n\nvar proto = Dayjs.prototype;\ndayjs.prototype = proto;\n[['$ms', MS], ['$s', S], ['$m', MIN], ['$H', H], ['$W', D], ['$M', M], ['$y', Y], ['$D', DATE]].forEach(function (g) {\n proto[g[1]] = function (input) {\n return this.$g(input, g[0], g[1]);\n };\n});\n\ndayjs.extend = function (plugin, option) {\n if (!plugin.$i) {\n // install plugin only once\n plugin(option, Dayjs, dayjs);\n plugin.$i = true;\n }\n\n return dayjs;\n};\n\ndayjs.locale = parseLocale;\ndayjs.isDayjs = isDayjs;\n\ndayjs.unix = function (timestamp) {\n return dayjs(timestamp * 1e3);\n};\n\ndayjs.en = Ls[L];\ndayjs.Ls = Ls;\ndayjs.p = {};\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nfunction _prodErrorMap() {\n // We will include this one message in the prod error map since by the very\n // nature of this error, developers will never be able to see the message\n // using the debugErrorMap (which is installed during auth initialization).\n return {\n [\"dependent-sdk-initialized-before-auth\" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +\n 'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +\n 'starting any other Firebase SDK.'\n };\n}\n/**\n * A minimal error map with all verbose error messages stripped.\n *\n * See discussion at {@link AuthErrorMap}\n *\n * @public\n */\nconst prodErrorMap = _prodErrorMap;\nconst _DEFAULT_AUTH_ERROR_FACTORY = new ErrorFactory('auth', 'Firebase', _prodErrorMap());\n/**\n * A map of potential `Auth` error codes, for easier comparison with errors\n * thrown by the SDK.\n *\n * @remarks\n * Note that you can't tree-shake individual keys\n * in the map, so by using the map you might substantially increase your\n * bundle size.\n *\n * @public\n */\nconst AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {\n USER_DISABLED: 'auth/user-disabled'};\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst logClient = new Logger('@firebase/auth');\nfunction _logWarn(msg, ...args) {\n if (logClient.logLevel <= LogLevel.WARN) {\n logClient.warn(`Auth (${SDK_VERSION}): ${msg}`, ...args);\n }\n}\nfunction _logError(msg, ...args) {\n if (logClient.logLevel <= LogLevel.ERROR) {\n logClient.error(`Auth (${SDK_VERSION}): ${msg}`, ...args);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _fail(authOrCode, ...rest) {\n throw createErrorInternal(authOrCode, ...rest);\n}\nfunction _createError(authOrCode, ...rest) {\n return createErrorInternal(authOrCode, ...rest);\n}\nfunction _errorWithCustomMessage(auth, code, message) {\n const errorMap = Object.assign(Object.assign({}, prodErrorMap()), { [code]: message });\n const factory = new ErrorFactory('auth', 'Firebase', errorMap);\n return factory.create(code, {\n appName: auth.name\n });\n}\nfunction _serverAppCurrentUserOperationNotSupportedError(auth) {\n return _errorWithCustomMessage(auth, \"operation-not-supported-in-this-environment\" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */, 'Operations that alter the current user are not supported in conjunction with FirebaseServerApp');\n}\nfunction createErrorInternal(authOrCode, ...rest) {\n if (typeof authOrCode !== 'string') {\n const code = rest[0];\n const fullParams = [...rest.slice(1)];\n if (fullParams[0]) {\n fullParams[0].appName = authOrCode.name;\n }\n return authOrCode._errorFactory.create(code, ...fullParams);\n }\n return _DEFAULT_AUTH_ERROR_FACTORY.create(authOrCode, ...rest);\n}\nfunction _assert(assertion, authOrCode, ...rest) {\n if (!assertion) {\n throw createErrorInternal(authOrCode, ...rest);\n }\n}\n/**\n * Unconditionally fails, throwing an internal error with the given message.\n *\n * @param failure type of failure encountered\n * @throws Error\n */\nfunction debugFail(failure) {\n // Log the failure in addition to throw an exception, just in case the\n // exception is swallowed.\n const message = `INTERNAL ASSERTION FAILED: ` + failure;\n _logError(message);\n // NOTE: We don't use FirebaseError here because these are internal failures\n // that cannot be handled by the user. (Also it would create a circular\n // dependency between the error and assert modules which doesn't work.)\n throw new Error(message);\n}\n/**\n * Fails if the given assertion condition is false, throwing an Error with the\n * given message if it did.\n *\n * @param assertion\n * @param message\n */\nfunction debugAssert(assertion, message) {\n if (!assertion) {\n debugFail(message);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _getCurrentUrl() {\n var _a;\n return (typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.href)) || '';\n}\nfunction _isHttpOrHttps() {\n return _getCurrentScheme() === 'http:' || _getCurrentScheme() === 'https:';\n}\nfunction _getCurrentScheme() {\n var _a;\n return (typeof self !== 'undefined' && ((_a = self.location) === null || _a === void 0 ? void 0 : _a.protocol)) || null;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Determine whether the browser is working online\n */\nfunction _isOnline() {\n if (typeof navigator !== 'undefined' &&\n navigator &&\n 'onLine' in navigator &&\n typeof navigator.onLine === 'boolean' &&\n // Apply only for traditional web apps and Chrome extensions.\n // This is especially true for Cordova apps which have unreliable\n // navigator.onLine behavior unless cordova-plugin-network-information is\n // installed which overwrites the native navigator.onLine value and\n // defines navigator.connection.\n (_isHttpOrHttps() || isBrowserExtension() || 'connection' in navigator)) {\n return navigator.onLine;\n }\n // If we can't determine the state, assume it is online.\n return true;\n}\nfunction _getUserLanguage() {\n if (typeof navigator === 'undefined') {\n return null;\n }\n const navigatorLanguage = navigator;\n return (\n // Most reliable, but only supported in Chrome/Firefox.\n (navigatorLanguage.languages && navigatorLanguage.languages[0]) ||\n // Supported in most browsers, but returns the language of the browser\n // UI, not the language set in browser settings.\n navigatorLanguage.language ||\n // Couldn't determine language.\n null);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A structure to help pick between a range of long and short delay durations\n * depending on the current environment. In general, the long delay is used for\n * mobile environments whereas short delays are used for desktop environments.\n */\nclass Delay {\n constructor(shortDelay, longDelay) {\n this.shortDelay = shortDelay;\n this.longDelay = longDelay;\n // Internal error when improperly initialized.\n debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');\n this.isMobile = isMobileCordova() || isReactNative();\n }\n get() {\n if (!_isOnline()) {\n // Pick the shorter timeout.\n return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);\n }\n // If running in a mobile environment, return the long delay, otherwise\n // return the short delay.\n // This could be improved in the future to dynamically change based on other\n // variables instead of just reading the current environment.\n return this.isMobile ? this.longDelay : this.shortDelay;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _emulatorUrl(config, path) {\n debugAssert(config.emulator, 'Emulator should always be set here');\n const { url } = config.emulator;\n if (!path) {\n return url;\n }\n return `${url}${path.startsWith('/') ? path.slice(1) : path}`;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass FetchProvider {\n static initialize(fetchImpl, headersImpl, responseImpl) {\n this.fetchImpl = fetchImpl;\n if (headersImpl) {\n this.headersImpl = headersImpl;\n }\n if (responseImpl) {\n this.responseImpl = responseImpl;\n }\n }\n static fetch() {\n if (this.fetchImpl) {\n return this.fetchImpl;\n }\n if (typeof self !== 'undefined' && 'fetch' in self) {\n return self.fetch;\n }\n if (typeof globalThis !== 'undefined' && globalThis.fetch) {\n return globalThis.fetch;\n }\n if (typeof fetch !== 'undefined') {\n return fetch;\n }\n debugFail('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n }\n static headers() {\n if (this.headersImpl) {\n return this.headersImpl;\n }\n if (typeof self !== 'undefined' && 'Headers' in self) {\n return self.Headers;\n }\n if (typeof globalThis !== 'undefined' && globalThis.Headers) {\n return globalThis.Headers;\n }\n if (typeof Headers !== 'undefined') {\n return Headers;\n }\n debugFail('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n }\n static response() {\n if (this.responseImpl) {\n return this.responseImpl;\n }\n if (typeof self !== 'undefined' && 'Response' in self) {\n return self.Response;\n }\n if (typeof globalThis !== 'undefined' && globalThis.Response) {\n return globalThis.Response;\n }\n if (typeof Response !== 'undefined') {\n return Response;\n }\n debugFail('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Map from errors returned by the server to errors to developer visible errors\n */\nconst SERVER_ERROR_MAP = {\n // Custom token errors.\n [\"CREDENTIAL_MISMATCH\" /* ServerError.CREDENTIAL_MISMATCH */]: \"custom-token-mismatch\" /* AuthErrorCode.CREDENTIAL_MISMATCH */,\n // This can only happen if the SDK sends a bad request.\n [\"MISSING_CUSTOM_TOKEN\" /* ServerError.MISSING_CUSTOM_TOKEN */]: \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */,\n // Create Auth URI errors.\n [\"INVALID_IDENTIFIER\" /* ServerError.INVALID_IDENTIFIER */]: \"invalid-email\" /* AuthErrorCode.INVALID_EMAIL */,\n // This can only happen if the SDK sends a bad request.\n [\"MISSING_CONTINUE_URI\" /* ServerError.MISSING_CONTINUE_URI */]: \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */,\n // Sign in with email and password errors (some apply to sign up too).\n [\"INVALID_PASSWORD\" /* ServerError.INVALID_PASSWORD */]: \"wrong-password\" /* AuthErrorCode.INVALID_PASSWORD */,\n // This can only happen if the SDK sends a bad request.\n [\"MISSING_PASSWORD\" /* ServerError.MISSING_PASSWORD */]: \"missing-password\" /* AuthErrorCode.MISSING_PASSWORD */,\n // Thrown if Email Enumeration Protection is enabled in the project and the email or password is\n // invalid.\n [\"INVALID_LOGIN_CREDENTIALS\" /* ServerError.INVALID_LOGIN_CREDENTIALS */]: \"invalid-credential\" /* AuthErrorCode.INVALID_CREDENTIAL */,\n // Sign up with email and password errors.\n [\"EMAIL_EXISTS\" /* ServerError.EMAIL_EXISTS */]: \"email-already-in-use\" /* AuthErrorCode.EMAIL_EXISTS */,\n [\"PASSWORD_LOGIN_DISABLED\" /* ServerError.PASSWORD_LOGIN_DISABLED */]: \"operation-not-allowed\" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,\n // Verify assertion for sign in with credential errors:\n [\"INVALID_IDP_RESPONSE\" /* ServerError.INVALID_IDP_RESPONSE */]: \"invalid-credential\" /* AuthErrorCode.INVALID_CREDENTIAL */,\n [\"INVALID_PENDING_TOKEN\" /* ServerError.INVALID_PENDING_TOKEN */]: \"invalid-credential\" /* AuthErrorCode.INVALID_CREDENTIAL */,\n [\"FEDERATED_USER_ID_ALREADY_LINKED\" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */]: \"credential-already-in-use\" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,\n // This can only happen if the SDK sends a bad request.\n [\"MISSING_REQ_TYPE\" /* ServerError.MISSING_REQ_TYPE */]: \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */,\n // Send Password reset email errors:\n [\"EMAIL_NOT_FOUND\" /* ServerError.EMAIL_NOT_FOUND */]: \"user-not-found\" /* AuthErrorCode.USER_DELETED */,\n [\"RESET_PASSWORD_EXCEED_LIMIT\" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */]: \"too-many-requests\" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,\n [\"EXPIRED_OOB_CODE\" /* ServerError.EXPIRED_OOB_CODE */]: \"expired-action-code\" /* AuthErrorCode.EXPIRED_OOB_CODE */,\n [\"INVALID_OOB_CODE\" /* ServerError.INVALID_OOB_CODE */]: \"invalid-action-code\" /* AuthErrorCode.INVALID_OOB_CODE */,\n // This can only happen if the SDK sends a bad request.\n [\"MISSING_OOB_CODE\" /* ServerError.MISSING_OOB_CODE */]: \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */,\n // Operations that require ID token in request:\n [\"CREDENTIAL_TOO_OLD_LOGIN_AGAIN\" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: \"requires-recent-login\" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,\n [\"INVALID_ID_TOKEN\" /* ServerError.INVALID_ID_TOKEN */]: \"invalid-user-token\" /* AuthErrorCode.INVALID_AUTH */,\n [\"TOKEN_EXPIRED\" /* ServerError.TOKEN_EXPIRED */]: \"user-token-expired\" /* AuthErrorCode.TOKEN_EXPIRED */,\n [\"USER_NOT_FOUND\" /* ServerError.USER_NOT_FOUND */]: \"user-token-expired\" /* AuthErrorCode.TOKEN_EXPIRED */,\n // Other errors.\n [\"TOO_MANY_ATTEMPTS_TRY_LATER\" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */]: \"too-many-requests\" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,\n [\"PASSWORD_DOES_NOT_MEET_REQUIREMENTS\" /* ServerError.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */]: \"password-does-not-meet-requirements\" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */,\n // Phone Auth related errors.\n [\"INVALID_CODE\" /* ServerError.INVALID_CODE */]: \"invalid-verification-code\" /* AuthErrorCode.INVALID_CODE */,\n [\"INVALID_SESSION_INFO\" /* ServerError.INVALID_SESSION_INFO */]: \"invalid-verification-id\" /* AuthErrorCode.INVALID_SESSION_INFO */,\n [\"INVALID_TEMPORARY_PROOF\" /* ServerError.INVALID_TEMPORARY_PROOF */]: \"invalid-credential\" /* AuthErrorCode.INVALID_CREDENTIAL */,\n [\"MISSING_SESSION_INFO\" /* ServerError.MISSING_SESSION_INFO */]: \"missing-verification-id\" /* AuthErrorCode.MISSING_SESSION_INFO */,\n [\"SESSION_EXPIRED\" /* ServerError.SESSION_EXPIRED */]: \"code-expired\" /* AuthErrorCode.CODE_EXPIRED */,\n // Other action code errors when additional settings passed.\n // MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.\n // This is OK as this error will be caught by client side validation.\n [\"MISSING_ANDROID_PACKAGE_NAME\" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */]: \"missing-android-pkg-name\" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,\n [\"UNAUTHORIZED_DOMAIN\" /* ServerError.UNAUTHORIZED_DOMAIN */]: \"unauthorized-continue-uri\" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,\n // getProjectConfig errors when clientId is passed.\n [\"INVALID_OAUTH_CLIENT_ID\" /* ServerError.INVALID_OAUTH_CLIENT_ID */]: \"invalid-oauth-client-id\" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,\n // User actions (sign-up or deletion) disabled errors.\n [\"ADMIN_ONLY_OPERATION\" /* ServerError.ADMIN_ONLY_OPERATION */]: \"admin-restricted-operation\" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,\n // Multi factor related errors.\n [\"INVALID_MFA_PENDING_CREDENTIAL\" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */]: \"invalid-multi-factor-session\" /* AuthErrorCode.INVALID_MFA_SESSION */,\n [\"MFA_ENROLLMENT_NOT_FOUND\" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */]: \"multi-factor-info-not-found\" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,\n [\"MISSING_MFA_ENROLLMENT_ID\" /* ServerError.MISSING_MFA_ENROLLMENT_ID */]: \"missing-multi-factor-info\" /* AuthErrorCode.MISSING_MFA_INFO */,\n [\"MISSING_MFA_PENDING_CREDENTIAL\" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */]: \"missing-multi-factor-session\" /* AuthErrorCode.MISSING_MFA_SESSION */,\n [\"SECOND_FACTOR_EXISTS\" /* ServerError.SECOND_FACTOR_EXISTS */]: \"second-factor-already-in-use\" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,\n [\"SECOND_FACTOR_LIMIT_EXCEEDED\" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */]: \"maximum-second-factor-count-exceeded\" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,\n // Blocking functions related errors.\n [\"BLOCKING_FUNCTION_ERROR_RESPONSE\" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */,\n // Recaptcha related errors.\n [\"RECAPTCHA_NOT_ENABLED\" /* ServerError.RECAPTCHA_NOT_ENABLED */]: \"recaptcha-not-enabled\" /* AuthErrorCode.RECAPTCHA_NOT_ENABLED */,\n [\"MISSING_RECAPTCHA_TOKEN\" /* ServerError.MISSING_RECAPTCHA_TOKEN */]: \"missing-recaptcha-token\" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */,\n [\"INVALID_RECAPTCHA_TOKEN\" /* ServerError.INVALID_RECAPTCHA_TOKEN */]: \"invalid-recaptcha-token\" /* AuthErrorCode.INVALID_RECAPTCHA_TOKEN */,\n [\"INVALID_RECAPTCHA_ACTION\" /* ServerError.INVALID_RECAPTCHA_ACTION */]: \"invalid-recaptcha-action\" /* AuthErrorCode.INVALID_RECAPTCHA_ACTION */,\n [\"MISSING_CLIENT_TYPE\" /* ServerError.MISSING_CLIENT_TYPE */]: \"missing-client-type\" /* AuthErrorCode.MISSING_CLIENT_TYPE */,\n [\"MISSING_RECAPTCHA_VERSION\" /* ServerError.MISSING_RECAPTCHA_VERSION */]: \"missing-recaptcha-version\" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */,\n [\"INVALID_RECAPTCHA_VERSION\" /* ServerError.INVALID_RECAPTCHA_VERSION */]: \"invalid-recaptcha-version\" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */,\n [\"INVALID_REQ_TYPE\" /* ServerError.INVALID_REQ_TYPE */]: \"invalid-req-type\" /* AuthErrorCode.INVALID_REQ_TYPE */\n};\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst CookieAuthProxiedEndpoints = [\n \"/v1/accounts:signInWithCustomToken\" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */,\n \"/v1/accounts:signInWithEmailLink\" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */,\n \"/v1/accounts:signInWithIdp\" /* Endpoint.SIGN_IN_WITH_IDP */,\n \"/v1/accounts:signInWithPassword\" /* Endpoint.SIGN_IN_WITH_PASSWORD */,\n \"/v1/accounts:signInWithPhoneNumber\" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */,\n \"/v1/token\" /* Endpoint.TOKEN */\n];\nconst DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);\nfunction _addTidIfNecessary(auth, request) {\n if (auth.tenantId && !request.tenantId) {\n return Object.assign(Object.assign({}, request), { tenantId: auth.tenantId });\n }\n return request;\n}\nasync function _performApiRequest(auth, method, path, request, customErrorMap = {}) {\n return _performFetchWithErrorHandling(auth, customErrorMap, async () => {\n let body = {};\n let params = {};\n if (request) {\n if (method === \"GET\" /* HttpMethod.GET */) {\n params = request;\n }\n else {\n body = {\n body: JSON.stringify(request)\n };\n }\n }\n const query = querystring(Object.assign({ key: auth.config.apiKey }, params)).slice(1);\n const headers = await auth._getAdditionalHeaders();\n headers[\"Content-Type\" /* HttpHeader.CONTENT_TYPE */] = 'application/json';\n if (auth.languageCode) {\n headers[\"X-Firebase-Locale\" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;\n }\n const fetchArgs = Object.assign({ method,\n headers }, body);\n /* Security-conscious server-side frameworks tend to have built in mitigations for referrer\n problems\". See the Cloudflare GitHub issue #487: Error: The 'referrerPolicy' field on\n 'RequestInitializerDict' is not implemented.\"\n https://github.com/cloudflare/next-on-pages/issues/487 */\n if (!isCloudflareWorker()) {\n fetchArgs.referrerPolicy = 'no-referrer';\n }\n if (auth.emulatorConfig && isCloudWorkstation(auth.emulatorConfig.host)) {\n fetchArgs.credentials = 'include';\n }\n return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);\n });\n}\nasync function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {\n auth._canInitEmulator = false;\n const errorMap = Object.assign(Object.assign({}, SERVER_ERROR_MAP), customErrorMap);\n try {\n const networkTimeout = new NetworkTimeout(auth);\n const response = await Promise.race([\n fetchFn(),\n networkTimeout.promise\n ]);\n // If we've reached this point, the fetch succeeded and the networkTimeout\n // didn't throw; clear the network timeout delay so that Node won't hang\n networkTimeout.clearNetworkTimeout();\n const json = await response.json();\n if ('needConfirmation' in json) {\n throw _makeTaggedError(auth, \"account-exists-with-different-credential\" /* AuthErrorCode.NEED_CONFIRMATION */, json);\n }\n if (response.ok && !('errorMessage' in json)) {\n return json;\n }\n else {\n const errorMessage = response.ok ? json.errorMessage : json.error.message;\n const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : ');\n if (serverErrorCode === \"FEDERATED_USER_ID_ALREADY_LINKED\" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {\n throw _makeTaggedError(auth, \"credential-already-in-use\" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);\n }\n else if (serverErrorCode === \"EMAIL_EXISTS\" /* ServerError.EMAIL_EXISTS */) {\n throw _makeTaggedError(auth, \"email-already-in-use\" /* AuthErrorCode.EMAIL_EXISTS */, json);\n }\n else if (serverErrorCode === \"USER_DISABLED\" /* ServerError.USER_DISABLED */) {\n throw _makeTaggedError(auth, \"user-disabled\" /* AuthErrorCode.USER_DISABLED */, json);\n }\n const authError = errorMap[serverErrorCode] ||\n serverErrorCode\n .toLowerCase()\n .replace(/[_\\s]+/g, '-');\n if (serverErrorMessage) {\n throw _errorWithCustomMessage(auth, authError, serverErrorMessage);\n }\n else {\n _fail(auth, authError);\n }\n }\n }\n catch (e) {\n if (e instanceof FirebaseError) {\n throw e;\n }\n // Changing this to a different error code will log user out when there is a network error\n // because we treat any error other than NETWORK_REQUEST_FAILED as token is invalid.\n // https://github.com/firebase/firebase-js-sdk/blob/4fbc73610d70be4e0852e7de63a39cb7897e8546/packages/auth/src/core/auth/auth_impl.ts#L309-L316\n _fail(auth, \"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */, { 'message': String(e) });\n }\n}\nasync function _performSignInRequest(auth, method, path, request, customErrorMap = {}) {\n const serverResponse = await _performApiRequest(auth, method, path, request, customErrorMap);\n if ('mfaPendingCredential' in serverResponse) {\n _fail(auth, \"multi-factor-auth-required\" /* AuthErrorCode.MFA_REQUIRED */, {\n _serverResponse: serverResponse\n });\n }\n return serverResponse;\n}\nasync function _getFinalTarget(auth, host, path, query) {\n const base = `${host}${path}?${query}`;\n const authInternal = auth;\n const finalTarget = authInternal.config.emulator\n ? _emulatorUrl(auth.config, base)\n : `${auth.config.apiScheme}://${base}`;\n // Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,\n // saving the idToken and refreshToken into cookies, and then redacting the refreshToken\n // from the response\n if (CookieAuthProxiedEndpoints.includes(path)) {\n // Persistence manager is async, we need to await it. We can't just wait for auth initialized\n // here since auth initialization calls this function.\n await authInternal._persistenceManagerAvailable;\n if (authInternal._getPersistenceType() === \"COOKIE\" /* PersistenceType.COOKIE */) {\n const cookiePersistence = authInternal._getPersistence();\n return cookiePersistence._getFinalTarget(finalTarget).toString();\n }\n }\n return finalTarget;\n}\nfunction _parseEnforcementState(enforcementStateStr) {\n switch (enforcementStateStr) {\n case 'ENFORCE':\n return \"ENFORCE\" /* EnforcementState.ENFORCE */;\n case 'AUDIT':\n return \"AUDIT\" /* EnforcementState.AUDIT */;\n case 'OFF':\n return \"OFF\" /* EnforcementState.OFF */;\n default:\n return \"ENFORCEMENT_STATE_UNSPECIFIED\" /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */;\n }\n}\nclass NetworkTimeout {\n clearNetworkTimeout() {\n clearTimeout(this.timer);\n }\n constructor(auth) {\n this.auth = auth;\n // Node timers and browser timers are fundamentally incompatible, but we\n // don't care about the value here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.timer = null;\n this.promise = new Promise((_, reject) => {\n this.timer = setTimeout(() => {\n return reject(_createError(this.auth, \"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));\n }, DEFAULT_API_TIMEOUT_MS.get());\n });\n }\n}\nfunction _makeTaggedError(auth, code, response) {\n const errorParams = {\n appName: auth.name\n };\n if (response.email) {\n errorParams.email = response.email;\n }\n if (response.phoneNumber) {\n errorParams.phoneNumber = response.phoneNumber;\n }\n const error = _createError(auth, code, errorParams);\n // We know customData is defined on error because errorParams is defined\n error.customData._tokenResponse = response;\n return error;\n}\nfunction isEnterprise(grecaptcha) {\n return (grecaptcha !== undefined &&\n grecaptcha.enterprise !== undefined);\n}\nclass RecaptchaConfig {\n constructor(response) {\n /**\n * The reCAPTCHA site key.\n */\n this.siteKey = '';\n /**\n * The list of providers and their enablement status for reCAPTCHA Enterprise.\n */\n this.recaptchaEnforcementState = [];\n if (response.recaptchaKey === undefined) {\n throw new Error('recaptchaKey undefined');\n }\n // Example response.recaptchaKey: \"projects/proj123/keys/sitekey123\"\n this.siteKey = response.recaptchaKey.split('/')[3];\n this.recaptchaEnforcementState = response.recaptchaEnforcementState;\n }\n /**\n * Returns the reCAPTCHA Enterprise enforcement state for the given provider.\n *\n * @param providerStr - The provider whose enforcement state is to be returned.\n * @returns The reCAPTCHA Enterprise enforcement state for the given provider.\n */\n getProviderEnforcementState(providerStr) {\n if (!this.recaptchaEnforcementState ||\n this.recaptchaEnforcementState.length === 0) {\n return null;\n }\n for (const recaptchaEnforcementState of this.recaptchaEnforcementState) {\n if (recaptchaEnforcementState.provider &&\n recaptchaEnforcementState.provider === providerStr) {\n return _parseEnforcementState(recaptchaEnforcementState.enforcementState);\n }\n }\n return null;\n }\n /**\n * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.\n *\n * @param providerStr - The provider whose enablement state is to be returned.\n * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.\n */\n isProviderEnabled(providerStr) {\n return (this.getProviderEnforcementState(providerStr) ===\n \"ENFORCE\" /* EnforcementState.ENFORCE */ ||\n this.getProviderEnforcementState(providerStr) === \"AUDIT\" /* EnforcementState.AUDIT */);\n }\n /**\n * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise\n * returns false.\n *\n * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.\n */\n isAnyProviderEnabled() {\n return (this.isProviderEnabled(\"EMAIL_PASSWORD_PROVIDER\" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) ||\n this.isProviderEnabled(\"PHONE_PROVIDER\" /* RecaptchaAuthProvider.PHONE_PROVIDER */));\n }\n}\nasync function getRecaptchaConfig(auth, request) {\n return _performApiRequest(auth, \"GET\" /* HttpMethod.GET */, \"/v2/recaptchaConfig\" /* Endpoint.GET_RECAPTCHA_CONFIG */, _addTidIfNecessary(auth, request));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function deleteAccount(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:delete\" /* Endpoint.DELETE_ACCOUNT */, request);\n}\nasync function getAccountInfo(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:lookup\" /* Endpoint.GET_ACCOUNT_INFO */, request);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction utcTimestampToDateString(utcTimestamp) {\n if (!utcTimestamp) {\n return undefined;\n }\n try {\n // Convert to date object.\n const date = new Date(Number(utcTimestamp));\n // Test date is valid.\n if (!isNaN(date.getTime())) {\n // Convert to UTC date string.\n return date.toUTCString();\n }\n }\n catch (e) {\n // Do nothing. undefined will be returned.\n }\n return undefined;\n}\n/**\n * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.\n *\n * @remarks\n * Returns the current token if it has not expired or if it will not expire in the next five\n * minutes. Otherwise, this will refresh the token and return a new one.\n *\n * @param user - The user.\n * @param forceRefresh - Force refresh regardless of token expiration.\n *\n * @public\n */\nasync function getIdTokenResult(user, forceRefresh = false) {\n const userInternal = getModularInstance(user);\n const token = await userInternal.getIdToken(forceRefresh);\n const claims = _parseToken(token);\n _assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;\n const signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];\n return {\n claims,\n token,\n authTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.auth_time)),\n issuedAtTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.iat)),\n expirationTime: utcTimestampToDateString(secondsStringToMilliseconds(claims.exp)),\n signInProvider: signInProvider || null,\n signInSecondFactor: (firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_second_factor']) || null\n };\n}\nfunction secondsStringToMilliseconds(seconds) {\n return Number(seconds) * 1000;\n}\nfunction _parseToken(token) {\n const [algorithm, payload, signature] = token.split('.');\n if (algorithm === undefined ||\n payload === undefined ||\n signature === undefined) {\n _logError('JWT malformed, contained fewer than 3 sections');\n return null;\n }\n try {\n const decoded = base64Decode(payload);\n if (!decoded) {\n _logError('Failed to decode base64 JWT payload');\n return null;\n }\n return JSON.parse(decoded);\n }\n catch (e) {\n _logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());\n return null;\n }\n}\n/**\n * Extract expiresIn TTL from a token by subtracting the expiration from the issuance.\n */\nfunction _tokenExpiresIn(token) {\n const parsedToken = _parseToken(token);\n _assert(parsedToken, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n _assert(typeof parsedToken.exp !== 'undefined', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n _assert(typeof parsedToken.iat !== 'undefined', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return Number(parsedToken.exp) - Number(parsedToken.iat);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function _logoutIfInvalidated(user, promise, bypassAuthState = false) {\n if (bypassAuthState) {\n return promise;\n }\n try {\n return await promise;\n }\n catch (e) {\n if (e instanceof FirebaseError && isUserInvalidated(e)) {\n if (user.auth.currentUser === user) {\n await user.auth.signOut();\n }\n }\n throw e;\n }\n}\nfunction isUserInvalidated({ code }) {\n return (code === `auth/${\"user-disabled\" /* AuthErrorCode.USER_DISABLED */}` ||\n code === `auth/${\"user-token-expired\" /* AuthErrorCode.TOKEN_EXPIRED */}`);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass ProactiveRefresh {\n constructor(user) {\n this.user = user;\n this.isRunning = false;\n // Node timers and browser timers return fundamentally different types.\n // We don't actually care what the value is but TS won't accept unknown and\n // we can't cast properly in both environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.timerId = null;\n this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;\n }\n _start() {\n if (this.isRunning) {\n return;\n }\n this.isRunning = true;\n this.schedule();\n }\n _stop() {\n if (!this.isRunning) {\n return;\n }\n this.isRunning = false;\n if (this.timerId !== null) {\n clearTimeout(this.timerId);\n }\n }\n getInterval(wasError) {\n var _a;\n if (wasError) {\n const interval = this.errorBackoff;\n this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);\n return interval;\n }\n else {\n // Reset the error backoff\n this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;\n const expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;\n const interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;\n return Math.max(0, interval);\n }\n }\n schedule(wasError = false) {\n if (!this.isRunning) {\n // Just in case...\n return;\n }\n const interval = this.getInterval(wasError);\n this.timerId = setTimeout(async () => {\n await this.iteration();\n }, interval);\n }\n async iteration() {\n try {\n await this.user.getIdToken(true);\n }\n catch (e) {\n // Only retry on network errors\n if ((e === null || e === void 0 ? void 0 : e.code) ===\n `auth/${\"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {\n this.schedule(/* wasError */ true);\n }\n return;\n }\n this.schedule();\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass UserMetadata {\n constructor(createdAt, lastLoginAt) {\n this.createdAt = createdAt;\n this.lastLoginAt = lastLoginAt;\n this._initializeTime();\n }\n _initializeTime() {\n this.lastSignInTime = utcTimestampToDateString(this.lastLoginAt);\n this.creationTime = utcTimestampToDateString(this.createdAt);\n }\n _copy(metadata) {\n this.createdAt = metadata.createdAt;\n this.lastLoginAt = metadata.lastLoginAt;\n this._initializeTime();\n }\n toJSON() {\n return {\n createdAt: this.createdAt,\n lastLoginAt: this.lastLoginAt\n };\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function _reloadWithoutSaving(user) {\n var _a;\n const auth = user.auth;\n const idToken = await user.getIdToken();\n const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { idToken }));\n _assert(response === null || response === void 0 ? void 0 : response.users.length, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const coreAccount = response.users[0];\n user._notifyReloadListener(coreAccount);\n const newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)\n ? extractProviderData(coreAccount.providerUserInfo)\n : [];\n const providerData = mergeProviderData(user.providerData, newProviderData);\n // Preserves the non-nonymous status of the stored user, even if no more\n // credentials (federated or email/password) are linked to the user. If\n // the user was previously anonymous, then use provider data to update.\n // On the other hand, if it was not anonymous before, it should never be\n // considered anonymous now.\n const oldIsAnonymous = user.isAnonymous;\n const newIsAnonymous = !(user.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);\n const isAnonymous = !oldIsAnonymous ? false : newIsAnonymous;\n const updates = {\n uid: coreAccount.localId,\n displayName: coreAccount.displayName || null,\n photoURL: coreAccount.photoUrl || null,\n email: coreAccount.email || null,\n emailVerified: coreAccount.emailVerified || false,\n phoneNumber: coreAccount.phoneNumber || null,\n tenantId: coreAccount.tenantId || null,\n providerData,\n metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),\n isAnonymous\n };\n Object.assign(user, updates);\n}\n/**\n * Reloads user account data, if signed in.\n *\n * @param user - The user.\n *\n * @public\n */\nasync function reload(user) {\n const userInternal = getModularInstance(user);\n await _reloadWithoutSaving(userInternal);\n // Even though the current user hasn't changed, update\n // current user will trigger a persistence update w/ the\n // new info.\n await userInternal.auth._persistUserIfCurrent(userInternal);\n userInternal.auth._notifyListenersIfCurrent(userInternal);\n}\nfunction mergeProviderData(original, newData) {\n const deduped = original.filter(o => !newData.some(n => n.providerId === o.providerId));\n return [...deduped, ...newData];\n}\nfunction extractProviderData(providers) {\n return providers.map((_a) => {\n var { providerId } = _a, provider = __rest(_a, [\"providerId\"]);\n return {\n providerId,\n uid: provider.rawId || '',\n displayName: provider.displayName || null,\n email: provider.email || null,\n phoneNumber: provider.phoneNumber || null,\n photoURL: provider.photoUrl || null\n };\n });\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function requestStsToken(auth, refreshToken) {\n const response = await _performFetchWithErrorHandling(auth, {}, async () => {\n const body = querystring({\n 'grant_type': 'refresh_token',\n 'refresh_token': refreshToken\n }).slice(1);\n const { tokenApiHost, apiKey } = auth.config;\n const url = await _getFinalTarget(auth, tokenApiHost, \"/v1/token\" /* Endpoint.TOKEN */, `key=${apiKey}`);\n const headers = await auth._getAdditionalHeaders();\n headers[\"Content-Type\" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';\n const options = {\n method: \"POST\" /* HttpMethod.POST */,\n headers,\n body\n };\n if (auth.emulatorConfig &&\n isCloudWorkstation(auth.emulatorConfig.host)) {\n options.credentials = 'include';\n }\n return FetchProvider.fetch()(url, options);\n });\n // The response comes back in snake_case. Convert to camel:\n return {\n accessToken: response.access_token,\n expiresIn: response.expires_in,\n refreshToken: response.refresh_token\n };\n}\nasync function revokeToken(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v2/accounts:revokeToken\" /* Endpoint.REVOKE_TOKEN */, _addTidIfNecessary(auth, request));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * We need to mark this class as internal explicitly to exclude it in the public typings, because\n * it references AuthInternal which has a circular dependency with UserInternal.\n *\n * @internal\n */\nclass StsTokenManager {\n constructor() {\n this.refreshToken = null;\n this.accessToken = null;\n this.expirationTime = null;\n }\n get isExpired() {\n return (!this.expirationTime ||\n Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);\n }\n updateFromServerResponse(response) {\n _assert(response.idToken, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n _assert(typeof response.idToken !== 'undefined', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n _assert(typeof response.refreshToken !== 'undefined', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'\n ? Number(response.expiresIn)\n : _tokenExpiresIn(response.idToken);\n this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);\n }\n updateFromIdToken(idToken) {\n _assert(idToken.length !== 0, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const expiresIn = _tokenExpiresIn(idToken);\n this.updateTokensAndExpiration(idToken, null, expiresIn);\n }\n async getToken(auth, forceRefresh = false) {\n if (!forceRefresh && this.accessToken && !this.isExpired) {\n return this.accessToken;\n }\n _assert(this.refreshToken, auth, \"user-token-expired\" /* AuthErrorCode.TOKEN_EXPIRED */);\n if (this.refreshToken) {\n await this.refresh(auth, this.refreshToken);\n return this.accessToken;\n }\n return null;\n }\n clearRefreshToken() {\n this.refreshToken = null;\n }\n async refresh(auth, oldToken) {\n const { accessToken, refreshToken, expiresIn } = await requestStsToken(auth, oldToken);\n this.updateTokensAndExpiration(accessToken, refreshToken, Number(expiresIn));\n }\n updateTokensAndExpiration(accessToken, refreshToken, expiresInSec) {\n this.refreshToken = refreshToken || null;\n this.accessToken = accessToken || null;\n this.expirationTime = Date.now() + expiresInSec * 1000;\n }\n static fromJSON(appName, object) {\n const { refreshToken, accessToken, expirationTime } = object;\n const manager = new StsTokenManager();\n if (refreshToken) {\n _assert(typeof refreshToken === 'string', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */, {\n appName\n });\n manager.refreshToken = refreshToken;\n }\n if (accessToken) {\n _assert(typeof accessToken === 'string', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */, {\n appName\n });\n manager.accessToken = accessToken;\n }\n if (expirationTime) {\n _assert(typeof expirationTime === 'number', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */, {\n appName\n });\n manager.expirationTime = expirationTime;\n }\n return manager;\n }\n toJSON() {\n return {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expirationTime: this.expirationTime\n };\n }\n _assign(stsTokenManager) {\n this.accessToken = stsTokenManager.accessToken;\n this.refreshToken = stsTokenManager.refreshToken;\n this.expirationTime = stsTokenManager.expirationTime;\n }\n _clone() {\n return Object.assign(new StsTokenManager(), this.toJSON());\n }\n _performRefresh() {\n return debugFail('not implemented');\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction assertStringOrUndefined(assertion, appName) {\n _assert(typeof assertion === 'string' || typeof assertion === 'undefined', \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */, { appName });\n}\nclass UserImpl {\n constructor(_a) {\n var { uid, auth, stsTokenManager } = _a, opt = __rest(_a, [\"uid\", \"auth\", \"stsTokenManager\"]);\n // For the user object, provider is always Firebase.\n this.providerId = \"firebase\" /* ProviderId.FIREBASE */;\n this.proactiveRefresh = new ProactiveRefresh(this);\n this.reloadUserInfo = null;\n this.reloadListener = null;\n this.uid = uid;\n this.auth = auth;\n this.stsTokenManager = stsTokenManager;\n this.accessToken = stsTokenManager.accessToken;\n this.displayName = opt.displayName || null;\n this.email = opt.email || null;\n this.emailVerified = opt.emailVerified || false;\n this.phoneNumber = opt.phoneNumber || null;\n this.photoURL = opt.photoURL || null;\n this.isAnonymous = opt.isAnonymous || false;\n this.tenantId = opt.tenantId || null;\n this.providerData = opt.providerData ? [...opt.providerData] : [];\n this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);\n }\n async getIdToken(forceRefresh) {\n const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh));\n _assert(accessToken, this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n if (this.accessToken !== accessToken) {\n this.accessToken = accessToken;\n await this.auth._persistUserIfCurrent(this);\n this.auth._notifyListenersIfCurrent(this);\n }\n return accessToken;\n }\n getIdTokenResult(forceRefresh) {\n return getIdTokenResult(this, forceRefresh);\n }\n reload() {\n return reload(this);\n }\n _assign(user) {\n if (this === user) {\n return;\n }\n _assert(this.uid === user.uid, this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n this.displayName = user.displayName;\n this.photoURL = user.photoURL;\n this.email = user.email;\n this.emailVerified = user.emailVerified;\n this.phoneNumber = user.phoneNumber;\n this.isAnonymous = user.isAnonymous;\n this.tenantId = user.tenantId;\n this.providerData = user.providerData.map(userInfo => (Object.assign({}, userInfo)));\n this.metadata._copy(user.metadata);\n this.stsTokenManager._assign(user.stsTokenManager);\n }\n _clone(auth) {\n const newUser = new UserImpl(Object.assign(Object.assign({}, this), { auth, stsTokenManager: this.stsTokenManager._clone() }));\n newUser.metadata._copy(this.metadata);\n return newUser;\n }\n _onReload(callback) {\n // There should only ever be one listener, and that is a single instance of MultiFactorUser\n _assert(!this.reloadListener, this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n this.reloadListener = callback;\n if (this.reloadUserInfo) {\n this._notifyReloadListener(this.reloadUserInfo);\n this.reloadUserInfo = null;\n }\n }\n _notifyReloadListener(userInfo) {\n if (this.reloadListener) {\n this.reloadListener(userInfo);\n }\n else {\n // If no listener is subscribed yet, save the result so it's available when they do subscribe\n this.reloadUserInfo = userInfo;\n }\n }\n _startProactiveRefresh() {\n this.proactiveRefresh._start();\n }\n _stopProactiveRefresh() {\n this.proactiveRefresh._stop();\n }\n async _updateTokensIfNecessary(response, reload = false) {\n let tokensRefreshed = false;\n if (response.idToken &&\n response.idToken !== this.stsTokenManager.accessToken) {\n this.stsTokenManager.updateFromServerResponse(response);\n tokensRefreshed = true;\n }\n if (reload) {\n await _reloadWithoutSaving(this);\n }\n await this.auth._persistUserIfCurrent(this);\n if (tokensRefreshed) {\n this.auth._notifyListenersIfCurrent(this);\n }\n }\n async delete() {\n if (_isFirebaseServerApp(this.auth.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth));\n }\n const idToken = await this.getIdToken();\n await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken }));\n this.stsTokenManager.clearRefreshToken();\n // TODO: Determine if cancellable-promises are necessary to use in this class so that delete()\n // cancels pending actions...\n return this.auth.signOut();\n }\n toJSON() {\n return Object.assign(Object.assign({ uid: this.uid, email: this.email || undefined, emailVerified: this.emailVerified, displayName: this.displayName || undefined, isAnonymous: this.isAnonymous, photoURL: this.photoURL || undefined, phoneNumber: this.phoneNumber || undefined, tenantId: this.tenantId || undefined, providerData: this.providerData.map(userInfo => (Object.assign({}, userInfo))), stsTokenManager: this.stsTokenManager.toJSON(), \n // Redirect event ID must be maintained in case there is a pending\n // redirect event.\n _redirectEventId: this._redirectEventId }, this.metadata.toJSON()), { \n // Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing):\n apiKey: this.auth.config.apiKey, appName: this.auth.name });\n }\n get refreshToken() {\n return this.stsTokenManager.refreshToken || '';\n }\n static _fromJSON(auth, object) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n const displayName = (_a = object.displayName) !== null && _a !== void 0 ? _a : undefined;\n const email = (_b = object.email) !== null && _b !== void 0 ? _b : undefined;\n const phoneNumber = (_c = object.phoneNumber) !== null && _c !== void 0 ? _c : undefined;\n const photoURL = (_d = object.photoURL) !== null && _d !== void 0 ? _d : undefined;\n const tenantId = (_e = object.tenantId) !== null && _e !== void 0 ? _e : undefined;\n const _redirectEventId = (_f = object._redirectEventId) !== null && _f !== void 0 ? _f : undefined;\n const createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;\n const lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;\n const { uid, emailVerified, isAnonymous, providerData, stsTokenManager: plainObjectTokenManager } = object;\n _assert(uid && plainObjectTokenManager, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);\n _assert(typeof uid === 'string', auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n assertStringOrUndefined(displayName, auth.name);\n assertStringOrUndefined(email, auth.name);\n _assert(typeof emailVerified === 'boolean', auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n _assert(typeof isAnonymous === 'boolean', auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n assertStringOrUndefined(phoneNumber, auth.name);\n assertStringOrUndefined(photoURL, auth.name);\n assertStringOrUndefined(tenantId, auth.name);\n assertStringOrUndefined(_redirectEventId, auth.name);\n assertStringOrUndefined(createdAt, auth.name);\n assertStringOrUndefined(lastLoginAt, auth.name);\n const user = new UserImpl({\n uid,\n auth,\n email,\n emailVerified,\n displayName,\n isAnonymous,\n photoURL,\n phoneNumber,\n tenantId,\n stsTokenManager,\n createdAt,\n lastLoginAt\n });\n if (providerData && Array.isArray(providerData)) {\n user.providerData = providerData.map(userInfo => (Object.assign({}, userInfo)));\n }\n if (_redirectEventId) {\n user._redirectEventId = _redirectEventId;\n }\n return user;\n }\n /**\n * Initialize a User from an idToken server response\n * @param auth\n * @param idTokenResponse\n */\n static async _fromIdTokenResponse(auth, idTokenResponse, isAnonymous = false) {\n const stsTokenManager = new StsTokenManager();\n stsTokenManager.updateFromServerResponse(idTokenResponse);\n // Initialize the Firebase Auth user.\n const user = new UserImpl({\n uid: idTokenResponse.localId,\n auth,\n stsTokenManager,\n isAnonymous\n });\n // Updates the user info and data and resolves with a user instance.\n await _reloadWithoutSaving(user);\n return user;\n }\n /**\n * Initialize a User from an idToken server response\n * @param auth\n * @param idTokenResponse\n */\n static async _fromGetAccountInfoResponse(auth, response, idToken) {\n const coreAccount = response.users[0];\n _assert(coreAccount.localId !== undefined, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const providerData = coreAccount.providerUserInfo !== undefined\n ? extractProviderData(coreAccount.providerUserInfo)\n : [];\n const isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);\n const stsTokenManager = new StsTokenManager();\n stsTokenManager.updateFromIdToken(idToken);\n // Initialize the Firebase Auth user.\n const user = new UserImpl({\n uid: coreAccount.localId,\n auth,\n stsTokenManager,\n isAnonymous\n });\n // update the user with data from the GetAccountInfo response.\n const updates = {\n uid: coreAccount.localId,\n displayName: coreAccount.displayName || null,\n photoURL: coreAccount.photoUrl || null,\n email: coreAccount.email || null,\n emailVerified: coreAccount.emailVerified || false,\n phoneNumber: coreAccount.phoneNumber || null,\n tenantId: coreAccount.tenantId || null,\n providerData,\n metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),\n isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&\n !(providerData === null || providerData === void 0 ? void 0 : providerData.length)\n };\n Object.assign(user, updates);\n return user;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst instanceCache = new Map();\nfunction _getInstance(cls) {\n debugAssert(cls instanceof Function, 'Expected a class definition');\n let instance = instanceCache.get(cls);\n if (instance) {\n debugAssert(instance instanceof cls, 'Instance stored in cache mismatched with class');\n return instance;\n }\n instance = new cls();\n instanceCache.set(cls, instance);\n return instance;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass InMemoryPersistence {\n constructor() {\n this.type = \"NONE\" /* PersistenceType.NONE */;\n this.storage = {};\n }\n async _isAvailable() {\n return true;\n }\n async _set(key, value) {\n this.storage[key] = value;\n }\n async _get(key) {\n const value = this.storage[key];\n return value === undefined ? null : value;\n }\n async _remove(key) {\n delete this.storage[key];\n }\n _addListener(_key, _listener) {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n _removeListener(_key, _listener) {\n // Listeners are not supported for in-memory storage since it cannot be shared across windows/workers\n return;\n }\n}\nInMemoryPersistence.type = 'NONE';\n/**\n * An implementation of {@link Persistence} of type 'NONE'.\n *\n * @public\n */\nconst inMemoryPersistence = InMemoryPersistence;\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _persistenceKeyName(key, apiKey, appName) {\n return `${\"firebase\" /* Namespace.PERSISTENCE */}:${key}:${apiKey}:${appName}`;\n}\nclass PersistenceUserManager {\n constructor(persistence, auth, userKey) {\n this.persistence = persistence;\n this.auth = auth;\n this.userKey = userKey;\n const { config, name } = this.auth;\n this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);\n this.fullPersistenceKey = _persistenceKeyName(\"persistence\" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);\n this.boundEventHandler = auth._onStorageEvent.bind(auth);\n this.persistence._addListener(this.fullUserKey, this.boundEventHandler);\n }\n setCurrentUser(user) {\n return this.persistence._set(this.fullUserKey, user.toJSON());\n }\n async getCurrentUser() {\n const blob = await this.persistence._get(this.fullUserKey);\n if (!blob) {\n return null;\n }\n if (typeof blob === 'string') {\n const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined);\n if (!response) {\n return null;\n }\n return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);\n }\n return UserImpl._fromJSON(this.auth, blob);\n }\n removeCurrentUser() {\n return this.persistence._remove(this.fullUserKey);\n }\n savePersistenceForRedirect() {\n return this.persistence._set(this.fullPersistenceKey, this.persistence.type);\n }\n async setPersistence(newPersistence) {\n if (this.persistence === newPersistence) {\n return;\n }\n const currentUser = await this.getCurrentUser();\n await this.removeCurrentUser();\n this.persistence = newPersistence;\n if (currentUser) {\n return this.setCurrentUser(currentUser);\n }\n }\n delete() {\n this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);\n }\n static async create(auth, persistenceHierarchy, userKey = \"authUser\" /* KeyName.AUTH_USER */) {\n if (!persistenceHierarchy.length) {\n return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);\n }\n // Eliminate any persistences that are not available\n const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {\n if (await persistence._isAvailable()) {\n return persistence;\n }\n return undefined;\n }))).filter(persistence => persistence);\n // Fall back to the first persistence listed, or in memory if none available\n let selectedPersistence = availablePersistences[0] ||\n _getInstance(inMemoryPersistence);\n const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);\n // Pull out the existing user, setting the chosen persistence to that\n // persistence if the user exists.\n let userToMigrate = null;\n // Note, here we check for a user in _all_ persistences, not just the\n // ones deemed available. If we can migrate a user out of a broken\n // persistence, we will (but only if that persistence supports migration).\n for (const persistence of persistenceHierarchy) {\n try {\n const blob = await persistence._get(key);\n if (blob) {\n let user;\n if (typeof blob === 'string') {\n const response = await getAccountInfo(auth, {\n idToken: blob\n }).catch(() => undefined);\n if (!response) {\n break;\n }\n user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob);\n }\n else {\n user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)\n }\n if (persistence !== selectedPersistence) {\n userToMigrate = user;\n }\n selectedPersistence = persistence;\n break;\n }\n }\n catch (_a) { }\n }\n // If we find the user in a persistence that does support migration, use\n // that migration path (of only persistences that support migration)\n const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration);\n // If the persistence does _not_ allow migration, just finish off here\n if (!selectedPersistence._shouldAllowMigration ||\n !migrationHierarchy.length) {\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\n }\n selectedPersistence = migrationHierarchy[0];\n if (userToMigrate) {\n // This normally shouldn't throw since chosenPersistence.isAvailable() is true, but if it does\n // we'll just let it bubble to surface the error.\n await selectedPersistence._set(key, userToMigrate.toJSON());\n }\n // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues\n // such as users getting stuck with a previous account after signing out and refreshing the tab.\n await Promise.all(persistenceHierarchy.map(async (persistence) => {\n if (persistence !== selectedPersistence) {\n try {\n await persistence._remove(key);\n }\n catch (_a) { }\n }\n }));\n return new PersistenceUserManager(selectedPersistence, auth, userKey);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Determine the browser for the purposes of reporting usage to the API\n */\nfunction _getBrowserName(userAgent) {\n const ua = userAgent.toLowerCase();\n if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {\n return \"Opera\" /* BrowserName.OPERA */;\n }\n else if (_isIEMobile(ua)) {\n // Windows phone IEMobile browser.\n return \"IEMobile\" /* BrowserName.IEMOBILE */;\n }\n else if (ua.includes('msie') || ua.includes('trident/')) {\n return \"IE\" /* BrowserName.IE */;\n }\n else if (ua.includes('edge/')) {\n return \"Edge\" /* BrowserName.EDGE */;\n }\n else if (_isFirefox(ua)) {\n return \"Firefox\" /* BrowserName.FIREFOX */;\n }\n else if (ua.includes('silk/')) {\n return \"Silk\" /* BrowserName.SILK */;\n }\n else if (_isBlackBerry(ua)) {\n // Blackberry browser.\n return \"Blackberry\" /* BrowserName.BLACKBERRY */;\n }\n else if (_isWebOS(ua)) {\n // WebOS default browser.\n return \"Webos\" /* BrowserName.WEBOS */;\n }\n else if (_isSafari(ua)) {\n return \"Safari\" /* BrowserName.SAFARI */;\n }\n else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&\n !ua.includes('edge/')) {\n return \"Chrome\" /* BrowserName.CHROME */;\n }\n else if (_isAndroid(ua)) {\n // Android stock browser.\n return \"Android\" /* BrowserName.ANDROID */;\n }\n else {\n // Most modern browsers have name/version at end of user agent string.\n const re = /([a-zA-Z\\d\\.]+)\\/[a-zA-Z\\d\\.]*$/;\n const matches = userAgent.match(re);\n if ((matches === null || matches === void 0 ? void 0 : matches.length) === 2) {\n return matches[1];\n }\n }\n return \"Other\" /* BrowserName.OTHER */;\n}\nfunction _isFirefox(ua = getUA()) {\n return /firefox\\//i.test(ua);\n}\nfunction _isSafari(userAgent = getUA()) {\n const ua = userAgent.toLowerCase();\n return (ua.includes('safari/') &&\n !ua.includes('chrome/') &&\n !ua.includes('crios/') &&\n !ua.includes('android'));\n}\nfunction _isChromeIOS(ua = getUA()) {\n return /crios\\//i.test(ua);\n}\nfunction _isIEMobile(ua = getUA()) {\n return /iemobile/i.test(ua);\n}\nfunction _isAndroid(ua = getUA()) {\n return /android/i.test(ua);\n}\nfunction _isBlackBerry(ua = getUA()) {\n return /blackberry/i.test(ua);\n}\nfunction _isWebOS(ua = getUA()) {\n return /webos/i.test(ua);\n}\nfunction _isIOS(ua = getUA()) {\n return (/iphone|ipad|ipod/i.test(ua) ||\n (/macintosh/i.test(ua) && /mobile/i.test(ua)));\n}\nfunction _isIOSStandalone(ua = getUA()) {\n var _a;\n return _isIOS(ua) && !!((_a = window.navigator) === null || _a === void 0 ? void 0 : _a.standalone);\n}\nfunction _isIE10() {\n return isIE() && document.documentMode === 10;\n}\nfunction _isMobileBrowser(ua = getUA()) {\n // TODO: implement getBrowserName equivalent for OS.\n return (_isIOS(ua) ||\n _isAndroid(ua) ||\n _isWebOS(ua) ||\n _isBlackBerry(ua) ||\n /windows phone/i.test(ua) ||\n _isIEMobile(ua));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/*\n * Determine the SDK version string\n */\nfunction _getClientVersion(clientPlatform, frameworks = []) {\n let reportedPlatform;\n switch (clientPlatform) {\n case \"Browser\" /* ClientPlatform.BROWSER */:\n // In a browser environment, report the browser name.\n reportedPlatform = _getBrowserName(getUA());\n break;\n case \"Worker\" /* ClientPlatform.WORKER */:\n // Technically a worker runs from a browser but we need to differentiate a\n // worker from a browser.\n // For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.\n reportedPlatform = `${_getBrowserName(getUA())}-${clientPlatform}`;\n break;\n default:\n reportedPlatform = clientPlatform;\n }\n const reportedFrameworks = frameworks.length\n ? frameworks.join(',')\n : 'FirebaseCore-web'; /* default value if no other framework is used */\n return `${reportedPlatform}/${\"JsCore\" /* ClientImplementation.CORE */}/${SDK_VERSION}/${reportedFrameworks}`;\n}\n\n/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass AuthMiddlewareQueue {\n constructor(auth) {\n this.auth = auth;\n this.queue = [];\n }\n pushCallback(callback, onAbort) {\n // The callback could be sync or async. Wrap it into a\n // function that is always async.\n const wrappedCallback = (user) => new Promise((resolve, reject) => {\n try {\n const result = callback(user);\n // Either resolve with existing promise or wrap a non-promise\n // return value into a promise.\n resolve(result);\n }\n catch (e) {\n // Sync callback throws.\n reject(e);\n }\n });\n // Attach the onAbort if present\n wrappedCallback.onAbort = onAbort;\n this.queue.push(wrappedCallback);\n const index = this.queue.length - 1;\n return () => {\n // Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb\n // indexing of other elements.\n this.queue[index] = () => Promise.resolve();\n };\n }\n async runMiddleware(nextUser) {\n if (this.auth.currentUser === nextUser) {\n return;\n }\n // While running the middleware, build a temporary stack of onAbort\n // callbacks to call if one middleware callback rejects.\n const onAbortStack = [];\n try {\n for (const beforeStateCallback of this.queue) {\n await beforeStateCallback(nextUser);\n // Only push the onAbort if the callback succeeds\n if (beforeStateCallback.onAbort) {\n onAbortStack.push(beforeStateCallback.onAbort);\n }\n }\n }\n catch (e) {\n // Run all onAbort, with separate try/catch to ignore any errors and\n // continue\n onAbortStack.reverse();\n for (const onAbort of onAbortStack) {\n try {\n onAbort();\n }\n catch (_) {\n /* swallow error */\n }\n }\n throw this.auth._errorFactory.create(\"login-blocked\" /* AuthErrorCode.LOGIN_BLOCKED */, {\n originalMessage: e === null || e === void 0 ? void 0 : e.message\n });\n }\n }\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Fetches the password policy for the currently set tenant or the project if no tenant is set.\n *\n * @param auth Auth object.\n * @param request Password policy request.\n * @returns Password policy response.\n */\nasync function _getPasswordPolicy(auth, request = {}) {\n return _performApiRequest(auth, \"GET\" /* HttpMethod.GET */, \"/v2/passwordPolicy\" /* Endpoint.GET_PASSWORD_POLICY */, _addTidIfNecessary(auth, request));\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Minimum min password length enforced by the backend, even if no minimum length is set.\nconst MINIMUM_MIN_PASSWORD_LENGTH = 6;\n/**\n * Stores password policy requirements and provides password validation against the policy.\n *\n * @internal\n */\nclass PasswordPolicyImpl {\n constructor(response) {\n var _a, _b, _c, _d;\n // Only include custom strength options defined in the response.\n const responseOptions = response.customStrengthOptions;\n this.customStrengthOptions = {};\n // TODO: Remove once the backend is updated to include the minimum min password length instead of undefined when there is no minimum length set.\n this.customStrengthOptions.minPasswordLength =\n (_a = responseOptions.minPasswordLength) !== null && _a !== void 0 ? _a : MINIMUM_MIN_PASSWORD_LENGTH;\n if (responseOptions.maxPasswordLength) {\n this.customStrengthOptions.maxPasswordLength =\n responseOptions.maxPasswordLength;\n }\n if (responseOptions.containsLowercaseCharacter !== undefined) {\n this.customStrengthOptions.containsLowercaseLetter =\n responseOptions.containsLowercaseCharacter;\n }\n if (responseOptions.containsUppercaseCharacter !== undefined) {\n this.customStrengthOptions.containsUppercaseLetter =\n responseOptions.containsUppercaseCharacter;\n }\n if (responseOptions.containsNumericCharacter !== undefined) {\n this.customStrengthOptions.containsNumericCharacter =\n responseOptions.containsNumericCharacter;\n }\n if (responseOptions.containsNonAlphanumericCharacter !== undefined) {\n this.customStrengthOptions.containsNonAlphanumericCharacter =\n responseOptions.containsNonAlphanumericCharacter;\n }\n this.enforcementState = response.enforcementState;\n if (this.enforcementState === 'ENFORCEMENT_STATE_UNSPECIFIED') {\n this.enforcementState = 'OFF';\n }\n // Use an empty string if no non-alphanumeric characters are specified in the response.\n this.allowedNonAlphanumericCharacters =\n (_c = (_b = response.allowedNonAlphanumericCharacters) === null || _b === void 0 ? void 0 : _b.join('')) !== null && _c !== void 0 ? _c : '';\n this.forceUpgradeOnSignin = (_d = response.forceUpgradeOnSignin) !== null && _d !== void 0 ? _d : false;\n this.schemaVersion = response.schemaVersion;\n }\n validatePassword(password) {\n var _a, _b, _c, _d, _e, _f;\n const status = {\n isValid: true,\n passwordPolicy: this\n };\n // Check the password length and character options.\n this.validatePasswordLengthOptions(password, status);\n this.validatePasswordCharacterOptions(password, status);\n // Combine the status into single isValid property.\n status.isValid && (status.isValid = (_a = status.meetsMinPasswordLength) !== null && _a !== void 0 ? _a : true);\n status.isValid && (status.isValid = (_b = status.meetsMaxPasswordLength) !== null && _b !== void 0 ? _b : true);\n status.isValid && (status.isValid = (_c = status.containsLowercaseLetter) !== null && _c !== void 0 ? _c : true);\n status.isValid && (status.isValid = (_d = status.containsUppercaseLetter) !== null && _d !== void 0 ? _d : true);\n status.isValid && (status.isValid = (_e = status.containsNumericCharacter) !== null && _e !== void 0 ? _e : true);\n status.isValid && (status.isValid = (_f = status.containsNonAlphanumericCharacter) !== null && _f !== void 0 ? _f : true);\n return status;\n }\n /**\n * Validates that the password meets the length options for the policy.\n *\n * @param password Password to validate.\n * @param status Validation status.\n */\n validatePasswordLengthOptions(password, status) {\n const minPasswordLength = this.customStrengthOptions.minPasswordLength;\n const maxPasswordLength = this.customStrengthOptions.maxPasswordLength;\n if (minPasswordLength) {\n status.meetsMinPasswordLength = password.length >= minPasswordLength;\n }\n if (maxPasswordLength) {\n status.meetsMaxPasswordLength = password.length <= maxPasswordLength;\n }\n }\n /**\n * Validates that the password meets the character options for the policy.\n *\n * @param password Password to validate.\n * @param status Validation status.\n */\n validatePasswordCharacterOptions(password, status) {\n // Assign statuses for requirements even if the password is an empty string.\n this.updatePasswordCharacterOptionsStatuses(status, \n /* containsLowercaseCharacter= */ false, \n /* containsUppercaseCharacter= */ false, \n /* containsNumericCharacter= */ false, \n /* containsNonAlphanumericCharacter= */ false);\n let passwordChar;\n for (let i = 0; i < password.length; i++) {\n passwordChar = password.charAt(i);\n this.updatePasswordCharacterOptionsStatuses(status, \n /* containsLowercaseCharacter= */ passwordChar >= 'a' &&\n passwordChar <= 'z', \n /* containsUppercaseCharacter= */ passwordChar >= 'A' &&\n passwordChar <= 'Z', \n /* containsNumericCharacter= */ passwordChar >= '0' &&\n passwordChar <= '9', \n /* containsNonAlphanumericCharacter= */ this.allowedNonAlphanumericCharacters.includes(passwordChar));\n }\n }\n /**\n * Updates the running validation status with the statuses for the character options.\n * Expected to be called each time a character is processed to update each option status\n * based on the current character.\n *\n * @param status Validation status.\n * @param containsLowercaseCharacter Whether the character is a lowercase letter.\n * @param containsUppercaseCharacter Whether the character is an uppercase letter.\n * @param containsNumericCharacter Whether the character is a numeric character.\n * @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character.\n */\n updatePasswordCharacterOptionsStatuses(status, containsLowercaseCharacter, containsUppercaseCharacter, containsNumericCharacter, containsNonAlphanumericCharacter) {\n if (this.customStrengthOptions.containsLowercaseLetter) {\n status.containsLowercaseLetter || (status.containsLowercaseLetter = containsLowercaseCharacter);\n }\n if (this.customStrengthOptions.containsUppercaseLetter) {\n status.containsUppercaseLetter || (status.containsUppercaseLetter = containsUppercaseCharacter);\n }\n if (this.customStrengthOptions.containsNumericCharacter) {\n status.containsNumericCharacter || (status.containsNumericCharacter = containsNumericCharacter);\n }\n if (this.customStrengthOptions.containsNonAlphanumericCharacter) {\n status.containsNonAlphanumericCharacter || (status.containsNonAlphanumericCharacter = containsNonAlphanumericCharacter);\n }\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass AuthImpl {\n constructor(app, heartbeatServiceProvider, appCheckServiceProvider, config) {\n this.app = app;\n this.heartbeatServiceProvider = heartbeatServiceProvider;\n this.appCheckServiceProvider = appCheckServiceProvider;\n this.config = config;\n this.currentUser = null;\n this.emulatorConfig = null;\n this.operations = Promise.resolve();\n this.authStateSubscription = new Subscription(this);\n this.idTokenSubscription = new Subscription(this);\n this.beforeStateQueue = new AuthMiddlewareQueue(this);\n this.redirectUser = null;\n this.isProactiveRefreshEnabled = false;\n this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION = 1;\n // Any network calls will set this to true and prevent subsequent emulator\n // initialization\n this._canInitEmulator = true;\n this._isInitialized = false;\n this._deleted = false;\n this._initializationPromise = null;\n this._popupRedirectResolver = null;\n this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY;\n this._agentRecaptchaConfig = null;\n this._tenantRecaptchaConfigs = {};\n this._projectPasswordPolicy = null;\n this._tenantPasswordPolicies = {};\n this._resolvePersistenceManagerAvailable = undefined;\n // Tracks the last notified UID for state change listeners to prevent\n // repeated calls to the callbacks. Undefined means it's never been\n // called, whereas null means it's been called with a signed out user\n this.lastNotifiedUid = undefined;\n this.languageCode = null;\n this.tenantId = null;\n this.settings = { appVerificationDisabledForTesting: false };\n this.frameworks = [];\n this.name = app.name;\n this.clientVersion = config.sdkClientVersion;\n // TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs\n // persistenceMananger to be available. see _getFinalTarget for more context\n this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve));\n }\n _initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {\n if (popupRedirectResolver) {\n this._popupRedirectResolver = _getInstance(popupRedirectResolver);\n }\n // Have to check for app deletion throughout initialization (after each\n // promise resolution)\n this._initializationPromise = this.queue(async () => {\n var _a, _b, _c;\n if (this._deleted) {\n return;\n }\n this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);\n (_a = this._resolvePersistenceManagerAvailable) === null || _a === void 0 ? void 0 : _a.call(this);\n if (this._deleted) {\n return;\n }\n // Initialize the resolver early if necessary (only applicable to web:\n // this will cause the iframe to load immediately in certain cases)\n if ((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively) {\n // If this fails, don't halt auth loading\n try {\n await this._popupRedirectResolver._initialize(this);\n }\n catch (e) {\n /* Ignore the error */\n }\n }\n await this.initializeCurrentUser(popupRedirectResolver);\n this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;\n if (this._deleted) {\n return;\n }\n this._isInitialized = true;\n });\n return this._initializationPromise;\n }\n /**\n * If the persistence is changed in another window, the user manager will let us know\n */\n async _onStorageEvent() {\n if (this._deleted) {\n return;\n }\n const user = await this.assertedPersistence.getCurrentUser();\n if (!this.currentUser && !user) {\n // No change, do nothing (was signed out and remained signed out).\n return;\n }\n // If the same user is to be synchronized.\n if (this.currentUser && user && this.currentUser.uid === user.uid) {\n // Data update, simply copy data changes.\n this._currentUser._assign(user);\n // If tokens changed from previous user tokens, this will trigger\n // notifyAuthListeners_.\n await this.currentUser.getIdToken();\n return;\n }\n // Update current Auth state. Either a new login or logout.\n // Skip blocking callbacks, they should not apply to a change in another tab.\n await this._updateCurrentUser(user, /* skipBeforeStateCallbacks */ true);\n }\n async initializeCurrentUserFromIdToken(idToken) {\n try {\n const response = await getAccountInfo(this, { idToken });\n const user = await UserImpl._fromGetAccountInfoResponse(this, response, idToken);\n await this.directlySetCurrentUser(user);\n }\n catch (err) {\n console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err);\n await this.directlySetCurrentUser(null);\n }\n }\n async initializeCurrentUser(popupRedirectResolver) {\n var _a;\n if (_isFirebaseServerApp(this.app)) {\n const idToken = this.app.settings.authIdToken;\n if (idToken) {\n // Start the auth operation in the next tick to allow a moment for the customer's app to\n // attach an emulator, if desired.\n return new Promise(resolve => {\n setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(resolve, resolve));\n });\n }\n else {\n return this.directlySetCurrentUser(null);\n }\n }\n // First check to see if we have a pending redirect event.\n const previouslyStoredUser = (await this.assertedPersistence.getCurrentUser());\n let futureCurrentUser = previouslyStoredUser;\n let needsTocheckMiddleware = false;\n if (popupRedirectResolver && this.config.authDomain) {\n await this.getOrInitRedirectPersistenceManager();\n const redirectUserEventId = (_a = this.redirectUser) === null || _a === void 0 ? void 0 : _a._redirectEventId;\n const storedUserEventId = futureCurrentUser === null || futureCurrentUser === void 0 ? void 0 : futureCurrentUser._redirectEventId;\n const result = await this.tryRedirectSignIn(popupRedirectResolver);\n // If the stored user (i.e. the old \"currentUser\") has a redirectId that\n // matches the redirect user, then we want to initially sign in with the\n // new user object from result.\n // TODO(samgho): More thoroughly test all of this\n if ((!redirectUserEventId || redirectUserEventId === storedUserEventId) &&\n (result === null || result === void 0 ? void 0 : result.user)) {\n futureCurrentUser = result.user;\n needsTocheckMiddleware = true;\n }\n }\n // If no user in persistence, there is no current user. Set to null.\n if (!futureCurrentUser) {\n return this.directlySetCurrentUser(null);\n }\n if (!futureCurrentUser._redirectEventId) {\n // This isn't a redirect link operation, we can reload and bail.\n // First though, ensure that we check the middleware is happy.\n if (needsTocheckMiddleware) {\n try {\n await this.beforeStateQueue.runMiddleware(futureCurrentUser);\n }\n catch (e) {\n futureCurrentUser = previouslyStoredUser;\n // We know this is available since the bit is only set when the\n // resolver is available\n this._popupRedirectResolver._overrideRedirectResult(this, () => Promise.reject(e));\n }\n }\n if (futureCurrentUser) {\n return this.reloadAndSetCurrentUserOrClear(futureCurrentUser);\n }\n else {\n return this.directlySetCurrentUser(null);\n }\n }\n _assert(this._popupRedirectResolver, this, \"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n await this.getOrInitRedirectPersistenceManager();\n // If the redirect user's event ID matches the current user's event ID,\n // DO NOT reload the current user, otherwise they'll be cleared from storage.\n // This is important for the reauthenticateWithRedirect() flow.\n if (this.redirectUser &&\n this.redirectUser._redirectEventId === futureCurrentUser._redirectEventId) {\n return this.directlySetCurrentUser(futureCurrentUser);\n }\n return this.reloadAndSetCurrentUserOrClear(futureCurrentUser);\n }\n async tryRedirectSignIn(redirectResolver) {\n // The redirect user needs to be checked (and signed in if available)\n // during auth initialization. All of the normal sign in and link/reauth\n // flows call back into auth and push things onto the promise queue. We\n // need to await the result of the redirect sign in *inside the promise\n // queue*. This presents a problem: we run into deadlock. See:\n // ┌> [Initialization] ─────┐\n // ┌> [<other queue tasks>] │\n // └─ [getRedirectResult] <─┘\n // where [] are tasks on the queue and arrows denote awaits\n // Initialization will never complete because it's waiting on something\n // that's waiting for initialization to complete!\n //\n // Instead, this method calls getRedirectResult() (stored in\n // _completeRedirectFn) with an optional parameter that instructs all of\n // the underlying auth operations to skip anything that mutates auth state.\n let result = null;\n try {\n // We know this._popupRedirectResolver is set since redirectResolver\n // is passed in. The _completeRedirectFn expects the unwrapped extern.\n result = await this._popupRedirectResolver._completeRedirectFn(this, redirectResolver, true);\n }\n catch (e) {\n // Swallow any errors here; the code can retrieve them in\n // getRedirectResult().\n await this._setRedirectUser(null);\n }\n return result;\n }\n async reloadAndSetCurrentUserOrClear(user) {\n try {\n await _reloadWithoutSaving(user);\n }\n catch (e) {\n if ((e === null || e === void 0 ? void 0 : e.code) !==\n `auth/${\"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {\n // Something's wrong with the user's token. Log them out and remove\n // them from storage\n return this.directlySetCurrentUser(null);\n }\n }\n return this.directlySetCurrentUser(user);\n }\n useDeviceLanguage() {\n this.languageCode = _getUserLanguage();\n }\n async _delete() {\n this._deleted = true;\n }\n async updateCurrentUser(userExtern) {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));\n }\n // The public updateCurrentUser method needs to make a copy of the user,\n // and also check that the project matches\n const user = userExtern\n ? getModularInstance(userExtern)\n : null;\n if (user) {\n _assert(user.auth.config.apiKey === this.config.apiKey, this, \"invalid-user-token\" /* AuthErrorCode.INVALID_AUTH */);\n }\n return this._updateCurrentUser(user && user._clone(this));\n }\n async _updateCurrentUser(user, skipBeforeStateCallbacks = false) {\n if (this._deleted) {\n return;\n }\n if (user) {\n _assert(this.tenantId === user.tenantId, this, \"tenant-id-mismatch\" /* AuthErrorCode.TENANT_ID_MISMATCH */);\n }\n if (!skipBeforeStateCallbacks) {\n await this.beforeStateQueue.runMiddleware(user);\n }\n return this.queue(async () => {\n await this.directlySetCurrentUser(user);\n this.notifyAuthListeners();\n });\n }\n async signOut() {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));\n }\n // Run first, to block _setRedirectUser() if any callbacks fail.\n await this.beforeStateQueue.runMiddleware(null);\n // Clear the redirect user when signOut is called\n if (this.redirectPersistenceManager || this._popupRedirectResolver) {\n await this._setRedirectUser(null);\n }\n // Prevent callbacks from being called again in _updateCurrentUser, as\n // they were already called in the first line.\n return this._updateCurrentUser(null, /* skipBeforeStateCallbacks */ true);\n }\n setPersistence(persistence) {\n if (_isFirebaseServerApp(this.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));\n }\n return this.queue(async () => {\n await this.assertedPersistence.setPersistence(_getInstance(persistence));\n });\n }\n _getRecaptchaConfig() {\n if (this.tenantId == null) {\n return this._agentRecaptchaConfig;\n }\n else {\n return this._tenantRecaptchaConfigs[this.tenantId];\n }\n }\n async validatePassword(password) {\n if (!this._getPasswordPolicyInternal()) {\n await this._updatePasswordPolicy();\n }\n // Password policy will be defined after fetching.\n const passwordPolicy = this._getPasswordPolicyInternal();\n // Check that the policy schema version is supported by the SDK.\n // TODO: Update this logic to use a max supported policy schema version once we have multiple schema versions.\n if (passwordPolicy.schemaVersion !==\n this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION) {\n return Promise.reject(this._errorFactory.create(\"unsupported-password-policy-schema-version\" /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */, {}));\n }\n return passwordPolicy.validatePassword(password);\n }\n _getPasswordPolicyInternal() {\n if (this.tenantId === null) {\n return this._projectPasswordPolicy;\n }\n else {\n return this._tenantPasswordPolicies[this.tenantId];\n }\n }\n async _updatePasswordPolicy() {\n const response = await _getPasswordPolicy(this);\n const passwordPolicy = new PasswordPolicyImpl(response);\n if (this.tenantId === null) {\n this._projectPasswordPolicy = passwordPolicy;\n }\n else {\n this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;\n }\n }\n _getPersistenceType() {\n return this.assertedPersistence.persistence.type;\n }\n _getPersistence() {\n return this.assertedPersistence.persistence;\n }\n _updateErrorMap(errorMap) {\n this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap());\n }\n onAuthStateChanged(nextOrObserver, error, completed) {\n return this.registerStateListener(this.authStateSubscription, nextOrObserver, error, completed);\n }\n beforeAuthStateChanged(callback, onAbort) {\n return this.beforeStateQueue.pushCallback(callback, onAbort);\n }\n onIdTokenChanged(nextOrObserver, error, completed) {\n return this.registerStateListener(this.idTokenSubscription, nextOrObserver, error, completed);\n }\n authStateReady() {\n return new Promise((resolve, reject) => {\n if (this.currentUser) {\n resolve();\n }\n else {\n const unsubscribe = this.onAuthStateChanged(() => {\n unsubscribe();\n resolve();\n }, reject);\n }\n });\n }\n /**\n * Revokes the given access token. Currently only supports Apple OAuth access tokens.\n */\n async revokeAccessToken(token) {\n if (this.currentUser) {\n const idToken = await this.currentUser.getIdToken();\n // Generalize this to accept other providers once supported.\n const request = {\n providerId: 'apple.com',\n tokenType: \"ACCESS_TOKEN\" /* TokenType.ACCESS_TOKEN */,\n token,\n idToken\n };\n if (this.tenantId != null) {\n request.tenantId = this.tenantId;\n }\n await revokeToken(this, request);\n }\n }\n toJSON() {\n var _a;\n return {\n apiKey: this.config.apiKey,\n authDomain: this.config.authDomain,\n appName: this.name,\n currentUser: (_a = this._currentUser) === null || _a === void 0 ? void 0 : _a.toJSON()\n };\n }\n async _setRedirectUser(user, popupRedirectResolver) {\n const redirectManager = await this.getOrInitRedirectPersistenceManager(popupRedirectResolver);\n return user === null\n ? redirectManager.removeCurrentUser()\n : redirectManager.setCurrentUser(user);\n }\n async getOrInitRedirectPersistenceManager(popupRedirectResolver) {\n if (!this.redirectPersistenceManager) {\n const resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||\n this._popupRedirectResolver;\n _assert(resolver, this, \"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], \"redirectUser\" /* KeyName.REDIRECT_USER */);\n this.redirectUser =\n await this.redirectPersistenceManager.getCurrentUser();\n }\n return this.redirectPersistenceManager;\n }\n async _redirectUserForId(id) {\n var _a, _b;\n // Make sure we've cleared any pending persistence actions if we're not in\n // the initializer\n if (this._isInitialized) {\n await this.queue(async () => { });\n }\n if (((_a = this._currentUser) === null || _a === void 0 ? void 0 : _a._redirectEventId) === id) {\n return this._currentUser;\n }\n if (((_b = this.redirectUser) === null || _b === void 0 ? void 0 : _b._redirectEventId) === id) {\n return this.redirectUser;\n }\n return null;\n }\n async _persistUserIfCurrent(user) {\n if (user === this.currentUser) {\n return this.queue(async () => this.directlySetCurrentUser(user));\n }\n }\n /** Notifies listeners only if the user is current */\n _notifyListenersIfCurrent(user) {\n if (user === this.currentUser) {\n this.notifyAuthListeners();\n }\n }\n _key() {\n return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`;\n }\n _startProactiveRefresh() {\n this.isProactiveRefreshEnabled = true;\n if (this.currentUser) {\n this._currentUser._startProactiveRefresh();\n }\n }\n _stopProactiveRefresh() {\n this.isProactiveRefreshEnabled = false;\n if (this.currentUser) {\n this._currentUser._stopProactiveRefresh();\n }\n }\n /** Returns the current user cast as the internal type */\n get _currentUser() {\n return this.currentUser;\n }\n notifyAuthListeners() {\n var _a, _b;\n if (!this._isInitialized) {\n return;\n }\n this.idTokenSubscription.next(this.currentUser);\n const currentUid = (_b = (_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.uid) !== null && _b !== void 0 ? _b : null;\n if (this.lastNotifiedUid !== currentUid) {\n this.lastNotifiedUid = currentUid;\n this.authStateSubscription.next(this.currentUser);\n }\n }\n registerStateListener(subscription, nextOrObserver, error, completed) {\n if (this._deleted) {\n return () => { };\n }\n const cb = typeof nextOrObserver === 'function'\n ? nextOrObserver\n : nextOrObserver.next.bind(nextOrObserver);\n let isUnsubscribed = false;\n const promise = this._isInitialized\n ? Promise.resolve()\n : this._initializationPromise;\n _assert(promise, this, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n // The callback needs to be called asynchronously per the spec.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n promise.then(() => {\n if (isUnsubscribed) {\n return;\n }\n cb(this.currentUser);\n });\n if (typeof nextOrObserver === 'function') {\n const unsubscribe = subscription.addObserver(nextOrObserver, error, completed);\n return () => {\n isUnsubscribed = true;\n unsubscribe();\n };\n }\n else {\n const unsubscribe = subscription.addObserver(nextOrObserver);\n return () => {\n isUnsubscribed = true;\n unsubscribe();\n };\n }\n }\n /**\n * Unprotected (from race conditions) method to set the current user. This\n * should only be called from within a queued callback. This is necessary\n * because the queue shouldn't rely on another queued callback.\n */\n async directlySetCurrentUser(user) {\n if (this.currentUser && this.currentUser !== user) {\n this._currentUser._stopProactiveRefresh();\n }\n if (user && this.isProactiveRefreshEnabled) {\n user._startProactiveRefresh();\n }\n this.currentUser = user;\n if (user) {\n await this.assertedPersistence.setCurrentUser(user);\n }\n else {\n await this.assertedPersistence.removeCurrentUser();\n }\n }\n queue(action) {\n // In case something errors, the callback still should be called in order\n // to keep the promise chain alive\n this.operations = this.operations.then(action, action);\n return this.operations;\n }\n get assertedPersistence() {\n _assert(this.persistenceManager, this, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return this.persistenceManager;\n }\n _logFramework(framework) {\n if (!framework || this.frameworks.includes(framework)) {\n return;\n }\n this.frameworks.push(framework);\n // Sort alphabetically so that \"FirebaseCore-web,FirebaseUI-web\" and\n // \"FirebaseUI-web,FirebaseCore-web\" aren't viewed as different.\n this.frameworks.sort();\n this.clientVersion = _getClientVersion(this.config.clientPlatform, this._getFrameworks());\n }\n _getFrameworks() {\n return this.frameworks;\n }\n async _getAdditionalHeaders() {\n var _a;\n // Additional headers on every request\n const headers = {\n [\"X-Client-Version\" /* HttpHeader.X_CLIENT_VERSION */]: this.clientVersion\n };\n if (this.app.options.appId) {\n headers[\"X-Firebase-gmpid\" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;\n }\n // If the heartbeat service exists, add the heartbeat string\n const heartbeatsHeader = await ((_a = this.heartbeatServiceProvider\n .getImmediate({\n optional: true\n })) === null || _a === void 0 ? void 0 : _a.getHeartbeatsHeader());\n if (heartbeatsHeader) {\n headers[\"X-Firebase-Client\" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;\n }\n // If the App Check service exists, add the App Check token in the headers\n const appCheckToken = await this._getAppCheckToken();\n if (appCheckToken) {\n headers[\"X-Firebase-AppCheck\" /* HttpHeader.X_FIREBASE_APP_CHECK */] = appCheckToken;\n }\n return headers;\n }\n async _getAppCheckToken() {\n var _a;\n if (_isFirebaseServerApp(this.app) && this.app.settings.appCheckToken) {\n return this.app.settings.appCheckToken;\n }\n const appCheckTokenResult = await ((_a = this.appCheckServiceProvider\n .getImmediate({ optional: true })) === null || _a === void 0 ? void 0 : _a.getToken());\n if (appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.error) {\n // Context: appCheck.getToken() will never throw even if an error happened.\n // In the error case, a dummy token will be returned along with an error field describing\n // the error. In general, we shouldn't care about the error condition and just use\n // the token (actual or dummy) to send requests.\n _logWarn(`Error while retrieving App Check token: ${appCheckTokenResult.error}`);\n }\n return appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.token;\n }\n}\n/**\n * Method to be used to cast down to our private implementation of Auth.\n * It will also handle unwrapping from the compat type if necessary\n *\n * @param auth Auth object passed in from developer\n */\nfunction _castAuth(auth) {\n return getModularInstance(auth);\n}\n/** Helper class to wrap subscriber logic */\nclass Subscription {\n constructor(auth) {\n this.auth = auth;\n this.observer = null;\n this.addObserver = createSubscribe(observer => (this.observer = observer));\n }\n get next() {\n _assert(this.observer, this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return this.observer.next.bind(this.observer);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nlet externalJSProvider = {\n async loadJS() {\n throw new Error('Unable to load external scripts');\n },\n recaptchaV2Script: '',\n recaptchaEnterpriseScript: '',\n gapiScript: ''\n};\nfunction _setExternalJSProvider(p) {\n externalJSProvider = p;\n}\nfunction _loadJS(url) {\n return externalJSProvider.loadJS(url);\n}\nfunction _recaptchaEnterpriseScriptUrl() {\n return externalJSProvider.recaptchaEnterpriseScript;\n}\nfunction _gapiScriptUrl() {\n return externalJSProvider.gapiScript;\n}\nfunction _generateCallbackName(prefix) {\n return `__${prefix}${Math.floor(Math.random() * 1000000)}`;\n}\nclass MockGreCAPTCHATopLevel {\n constructor() {\n this.enterprise = new MockGreCAPTCHA();\n }\n ready(callback) {\n callback();\n }\n execute(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _siteKey, _options) {\n return Promise.resolve('token');\n }\n render(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _container, _parameters) {\n return '';\n }\n}\nclass MockGreCAPTCHA {\n ready(callback) {\n callback();\n }\n execute(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _siteKey, _options) {\n return Promise.resolve('token');\n }\n render(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _container, _parameters) {\n return '';\n }\n}\n\n/* eslint-disable @typescript-eslint/no-require-imports */\nconst RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';\nconst FAKE_TOKEN = 'NO_RECAPTCHA';\nclass RecaptchaEnterpriseVerifier {\n /**\n *\n * @param authExtern - The corresponding Firebase {@link Auth} instance.\n *\n */\n constructor(authExtern) {\n /**\n * Identifies the type of application verifier (e.g. \"recaptcha-enterprise\").\n */\n this.type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE;\n this.auth = _castAuth(authExtern);\n }\n /**\n * Executes the verification process.\n *\n * @returns A Promise for a token that can be used to assert the validity of a request.\n */\n async verify(action = 'verify', forceRefresh = false) {\n async function retrieveSiteKey(auth) {\n if (!forceRefresh) {\n if (auth.tenantId == null && auth._agentRecaptchaConfig != null) {\n return auth._agentRecaptchaConfig.siteKey;\n }\n if (auth.tenantId != null &&\n auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined) {\n return auth._tenantRecaptchaConfigs[auth.tenantId].siteKey;\n }\n }\n return new Promise(async (resolve, reject) => {\n getRecaptchaConfig(auth, {\n clientType: \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */,\n version: \"RECAPTCHA_ENTERPRISE\" /* RecaptchaVersion.ENTERPRISE */\n })\n .then(response => {\n if (response.recaptchaKey === undefined) {\n reject(new Error('recaptcha Enterprise site key undefined'));\n }\n else {\n const config = new RecaptchaConfig(response);\n if (auth.tenantId == null) {\n auth._agentRecaptchaConfig = config;\n }\n else {\n auth._tenantRecaptchaConfigs[auth.tenantId] = config;\n }\n return resolve(config.siteKey);\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n }\n function retrieveRecaptchaToken(siteKey, resolve, reject) {\n const grecaptcha = window.grecaptcha;\n if (isEnterprise(grecaptcha)) {\n grecaptcha.enterprise.ready(() => {\n grecaptcha.enterprise\n .execute(siteKey, { action })\n .then(token => {\n resolve(token);\n })\n .catch(() => {\n resolve(FAKE_TOKEN);\n });\n });\n }\n else {\n reject(Error('No reCAPTCHA enterprise script loaded.'));\n }\n }\n // Returns Promise for a mock token when appVerificationDisabledForTesting is true.\n if (this.auth.settings.appVerificationDisabledForTesting) {\n const mockRecaptcha = new MockGreCAPTCHATopLevel();\n return mockRecaptcha.execute('siteKey', { action: 'verify' });\n }\n return new Promise((resolve, reject) => {\n retrieveSiteKey(this.auth)\n .then(siteKey => {\n if (!forceRefresh && isEnterprise(window.grecaptcha)) {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n }\n else {\n if (typeof window === 'undefined') {\n reject(new Error('RecaptchaVerifier is only supported in browser'));\n return;\n }\n let url = _recaptchaEnterpriseScriptUrl();\n if (url.length !== 0) {\n url += siteKey;\n }\n _loadJS(url)\n .then(() => {\n retrieveRecaptchaToken(siteKey, resolve, reject);\n })\n .catch(error => {\n reject(error);\n });\n }\n })\n .catch(error => {\n reject(error);\n });\n });\n }\n}\nasync function injectRecaptchaFields(auth, request, action, isCaptchaResp = false, isFakeToken = false) {\n const verifier = new RecaptchaEnterpriseVerifier(auth);\n let captchaResponse;\n if (isFakeToken) {\n captchaResponse = FAKE_TOKEN;\n }\n else {\n try {\n captchaResponse = await verifier.verify(action);\n }\n catch (error) {\n captchaResponse = await verifier.verify(action, true);\n }\n }\n const newRequest = Object.assign({}, request);\n if (action === \"mfaSmsEnrollment\" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */ ||\n action === \"mfaSmsSignIn\" /* RecaptchaActionName.MFA_SMS_SIGNIN */) {\n if ('phoneEnrollmentInfo' in newRequest) {\n const phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber;\n const recaptchaToken = newRequest.phoneEnrollmentInfo.recaptchaToken;\n Object.assign(newRequest, {\n 'phoneEnrollmentInfo': {\n phoneNumber,\n recaptchaToken,\n captchaResponse,\n 'clientType': \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */,\n 'recaptchaVersion': \"RECAPTCHA_ENTERPRISE\" /* RecaptchaVersion.ENTERPRISE */\n }\n });\n }\n else if ('phoneSignInInfo' in newRequest) {\n const recaptchaToken = newRequest.phoneSignInInfo.recaptchaToken;\n Object.assign(newRequest, {\n 'phoneSignInInfo': {\n recaptchaToken,\n captchaResponse,\n 'clientType': \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */,\n 'recaptchaVersion': \"RECAPTCHA_ENTERPRISE\" /* RecaptchaVersion.ENTERPRISE */\n }\n });\n }\n return newRequest;\n }\n if (!isCaptchaResp) {\n Object.assign(newRequest, { captchaResponse });\n }\n else {\n Object.assign(newRequest, { 'captchaResp': captchaResponse });\n }\n Object.assign(newRequest, { 'clientType': \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */ });\n Object.assign(newRequest, {\n 'recaptchaVersion': \"RECAPTCHA_ENTERPRISE\" /* RecaptchaVersion.ENTERPRISE */\n });\n return newRequest;\n}\nasync function handleRecaptchaFlow(authInstance, request, actionName, actionMethod, recaptchaAuthProvider) {\n var _a;\n {\n if ((_a = authInstance\n ._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled(\"EMAIL_PASSWORD_PROVIDER\" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)) {\n const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === \"getOobCode\" /* RecaptchaActionName.GET_OOB_CODE */);\n return actionMethod(authInstance, requestWithRecaptcha);\n }\n else {\n return actionMethod(authInstance, request).catch(async (error) => {\n if (error.code === `auth/${\"missing-recaptcha-token\" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {\n console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);\n const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === \"getOobCode\" /* RecaptchaActionName.GET_OOB_CODE */);\n return actionMethod(authInstance, requestWithRecaptcha);\n }\n else {\n return Promise.reject(error);\n }\n });\n }\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Initializes an {@link Auth} instance with fine-grained control over\n * {@link Dependencies}.\n *\n * @remarks\n *\n * This function allows more control over the {@link Auth} instance than\n * {@link getAuth}. `getAuth` uses platform-specific defaults to supply\n * the {@link Dependencies}. In general, `getAuth` is the easiest way to\n * initialize Auth and works for most use cases. Use `initializeAuth` if you\n * need control over which persistence layer is used, or to minimize bundle\n * size if you're not using either `signInWithPopup` or `signInWithRedirect`.\n *\n * For example, if your app only uses anonymous accounts and you only want\n * accounts saved for the current session, initialize `Auth` with:\n *\n * ```js\n * const auth = initializeAuth(app, {\n * persistence: browserSessionPersistence,\n * popupRedirectResolver: undefined,\n * });\n * ```\n *\n * @public\n */\nfunction initializeAuth(app, deps) {\n const provider = _getProvider(app, 'auth');\n if (provider.isInitialized()) {\n const auth = provider.getImmediate();\n const initialOptions = provider.getOptions();\n if (deepEqual(initialOptions, deps !== null && deps !== void 0 ? deps : {})) {\n return auth;\n }\n else {\n _fail(auth, \"already-initialized\" /* AuthErrorCode.ALREADY_INITIALIZED */);\n }\n }\n const auth = provider.initialize({ options: deps });\n return auth;\n}\nfunction _initializeAuthInstance(auth, deps) {\n const persistence = (deps === null || deps === void 0 ? void 0 : deps.persistence) || [];\n const hierarchy = (Array.isArray(persistence) ? persistence : [persistence]).map(_getInstance);\n if (deps === null || deps === void 0 ? void 0 : deps.errorMap) {\n auth._updateErrorMap(deps.errorMap);\n }\n // This promise is intended to float; auth initialization happens in the\n // background, meanwhile the auth object may be used by the app.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n auth._initializeWithPersistence(hierarchy, deps === null || deps === void 0 ? void 0 : deps.popupRedirectResolver);\n}\n\n/**\n * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production\n * Firebase Auth services.\n *\n * @remarks\n * This must be called synchronously immediately following the first call to\n * {@link initializeAuth}. Do not use with production credentials as emulator\n * traffic is not encrypted.\n *\n *\n * @example\n * ```javascript\n * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').\n * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to\n * `true` to disable the warning banner attached to the DOM.\n *\n * @public\n */\nfunction connectAuthEmulator(auth, url, options) {\n const authInternal = _castAuth(auth);\n _assert(/^https?:\\/\\//.test(url), authInternal, \"invalid-emulator-scheme\" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);\n const disableWarnings = false;\n const protocol = extractProtocol(url);\n const { host, port } = extractHostAndPort(url);\n const portStr = port === null ? '' : `:${port}`;\n // Always replace path with \"/\" (even if input url had no path at all, or had a different one).\n const emulator = { url: `${protocol}//${host}${portStr}/` };\n const emulatorConfig = Object.freeze({\n host,\n port,\n protocol: protocol.replace(':', ''),\n options: Object.freeze({ disableWarnings })\n });\n // There are a few scenarios to guard against if the Auth instance has already started:\n if (!authInternal._canInitEmulator) {\n // Applications may not initialize the emulator for the first time if Auth has already started\n // to make network requests.\n _assert(authInternal.config.emulator && authInternal.emulatorConfig, authInternal, \"emulator-config-failed\" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);\n // Applications may not alter the configuration of the emulator (aka pass a different config)\n // once Auth has started to make network requests.\n _assert(deepEqual(emulator, authInternal.config.emulator) &&\n deepEqual(emulatorConfig, authInternal.emulatorConfig), authInternal, \"emulator-config-failed\" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);\n // It's valid, however, to invoke connectAuthEmulator() after Auth has started making\n // connections, so long as the config matches the existing config. This results in a no-op.\n return;\n }\n authInternal.config.emulator = emulator;\n authInternal.emulatorConfig = emulatorConfig;\n authInternal.settings.appVerificationDisabledForTesting = true;\n // Workaround to get cookies in Firebase Studio\n if (isCloudWorkstation(host)) {\n void pingServer(`${protocol}//${host}${portStr}`);\n updateEmulatorBanner('Auth', true);\n }\n else {\n emitEmulatorWarning();\n }\n}\nfunction extractProtocol(url) {\n const protocolEnd = url.indexOf(':');\n return protocolEnd < 0 ? '' : url.substr(0, protocolEnd + 1);\n}\nfunction extractHostAndPort(url) {\n const protocol = extractProtocol(url);\n const authority = /(\\/\\/)?([^?#/]+)/.exec(url.substr(protocol.length)); // Between // and /, ? or #.\n if (!authority) {\n return { host: '', port: null };\n }\n const hostAndPort = authority[2].split('@').pop() || ''; // Strip out \"username:password@\".\n const bracketedIPv6 = /^(\\[[^\\]]+\\])(:|$)/.exec(hostAndPort);\n if (bracketedIPv6) {\n const host = bracketedIPv6[1];\n return { host, port: parsePort(hostAndPort.substr(host.length + 1)) };\n }\n else {\n const [host, port] = hostAndPort.split(':');\n return { host, port: parsePort(port) };\n }\n}\nfunction parsePort(portStr) {\n if (!portStr) {\n return null;\n }\n const port = Number(portStr);\n if (isNaN(port)) {\n return null;\n }\n return port;\n}\nfunction emitEmulatorWarning() {\n function attachBanner() {\n const el = document.createElement('p');\n const sty = el.style;\n el.innerText =\n 'Running in emulator mode. Do not use with production credentials.';\n sty.position = 'fixed';\n sty.width = '100%';\n sty.backgroundColor = '#ffffff';\n sty.border = '.1em solid #000000';\n sty.color = '#b50000';\n sty.bottom = '0px';\n sty.left = '0px';\n sty.margin = '0px';\n sty.zIndex = '10000';\n sty.textAlign = 'center';\n el.classList.add('firebase-emulator-warning');\n document.body.appendChild(el);\n }\n if (typeof console !== 'undefined' && typeof console.info === 'function') {\n console.info('WARNING: You are using the Auth Emulator,' +\n ' which is intended for local testing only. Do not use with' +\n ' production credentials.');\n }\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', attachBanner);\n }\n else {\n attachBanner();\n }\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Interface that represents the credentials returned by an {@link AuthProvider}.\n *\n * @remarks\n * Implementations specify the details about each auth provider's credential requirements.\n *\n * @public\n */\nclass AuthCredential {\n /** @internal */\n constructor(\n /**\n * The authentication provider ID for the credential.\n *\n * @remarks\n * For example, 'facebook.com', or 'google.com'.\n */\n providerId, \n /**\n * The authentication sign in method for the credential.\n *\n * @remarks\n * For example, {@link SignInMethod}.EMAIL_PASSWORD, or\n * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method\n * identifier as returned in {@link fetchSignInMethodsForEmail}.\n */\n signInMethod) {\n this.providerId = providerId;\n this.signInMethod = signInMethod;\n }\n /**\n * Returns a JSON-serializable representation of this object.\n *\n * @returns a JSON-serializable representation of this object.\n */\n toJSON() {\n return debugFail('not implemented');\n }\n /** @internal */\n _getIdTokenResponse(_auth) {\n return debugFail('not implemented');\n }\n /** @internal */\n _linkToIdToken(_auth, _idToken) {\n return debugFail('not implemented');\n }\n /** @internal */\n _getReauthenticationResolver(_auth) {\n return debugFail('not implemented');\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function resetPassword(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:resetPassword\" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request));\n}\n// Used for linking an email/password account to an existing idToken. Uses the same request/response\n// format as updateEmailPassword.\nasync function linkEmailPassword(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:signUp\" /* Endpoint.SIGN_UP */, request);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function signInWithPassword(auth, request) {\n return _performSignInRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:signInWithPassword\" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));\n}\nasync function sendOobCode(auth, request) {\n return _performApiRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:sendOobCode\" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request));\n}\nasync function sendPasswordResetEmail$1(auth, request) {\n return sendOobCode(auth, request);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function signInWithEmailLink$1(auth, request) {\n return _performSignInRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:signInWithEmailLink\" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));\n}\nasync function signInWithEmailLinkForLinking(auth, request) {\n return _performSignInRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:signInWithEmailLink\" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Interface that represents the credentials returned by {@link EmailAuthProvider} for\n * {@link ProviderId}.PASSWORD\n *\n * @remarks\n * Covers both {@link SignInMethod}.EMAIL_PASSWORD and\n * {@link SignInMethod}.EMAIL_LINK.\n *\n * @public\n */\nclass EmailAuthCredential extends AuthCredential {\n /** @internal */\n constructor(\n /** @internal */\n _email, \n /** @internal */\n _password, signInMethod, \n /** @internal */\n _tenantId = null) {\n super(\"password\" /* ProviderId.PASSWORD */, signInMethod);\n this._email = _email;\n this._password = _password;\n this._tenantId = _tenantId;\n }\n /** @internal */\n static _fromEmailAndPassword(email, password) {\n return new EmailAuthCredential(email, password, \"password\" /* SignInMethod.EMAIL_PASSWORD */);\n }\n /** @internal */\n static _fromEmailAndCode(email, oobCode, tenantId = null) {\n return new EmailAuthCredential(email, oobCode, \"emailLink\" /* SignInMethod.EMAIL_LINK */, tenantId);\n }\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON() {\n return {\n email: this._email,\n password: this._password,\n signInMethod: this.signInMethod,\n tenantId: this._tenantId\n };\n }\n /**\n * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.\n *\n * @param json - Either `object` or the stringified representation of the object. When string is\n * provided, `JSON.parse` would be called first.\n *\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\n */\n static fromJSON(json) {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {\n if (obj.signInMethod === \"password\" /* SignInMethod.EMAIL_PASSWORD */) {\n return this._fromEmailAndPassword(obj.email, obj.password);\n }\n else if (obj.signInMethod === \"emailLink\" /* SignInMethod.EMAIL_LINK */) {\n return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);\n }\n }\n return null;\n }\n /** @internal */\n async _getIdTokenResponse(auth) {\n switch (this.signInMethod) {\n case \"password\" /* SignInMethod.EMAIL_PASSWORD */:\n const request = {\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */\n };\n return handleRecaptchaFlow(auth, request, \"signInWithPassword\" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword);\n case \"emailLink\" /* SignInMethod.EMAIL_LINK */:\n return signInWithEmailLink$1(auth, {\n email: this._email,\n oobCode: this._password\n });\n default:\n _fail(auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n }\n }\n /** @internal */\n async _linkToIdToken(auth, idToken) {\n switch (this.signInMethod) {\n case \"password\" /* SignInMethod.EMAIL_PASSWORD */:\n const request = {\n idToken,\n returnSecureToken: true,\n email: this._email,\n password: this._password,\n clientType: \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */\n };\n return handleRecaptchaFlow(auth, request, \"signUpPassword\" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword);\n case \"emailLink\" /* SignInMethod.EMAIL_LINK */:\n return signInWithEmailLinkForLinking(auth, {\n idToken,\n email: this._email,\n oobCode: this._password\n });\n default:\n _fail(auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n }\n }\n /** @internal */\n _getReauthenticationResolver(auth) {\n return this._getIdTokenResponse(auth);\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function signInWithIdp(auth, request) {\n return _performSignInRequest(auth, \"POST\" /* HttpMethod.POST */, \"/v1/accounts:signInWithIdp\" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst IDP_REQUEST_URI$1 = 'http://localhost';\n/**\n * Represents the OAuth credentials returned by an {@link OAuthProvider}.\n *\n * @remarks\n * Implementations specify the details about each auth provider's credential requirements.\n *\n * @public\n */\nclass OAuthCredential extends AuthCredential {\n constructor() {\n super(...arguments);\n this.pendingToken = null;\n }\n /** @internal */\n static _fromParams(params) {\n const cred = new OAuthCredential(params.providerId, params.signInMethod);\n if (params.idToken || params.accessToken) {\n // OAuth 2 and either ID token or access token.\n if (params.idToken) {\n cred.idToken = params.idToken;\n }\n if (params.accessToken) {\n cred.accessToken = params.accessToken;\n }\n // Add nonce if available and no pendingToken is present.\n if (params.nonce && !params.pendingToken) {\n cred.nonce = params.nonce;\n }\n if (params.pendingToken) {\n cred.pendingToken = params.pendingToken;\n }\n }\n else if (params.oauthToken && params.oauthTokenSecret) {\n // OAuth 1 and OAuth token with token secret\n cred.accessToken = params.oauthToken;\n cred.secret = params.oauthTokenSecret;\n }\n else {\n _fail(\"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n }\n return cred;\n }\n /** {@inheritdoc AuthCredential.toJSON} */\n toJSON() {\n return {\n idToken: this.idToken,\n accessToken: this.accessToken,\n secret: this.secret,\n nonce: this.nonce,\n pendingToken: this.pendingToken,\n providerId: this.providerId,\n signInMethod: this.signInMethod\n };\n }\n /**\n * Static method to deserialize a JSON representation of an object into an\n * {@link AuthCredential}.\n *\n * @param json - Input can be either Object or the stringified representation of the object.\n * When string is provided, JSON.parse would be called first.\n *\n * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.\n */\n static fromJSON(json) {\n const obj = typeof json === 'string' ? JSON.parse(json) : json;\n const { providerId, signInMethod } = obj, rest = __rest(obj, [\"providerId\", \"signInMethod\"]);\n if (!providerId || !signInMethod) {\n return null;\n }\n const cred = new OAuthCredential(providerId, signInMethod);\n cred.idToken = rest.idToken || undefined;\n cred.accessToken = rest.accessToken || undefined;\n cred.secret = rest.secret;\n cred.nonce = rest.nonce;\n cred.pendingToken = rest.pendingToken || null;\n return cred;\n }\n /** @internal */\n _getIdTokenResponse(auth) {\n const request = this.buildRequest();\n return signInWithIdp(auth, request);\n }\n /** @internal */\n _linkToIdToken(auth, idToken) {\n const request = this.buildRequest();\n request.idToken = idToken;\n return signInWithIdp(auth, request);\n }\n /** @internal */\n _getReauthenticationResolver(auth) {\n const request = this.buildRequest();\n request.autoCreate = false;\n return signInWithIdp(auth, request);\n }\n buildRequest() {\n const request = {\n requestUri: IDP_REQUEST_URI$1,\n returnSecureToken: true\n };\n if (this.pendingToken) {\n request.pendingToken = this.pendingToken;\n }\n else {\n const postBody = {};\n if (this.idToken) {\n postBody['id_token'] = this.idToken;\n }\n if (this.accessToken) {\n postBody['access_token'] = this.accessToken;\n }\n if (this.secret) {\n postBody['oauth_token_secret'] = this.secret;\n }\n postBody['providerId'] = this.providerId;\n if (this.nonce && !this.pendingToken) {\n postBody['nonce'] = this.nonce;\n }\n request.postBody = querystring(postBody);\n }\n return request;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Maps the mode string in action code URL to Action Code Info operation.\n *\n * @param mode\n */\nfunction parseMode(mode) {\n switch (mode) {\n case 'recoverEmail':\n return \"RECOVER_EMAIL\" /* ActionCodeOperation.RECOVER_EMAIL */;\n case 'resetPassword':\n return \"PASSWORD_RESET\" /* ActionCodeOperation.PASSWORD_RESET */;\n case 'signIn':\n return \"EMAIL_SIGNIN\" /* ActionCodeOperation.EMAIL_SIGNIN */;\n case 'verifyEmail':\n return \"VERIFY_EMAIL\" /* ActionCodeOperation.VERIFY_EMAIL */;\n case 'verifyAndChangeEmail':\n return \"VERIFY_AND_CHANGE_EMAIL\" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;\n case 'revertSecondFactorAddition':\n return \"REVERT_SECOND_FACTOR_ADDITION\" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;\n default:\n return null;\n }\n}\n/**\n * Helper to parse FDL links\n *\n * @param url\n */\nfunction parseDeepLink(url) {\n const link = querystringDecode(extractQuerystring(url))['link'];\n // Double link case (automatic redirect).\n const doubleDeepLink = link\n ? querystringDecode(extractQuerystring(link))['deep_link_id']\n : null;\n // iOS custom scheme links.\n const iOSDeepLink = querystringDecode(extractQuerystring(url))['deep_link_id'];\n const iOSDoubleDeepLink = iOSDeepLink\n ? querystringDecode(extractQuerystring(iOSDeepLink))['link']\n : null;\n return iOSDoubleDeepLink || iOSDeepLink || doubleDeepLink || link || url;\n}\n/**\n * A utility class to parse email action URLs such as password reset, email verification,\n * email link sign in, etc.\n *\n * @public\n */\nclass ActionCodeURL {\n /**\n * @param actionLink - The link from which to extract the URL.\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\n *\n * @internal\n */\n constructor(actionLink) {\n var _a, _b, _c, _d, _e, _f;\n const searchParams = querystringDecode(extractQuerystring(actionLink));\n const apiKey = (_a = searchParams[\"apiKey\" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;\n const code = (_b = searchParams[\"oobCode\" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;\n const operation = parseMode((_c = searchParams[\"mode\" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);\n // Validate API key, code and mode.\n _assert(apiKey && code && operation, \"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n this.apiKey = apiKey;\n this.operation = operation;\n this.code = code;\n this.continueUrl = (_d = searchParams[\"continueUrl\" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;\n this.languageCode = (_e = searchParams[\"lang\" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;\n this.tenantId = (_f = searchParams[\"tenantId\" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;\n }\n /**\n * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,\n * otherwise returns null.\n *\n * @param link - The email action link string.\n * @returns The {@link ActionCodeURL} object, or null if the link is invalid.\n *\n * @public\n */\n static parseLink(link) {\n const actionLink = parseDeepLink(link);\n try {\n return new ActionCodeURL(actionLink);\n }\n catch (_a) {\n return null;\n }\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for generating {@link EmailAuthCredential}.\n *\n * @public\n */\nclass EmailAuthProvider {\n constructor() {\n /**\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\n */\n this.providerId = EmailAuthProvider.PROVIDER_ID;\n }\n /**\n * Initialize an {@link AuthCredential} using an email and password.\n *\n * @example\n * ```javascript\n * const authCredential = EmailAuthProvider.credential(email, password);\n * const userCredential = await signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * ```javascript\n * const userCredential = await signInWithEmailAndPassword(auth, email, password);\n * ```\n *\n * @param email - Email address.\n * @param password - User account password.\n * @returns The auth provider credential.\n */\n static credential(email, password) {\n return EmailAuthCredential._fromEmailAndPassword(email, password);\n }\n /**\n * Initialize an {@link AuthCredential} using an email and an email link after a sign in with\n * email link operation.\n *\n * @example\n * ```javascript\n * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);\n * const userCredential = await signInWithCredential(auth, authCredential);\n * ```\n *\n * @example\n * ```javascript\n * await sendSignInLinkToEmail(auth, email);\n * // Obtain emailLink from user.\n * const userCredential = await signInWithEmailLink(auth, email, emailLink);\n * ```\n *\n * @param auth - The {@link Auth} instance used to verify the link.\n * @param email - Email address.\n * @param emailLink - Sign-in email link.\n * @returns - The auth provider credential.\n */\n static credentialWithLink(email, emailLink) {\n const actionCodeUrl = ActionCodeURL.parseLink(emailLink);\n _assert(actionCodeUrl, \"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);\n }\n}\n/**\n * Always set to {@link ProviderId}.PASSWORD, even for email link.\n */\nEmailAuthProvider.PROVIDER_ID = \"password\" /* ProviderId.PASSWORD */;\n/**\n * Always set to {@link SignInMethod}.EMAIL_PASSWORD.\n */\nEmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = \"password\" /* SignInMethod.EMAIL_PASSWORD */;\n/**\n * Always set to {@link SignInMethod}.EMAIL_LINK.\n */\nEmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = \"emailLink\" /* SignInMethod.EMAIL_LINK */;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The base class for all Federated providers (OAuth (including OIDC), SAML).\n *\n * This class is not meant to be instantiated directly.\n *\n * @public\n */\nclass FederatedAuthProvider {\n /**\n * Constructor for generic OAuth providers.\n *\n * @param providerId - Provider for which credentials should be generated.\n */\n constructor(providerId) {\n this.providerId = providerId;\n /** @internal */\n this.defaultLanguageCode = null;\n /** @internal */\n this.customParameters = {};\n }\n /**\n * Set the language gode.\n *\n * @param languageCode - language code\n */\n setDefaultLanguage(languageCode) {\n this.defaultLanguageCode = languageCode;\n }\n /**\n * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in\n * operations.\n *\n * @remarks\n * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,\n * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.\n *\n * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.\n */\n setCustomParameters(customOAuthParameters) {\n this.customParameters = customOAuthParameters;\n return this;\n }\n /**\n * Retrieve the current list of {@link CustomParameters}.\n */\n getCustomParameters() {\n return this.customParameters;\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Common code to all OAuth providers. This is separate from the\n * {@link OAuthProvider} so that child providers (like\n * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.\n * Instead, they rely on a static `credential` method.\n */\nclass BaseOAuthProvider extends FederatedAuthProvider {\n constructor() {\n super(...arguments);\n /** @internal */\n this.scopes = [];\n }\n /**\n * Add an OAuth scope to the credential.\n *\n * @param scope - Provider OAuth scope to add.\n */\n addScope(scope) {\n // If not already added, add scope to list.\n if (!this.scopes.includes(scope)) {\n this.scopes.push(scope);\n }\n return this;\n }\n /**\n * Retrieve the current list of OAuth scopes.\n */\n getScopes() {\n return [...this.scopes];\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new FacebookAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('user_birthday');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = FacebookAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new FacebookAuthProvider();\n * provider.addScope('user_birthday');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Facebook Access Token.\n * const credential = FacebookAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n *\n * @public\n */\nclass FacebookAuthProvider extends BaseOAuthProvider {\n constructor() {\n super(\"facebook.com\" /* ProviderId.FACEBOOK */);\n }\n /**\n * Creates a credential for Facebook.\n *\n * @example\n * ```javascript\n * // `event` from the Facebook auth.authResponseChange callback.\n * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);\n * const result = await signInWithCredential(credential);\n * ```\n *\n * @param accessToken - Facebook access token.\n */\n static credential(accessToken) {\n return OAuthCredential._fromParams({\n providerId: FacebookAuthProvider.PROVIDER_ID,\n signInMethod: FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD,\n accessToken\n });\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(userCredential) {\n return FacebookAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error) {\n return FacebookAuthProvider.credentialFromTaggedObject((error.customData || {}));\n }\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n try {\n return FacebookAuthProvider.credential(tokenResponse.oauthAccessToken);\n }\n catch (_a) {\n return null;\n }\n }\n}\n/** Always set to {@link SignInMethod}.FACEBOOK. */\nFacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = \"facebook.com\" /* SignInMethod.FACEBOOK */;\n/** Always set to {@link ProviderId}.FACEBOOK. */\nFacebookAuthProvider.PROVIDER_ID = \"facebook.com\" /* ProviderId.FACEBOOK */;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new GoogleAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('profile');\n * provider.addScope('email');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Google Access Token.\n * const credential = GoogleAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new GoogleAuthProvider();\n * provider.addScope('profile');\n * provider.addScope('email');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Google Access Token.\n * const credential = GoogleAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n *\n * @public\n */\nclass GoogleAuthProvider extends BaseOAuthProvider {\n constructor() {\n super(\"google.com\" /* ProviderId.GOOGLE */);\n this.addScope('profile');\n }\n /**\n * Creates a credential for Google. At least one of ID token and access token is required.\n *\n * @example\n * ```javascript\n * // \\`googleUser\\` from the onsuccess Google Sign In callback.\n * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);\n * const result = await signInWithCredential(credential);\n * ```\n *\n * @param idToken - Google ID token.\n * @param accessToken - Google access token.\n */\n static credential(idToken, accessToken) {\n return OAuthCredential._fromParams({\n providerId: GoogleAuthProvider.PROVIDER_ID,\n signInMethod: GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD,\n idToken,\n accessToken\n });\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(userCredential) {\n return GoogleAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error) {\n return GoogleAuthProvider.credentialFromTaggedObject((error.customData || {}));\n }\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\n if (!tokenResponse) {\n return null;\n }\n const { oauthIdToken, oauthAccessToken } = tokenResponse;\n if (!oauthIdToken && !oauthAccessToken) {\n // This could be an oauth 1 credential or a phone credential\n return null;\n }\n try {\n return GoogleAuthProvider.credential(oauthIdToken, oauthAccessToken);\n }\n catch (_a) {\n return null;\n }\n }\n}\n/** Always set to {@link SignInMethod}.GOOGLE. */\nGoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = \"google.com\" /* SignInMethod.GOOGLE */;\n/** Always set to {@link ProviderId}.GOOGLE. */\nGoogleAuthProvider.PROVIDER_ID = \"google.com\" /* ProviderId.GOOGLE */;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.\n *\n * @remarks\n * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use\n * the {@link signInWithPopup} handler:\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new GithubAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * provider.addScope('repo');\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a GitHub Access Token.\n * const credential = GithubAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new GithubAuthProvider();\n * provider.addScope('repo');\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a GitHub Access Token.\n * const credential = GithubAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * ```\n * @public\n */\nclass GithubAuthProvider extends BaseOAuthProvider {\n constructor() {\n super(\"github.com\" /* ProviderId.GITHUB */);\n }\n /**\n * Creates a credential for GitHub.\n *\n * @param accessToken - GitHub access token.\n */\n static credential(accessToken) {\n return OAuthCredential._fromParams({\n providerId: GithubAuthProvider.PROVIDER_ID,\n signInMethod: GithubAuthProvider.GITHUB_SIGN_IN_METHOD,\n accessToken\n });\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(userCredential) {\n return GithubAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error) {\n return GithubAuthProvider.credentialFromTaggedObject((error.customData || {}));\n }\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\n if (!tokenResponse || !('oauthAccessToken' in tokenResponse)) {\n return null;\n }\n if (!tokenResponse.oauthAccessToken) {\n return null;\n }\n try {\n return GithubAuthProvider.credential(tokenResponse.oauthAccessToken);\n }\n catch (_a) {\n return null;\n }\n }\n}\n/** Always set to {@link SignInMethod}.GITHUB. */\nGithubAuthProvider.GITHUB_SIGN_IN_METHOD = \"github.com\" /* SignInMethod.GITHUB */;\n/** Always set to {@link ProviderId}.GITHUB. */\nGithubAuthProvider.PROVIDER_ID = \"github.com\" /* ProviderId.GITHUB */;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.\n *\n * @example\n * ```javascript\n * // Sign in using a redirect.\n * const provider = new TwitterAuthProvider();\n * // Start a sign in process for an unauthenticated user.\n * await signInWithRedirect(auth, provider);\n * // This will trigger a full page redirect away from your app\n *\n * // After returning from the redirect when your app initializes you can obtain the result\n * const result = await getRedirectResult(auth);\n * if (result) {\n * // This is the signed-in user\n * const user = result.user;\n * // This gives you a Twitter Access Token and Secret.\n * const credential = TwitterAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * const secret = credential.secret;\n * }\n * ```\n *\n * @example\n * ```javascript\n * // Sign in using a popup.\n * const provider = new TwitterAuthProvider();\n * const result = await signInWithPopup(auth, provider);\n *\n * // The signed-in user info.\n * const user = result.user;\n * // This gives you a Twitter Access Token and Secret.\n * const credential = TwitterAuthProvider.credentialFromResult(result);\n * const token = credential.accessToken;\n * const secret = credential.secret;\n * ```\n *\n * @public\n */\nclass TwitterAuthProvider extends BaseOAuthProvider {\n constructor() {\n super(\"twitter.com\" /* ProviderId.TWITTER */);\n }\n /**\n * Creates a credential for Twitter.\n *\n * @param token - Twitter access token.\n * @param secret - Twitter secret.\n */\n static credential(token, secret) {\n return OAuthCredential._fromParams({\n providerId: TwitterAuthProvider.PROVIDER_ID,\n signInMethod: TwitterAuthProvider.TWITTER_SIGN_IN_METHOD,\n oauthToken: token,\n oauthTokenSecret: secret\n });\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromResult(userCredential) {\n return TwitterAuthProvider.credentialFromTaggedObject(userCredential);\n }\n /**\n * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was\n * thrown during a sign-in, link, or reauthenticate operation.\n *\n * @param userCredential - The user credential.\n */\n static credentialFromError(error) {\n return TwitterAuthProvider.credentialFromTaggedObject((error.customData || {}));\n }\n static credentialFromTaggedObject({ _tokenResponse: tokenResponse }) {\n if (!tokenResponse) {\n return null;\n }\n const { oauthAccessToken, oauthTokenSecret } = tokenResponse;\n if (!oauthAccessToken || !oauthTokenSecret) {\n return null;\n }\n try {\n return TwitterAuthProvider.credential(oauthAccessToken, oauthTokenSecret);\n }\n catch (_a) {\n return null;\n }\n }\n}\n/** Always set to {@link SignInMethod}.TWITTER. */\nTwitterAuthProvider.TWITTER_SIGN_IN_METHOD = \"twitter.com\" /* SignInMethod.TWITTER */;\n/** Always set to {@link ProviderId}.TWITTER. */\nTwitterAuthProvider.PROVIDER_ID = \"twitter.com\" /* ProviderId.TWITTER */;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass UserCredentialImpl {\n constructor(params) {\n this.user = params.user;\n this.providerId = params.providerId;\n this._tokenResponse = params._tokenResponse;\n this.operationType = params.operationType;\n }\n static async _fromIdTokenResponse(auth, operationType, idTokenResponse, isAnonymous = false) {\n const user = await UserImpl._fromIdTokenResponse(auth, idTokenResponse, isAnonymous);\n const providerId = providerIdForResponse(idTokenResponse);\n const userCred = new UserCredentialImpl({\n user,\n providerId,\n _tokenResponse: idTokenResponse,\n operationType\n });\n return userCred;\n }\n static async _forOperation(user, operationType, response) {\n await user._updateTokensIfNecessary(response, /* reload */ true);\n const providerId = providerIdForResponse(response);\n return new UserCredentialImpl({\n user,\n providerId,\n _tokenResponse: response,\n operationType\n });\n }\n}\nfunction providerIdForResponse(response) {\n if (response.providerId) {\n return response.providerId;\n }\n if ('phoneNumber' in response) {\n return \"phone\" /* ProviderId.PHONE */;\n }\n return null;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass MultiFactorError extends FirebaseError {\n constructor(auth, error, operationType, user) {\n var _a;\n super(error.code, error.message);\n this.operationType = operationType;\n this.user = user;\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, MultiFactorError.prototype);\n this.customData = {\n appName: auth.name,\n tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined,\n _serverResponse: error.customData._serverResponse,\n operationType\n };\n }\n static _fromErrorAndOperation(auth, error, operationType, user) {\n return new MultiFactorError(auth, error, operationType, user);\n }\n}\nfunction _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {\n const idTokenProvider = operationType === \"reauthenticate\" /* OperationType.REAUTHENTICATE */\n ? credential._getReauthenticationResolver(auth)\n : credential._getIdTokenResponse(auth);\n return idTokenProvider.catch(error => {\n if (error.code === `auth/${\"multi-factor-auth-required\" /* AuthErrorCode.MFA_REQUIRED */}`) {\n throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);\n }\n throw error;\n });\n}\nasync function _link$1(user, credential, bypassAuthState = false) {\n const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState);\n return UserCredentialImpl._forOperation(user, \"link\" /* OperationType.LINK */, response);\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function _reauthenticate(user, credential, bypassAuthState = false) {\n const { auth } = user;\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));\n }\n const operationType = \"reauthenticate\" /* OperationType.REAUTHENTICATE */;\n try {\n const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);\n _assert(response.idToken, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const parsed = _parseToken(response.idToken);\n _assert(parsed, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n const { sub: localId } = parsed;\n _assert(user.uid === localId, auth, \"user-mismatch\" /* AuthErrorCode.USER_MISMATCH */);\n return UserCredentialImpl._forOperation(user, operationType, response);\n }\n catch (e) {\n // Convert user deleted error into user mismatch\n if ((e === null || e === void 0 ? void 0 : e.code) === `auth/${\"user-not-found\" /* AuthErrorCode.USER_DELETED */}`) {\n _fail(auth, \"user-mismatch\" /* AuthErrorCode.USER_MISMATCH */);\n }\n throw e;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function _signInWithCredential(auth, credential, bypassAuthState = false) {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));\n }\n const operationType = \"signIn\" /* OperationType.SIGN_IN */;\n const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);\n const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);\n if (!bypassAuthState) {\n await auth._updateCurrentUser(userCredential.user);\n }\n return userCredential;\n}\n/**\n * Asynchronously signs in with the given credentials.\n *\n * @remarks\n * An {@link AuthProvider} can be used to generate the credential.\n *\n * This method is not supported by {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * @param auth - The {@link Auth} instance.\n * @param credential - The auth credential.\n *\n * @public\n */\nasync function signInWithCredential(auth, credential) {\n return _signInWithCredential(_castAuth(auth), credential);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Updates the password policy cached in the {@link Auth} instance if a policy is already\n * cached for the project or tenant.\n *\n * @remarks\n * We only fetch the password policy if the password did not meet policy requirements and\n * there is an existing policy cached. A developer must call validatePassword at least\n * once for the cache to be automatically updated.\n *\n * @param auth - The {@link Auth} instance.\n *\n * @private\n */\nasync function recachePasswordPolicy(auth) {\n const authInternal = _castAuth(auth);\n if (authInternal._getPasswordPolicyInternal()) {\n await authInternal._updatePasswordPolicy();\n }\n}\n/**\n * Sends a password reset email to the given email address. This method does not throw an error when\n * there's no user account with the given email address and\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled.\n *\n * @remarks\n * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in\n * the email sent to the user, along with the new password specified by the user.\n *\n * @example\n * ```javascript\n * const actionCodeSettings = {\n * url: 'https://www.example.com/?email=user@example.com',\n * iOS: {\n * bundleId: 'com.example.ios'\n * },\n * android: {\n * packageName: 'com.example.android',\n * installApp: true,\n * minimumVersion: '12'\n * },\n * handleCodeInApp: true\n * };\n * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);\n * // Obtain code from user.\n * await confirmPasswordReset('user@example.com', code);\n * ```\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The user's email address.\n * @param actionCodeSettings - The {@link ActionCodeSettings}.\n *\n * @public\n */\nasync function sendPasswordResetEmail(auth, email, actionCodeSettings) {\n const authInternal = _castAuth(auth);\n const request = {\n requestType: \"PASSWORD_RESET\" /* ActionCodeOperation.PASSWORD_RESET */,\n email,\n clientType: \"CLIENT_TYPE_WEB\" /* RecaptchaClientType.WEB */\n };\n await handleRecaptchaFlow(authInternal, request, \"getOobCode\" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1);\n}\n/**\n * Completes the password reset process, given a confirmation code and new password.\n *\n * @param auth - The {@link Auth} instance.\n * @param oobCode - A confirmation code sent to the user.\n * @param newPassword - The new password.\n *\n * @public\n */\nasync function confirmPasswordReset(auth, oobCode, newPassword) {\n await resetPassword(getModularInstance(auth), {\n oobCode,\n newPassword\n })\n .catch(async (error) => {\n if (error.code ===\n `auth/${\"password-does-not-meet-requirements\" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {\n void recachePasswordPolicy(auth);\n }\n throw error;\n });\n // Do not return the email.\n}\n/**\n * Asynchronously signs in using an email and password.\n *\n * @remarks\n * Fails with an error if the email address and password do not match. When\n * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}\n * is enabled, this method fails with \"auth/invalid-credential\" in case of an invalid\n * email/password.\n *\n * This method is not supported on {@link Auth} instances created with a\n * {@link @firebase/app#FirebaseServerApp}.\n *\n * Note: The user's password is NOT the password used to access the user's email account. The\n * email address serves as a unique identifier for the user, and the password is used to access\n * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.\n *\n *\n * @param auth - The {@link Auth} instance.\n * @param email - The users email address.\n * @param password - The users password.\n *\n * @public\n */\nfunction signInWithEmailAndPassword(auth, email, password) {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));\n }\n return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(async (error) => {\n if (error.code === `auth/${\"password-does-not-meet-requirements\" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {\n void recachePasswordPolicy(auth);\n }\n throw error;\n });\n}\n/**\n * Adds an observer for changes to the signed-in user's ID token.\n *\n * @remarks\n * This includes sign-in, sign-out, and token refresh events.\n * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.\n *\n * @param auth - The {@link Auth} instance.\n * @param nextOrObserver - callback triggered on change.\n * @param error - Deprecated. This callback is never triggered. Errors\n * on signing in/out can be caught in promises returned from\n * sign-in/sign-out functions.\n * @param completed - Deprecated. This callback is never triggered.\n *\n * @public\n */\nfunction onIdTokenChanged(auth, nextOrObserver, error, completed) {\n return getModularInstance(auth).onIdTokenChanged(nextOrObserver, error, completed);\n}\n/**\n * Adds a blocking callback that runs before an auth state change\n * sets a new user.\n *\n * @param auth - The {@link Auth} instance.\n * @param callback - callback triggered before new user value is set.\n * If this throws, it blocks the user from being set.\n * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`\n * callback throws, allowing you to undo any side effects.\n */\nfunction beforeAuthStateChanged(auth, callback, onAbort) {\n return getModularInstance(auth).beforeAuthStateChanged(callback, onAbort);\n}\n\nconst STORAGE_AVAILABLE_KEY = '__sak';\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// There are two different browser persistence types: local and session.\n// Both have the same implementation but use a different underlying storage\n// object.\nclass BrowserPersistenceClass {\n constructor(storageRetriever, type) {\n this.storageRetriever = storageRetriever;\n this.type = type;\n }\n _isAvailable() {\n try {\n if (!this.storage) {\n return Promise.resolve(false);\n }\n this.storage.setItem(STORAGE_AVAILABLE_KEY, '1');\n this.storage.removeItem(STORAGE_AVAILABLE_KEY);\n return Promise.resolve(true);\n }\n catch (_a) {\n return Promise.resolve(false);\n }\n }\n _set(key, value) {\n this.storage.setItem(key, JSON.stringify(value));\n return Promise.resolve();\n }\n _get(key) {\n const json = this.storage.getItem(key);\n return Promise.resolve(json ? JSON.parse(json) : null);\n }\n _remove(key) {\n this.storage.removeItem(key);\n return Promise.resolve();\n }\n get storage() {\n return this.storageRetriever();\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// The polling period in case events are not supported\nconst _POLLING_INTERVAL_MS$1 = 1000;\n// The IE 10 localStorage cross tab synchronization delay in milliseconds\nconst IE10_LOCAL_STORAGE_SYNC_DELAY = 10;\nclass BrowserLocalPersistence extends BrowserPersistenceClass {\n constructor() {\n super(() => window.localStorage, \"LOCAL\" /* PersistenceType.LOCAL */);\n this.boundEventHandler = (event, poll) => this.onStorageEvent(event, poll);\n this.listeners = {};\n this.localCache = {};\n // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.pollTimer = null;\n // Whether to use polling instead of depending on window events\n this.fallbackToPolling = _isMobileBrowser();\n this._shouldAllowMigration = true;\n }\n forAllChangedKeys(cb) {\n // Check all keys with listeners on them.\n for (const key of Object.keys(this.listeners)) {\n // Get value from localStorage.\n const newValue = this.storage.getItem(key);\n const oldValue = this.localCache[key];\n // If local map value does not match, trigger listener with storage event.\n // Differentiate this simulated event from the real storage event.\n if (newValue !== oldValue) {\n cb(key, oldValue, newValue);\n }\n }\n }\n onStorageEvent(event, poll = false) {\n // Key would be null in some situations, like when localStorage is cleared\n if (!event.key) {\n this.forAllChangedKeys((key, _oldValue, newValue) => {\n this.notifyListeners(key, newValue);\n });\n return;\n }\n const key = event.key;\n // Check the mechanism how this event was detected.\n // The first event will dictate the mechanism to be used.\n if (poll) {\n // Environment detects storage changes via polling.\n // Remove storage event listener to prevent possible event duplication.\n this.detachListener();\n }\n else {\n // Environment detects storage changes via storage event listener.\n // Remove polling listener to prevent possible event duplication.\n this.stopPolling();\n }\n const triggerListeners = () => {\n // Keep local map up to date in case storage event is triggered before\n // poll.\n const storedValue = this.storage.getItem(key);\n if (!poll && this.localCache[key] === storedValue) {\n // Real storage event which has already been detected, do nothing.\n // This seems to trigger in some IE browsers for some reason.\n return;\n }\n this.notifyListeners(key, storedValue);\n };\n const storedValue = this.storage.getItem(key);\n if (_isIE10() &&\n storedValue !== event.newValue &&\n event.newValue !== event.oldValue) {\n // IE 10 has this weird bug where a storage event would trigger with the\n // correct key, oldValue and newValue but localStorage.getItem(key) does\n // not yield the updated value until a few milliseconds. This ensures\n // this recovers from that situation.\n setTimeout(triggerListeners, IE10_LOCAL_STORAGE_SYNC_DELAY);\n }\n else {\n triggerListeners();\n }\n }\n notifyListeners(key, value) {\n this.localCache[key] = value;\n const listeners = this.listeners[key];\n if (listeners) {\n for (const listener of Array.from(listeners)) {\n listener(value ? JSON.parse(value) : value);\n }\n }\n }\n startPolling() {\n this.stopPolling();\n this.pollTimer = setInterval(() => {\n this.forAllChangedKeys((key, oldValue, newValue) => {\n this.onStorageEvent(new StorageEvent('storage', {\n key,\n oldValue,\n newValue\n }), \n /* poll */ true);\n });\n }, _POLLING_INTERVAL_MS$1);\n }\n stopPolling() {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n attachListener() {\n window.addEventListener('storage', this.boundEventHandler);\n }\n detachListener() {\n window.removeEventListener('storage', this.boundEventHandler);\n }\n _addListener(key, listener) {\n if (Object.keys(this.listeners).length === 0) {\n // Whether browser can detect storage event when it had already been pushed to the background.\n // This may happen in some mobile browsers. A localStorage change in the foreground window\n // will not be detected in the background window via the storage event.\n // This was detected in iOS 7.x mobile browsers\n if (this.fallbackToPolling) {\n this.startPolling();\n }\n else {\n this.attachListener();\n }\n }\n if (!this.listeners[key]) {\n this.listeners[key] = new Set();\n // Populate the cache to avoid spuriously triggering on first poll.\n this.localCache[key] = this.storage.getItem(key);\n }\n this.listeners[key].add(listener);\n }\n _removeListener(key, listener) {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n if (Object.keys(this.listeners).length === 0) {\n this.detachListener();\n this.stopPolling();\n }\n }\n // Update local cache on base operations:\n async _set(key, value) {\n await super._set(key, value);\n this.localCache[key] = JSON.stringify(value);\n }\n async _get(key) {\n const value = await super._get(key);\n this.localCache[key] = JSON.stringify(value);\n return value;\n }\n async _remove(key) {\n await super._remove(key);\n delete this.localCache[key];\n }\n}\nBrowserLocalPersistence.type = 'LOCAL';\n/**\n * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`\n * for the underlying storage.\n *\n * @public\n */\nconst browserLocalPersistence = BrowserLocalPersistence;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass BrowserSessionPersistence extends BrowserPersistenceClass {\n constructor() {\n super(() => window.sessionStorage, \"SESSION\" /* PersistenceType.SESSION */);\n }\n _addListener(_key, _listener) {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n _removeListener(_key, _listener) {\n // Listeners are not supported for session storage since it cannot be shared across windows\n return;\n }\n}\nBrowserSessionPersistence.type = 'SESSION';\n/**\n * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`\n * for the underlying storage.\n *\n * @public\n */\nconst browserSessionPersistence = BrowserSessionPersistence;\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Shim for Promise.allSettled, note the slightly different format of `fulfilled` vs `status`.\n *\n * @param promises - Array of promises to wait on.\n */\nfunction _allSettled(promises) {\n return Promise.all(promises.map(async (promise) => {\n try {\n const value = await promise;\n return {\n fulfilled: true,\n value\n };\n }\n catch (reason) {\n return {\n fulfilled: false,\n reason\n };\n }\n }));\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Interface class for receiving messages.\n *\n */\nclass Receiver {\n constructor(eventTarget) {\n this.eventTarget = eventTarget;\n this.handlersMap = {};\n this.boundEventHandler = this.handleEvent.bind(this);\n }\n /**\n * Obtain an instance of a Receiver for a given event target, if none exists it will be created.\n *\n * @param eventTarget - An event target (such as window or self) through which the underlying\n * messages will be received.\n */\n static _getInstance(eventTarget) {\n // The results are stored in an array since objects can't be keys for other\n // objects. In addition, setting a unique property on an event target as a\n // hash map key may not be allowed due to CORS restrictions.\n const existingInstance = this.receivers.find(receiver => receiver.isListeningto(eventTarget));\n if (existingInstance) {\n return existingInstance;\n }\n const newInstance = new Receiver(eventTarget);\n this.receivers.push(newInstance);\n return newInstance;\n }\n isListeningto(eventTarget) {\n return this.eventTarget === eventTarget;\n }\n /**\n * Fans out a MessageEvent to the appropriate listeners.\n *\n * @remarks\n * Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have\n * finished processing.\n *\n * @param event - The MessageEvent.\n *\n */\n async handleEvent(event) {\n const messageEvent = event;\n const { eventId, eventType, data } = messageEvent.data;\n const handlers = this.handlersMap[eventType];\n if (!(handlers === null || handlers === void 0 ? void 0 : handlers.size)) {\n return;\n }\n messageEvent.ports[0].postMessage({\n status: \"ack\" /* _Status.ACK */,\n eventId,\n eventType\n });\n const promises = Array.from(handlers).map(async (handler) => handler(messageEvent.origin, data));\n const response = await _allSettled(promises);\n messageEvent.ports[0].postMessage({\n status: \"done\" /* _Status.DONE */,\n eventId,\n eventType,\n response\n });\n }\n /**\n * Subscribe an event handler for a particular event.\n *\n * @param eventType - Event name to subscribe to.\n * @param eventHandler - The event handler which should receive the events.\n *\n */\n _subscribe(eventType, eventHandler) {\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.addEventListener('message', this.boundEventHandler);\n }\n if (!this.handlersMap[eventType]) {\n this.handlersMap[eventType] = new Set();\n }\n this.handlersMap[eventType].add(eventHandler);\n }\n /**\n * Unsubscribe an event handler from a particular event.\n *\n * @param eventType - Event name to unsubscribe from.\n * @param eventHandler - Optional event handler, if none provided, unsubscribe all handlers on this event.\n *\n */\n _unsubscribe(eventType, eventHandler) {\n if (this.handlersMap[eventType] && eventHandler) {\n this.handlersMap[eventType].delete(eventHandler);\n }\n if (!eventHandler || this.handlersMap[eventType].size === 0) {\n delete this.handlersMap[eventType];\n }\n if (Object.keys(this.handlersMap).length === 0) {\n this.eventTarget.removeEventListener('message', this.boundEventHandler);\n }\n }\n}\nReceiver.receivers = [];\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _generateEventId(prefix = '', digits = 10) {\n let random = '';\n for (let i = 0; i < digits; i++) {\n random += Math.floor(Math.random() * 10);\n }\n return prefix + random;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Interface for sending messages and waiting for a completion response.\n *\n */\nclass Sender {\n constructor(target) {\n this.target = target;\n this.handlers = new Set();\n }\n /**\n * Unsubscribe the handler and remove it from our tracking Set.\n *\n * @param handler - The handler to unsubscribe.\n */\n removeMessageHandler(handler) {\n if (handler.messageChannel) {\n handler.messageChannel.port1.removeEventListener('message', handler.onMessage);\n handler.messageChannel.port1.close();\n }\n this.handlers.delete(handler);\n }\n /**\n * Send a message to the Receiver located at {@link target}.\n *\n * @remarks\n * We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the\n * receiver has had a chance to fully process the event.\n *\n * @param eventType - Type of event to send.\n * @param data - The payload of the event.\n * @param timeout - Timeout for waiting on an ACK from the receiver.\n *\n * @returns An array of settled promises from all the handlers that were listening on the receiver.\n */\n async _send(eventType, data, timeout = 50 /* _TimeoutDuration.ACK */) {\n const messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;\n if (!messageChannel) {\n throw new Error(\"connection_unavailable\" /* _MessageError.CONNECTION_UNAVAILABLE */);\n }\n // Node timers and browser timers return fundamentally different types.\n // We don't actually care what the value is but TS won't accept unknown and\n // we can't cast properly in both environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let completionTimer;\n let handler;\n return new Promise((resolve, reject) => {\n const eventId = _generateEventId('', 20);\n messageChannel.port1.start();\n const ackTimer = setTimeout(() => {\n reject(new Error(\"unsupported_event\" /* _MessageError.UNSUPPORTED_EVENT */));\n }, timeout);\n handler = {\n messageChannel,\n onMessage(event) {\n const messageEvent = event;\n if (messageEvent.data.eventId !== eventId) {\n return;\n }\n switch (messageEvent.data.status) {\n case \"ack\" /* _Status.ACK */:\n // The receiver should ACK first.\n clearTimeout(ackTimer);\n completionTimer = setTimeout(() => {\n reject(new Error(\"timeout\" /* _MessageError.TIMEOUT */));\n }, 3000 /* _TimeoutDuration.COMPLETION */);\n break;\n case \"done\" /* _Status.DONE */:\n // Once the receiver's handlers are finished we will get the results.\n clearTimeout(completionTimer);\n resolve(messageEvent.data.response);\n break;\n default:\n clearTimeout(ackTimer);\n clearTimeout(completionTimer);\n reject(new Error(\"invalid_response\" /* _MessageError.INVALID_RESPONSE */));\n break;\n }\n }\n };\n this.handlers.add(handler);\n messageChannel.port1.addEventListener('message', handler.onMessage);\n this.target.postMessage({\n eventType,\n eventId,\n data\n }, [messageChannel.port2]);\n }).finally(() => {\n if (handler) {\n this.removeMessageHandler(handler);\n }\n });\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Lazy accessor for window, since the compat layer won't tree shake this out,\n * we need to make sure not to mess with window unless we have to\n */\nfunction _window() {\n return window;\n}\nfunction _setWindowLocation(url) {\n _window().location.href = url;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction _isWorker() {\n return (typeof _window()['WorkerGlobalScope'] !== 'undefined' &&\n typeof _window()['importScripts'] === 'function');\n}\nasync function _getActiveServiceWorker() {\n if (!(navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker)) {\n return null;\n }\n try {\n const registration = await navigator.serviceWorker.ready;\n return registration.active;\n }\n catch (_a) {\n return null;\n }\n}\nfunction _getServiceWorkerController() {\n var _a;\n return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null;\n}\nfunction _getWorkerGlobalScope() {\n return _isWorker() ? self : null;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DB_NAME = 'firebaseLocalStorageDb';\nconst DB_VERSION = 1;\nconst DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';\nconst DB_DATA_KEYPATH = 'fbase_key';\n/**\n * Promise wrapper for IDBRequest\n *\n * Unfortunately we can't cleanly extend Promise<T> since promises are not callable in ES6\n *\n */\nclass DBPromise {\n constructor(request) {\n this.request = request;\n }\n toPromise() {\n return new Promise((resolve, reject) => {\n this.request.addEventListener('success', () => {\n resolve(this.request.result);\n });\n this.request.addEventListener('error', () => {\n reject(this.request.error);\n });\n });\n }\n}\nfunction getObjectStore(db, isReadWrite) {\n return db\n .transaction([DB_OBJECTSTORE_NAME], isReadWrite ? 'readwrite' : 'readonly')\n .objectStore(DB_OBJECTSTORE_NAME);\n}\nfunction _deleteDatabase() {\n const request = indexedDB.deleteDatabase(DB_NAME);\n return new DBPromise(request).toPromise();\n}\nfunction _openDatabase() {\n const request = indexedDB.open(DB_NAME, DB_VERSION);\n return new Promise((resolve, reject) => {\n request.addEventListener('error', () => {\n reject(request.error);\n });\n request.addEventListener('upgradeneeded', () => {\n const db = request.result;\n try {\n db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH });\n }\n catch (e) {\n reject(e);\n }\n });\n request.addEventListener('success', async () => {\n const db = request.result;\n // Strange bug that occurs in Firefox when multiple tabs are opened at the\n // same time. The only way to recover seems to be deleting the database\n // and re-initializing it.\n // https://github.com/firebase/firebase-js-sdk/issues/634\n if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {\n // Need to close the database or else you get a `blocked` event\n db.close();\n await _deleteDatabase();\n resolve(await _openDatabase());\n }\n else {\n resolve(db);\n }\n });\n });\n}\nasync function _putObject(db, key, value) {\n const request = getObjectStore(db, true).put({\n [DB_DATA_KEYPATH]: key,\n value\n });\n return new DBPromise(request).toPromise();\n}\nasync function getObject(db, key) {\n const request = getObjectStore(db, false).get(key);\n const data = await new DBPromise(request).toPromise();\n return data === undefined ? null : data.value;\n}\nfunction _deleteObject(db, key) {\n const request = getObjectStore(db, true).delete(key);\n return new DBPromise(request).toPromise();\n}\nconst _POLLING_INTERVAL_MS = 800;\nconst _TRANSACTION_RETRY_COUNT = 3;\nclass IndexedDBLocalPersistence {\n constructor() {\n this.type = \"LOCAL\" /* PersistenceType.LOCAL */;\n this._shouldAllowMigration = true;\n this.listeners = {};\n this.localCache = {};\n // setTimeout return value is platform specific\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.pollTimer = null;\n this.pendingWrites = 0;\n this.receiver = null;\n this.sender = null;\n this.serviceWorkerReceiverAvailable = false;\n this.activeServiceWorker = null;\n // Fire & forget the service worker registration as it may never resolve\n this._workerInitializationPromise =\n this.initializeServiceWorkerMessaging().then(() => { }, () => { });\n }\n async _openDb() {\n if (this.db) {\n return this.db;\n }\n this.db = await _openDatabase();\n return this.db;\n }\n async _withRetries(op) {\n let numAttempts = 0;\n while (true) {\n try {\n const db = await this._openDb();\n return await op(db);\n }\n catch (e) {\n if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {\n throw e;\n }\n if (this.db) {\n this.db.close();\n this.db = undefined;\n }\n // TODO: consider adding exponential backoff\n }\n }\n }\n /**\n * IndexedDB events do not propagate from the main window to the worker context. We rely on a\n * postMessage interface to send these events to the worker ourselves.\n */\n async initializeServiceWorkerMessaging() {\n return _isWorker() ? this.initializeReceiver() : this.initializeSender();\n }\n /**\n * As the worker we should listen to events from the main window.\n */\n async initializeReceiver() {\n this.receiver = Receiver._getInstance(_getWorkerGlobalScope());\n // Refresh from persistence if we receive a KeyChanged message.\n this.receiver._subscribe(\"keyChanged\" /* _EventType.KEY_CHANGED */, async (_origin, data) => {\n const keys = await this._poll();\n return {\n keyProcessed: keys.includes(data.key)\n };\n });\n // Let the sender know that we are listening so they give us more timeout.\n this.receiver._subscribe(\"ping\" /* _EventType.PING */, async (_origin, _data) => {\n return [\"keyChanged\" /* _EventType.KEY_CHANGED */];\n });\n }\n /**\n * As the main window, we should let the worker know when keys change (set and remove).\n *\n * @remarks\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready}\n * may not resolve.\n */\n async initializeSender() {\n var _a, _b;\n // Check to see if there's an active service worker.\n this.activeServiceWorker = await _getActiveServiceWorker();\n if (!this.activeServiceWorker) {\n return;\n }\n this.sender = new Sender(this.activeServiceWorker);\n // Ping the service worker to check what events they can handle.\n const results = await this.sender._send(\"ping\" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */);\n if (!results) {\n return;\n }\n if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&\n ((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes(\"keyChanged\" /* _EventType.KEY_CHANGED */))) {\n this.serviceWorkerReceiverAvailable = true;\n }\n }\n /**\n * Let the worker know about a changed key, the exact key doesn't technically matter since the\n * worker will just trigger a full sync anyway.\n *\n * @remarks\n * For now, we only support one service worker per page.\n *\n * @param key - Storage key which changed.\n */\n async notifyServiceWorker(key) {\n if (!this.sender ||\n !this.activeServiceWorker ||\n _getServiceWorkerController() !== this.activeServiceWorker) {\n return;\n }\n try {\n await this.sender._send(\"keyChanged\" /* _EventType.KEY_CHANGED */, { key }, \n // Use long timeout if receiver has previously responded to a ping from us.\n this.serviceWorkerReceiverAvailable\n ? 800 /* _TimeoutDuration.LONG_ACK */\n : 50 /* _TimeoutDuration.ACK */);\n }\n catch (_a) {\n // This is a best effort approach. Ignore errors.\n }\n }\n async _isAvailable() {\n try {\n if (!indexedDB) {\n return false;\n }\n const db = await _openDatabase();\n await _putObject(db, STORAGE_AVAILABLE_KEY, '1');\n await _deleteObject(db, STORAGE_AVAILABLE_KEY);\n return true;\n }\n catch (_a) { }\n return false;\n }\n async _withPendingWrite(write) {\n this.pendingWrites++;\n try {\n await write();\n }\n finally {\n this.pendingWrites--;\n }\n }\n async _set(key, value) {\n return this._withPendingWrite(async () => {\n await this._withRetries((db) => _putObject(db, key, value));\n this.localCache[key] = value;\n return this.notifyServiceWorker(key);\n });\n }\n async _get(key) {\n const obj = (await this._withRetries((db) => getObject(db, key)));\n this.localCache[key] = obj;\n return obj;\n }\n async _remove(key) {\n return this._withPendingWrite(async () => {\n await this._withRetries((db) => _deleteObject(db, key));\n delete this.localCache[key];\n return this.notifyServiceWorker(key);\n });\n }\n async _poll() {\n // TODO: check if we need to fallback if getAll is not supported\n const result = await this._withRetries((db) => {\n const getAllRequest = getObjectStore(db, false).getAll();\n return new DBPromise(getAllRequest).toPromise();\n });\n if (!result) {\n return [];\n }\n // If we have pending writes in progress abort, we'll get picked up on the next poll\n if (this.pendingWrites !== 0) {\n return [];\n }\n const keys = [];\n const keysInResult = new Set();\n if (result.length !== 0) {\n for (const { fbase_key: key, value } of result) {\n keysInResult.add(key);\n if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {\n this.notifyListeners(key, value);\n keys.push(key);\n }\n }\n }\n for (const localKey of Object.keys(this.localCache)) {\n if (this.localCache[localKey] && !keysInResult.has(localKey)) {\n // Deleted\n this.notifyListeners(localKey, null);\n keys.push(localKey);\n }\n }\n return keys;\n }\n notifyListeners(key, newValue) {\n this.localCache[key] = newValue;\n const listeners = this.listeners[key];\n if (listeners) {\n for (const listener of Array.from(listeners)) {\n listener(newValue);\n }\n }\n }\n startPolling() {\n this.stopPolling();\n this.pollTimer = setInterval(async () => this._poll(), _POLLING_INTERVAL_MS);\n }\n stopPolling() {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n _addListener(key, listener) {\n if (Object.keys(this.listeners).length === 0) {\n this.startPolling();\n }\n if (!this.listeners[key]) {\n this.listeners[key] = new Set();\n // Populate the cache to avoid spuriously triggering on first poll.\n void this._get(key); // This can happen in the background async and we can return immediately.\n }\n this.listeners[key].add(listener);\n }\n _removeListener(key, listener) {\n if (this.listeners[key]) {\n this.listeners[key].delete(listener);\n if (this.listeners[key].size === 0) {\n delete this.listeners[key];\n }\n }\n if (Object.keys(this.listeners).length === 0) {\n this.stopPolling();\n }\n }\n}\nIndexedDBLocalPersistence.type = 'LOCAL';\n/**\n * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`\n * for the underlying storage.\n *\n * @public\n */\nconst indexedDBLocalPersistence = IndexedDBLocalPersistence;\nnew Delay(30000, 60000);\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Chooses a popup/redirect resolver to use. This prefers the override (which\n * is directly passed in), and falls back to the property set on the auth\n * object. If neither are available, this function errors w/ an argument error.\n */\nfunction _withDefaultResolver(auth, resolverOverride) {\n if (resolverOverride) {\n return _getInstance(resolverOverride);\n }\n _assert(auth._popupRedirectResolver, auth, \"argument-error\" /* AuthErrorCode.ARGUMENT_ERROR */);\n return auth._popupRedirectResolver;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass IdpCredential extends AuthCredential {\n constructor(params) {\n super(\"custom\" /* ProviderId.CUSTOM */, \"custom\" /* ProviderId.CUSTOM */);\n this.params = params;\n }\n _getIdTokenResponse(auth) {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n _linkToIdToken(auth, idToken) {\n return signInWithIdp(auth, this._buildIdpRequest(idToken));\n }\n _getReauthenticationResolver(auth) {\n return signInWithIdp(auth, this._buildIdpRequest());\n }\n _buildIdpRequest(idToken) {\n const request = {\n requestUri: this.params.requestUri,\n sessionId: this.params.sessionId,\n postBody: this.params.postBody,\n tenantId: this.params.tenantId,\n pendingToken: this.params.pendingToken,\n returnSecureToken: true,\n returnIdpCredential: true\n };\n if (idToken) {\n request.idToken = idToken;\n }\n return request;\n }\n}\nfunction _signIn(params) {\n return _signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);\n}\nfunction _reauth(params) {\n const { auth, user } = params;\n _assert(user, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);\n}\nasync function _link(params) {\n const { auth, user } = params;\n _assert(user, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return _link$1(user, new IdpCredential(params), params.bypassAuthState);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\n * events\n */\nclass AbstractPopupRedirectOperation {\n constructor(auth, filter, resolver, user, bypassAuthState = false) {\n this.auth = auth;\n this.resolver = resolver;\n this.user = user;\n this.bypassAuthState = bypassAuthState;\n this.pendingPromise = null;\n this.eventManager = null;\n this.filter = Array.isArray(filter) ? filter : [filter];\n }\n execute() {\n return new Promise(async (resolve, reject) => {\n this.pendingPromise = { resolve, reject };\n try {\n this.eventManager = await this.resolver._initialize(this.auth);\n await this.onExecution();\n this.eventManager.registerConsumer(this);\n }\n catch (e) {\n this.reject(e);\n }\n });\n }\n async onAuthEvent(event) {\n const { urlResponse, sessionId, postBody, tenantId, error, type } = event;\n if (error) {\n this.reject(error);\n return;\n }\n const params = {\n auth: this.auth,\n requestUri: urlResponse,\n sessionId: sessionId,\n tenantId: tenantId || undefined,\n postBody: postBody || undefined,\n user: this.user,\n bypassAuthState: this.bypassAuthState\n };\n try {\n this.resolve(await this.getIdpTask(type)(params));\n }\n catch (e) {\n this.reject(e);\n }\n }\n onError(error) {\n this.reject(error);\n }\n getIdpTask(type) {\n switch (type) {\n case \"signInViaPopup\" /* AuthEventType.SIGN_IN_VIA_POPUP */:\n case \"signInViaRedirect\" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:\n return _signIn;\n case \"linkViaPopup\" /* AuthEventType.LINK_VIA_POPUP */:\n case \"linkViaRedirect\" /* AuthEventType.LINK_VIA_REDIRECT */:\n return _link;\n case \"reauthViaPopup\" /* AuthEventType.REAUTH_VIA_POPUP */:\n case \"reauthViaRedirect\" /* AuthEventType.REAUTH_VIA_REDIRECT */:\n return _reauth;\n default:\n _fail(this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n }\n }\n resolve(cred) {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.resolve(cred);\n this.unregisterAndCleanUp();\n }\n reject(error) {\n debugAssert(this.pendingPromise, 'Pending promise was never set');\n this.pendingPromise.reject(error);\n this.unregisterAndCleanUp();\n }\n unregisterAndCleanUp() {\n if (this.eventManager) {\n this.eventManager.unregisterConsumer(this);\n }\n this.pendingPromise = null;\n this.cleanUp();\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);\n/**\n * Popup event manager. Handles the popup's entire lifecycle; listens to auth\n * events\n *\n */\nclass PopupOperation extends AbstractPopupRedirectOperation {\n constructor(auth, filter, provider, resolver, user) {\n super(auth, filter, resolver, user);\n this.provider = provider;\n this.authWindow = null;\n this.pollId = null;\n if (PopupOperation.currentPopupAction) {\n PopupOperation.currentPopupAction.cancel();\n }\n PopupOperation.currentPopupAction = this;\n }\n async executeNotNull() {\n const result = await this.execute();\n _assert(result, this.auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return result;\n }\n async onExecution() {\n debugAssert(this.filter.length === 1, 'Popup operations only handle one event');\n const eventId = _generateEventId();\n this.authWindow = await this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor\n eventId);\n this.authWindow.associatedEvent = eventId;\n // Check for web storage support and origin validation _after_ the popup is\n // loaded. These operations are slow (~1 second or so) Rather than\n // waiting on them before opening the window, optimistically open the popup\n // and check for storage support at the same time. If storage support is\n // not available, this will cause the whole thing to reject properly. It\n // will also close the popup, but since the promise has already rejected,\n // the popup closed by user poll will reject into the void.\n this.resolver._originValidation(this.auth).catch(e => {\n this.reject(e);\n });\n this.resolver._isIframeWebStorageSupported(this.auth, isSupported => {\n if (!isSupported) {\n this.reject(_createError(this.auth, \"web-storage-unsupported\" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */));\n }\n });\n // Handle user closure. Notice this does *not* use await\n this.pollUserCancellation();\n }\n get eventId() {\n var _a;\n return ((_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.associatedEvent) || null;\n }\n cancel() {\n this.reject(_createError(this.auth, \"cancelled-popup-request\" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */));\n }\n cleanUp() {\n if (this.authWindow) {\n this.authWindow.close();\n }\n if (this.pollId) {\n window.clearTimeout(this.pollId);\n }\n this.authWindow = null;\n this.pollId = null;\n PopupOperation.currentPopupAction = null;\n }\n pollUserCancellation() {\n const poll = () => {\n var _a, _b;\n if ((_b = (_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.closed) {\n // Make sure that there is sufficient time for whatever action to\n // complete. The window could have closed but the sign in network\n // call could still be in flight. This is specifically true for\n // Firefox or if the opener is in an iframe, in which case the oauth\n // helper closes the popup.\n this.pollId = window.setTimeout(() => {\n this.pollId = null;\n this.reject(_createError(this.auth, \"popup-closed-by-user\" /* AuthErrorCode.POPUP_CLOSED_BY_USER */));\n }, 8000 /* _Timeout.AUTH_EVENT */);\n return;\n }\n this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());\n };\n poll();\n }\n}\n// Only one popup is ever shown at once. The lifecycle of the current popup\n// can be managed / cancelled by the constructor.\nPopupOperation.currentPopupAction = null;\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst PENDING_REDIRECT_KEY = 'pendingRedirect';\n// We only get one redirect outcome for any one auth, so just store it\n// in here.\nconst redirectOutcomeMap = new Map();\nclass RedirectAction extends AbstractPopupRedirectOperation {\n constructor(auth, resolver, bypassAuthState = false) {\n super(auth, [\n \"signInViaRedirect\" /* AuthEventType.SIGN_IN_VIA_REDIRECT */,\n \"linkViaRedirect\" /* AuthEventType.LINK_VIA_REDIRECT */,\n \"reauthViaRedirect\" /* AuthEventType.REAUTH_VIA_REDIRECT */,\n \"unknown\" /* AuthEventType.UNKNOWN */\n ], resolver, undefined, bypassAuthState);\n this.eventId = null;\n }\n /**\n * Override the execute function; if we already have a redirect result, then\n * just return it.\n */\n async execute() {\n let readyOutcome = redirectOutcomeMap.get(this.auth._key());\n if (!readyOutcome) {\n try {\n const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);\n const result = hasPendingRedirect ? await super.execute() : null;\n readyOutcome = () => Promise.resolve(result);\n }\n catch (e) {\n readyOutcome = () => Promise.reject(e);\n }\n redirectOutcomeMap.set(this.auth._key(), readyOutcome);\n }\n // If we're not bypassing auth state, the ready outcome should be set to\n // null.\n if (!this.bypassAuthState) {\n redirectOutcomeMap.set(this.auth._key(), () => Promise.resolve(null));\n }\n return readyOutcome();\n }\n async onAuthEvent(event) {\n if (event.type === \"signInViaRedirect\" /* AuthEventType.SIGN_IN_VIA_REDIRECT */) {\n return super.onAuthEvent(event);\n }\n else if (event.type === \"unknown\" /* AuthEventType.UNKNOWN */) {\n // This is a sentinel value indicating there's no pending redirect\n this.resolve(null);\n return;\n }\n if (event.eventId) {\n const user = await this.auth._redirectUserForId(event.eventId);\n if (user) {\n this.user = user;\n return super.onAuthEvent(event);\n }\n else {\n this.resolve(null);\n }\n }\n }\n async onExecution() { }\n cleanUp() { }\n}\nasync function _getAndClearPendingRedirectStatus(resolver, auth) {\n const key = pendingRedirectKey(auth);\n const persistence = resolverPersistence(resolver);\n if (!(await persistence._isAvailable())) {\n return false;\n }\n const hasPendingRedirect = (await persistence._get(key)) === 'true';\n await persistence._remove(key);\n return hasPendingRedirect;\n}\nfunction _overrideRedirectResult(auth, result) {\n redirectOutcomeMap.set(auth._key(), result);\n}\nfunction resolverPersistence(resolver) {\n return _getInstance(resolver._redirectPersistence);\n}\nfunction pendingRedirectKey(auth) {\n return _persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);\n}\nasync function _getRedirectResult(auth, resolverExtern, bypassAuthState = false) {\n if (_isFirebaseServerApp(auth.app)) {\n return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));\n }\n const authInternal = _castAuth(auth);\n const resolver = _withDefaultResolver(authInternal, resolverExtern);\n const action = new RedirectAction(authInternal, resolver, bypassAuthState);\n const result = await action.execute();\n if (result && !bypassAuthState) {\n delete result.user._redirectEventId;\n await authInternal._persistUserIfCurrent(result.user);\n await authInternal._setRedirectUser(null, resolverExtern);\n }\n return result;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// The amount of time to store the UIDs of seen events; this is\n// set to 10 min by default\nconst EVENT_DUPLICATION_CACHE_DURATION_MS = 10 * 60 * 1000;\nclass AuthEventManager {\n constructor(auth) {\n this.auth = auth;\n this.cachedEventUids = new Set();\n this.consumers = new Set();\n this.queuedRedirectEvent = null;\n this.hasHandledPotentialRedirect = false;\n this.lastProcessedEventTime = Date.now();\n }\n registerConsumer(authEventConsumer) {\n this.consumers.add(authEventConsumer);\n if (this.queuedRedirectEvent &&\n this.isEventForConsumer(this.queuedRedirectEvent, authEventConsumer)) {\n this.sendToConsumer(this.queuedRedirectEvent, authEventConsumer);\n this.saveEventToCache(this.queuedRedirectEvent);\n this.queuedRedirectEvent = null;\n }\n }\n unregisterConsumer(authEventConsumer) {\n this.consumers.delete(authEventConsumer);\n }\n onEvent(event) {\n // Check if the event has already been handled\n if (this.hasEventBeenHandled(event)) {\n return false;\n }\n let handled = false;\n this.consumers.forEach(consumer => {\n if (this.isEventForConsumer(event, consumer)) {\n handled = true;\n this.sendToConsumer(event, consumer);\n this.saveEventToCache(event);\n }\n });\n if (this.hasHandledPotentialRedirect || !isRedirectEvent(event)) {\n // If we've already seen a redirect before, or this is a popup event,\n // bail now\n return handled;\n }\n this.hasHandledPotentialRedirect = true;\n // If the redirect wasn't handled, hang on to it\n if (!handled) {\n this.queuedRedirectEvent = event;\n handled = true;\n }\n return handled;\n }\n sendToConsumer(event, consumer) {\n var _a;\n if (event.error && !isNullRedirectEvent(event)) {\n const code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||\n \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */;\n consumer.onError(_createError(this.auth, code));\n }\n else {\n consumer.onAuthEvent(event);\n }\n }\n isEventForConsumer(event, consumer) {\n const eventIdMatches = consumer.eventId === null ||\n (!!event.eventId && event.eventId === consumer.eventId);\n return consumer.filter.includes(event.type) && eventIdMatches;\n }\n hasEventBeenHandled(event) {\n if (Date.now() - this.lastProcessedEventTime >=\n EVENT_DUPLICATION_CACHE_DURATION_MS) {\n this.cachedEventUids.clear();\n }\n return this.cachedEventUids.has(eventUid(event));\n }\n saveEventToCache(event) {\n this.cachedEventUids.add(eventUid(event));\n this.lastProcessedEventTime = Date.now();\n }\n}\nfunction eventUid(e) {\n return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-');\n}\nfunction isNullRedirectEvent({ type, error }) {\n return (type === \"unknown\" /* AuthEventType.UNKNOWN */ &&\n (error === null || error === void 0 ? void 0 : error.code) === `auth/${\"no-auth-event\" /* AuthErrorCode.NO_AUTH_EVENT */}`);\n}\nfunction isRedirectEvent(event) {\n switch (event.type) {\n case \"signInViaRedirect\" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:\n case \"linkViaRedirect\" /* AuthEventType.LINK_VIA_REDIRECT */:\n case \"reauthViaRedirect\" /* AuthEventType.REAUTH_VIA_REDIRECT */:\n return true;\n case \"unknown\" /* AuthEventType.UNKNOWN */:\n return isNullRedirectEvent(event);\n default:\n return false;\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nasync function _getProjectConfig(auth, request = {}) {\n return _performApiRequest(auth, \"GET\" /* HttpMethod.GET */, \"/v1/projects\" /* Endpoint.GET_PROJECT_CONFIG */, request);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst IP_ADDRESS_REGEX = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\nconst HTTP_REGEX = /^https?/;\nasync function _validateOrigin(auth) {\n // Skip origin validation if we are in an emulated environment\n if (auth.config.emulator) {\n return;\n }\n const { authorizedDomains } = await _getProjectConfig(auth);\n for (const domain of authorizedDomains) {\n try {\n if (matchDomain(domain)) {\n return;\n }\n }\n catch (_a) {\n // Do nothing if there's a URL error; just continue searching\n }\n }\n // In the old SDK, this error also provides helpful messages.\n _fail(auth, \"unauthorized-domain\" /* AuthErrorCode.INVALID_ORIGIN */);\n}\nfunction matchDomain(expected) {\n const currentUrl = _getCurrentUrl();\n const { protocol, hostname } = new URL(currentUrl);\n if (expected.startsWith('chrome-extension://')) {\n const ceUrl = new URL(expected);\n if (ceUrl.hostname === '' && hostname === '') {\n // For some reason we're not parsing chrome URLs properly\n return (protocol === 'chrome-extension:' &&\n expected.replace('chrome-extension://', '') ===\n currentUrl.replace('chrome-extension://', ''));\n }\n return protocol === 'chrome-extension:' && ceUrl.hostname === hostname;\n }\n if (!HTTP_REGEX.test(protocol)) {\n return false;\n }\n if (IP_ADDRESS_REGEX.test(expected)) {\n // The domain has to be exactly equal to the pattern, as an IP domain will\n // only contain the IP, no extra character.\n return hostname === expected;\n }\n // Dots in pattern should be escaped.\n const escapedDomainPattern = expected.replace(/\\./g, '\\\\.');\n // Non ip address domains.\n // domain.com = *.domain.com OR domain.com\n const re = new RegExp('^(.+\\\\.' + escapedDomainPattern + '|' + escapedDomainPattern + ')$', 'i');\n return re.test(hostname);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst NETWORK_TIMEOUT = new Delay(30000, 60000);\n/**\n * Reset unloaded GApi modules. If gapi.load fails due to a network error,\n * it will stop working after a retrial. This is a hack to fix this issue.\n */\nfunction resetUnloadedGapiModules() {\n // Clear last failed gapi.load state to force next gapi.load to first\n // load the failed gapi.iframes module.\n // Get gapix.beacon context.\n const beacon = _window().___jsl;\n // Get current hint.\n if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {\n // Get gapi hint.\n for (const hint of Object.keys(beacon.H)) {\n // Requested modules.\n beacon.H[hint].r = beacon.H[hint].r || [];\n // Loaded modules.\n beacon.H[hint].L = beacon.H[hint].L || [];\n // Set requested modules to a copy of the loaded modules.\n beacon.H[hint].r = [...beacon.H[hint].L];\n // Clear pending callbacks.\n if (beacon.CP) {\n for (let i = 0; i < beacon.CP.length; i++) {\n // Remove all failed pending callbacks.\n beacon.CP[i] = null;\n }\n }\n }\n }\n}\nfunction loadGapi(auth) {\n return new Promise((resolve, reject) => {\n var _a, _b, _c;\n // Function to run when gapi.load is ready.\n function loadGapiIframe() {\n // The developer may have tried to previously run gapi.load and failed.\n // Run this to fix that.\n resetUnloadedGapiModules();\n gapi.load('gapi.iframes', {\n callback: () => {\n resolve(gapi.iframes.getContext());\n },\n ontimeout: () => {\n // The above reset may be sufficient, but having this reset after\n // failure ensures that if the developer calls gapi.load after the\n // connection is re-established and before another attempt to embed\n // the iframe, it would work and would not be broken because of our\n // failed attempt.\n // Timeout when gapi.iframes.Iframe not loaded.\n resetUnloadedGapiModules();\n reject(_createError(auth, \"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));\n },\n timeout: NETWORK_TIMEOUT.get()\n });\n }\n if ((_b = (_a = _window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) {\n // If gapi.iframes.Iframe available, resolve.\n resolve(gapi.iframes.getContext());\n }\n else if (!!((_c = _window().gapi) === null || _c === void 0 ? void 0 : _c.load)) {\n // Gapi loader ready, load gapi.iframes.\n loadGapiIframe();\n }\n else {\n // Create a new iframe callback when this is called so as not to overwrite\n // any previous defined callback. This happens if this method is called\n // multiple times in parallel and could result in the later callback\n // overwriting the previous one. This would end up with a iframe\n // timeout.\n const cbName = _generateCallbackName('iframefcb');\n // GApi loader not available, dynamically load platform.js.\n _window()[cbName] = () => {\n // GApi loader should be ready.\n if (!!gapi.load) {\n loadGapiIframe();\n }\n else {\n // Gapi loader failed, throw error.\n reject(_createError(auth, \"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));\n }\n };\n // Load GApi loader.\n return _loadJS(`${_gapiScriptUrl()}?onload=${cbName}`)\n .catch(e => reject(e));\n }\n }).catch(error => {\n // Reset cached promise to allow for retrial.\n cachedGApiLoader = null;\n throw error;\n });\n}\nlet cachedGApiLoader = null;\nfunction _loadGapi(auth) {\n cachedGApiLoader = cachedGApiLoader || loadGapi(auth);\n return cachedGApiLoader;\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst PING_TIMEOUT = new Delay(5000, 15000);\nconst IFRAME_PATH = '__/auth/iframe';\nconst EMULATED_IFRAME_PATH = 'emulator/auth/iframe';\nconst IFRAME_ATTRIBUTES = {\n style: {\n position: 'absolute',\n top: '-100px',\n width: '1px',\n height: '1px'\n },\n 'aria-hidden': 'true',\n tabindex: '-1'\n};\n// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to\n// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.\nconst EID_FROM_APIHOST = new Map([\n [\"identitytoolkit.googleapis.com\" /* DefaultConfig.API_HOST */, 'p'], // production\n ['staging-identitytoolkit.sandbox.googleapis.com', 's'], // staging\n ['test-identitytoolkit.sandbox.googleapis.com', 't'] // test\n]);\nfunction getIframeUrl(auth) {\n const config = auth.config;\n _assert(config.authDomain, auth, \"auth-domain-config-required\" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);\n const url = config.emulator\n ? _emulatorUrl(config, EMULATED_IFRAME_PATH)\n : `https://${auth.config.authDomain}/${IFRAME_PATH}`;\n const params = {\n apiKey: config.apiKey,\n appName: auth.name,\n v: SDK_VERSION\n };\n const eid = EID_FROM_APIHOST.get(auth.config.apiHost);\n if (eid) {\n params.eid = eid;\n }\n const frameworks = auth._getFrameworks();\n if (frameworks.length) {\n params.fw = frameworks.join(',');\n }\n return `${url}?${querystring(params).slice(1)}`;\n}\nasync function _openIframe(auth) {\n const context = await _loadGapi(auth);\n const gapi = _window().gapi;\n _assert(gapi, auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n return context.open({\n where: document.body,\n url: getIframeUrl(auth),\n messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,\n attributes: IFRAME_ATTRIBUTES,\n dontclear: true\n }, (iframe) => new Promise(async (resolve, reject) => {\n await iframe.restyle({\n // Prevent iframe from closing on mouse out.\n setHideOnLeave: false\n });\n const networkError = _createError(auth, \"network-request-failed\" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);\n // Confirm iframe is correctly loaded.\n // To fallback on failure, set a timeout.\n const networkErrorTimer = _window().setTimeout(() => {\n reject(networkError);\n }, PING_TIMEOUT.get());\n // Clear timer and resolve pending iframe ready promise.\n function clearTimerAndResolve() {\n _window().clearTimeout(networkErrorTimer);\n resolve(iframe);\n }\n // This returns an IThenable. However the reject part does not call\n // when the iframe is not loaded.\n iframe.ping(clearTimerAndResolve).then(clearTimerAndResolve, () => {\n reject(networkError);\n });\n }));\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst BASE_POPUP_OPTIONS = {\n location: 'yes',\n resizable: 'yes',\n statusbar: 'yes',\n toolbar: 'no'\n};\nconst DEFAULT_WIDTH = 500;\nconst DEFAULT_HEIGHT = 600;\nconst TARGET_BLANK = '_blank';\nconst FIREFOX_EMPTY_URL = 'http://localhost';\nclass AuthPopup {\n constructor(window) {\n this.window = window;\n this.associatedEvent = null;\n }\n close() {\n if (this.window) {\n try {\n this.window.close();\n }\n catch (e) { }\n }\n }\n}\nfunction _open(auth, url, name, width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) {\n const top = Math.max((window.screen.availHeight - height) / 2, 0).toString();\n const left = Math.max((window.screen.availWidth - width) / 2, 0).toString();\n let target = '';\n const options = Object.assign(Object.assign({}, BASE_POPUP_OPTIONS), { width: width.toString(), height: height.toString(), top,\n left });\n // Chrome iOS 7 and 8 is returning an undefined popup win when target is\n // specified, even though the popup is not necessarily blocked.\n const ua = getUA().toLowerCase();\n if (name) {\n target = _isChromeIOS(ua) ? TARGET_BLANK : name;\n }\n if (_isFirefox(ua)) {\n // Firefox complains when invalid URLs are popped out. Hacky way to bypass.\n url = url || FIREFOX_EMPTY_URL;\n // Firefox disables by default scrolling on popup windows, which can create\n // issues when the user has many Google accounts, for instance.\n options.scrollbars = 'yes';\n }\n const optionsString = Object.entries(options).reduce((accum, [key, value]) => `${accum}${key}=${value},`, '');\n if (_isIOSStandalone(ua) && target !== '_self') {\n openAsNewWindowIOS(url || '', target);\n return new AuthPopup(null);\n }\n // about:blank getting sanitized causing browsers like IE/Edge to display\n // brief error message before redirecting to handler.\n const newWin = window.open(url || '', target, optionsString);\n _assert(newWin, auth, \"popup-blocked\" /* AuthErrorCode.POPUP_BLOCKED */);\n // Flaky on IE edge, encapsulate with a try and catch.\n try {\n newWin.focus();\n }\n catch (e) { }\n return new AuthPopup(newWin);\n}\nfunction openAsNewWindowIOS(url, target) {\n const el = document.createElement('a');\n el.href = url;\n el.target = target;\n const click = document.createEvent('MouseEvent');\n click.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 1, null);\n el.dispatchEvent(click);\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * URL for Authentication widget which will initiate the OAuth handshake\n *\n * @internal\n */\nconst WIDGET_PATH = '__/auth/handler';\n/**\n * URL for emulated environment\n *\n * @internal\n */\nconst EMULATOR_WIDGET_PATH = 'emulator/auth/handler';\n/**\n * Fragment name for the App Check token that gets passed to the widget\n *\n * @internal\n */\nconst FIREBASE_APP_CHECK_FRAGMENT_ID = encodeURIComponent('fac');\nasync function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {\n _assert(auth.config.authDomain, auth, \"auth-domain-config-required\" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);\n _assert(auth.config.apiKey, auth, \"invalid-api-key\" /* AuthErrorCode.INVALID_API_KEY */);\n const params = {\n apiKey: auth.config.apiKey,\n appName: auth.name,\n authType,\n redirectUrl,\n v: SDK_VERSION,\n eventId\n };\n if (provider instanceof FederatedAuthProvider) {\n provider.setDefaultLanguage(auth.languageCode);\n params.providerId = provider.providerId || '';\n if (!isEmpty$1(provider.getCustomParameters())) {\n params.customParameters = JSON.stringify(provider.getCustomParameters());\n }\n // TODO set additionalParams from the provider as well?\n for (const [key, value] of Object.entries({})) {\n params[key] = value;\n }\n }\n if (provider instanceof BaseOAuthProvider) {\n const scopes = provider.getScopes().filter(scope => scope !== '');\n if (scopes.length > 0) {\n params.scopes = scopes.join(',');\n }\n }\n if (auth.tenantId) {\n params.tid = auth.tenantId;\n }\n // TODO: maybe set eid as endpointId\n // TODO: maybe set fw as Frameworks.join(\",\")\n const paramsDict = params;\n for (const key of Object.keys(paramsDict)) {\n if (paramsDict[key] === undefined) {\n delete paramsDict[key];\n }\n }\n // Sets the App Check token to pass to the widget\n const appCheckToken = await auth._getAppCheckToken();\n const appCheckTokenFragment = appCheckToken\n ? `#${FIREBASE_APP_CHECK_FRAGMENT_ID}=${encodeURIComponent(appCheckToken)}`\n : '';\n // Start at index 1 to skip the leading '&' in the query string\n return `${getHandlerBase(auth)}?${querystring(paramsDict).slice(1)}${appCheckTokenFragment}`;\n}\nfunction getHandlerBase({ config }) {\n if (!config.emulator) {\n return `https://${config.authDomain}/${WIDGET_PATH}`;\n }\n return _emulatorUrl(config, EMULATOR_WIDGET_PATH);\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The special web storage event\n *\n */\nconst WEB_STORAGE_SUPPORT_KEY = 'webStorageSupport';\nclass BrowserPopupRedirectResolver {\n constructor() {\n this.eventManagers = {};\n this.iframes = {};\n this.originValidationPromises = {};\n this._redirectPersistence = browserSessionPersistence;\n this._completeRedirectFn = _getRedirectResult;\n this._overrideRedirectResult = _overrideRedirectResult;\n }\n // Wrapping in async even though we don't await anywhere in order\n // to make sure errors are raised as promise rejections\n async _openPopup(auth, provider, authType, eventId) {\n var _a;\n debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()');\n const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);\n return _open(auth, url, _generateEventId());\n }\n async _openRedirect(auth, provider, authType, eventId) {\n await this._originValidation(auth);\n const url = await _getRedirectUrl(auth, provider, authType, _getCurrentUrl(), eventId);\n _setWindowLocation(url);\n return new Promise(() => { });\n }\n _initialize(auth) {\n const key = auth._key();\n if (this.eventManagers[key]) {\n const { manager, promise } = this.eventManagers[key];\n if (manager) {\n return Promise.resolve(manager);\n }\n else {\n debugAssert(promise, 'If manager is not set, promise should be');\n return promise;\n }\n }\n const promise = this.initAndGetManager(auth);\n this.eventManagers[key] = { promise };\n // If the promise is rejected, the key should be removed so that the\n // operation can be retried later.\n promise.catch(() => {\n delete this.eventManagers[key];\n });\n return promise;\n }\n async initAndGetManager(auth) {\n const iframe = await _openIframe(auth);\n const manager = new AuthEventManager(auth);\n iframe.register('authEvent', (iframeEvent) => {\n _assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, \"invalid-auth-event\" /* AuthErrorCode.INVALID_AUTH_EVENT */);\n // TODO: Consider splitting redirect and popup events earlier on\n const handled = manager.onEvent(iframeEvent.authEvent);\n return { status: handled ? \"ACK\" /* GapiOutcome.ACK */ : \"ERROR\" /* GapiOutcome.ERROR */ };\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\n this.eventManagers[auth._key()] = { manager };\n this.iframes[auth._key()] = iframe;\n return manager;\n }\n _isIframeWebStorageSupported(auth, cb) {\n const iframe = this.iframes[auth._key()];\n iframe.send(WEB_STORAGE_SUPPORT_KEY, { type: WEB_STORAGE_SUPPORT_KEY }, result => {\n var _a;\n const isSupported = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a[WEB_STORAGE_SUPPORT_KEY];\n if (isSupported !== undefined) {\n cb(!!isSupported);\n }\n _fail(auth, \"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n }, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);\n }\n _originValidation(auth) {\n const key = auth._key();\n if (!this.originValidationPromises[key]) {\n this.originValidationPromises[key] = _validateOrigin(auth);\n }\n return this.originValidationPromises[key];\n }\n get _shouldInitProactively() {\n // Mobile browsers and Safari need to optimistically initialize\n return _isMobileBrowser() || _isSafari() || _isIOS();\n }\n}\n/**\n * An implementation of {@link PopupRedirectResolver} suitable for browser\n * based applications.\n *\n * @remarks\n * This method does not work in a Node.js environment.\n *\n * @public\n */\nconst browserPopupRedirectResolver = BrowserPopupRedirectResolver;\n\nvar name = \"@firebase/auth\";\nvar version = \"1.10.8\";\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass AuthInterop {\n constructor(auth) {\n this.auth = auth;\n this.internalListeners = new Map();\n }\n getUid() {\n var _a;\n this.assertAuthConfigured();\n return ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.uid) || null;\n }\n async getToken(forceRefresh) {\n this.assertAuthConfigured();\n await this.auth._initializationPromise;\n if (!this.auth.currentUser) {\n return null;\n }\n const accessToken = await this.auth.currentUser.getIdToken(forceRefresh);\n return { accessToken };\n }\n addAuthTokenListener(listener) {\n this.assertAuthConfigured();\n if (this.internalListeners.has(listener)) {\n return;\n }\n const unsubscribe = this.auth.onIdTokenChanged(user => {\n listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);\n });\n this.internalListeners.set(listener, unsubscribe);\n this.updateProactiveRefresh();\n }\n removeAuthTokenListener(listener) {\n this.assertAuthConfigured();\n const unsubscribe = this.internalListeners.get(listener);\n if (!unsubscribe) {\n return;\n }\n this.internalListeners.delete(listener);\n unsubscribe();\n this.updateProactiveRefresh();\n }\n assertAuthConfigured() {\n _assert(this.auth._initializationPromise, \"dependent-sdk-initialized-before-auth\" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);\n }\n updateProactiveRefresh() {\n if (this.internalListeners.size > 0) {\n this.auth._startProactiveRefresh();\n }\n else {\n this.auth._stopProactiveRefresh();\n }\n }\n}\n\n/**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction getVersionForPlatform(clientPlatform) {\n switch (clientPlatform) {\n case \"Node\" /* ClientPlatform.NODE */:\n return 'node';\n case \"ReactNative\" /* ClientPlatform.REACT_NATIVE */:\n return 'rn';\n case \"Worker\" /* ClientPlatform.WORKER */:\n return 'webworker';\n case \"Cordova\" /* ClientPlatform.CORDOVA */:\n return 'cordova';\n case \"WebExtension\" /* ClientPlatform.WEB_EXTENSION */:\n return 'web-extension';\n default:\n return undefined;\n }\n}\n/** @internal */\nfunction registerAuth(clientPlatform) {\n _registerComponent(new Component(\"auth\" /* _ComponentName.AUTH */, (container, { options: deps }) => {\n const app = container.getProvider('app').getImmediate();\n const heartbeatServiceProvider = container.getProvider('heartbeat');\n const appCheckServiceProvider = container.getProvider('app-check-internal');\n const { apiKey, authDomain } = app.options;\n _assert(apiKey && !apiKey.includes(':'), \"invalid-api-key\" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });\n const config = {\n apiKey,\n authDomain,\n clientPlatform,\n apiHost: \"identitytoolkit.googleapis.com\" /* DefaultConfig.API_HOST */,\n tokenApiHost: \"securetoken.googleapis.com\" /* DefaultConfig.TOKEN_API_HOST */,\n apiScheme: \"https\" /* DefaultConfig.API_SCHEME */,\n sdkClientVersion: _getClientVersion(clientPlatform)\n };\n const authInstance = new AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config);\n _initializeAuthInstance(authInstance, deps);\n return authInstance;\n }, \"PUBLIC\" /* ComponentType.PUBLIC */)\n /**\n * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()\n * For why we do this, See go/firebase-next-auth-init\n */\n .setInstantiationMode(\"EXPLICIT\" /* InstantiationMode.EXPLICIT */)\n /**\n * Because all firebase products that depend on auth depend on auth-internal directly,\n * we need to initialize auth-internal after auth is initialized to make it available to other firebase products.\n */\n .setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => {\n const authInternalProvider = container.getProvider(\"auth-internal\" /* _ComponentName.AUTH_INTERNAL */);\n authInternalProvider.initialize();\n }));\n _registerComponent(new Component(\"auth-internal\" /* _ComponentName.AUTH_INTERNAL */, container => {\n const auth = _castAuth(container.getProvider(\"auth\" /* _ComponentName.AUTH */).getImmediate());\n return (auth => new AuthInterop(auth))(auth);\n }, \"PRIVATE\" /* ComponentType.PRIVATE */).setInstantiationMode(\"EXPLICIT\" /* InstantiationMode.EXPLICIT */));\n registerVersion(name, version, getVersionForPlatform(clientPlatform));\n // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation\n registerVersion(name, version, 'esm2017');\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DEFAULT_ID_TOKEN_MAX_AGE = 5 * 60;\nconst authIdTokenMaxAge = getExperimentalSetting('authIdTokenMaxAge') || DEFAULT_ID_TOKEN_MAX_AGE;\nlet lastPostedIdToken = null;\nconst mintCookieFactory = (url) => async (user) => {\n const idTokenResult = user && (await user.getIdTokenResult());\n const idTokenAge = idTokenResult &&\n (new Date().getTime() - Date.parse(idTokenResult.issuedAtTime)) / 1000;\n if (idTokenAge && idTokenAge > authIdTokenMaxAge) {\n return;\n }\n // Specifically trip null => undefined when logged out, to delete any existing cookie\n const idToken = idTokenResult === null || idTokenResult === void 0 ? void 0 : idTokenResult.token;\n if (lastPostedIdToken === idToken) {\n return;\n }\n lastPostedIdToken = idToken;\n await fetch(url, {\n method: idToken ? 'POST' : 'DELETE',\n headers: idToken\n ? {\n 'Authorization': `Bearer ${idToken}`\n }\n : {}\n });\n};\n/**\n * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.\n * If no instance exists, initializes an Auth instance with platform-specific default dependencies.\n *\n * @param app - The Firebase App.\n *\n * @public\n */\nfunction getAuth(app = getApp()) {\n const provider = _getProvider(app, 'auth');\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n const auth = initializeAuth(app, {\n popupRedirectResolver: browserPopupRedirectResolver,\n persistence: [\n indexedDBLocalPersistence,\n browserLocalPersistence,\n browserSessionPersistence\n ]\n });\n const authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');\n // Only do the Cookie exchange in a secure context\n if (authTokenSyncPath &&\n typeof isSecureContext === 'boolean' &&\n isSecureContext) {\n // Don't allow urls (XSS possibility), only paths on the same domain\n const authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);\n if (location.origin === authTokenSyncUrl.origin) {\n const mintCookie = mintCookieFactory(authTokenSyncUrl.toString());\n beforeAuthStateChanged(auth, mintCookie, () => mintCookie(auth.currentUser));\n onIdTokenChanged(auth, user => mintCookie(user));\n }\n }\n const authEmulatorHost = getDefaultEmulatorHost('auth');\n if (authEmulatorHost) {\n connectAuthEmulator(auth, `http://${authEmulatorHost}`);\n }\n return auth;\n}\nfunction getScriptParentElement() {\n var _a, _b;\n return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;\n}\n_setExternalJSProvider({\n loadJS(url) {\n // TODO: consider adding timeout support & cancellation\n return new Promise((resolve, reject) => {\n const el = document.createElement('script');\n el.setAttribute('src', url);\n el.onload = resolve;\n el.onerror = e => {\n const error = _createError(\"internal-error\" /* AuthErrorCode.INTERNAL_ERROR */);\n error.customData = e;\n reject(error);\n };\n el.type = 'text/javascript';\n el.charset = 'UTF-8';\n getScriptParentElement().appendChild(el);\n });\n },\n gapiScript: 'https://apis.google.com/js/api.js',\n recaptchaV2Script: 'https://www.google.com/recaptcha/api.js',\n recaptchaEnterpriseScript: 'https://www.google.com/recaptcha/enterprise.js?render='\n});\nregisterAuth(\"Browser\" /* ClientPlatform.BROWSER */);\n\nconst fromFirebaseDate = (date) => {\n return dayjs(date.seconds * 1000);\n};\n\nclass AvatarNotCreatedError extends Error {\n constructor() {\n super('Avatar not created');\n this.name = 'AvatarNotCreatedError';\n }\n}\nclass UserNotLoggedInError extends Error {\n constructor() {\n super('user not logged in');\n this.name = 'UserNotLoggedInError';\n }\n}\nclass NoColorwaySizeAssetsFoundError extends Error {\n constructor() {\n super('no colorway size assets found');\n this.name = 'NoColorwaySizeAssetsFoundError';\n }\n}\nclass BrandUserIdNotSetError extends Error {\n constructor() {\n super('brand user id not set');\n this.name = 'BrandUserIdNotSetError';\n }\n}\nclass NoFramesFoundError extends Error {\n constructor() {\n super('no frames found');\n this.name = 'NoFramesFoundError';\n }\n}\nclass RecommendedAvailableSizesError extends Error {\n constructor(recommended_size, available_sizes) {\n super('recommended available sizes error');\n this.name = 'RecommendedAvailableSizesError';\n this.recommended_size = recommended_size;\n this.available_sizes = available_sizes;\n }\n}\nclass NoStylesFoundError extends Error {\n constructor() {\n super('no styles found');\n this.name = 'NoStylesFoundError';\n }\n}\n// Backend responses\nconst AvatarNotCreated = 'avatar not created';\n\nvar errors = /*#__PURE__*/Object.freeze({\n __proto__: null,\n AvatarNotCreated: AvatarNotCreated,\n AvatarNotCreatedError: AvatarNotCreatedError,\n BrandUserIdNotSetError: BrandUserIdNotSetError,\n NoColorwaySizeAssetsFoundError: NoColorwaySizeAssetsFoundError,\n NoFramesFoundError: NoFramesFoundError,\n NoStylesFoundError: NoStylesFoundError,\n RecommendedAvailableSizesError: RecommendedAvailableSizesError,\n UserNotLoggedInError: UserNotLoggedInError\n});\n\nclass FirebaseUser {\n constructor(firestore, app) {\n this.firestore = firestore;\n this.brandUserId = null;\n this.auth = getAuth(app);\n this.auth.setPersistence(browserLocalPersistence);\n }\n get id() {\n var _a;\n return (_a = this.user) === null || _a === void 0 ? void 0 : _a.uid;\n }\n async onInit(brandId) {\n this.auth.onAuthStateChanged((user) => {\n this.setUser(user);\n if (!user)\n return;\n this.logUserLogin(brandId, user);\n this.setBrandUserId(user.uid);\n });\n await this.auth.authStateReady();\n const user = this.auth.currentUser;\n this.setUser(user);\n this.setBrandUserId(user === null || user === void 0 ? void 0 : user.uid);\n return Boolean(user);\n }\n setUser(user) {\n this.user = user;\n }\n async logUserLogin(brandId, user) {\n var _a, _b, _c, _d, _e;\n try {\n const userLoggingDoc = doc(this.firestore, 'user_logging', user.uid);\n const savedDoc = await getDoc(userLoggingDoc);\n const lastLogin = new Date();\n const savedData = savedDoc.exists ? savedDoc.data() : null;\n const lastBrandLogin = (_b = (_a = savedData === null || savedData === void 0 ? void 0 : savedData.brands) === null || _a === void 0 ? void 0 : _a[brandId]) === null || _b === void 0 ? void 0 : _b.last_login;\n if (lastBrandLogin && dayjs(lastLogin).diff(fromFirebaseDate(lastBrandLogin), 'seconds') <= 10080)\n return;\n const logins = (_e = (_d = (_c = savedData === null || savedData === void 0 ? void 0 : savedData.brands) === null || _c === void 0 ? void 0 : _c[brandId]) === null || _d === void 0 ? void 0 : _d.logins) !== null && _e !== void 0 ? _e : [];\n logins.push(lastLogin);\n const userLoggingData = {\n brands: {\n [brandId]: {\n brand_id: brandId,\n last_login: lastLogin,\n logins,\n },\n },\n last_brand_id: brandId,\n created_at: !savedDoc.exists() ? lastLogin : savedDoc.data().created_at,\n updated_at: lastLogin,\n };\n await setDoc(userLoggingDoc, userLoggingData, { merge: true });\n }\n catch (e) {\n console.error('LOGGING ERROR:', e);\n }\n }\n setBrandUserId(brandUserId) {\n this.brandUserId = brandUserId;\n }\n async getToken() {\n var _a;\n if (!((_a = this.user) === null || _a === void 0 ? void 0 : _a.uid))\n throw new UserNotLoggedInError();\n const token = await this.user.getIdToken();\n return token;\n }\n get userId() {\n var _a;\n if (!((_a = this.user) === null || _a === void 0 ? void 0 : _a.uid))\n throw new UserNotLoggedInError();\n return this.user.uid;\n }\n async getUserProfile() {\n var _a;\n if (!((_a = this.user) === null || _a === void 0 ? void 0 : _a.uid))\n throw new UserNotLoggedInError();\n const userProfile = await getDoc(doc(this.firestore, 'users', this.id));\n return userProfile.data();\n }\n watchUserProfileForChanges(callback) {\n let unsub;\n const q = query(collection(this.firestore, 'users'), where(documentId(), '==', this.id));\n unsub = onSnapshot(q, (snapshot) => callback(snapshot.docs[0].data()));\n return () => unsub();\n }\n watchUserProfileForFrames(predicate) {\n let unsub;\n const q = query(collection(this.firestore, 'users'), where(documentId(), '==', this.id));\n return new Promise((resolve) => {\n unsub = onSnapshot(q, async (snapshot) => {\n if (!(await predicate(snapshot)))\n return;\n unsub();\n resolve(snapshot.docs[0].data());\n });\n });\n }\n async login(username, password) {\n if (this.auth.currentUser)\n await this.auth.signOut();\n const user = await signInWithEmailAndPassword(this.auth, username, password);\n this.setUser(user.user);\n }\n async logout() {\n await this.auth.signOut();\n this.setUser(null);\n }\n async sendPasswordResetEmail(email) {\n await sendPasswordResetEmail(this.auth, email);\n }\n async confirmPasswordReset(code, newPassword) {\n await confirmPasswordReset(this.auth, code, newPassword);\n }\n}\n\nclass Firebase {\n constructor() {\n this.promisefyOnSnapshot = (q, unsubscribeWhenData) => {\n let unsub;\n const promise = new Promise((resolve) => {\n unsub = onSnapshot(q, (snapshot) => {\n resolve(snapshot);\n if (unsubscribeWhenData)\n unsub();\n });\n });\n return { promise, unsubscribe: () => unsub() };\n };\n const firebaseKeys = Config.getInstance().firebase;\n const firebaseApp = initializeApp(firebaseKeys);\n this.firestore = getFirestore(firebaseApp);\n this.user = new FirebaseUser(this.firestore, firebaseApp);\n }\n onInit(brandId) {\n return this.user.onInit(brandId);\n }\n query(collectionName, constraint, unsubscribeWhenData = true) {\n const q = query(collection(this.firestore, collectionName), constraint);\n return this.promisefyOnSnapshot(q, unsubscribeWhenData);\n }\n getDocs(collectionName, constraints) {\n const q = query(collection(this.firestore, collectionName), ...constraints);\n return getDocs(q);\n }\n async getDoc(collectionName, id) {\n const docRef = doc(this.firestore, collectionName, id);\n const docSnap = await getDoc(docRef);\n return docSnap.exists() ? docSnap.data() : null;\n }\n}\n\nconst getFirebaseError = (e) => {\n switch (e.code) {\n case AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY.USER_DISABLED:\n throw new Error('account has been disabled');\n default:\n throw new Error(e.message);\n }\n};\n\nconst asyncTry = (promise) => promise.then((data) => [null, data]).catch((error) => [error]);\n\nclass Fetcher {\n static get endpoint() {\n const api = Config.getInstance().api;\n return api.url;\n }\n static async Fetch({ user, endpointPath, method, body, useToken = true }) {\n const url = this.getUrl(endpointPath, useToken);\n const headers = await this.getHeaders(user, useToken);\n const config = { method, headers, credentials: 'omit' };\n if (body)\n config.body = JSON.stringify(body);\n const res = await fetch(url, config);\n if (res.ok)\n return res;\n if (res.status === 500)\n throw new Error(res.statusText);\n const json = await res.json();\n return Promise.reject(json);\n }\n static getUrl(endpointPath, useToken) {\n return useToken ? `${this.endpoint}/v1${endpointPath}` : this.endpoint + endpointPath;\n }\n static async getHeaders(user, useToken) {\n if (!useToken)\n return { 'Content-Type': 'application/json' };\n const token = await user.getToken();\n return {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n };\n }\n static Get(user, endpointPath, useToken) {\n return this.Fetch({ user, endpointPath, method: 'GET', body: null, useToken });\n }\n static Post(user, endpointPath, body = null, useToken) {\n return this.Fetch({ user, endpointPath, method: 'POST', body, useToken });\n }\n static Put(user, endpointPath, body, useToken) {\n return this.Fetch({ user, endpointPath, method: 'PUT', body, useToken });\n }\n static Patch(user, endpointPath, body, useToken) {\n return this.Fetch({ user, endpointPath, method: 'PATCH', body, useToken });\n }\n static Delete(user, endpointPath, body, useToken) {\n return this.Fetch({ user, endpointPath, method: 'DELETE', body, useToken });\n }\n}\n\nconst testImage = (url) => {\n const img = new Image();\n img.src = url;\n return new Promise((resolve) => {\n img.onerror = () => resolve(false);\n img.onload = () => resolve(true);\n });\n};\n\nclass TfrShop {\n constructor(brandId, firebase) {\n this.brandId = brandId;\n this.firebase = firebase;\n this.measurementLocations = new Map();\n }\n get user() {\n return this.firebase.user;\n }\n get isLoggedIn() {\n return !this.firebase || Boolean(this.user.id);\n }\n async onInit() {\n await this.getMeasurementLocations();\n return this.firebase.onInit(this.brandId);\n }\n async getRecommendedSizes(styleId) {\n var _a, _b;\n if (!this.isLoggedIn)\n throw new UserNotLoggedInError();\n try {\n const res = await Fetcher.Get(this.user, `/styles/${styleId}/recommendation`);\n const data = (await res.json());\n if (!((_a = data === null || data === void 0 ? void 0 : data.fits) === null || _a === void 0 ? void 0 : _a.length) || !((_b = data === null || data === void 0 ? void 0 : data.recommended_size) === null || _b === void 0 ? void 0 : _b.id))\n return null;\n return data;\n }\n catch (error) {\n if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)\n throw new AvatarNotCreatedError();\n throw error;\n }\n }\n async submitTelephoneNumber(tel) {\n const sanitizedTel = tel.replace(/[^\\+0-9]/g, '');\n const res = await Fetcher.Post(this.user, '/ios-app-link', { phone_number: sanitizedTel }, false);\n console.log(res);\n }\n async getColorwaySizeAssetFromSku(colorwaySizeAssetSku) {\n const assets = await this.getColorwaySizeAssets(null, [colorwaySizeAssetSku]);\n if (!(assets === null || assets === void 0 ? void 0 : assets.size))\n throw new NoColorwaySizeAssetsFoundError();\n return Array.from(assets.values())[0];\n }\n async getColorwaySizeAssetFromBrandStyleId(brandStyleId) {\n const assets = await this.getColorwaySizeAssets(brandStyleId);\n if (!(assets === null || assets === void 0 ? void 0 : assets.size))\n throw new NoColorwaySizeAssetsFoundError();\n return Array.from(assets.values())[0];\n }\n async getMeasurementLocationsFromSku(sku, filledLocations = []) {\n console.log({ sku });\n const asset = await this.getColorwaySizeAssetFromSku(sku);\n if (!asset)\n throw new Error('No colorway size asset found for sku');\n const styleCategory = await this.getStyle(asset.style_id);\n if (!styleCategory)\n throw new Error('Style category not found for style id');\n const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);\n if (!taxonomy)\n throw new Error('Taxonomy not found for style garment category id');\n const filteredLocations = !filledLocations.length\n ? taxonomy.measurement_locations.female\n : taxonomy.measurement_locations.female.filter((location) => filledLocations.includes(location));\n const locationsWithSortOrder = filteredLocations.map((location) => {\n return this.measurementLocations.has(location)\n ? this.measurementLocations.get(location)\n : { name: location, sort_order: Infinity };\n });\n return locationsWithSortOrder\n .sort((a, b) => (a.sort_order < b.sort_order ? -1 : 0))\n .map((location) => location.name);\n }\n async getMeasurementLocationsFromBrandStyleId(brandStyleId, filledLocations = []) {\n const asset = await this.getColorwaySizeAssetFromBrandStyleId(brandStyleId);\n if (!asset)\n throw new Error('No colorway size asset found for brand style id');\n const styleCategory = await this.getStyle(asset.style_id);\n if (!styleCategory)\n throw new Error('Style category not found for style id');\n const taxonomy = await this.getGetTaxonomy(styleCategory.style_garment_category_id);\n if (!taxonomy)\n throw new Error('Taxonomy not found for style garment category id');\n const filteredLocations = !filledLocations.length\n ? taxonomy.measurement_locations.female\n : taxonomy.measurement_locations.female.filter((location) => filledLocations.includes(location));\n const locationsWithSortOrder = filteredLocations.map((location) => {\n return this.measurementLocations.has(location)\n ? this.measurementLocations.get(location)\n : { name: location, sort_order: Infinity };\n });\n return locationsWithSortOrder\n .sort((a, b) => (a.sort_order < b.sort_order ? -1 : 0))\n .map((location) => location.name);\n }\n async getStyleByBrandStyleId(brandStyleId) {\n var _a, _b;\n try {\n const constraints = [where('brand_id', '==', this.brandId)];\n constraints.push(where('brand_style_id', '==', brandStyleId));\n const querySnapshot = await this.firebase.getDocs('styles', constraints);\n return (_b = (_a = querySnapshot.docs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.data();\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n async getColorwaySizeAssets(styleId, skus) {\n const constraints = [where('brand_id', '==', this.brandId)];\n if (styleId)\n constraints.push(where('style_id', '==', styleId));\n if ((skus === null || skus === void 0 ? void 0 : skus.length) > 0)\n constraints.push(where('sku', 'in', skus));\n try {\n const querySnapshot = await this.firebase.getDocs('colorway_size_assets', constraints);\n const colorwaySizeAssets = new Map();\n querySnapshot.forEach((doc) => {\n const colorwaySizeAsset = doc.data();\n colorwaySizeAssets.set(colorwaySizeAsset.id, colorwaySizeAsset);\n });\n return colorwaySizeAssets;\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n async getStyle(styleId) {\n try {\n const doc = await this.firebase.getDoc('styles', String(styleId));\n return doc;\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n getMeasurementLocationName(location) {\n return this.measurementLocations.has(location) ? this.measurementLocations.get(location).name : location;\n }\n getMeasurementLocationSortOrder(location) {\n return this.measurementLocations.has(location) ? this.measurementLocations.get(location).sort_order : Infinity;\n }\n async tryOn(styleId, sizeId) {\n if (!this.isLoggedIn)\n throw new UserNotLoggedInError();\n const colorwaySizeAssetSku = await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(styleId, sizeId);\n try {\n const frames = await this.getColorwaySizeAssetFrames(colorwaySizeAssetSku);\n return frames;\n }\n catch (error) {\n if (!(error instanceof NoFramesFoundError))\n throw error;\n return this.requestThenGetColorwaySizeAssetFrames(colorwaySizeAssetSku);\n }\n }\n async getColorwaySizeAssetSkuFromStyleIdAndSizeId(styleId, sizeId) {\n var _a, _b, _c;\n try {\n const constraints = [where('brand_id', '==', this.brandId)];\n constraints.push(where('style_id', '==', styleId));\n constraints.push(where('size_id', '==', sizeId));\n const querySnapshot = await this.firebase.getDocs('colorway_size_assets', constraints);\n return (_c = (_b = (_a = querySnapshot.docs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.data()) === null || _c === void 0 ? void 0 : _c.sku;\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n async getGetTaxonomy(styleId) {\n try {\n const doc = await this.firebase.getDoc('style_garment_categories', String(styleId));\n return doc;\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n async getMeasurementLocations() {\n const locations = await this.fetchMeasurementLocations();\n locations.forEach((location) => {\n this.measurementLocations.set(location.name, { name: location.garment_label, sort_order: location.sort_order });\n });\n }\n async fetchMeasurementLocations() {\n try {\n const docs = await this.firebase.getDocs('measurement_locations', []);\n return docs.docs.map((doc) => doc.data());\n }\n catch (error) {\n return getFirebaseError(error);\n }\n }\n async requestThenGetColorwaySizeAssetFrames(colorwaySizeAssetSku) {\n const [error, colorwaySizeAsset] = await asyncTry(this.getColorwaySizeAssetFromSku(colorwaySizeAssetSku));\n if (error)\n throw error;\n try {\n try {\n this.requestColorwaySizeAssetFrames(colorwaySizeAsset.id);\n }\n catch (_a) { }\n return this.awaitColorwaySizeAssetFrames(colorwaySizeAssetSku);\n }\n catch (error) {\n if ((error === null || error === void 0 ? void 0 : error.error) === AvatarNotCreated)\n throw new AvatarNotCreatedError();\n throw new NoStylesFoundError();\n }\n }\n async awaitColorwaySizeAssetFrames(colorwaySizeAssetSKU) {\n var _a, _b, _c, _d;\n if (!this.isLoggedIn)\n throw new UserNotLoggedInError();\n const callback = async (data) => {\n var _a, _b, _c, _d;\n const frames = (_d = (_c = (_b = (_a = data.docs[0].data()) === null || _a === void 0 ? void 0 : _a.vto) === null || _b === void 0 ? void 0 : _b[this.brandId]) === null || _c === void 0 ? void 0 : _c[colorwaySizeAssetSKU]) === null || _d === void 0 ? void 0 : _d.frames;\n if (!(frames === null || frames === void 0 ? void 0 : frames.length))\n return false;\n return testImage(frames[0]);\n };\n const userProfile = (await this.user.watchUserProfileForFrames(callback));\n if (!((_d = (_c = (_b = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.vto) === null || _a === void 0 ? void 0 : _a[this.brandId]) === null || _b === void 0 ? void 0 : _b[colorwaySizeAssetSKU]) === null || _c === void 0 ? void 0 : _c.frames) === null || _d === void 0 ? void 0 : _d.length))\n throw new NoFramesFoundError();\n return userProfile.vto[this.brandId][colorwaySizeAssetSKU].frames;\n }\n async requestColorwaySizeAssetFrames(colorwaySizeAssetId) {\n if (!this.isLoggedIn)\n throw new UserNotLoggedInError();\n if (!this.user.brandUserId)\n throw new BrandUserIdNotSetError();\n await Fetcher.Post(this.user, `/colorway-size-assets/${colorwaySizeAssetId}/frames`, {\n brand_user_id: String(this.user.brandUserId),\n });\n }\n async getColorwaySizeAssetFrames(colorwaySizeAssetSKU) {\n var _a, _b, _c;\n const userProfile = await this.user.getUserProfile();\n const frames = ((_c = (_b = (_a = userProfile === null || userProfile === void 0 ? void 0 : userProfile.vto) === null || _a === void 0 ? void 0 : _a[this.brandId]) === null || _b === void 0 ? void 0 : _b[colorwaySizeAssetSKU]) === null || _c === void 0 ? void 0 : _c.frames) || [];\n if (!frames.length)\n throw new NoFramesFoundError();\n const testedImage = await testImage(frames[0]);\n if (!testedImage)\n throw new NoFramesFoundError();\n return frames;\n }\n}\nconst initShop = (brandId, env = 'dev') => {\n if (env === 'dev' || env === 'development')\n console.warn('TfrShop is in development mode');\n Config.getInstance().setEnv(env);\n return new TfrShop(brandId, new Firebase());\n};\n\nvar MeasurementLocation;\n(function (MeasurementLocation) {\n MeasurementLocation[\"ACROSS_BACK\"] = \"across_back\";\n MeasurementLocation[\"ACROSS_FRONT\"] = \"across_front\";\n MeasurementLocation[\"ACROSS_SHOULDER\"] = \"across_shoulder\";\n MeasurementLocation[\"ANKLE\"] = \"ankle\";\n MeasurementLocation[\"ARMEYE\"] = \"arm_eye\";\n MeasurementLocation[\"ARM_LENGTH_FROM_SHOULDER\"] = \"arm_length_from_shoulder\";\n MeasurementLocation[\"BACK_CROTCH_LENGTH\"] = \"back_crotch_length\";\n MeasurementLocation[\"BACK_NECK_TO_EBLOW\"] = \"back_neck_to_elbow\";\n MeasurementLocation[\"BELOW_KNEE\"] = \"below_knee\";\n MeasurementLocation[\"BICEP\"] = \"bicep\";\n MeasurementLocation[\"BUST\"] = \"bust\";\n MeasurementLocation[\"BUST_POINT_TO_BUST_POINT\"] = \"bust_point_to_bust_point\";\n MeasurementLocation[\"CALF\"] = \"calf\";\n MeasurementLocation[\"CB_NECK_TO_WAIST\"] = \"cb_neck_to_waist\";\n MeasurementLocation[\"CB_NECK_TO_WRIST\"] = \"cb_neck_to_wrist\";\n MeasurementLocation[\"CF_NECK_TO_WAIST\"] = \"cf_neck_to_waist\";\n MeasurementLocation[\"ELBOW\"] = \"elbow\";\n MeasurementLocation[\"FOREARM\"] = \"forearm\";\n MeasurementLocation[\"FRONT_CROTCH_LENGTH\"] = \"front_crotch_length\";\n MeasurementLocation[\"HIGH_HIP_PLACEMENT_FROM_WAIST\"] = \"high_hip_placement\";\n MeasurementLocation[\"HIGH_HIP\"] = \"high_hip\";\n MeasurementLocation[\"HSP_TO_ACROSS_BACK\"] = \"hsp_to_across_back\";\n MeasurementLocation[\"HSP_TO_ACROSS_FRONT\"] = \"hsp_to_across_front\";\n MeasurementLocation[\"HSP_TO_BUST_POINT\"] = \"hsp_to_bust_point\";\n MeasurementLocation[\"HSP_TO_LOW_HIP_POSITION\"] = \"hsp_to_low_hip_position\";\n MeasurementLocation[\"HSP_TO_WAIST_POSITION\"] = \"hsp_to_waist_position\";\n MeasurementLocation[\"INSEAM\"] = \"inseam\";\n MeasurementLocation[\"KNEE\"] = \"knee\";\n MeasurementLocation[\"LOW_HIP\"] = \"low_hip\";\n MeasurementLocation[\"LOW_HIP_PLACEMENT_FROM_WAIST\"] = \"low_hip_placement\";\n MeasurementLocation[\"MID_NECK\"] = \"mid_neck\";\n MeasurementLocation[\"NECK_AT_BASE\"] = \"neck_base\";\n MeasurementLocation[\"SHOULDER_DROP\"] = \"shoulder_drop\";\n MeasurementLocation[\"SHOULDER_TO_SHOULDER\"] = \"shoulder_to_shoulder\";\n MeasurementLocation[\"SIDE_WAIST_TO_FLOOR\"] = \"side_waist_to_floor\";\n MeasurementLocation[\"SIDE_WAIST_TO_KNEE\"] = \"side_waist_to_knee\";\n MeasurementLocation[\"THIGH\"] = \"thigh\";\n MeasurementLocation[\"TOTAL_RISE_LENGTH\"] = \"total_rise_length\";\n MeasurementLocation[\"UNDER_BUST\"] = \"under_bust\";\n MeasurementLocation[\"VERTICAL_TRUNK\"] = \"vertical_trunk\";\n MeasurementLocation[\"WAIST\"] = \"waist\";\n MeasurementLocation[\"WRIST\"] = \"wrist\";\n})(MeasurementLocation || (MeasurementLocation = {}));\nconst MeasurementLocationName = {\n [MeasurementLocation.ACROSS_BACK]: 'Across back',\n [MeasurementLocation.ACROSS_FRONT]: 'Across front',\n [MeasurementLocation.ACROSS_SHOULDER]: 'Across shoulder',\n [MeasurementLocation.ANKLE]: 'Ankle',\n [MeasurementLocation.ARMEYE]: 'Armeye',\n [MeasurementLocation.ARM_LENGTH_FROM_SHOULDER]: 'Arm length from shoulder',\n [MeasurementLocation.BACK_CROTCH_LENGTH]: 'Back crotch length',\n [MeasurementLocation.BACK_NECK_TO_EBLOW]: 'Back neck to eblow',\n [MeasurementLocation.BELOW_KNEE]: 'Below knee',\n [MeasurementLocation.BICEP]: 'Bicep',\n [MeasurementLocation.BUST]: 'Chest/Bust',\n [MeasurementLocation.BUST_POINT_TO_BUST_POINT]: 'Bust point to bust point',\n [MeasurementLocation.CALF]: 'Calf',\n [MeasurementLocation.CB_NECK_TO_WAIST]: 'Cb neck to waist',\n [MeasurementLocation.CB_NECK_TO_WRIST]: 'Cb neck to wrist',\n [MeasurementLocation.CF_NECK_TO_WAIST]: 'Cf neck to waist',\n [MeasurementLocation.ELBOW]: 'Elbow',\n [MeasurementLocation.FOREARM]: 'Forearm',\n [MeasurementLocation.FRONT_CROTCH_LENGTH]: 'Front crotch length',\n [MeasurementLocation.HIGH_HIP_PLACEMENT_FROM_WAIST]: 'High hip placement from waist',\n [MeasurementLocation.HIGH_HIP]: 'High hip',\n [MeasurementLocation.HSP_TO_ACROSS_BACK]: 'Hsp to across back',\n [MeasurementLocation.HSP_TO_ACROSS_FRONT]: 'Hsp to across front',\n [MeasurementLocation.HSP_TO_BUST_POINT]: 'Hsp to bust point',\n [MeasurementLocation.HSP_TO_LOW_HIP_POSITION]: 'Hsp to low hip position',\n [MeasurementLocation.HSP_TO_WAIST_POSITION]: 'Hsp to waist position',\n [MeasurementLocation.INSEAM]: 'Inseam',\n [MeasurementLocation.KNEE]: 'Knee',\n [MeasurementLocation.LOW_HIP]: 'Low hip',\n [MeasurementLocation.LOW_HIP_PLACEMENT_FROM_WAIST]: 'Low hip placement from waist',\n [MeasurementLocation.MID_NECK]: 'Mid neck',\n [MeasurementLocation.NECK_AT_BASE]: 'Neck at base',\n [MeasurementLocation.SHOULDER_DROP]: 'Shoulder drop',\n [MeasurementLocation.SHOULDER_TO_SHOULDER]: 'Shoulder to shoulder',\n [MeasurementLocation.SIDE_WAIST_TO_FLOOR]: 'Side waist to floor',\n [MeasurementLocation.SIDE_WAIST_TO_KNEE]: 'Side waist to knee',\n [MeasurementLocation.THIGH]: 'Thigh',\n [MeasurementLocation.TOTAL_RISE_LENGTH]: 'Total rise length',\n [MeasurementLocation.UNDER_BUST]: 'Under bust',\n [MeasurementLocation.VERTICAL_TRUNK]: 'Vertical trunk',\n [MeasurementLocation.WAIST]: 'Waist',\n [MeasurementLocation.WRIST]: 'Wrist',\n};\nvar Classification;\n(function (Classification) {\n Classification[\"BLOUSES\"] = \"blouses\";\n Classification[\"COATS\"] = \"coats\";\n Classification[\"DRESSES\"] = \"dresses\";\n Classification[\"JACKETS\"] = \"jackets\";\n Classification[\"PANTS\"] = \"pants\";\n Classification[\"PUFFERS_AND_PARKAS\"] = \"puffer_and_parkas\";\n Classification[\"SHORTS\"] = \"shorts\";\n Classification[\"SKIRTS\"] = \"skirts\";\n Classification[\"SWEATERS\"] = \"sweaters\";\n Classification[\"T_SHIRTS_AND_TANKS\"] = \"t_shirts_and_tanks\";\n})(Classification || (Classification = {}));\nconst ClassificationLocations = {\n [Classification.BLOUSES]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP,\n ],\n // prettier-ignore\n [Classification.COATS]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP\n ],\n [Classification.DRESSES]: [\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n ],\n [Classification.JACKETS]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP,\n ],\n [Classification.PANTS]: [\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.WAIST,\n MeasurementLocation.THIGH,\n MeasurementLocation.INSEAM,\n ],\n [Classification.PUFFERS_AND_PARKAS]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP,\n ],\n [Classification.SHORTS]: [\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.WAIST,\n MeasurementLocation.THIGH,\n MeasurementLocation.INSEAM,\n ],\n // prettier-ignore\n [Classification.SKIRTS]: [\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.WAIST\n ],\n // prettier-ignore\n [Classification.SWEATERS]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP\n ],\n // prettier-ignore\n [Classification.T_SHIRTS_AND_TANKS]: [\n MeasurementLocation.BUST,\n MeasurementLocation.ACROSS_SHOULDER,\n MeasurementLocation.WAIST,\n MeasurementLocation.LOW_HIP,\n MeasurementLocation.HIGH_HIP\n ],\n};\nconst CategoryNames = {\n [\"activewear\" /* Category.ACTIVEWEAR */]: 'Active Wear',\n [\"dresses\" /* Category.DRESSES */]: 'Dresses',\n [\"jackets_and_coats\" /* Category.JACKETS_AND_COATS */]: 'Jackets and Coats',\n [\"jeans\" /* Category.JEANS */]: 'Jeans',\n [\"jumpsuits_and_rompers\" /* Category.JUMPSUITS_AND_ROMPERS */]: 'Jumpsuits and Rompers',\n [\"pants_and_shorts\" /* Category.PANTS_AND_SHORTS */]: 'Pants and Shorts',\n [\"skirts\" /* Category.SKIRTS */]: 'Skirts',\n [\"suits_and_tailoring\" /* Category.SUITS_AND_TAILORING */]: 'Suits and Tailoring',\n [\"sweaters\" /* Category.SWEATERS */]: 'Sweaters',\n [\"tops\" /* Category.TOPS */]: 'Tops',\n};\nconst Categories = [\n \"activewear\" /* Category.ACTIVEWEAR */,\n \"dresses\" /* Category.DRESSES */,\n \"jackets_and_coats\" /* Category.JACKETS_AND_COATS */,\n \"jeans\" /* Category.JEANS */,\n \"jumpsuits_and_rompers\" /* Category.JUMPSUITS_AND_ROMPERS */,\n \"pants_and_shorts\" /* Category.PANTS_AND_SHORTS */,\n \"skirts\" /* Category.SKIRTS */,\n \"suits_and_tailoring\" /* Category.SUITS_AND_TAILORING */,\n \"sweaters\" /* Category.SWEATERS */,\n \"tops\" /* Category.TOPS */,\n];\nconst SubcategoryNames = {\n [\"a_line\" /* Subcategory.A_LINE */]: 'A Line',\n [\"a_line_flared\" /* Subcategory.A_LINE_FLARED */]: 'A Line Flared',\n [\"blazers\" /* Subcategory.BLAZERS */]: 'Blazers',\n [\"bodycon\" /* Subcategory.BODYCON */]: 'Bodycon',\n [\"bodysuits\" /* Subcategory.BODYSUITS */]: 'Bodysuits',\n [\"boiler_suits\" /* Subcategory.BOILER_SUITS */]: 'Boiler Suits',\n [\"bootcut\" /* Subcategory.BOOTCUT */]: 'Bootcut',\n [\"cardigans\" /* Subcategory.CARDIGANS */]: 'Cardigans',\n [\"cigarette\" /* Subcategory.CIGARETTE */]: 'Cigarette',\n [\"corsets_and_bustiers\" /* Subcategory.CORSETS_AND_BUSTIERS */]: 'Corsets and Bustiers',\n [\"crewnecks\" /* Subcategory.CREWNECKS */]: 'Crewnecks',\n [\"culottes\" /* Subcategory.CULOTTES */]: 'Culottes',\n [\"denim\" /* Subcategory.DENIM */]: 'Denim',\n [\"denim_jackets\" /* Subcategory.DENIM_JACKETS */]: 'Denim Jackets',\n [\"denim_shorts\" /* Subcategory.DENIM_SHORTS */]: 'Denim Shorts',\n [\"fit_and_flare\" /* Subcategory.FIT_AND_FLARE */]: 'Fit and Flare',\n [\"flared\" /* Subcategory.FLARED */]: 'Flared',\n [\"hoodies_and_zipups\" /* Subcategory.HOODIES_AND_ZIPUPS */]: 'Hoodies and Zipups',\n [\"joggers\" /* Subcategory.JOGGERS */]: 'Joggers',\n [\"jumpsuits\" /* Subcategory.JUMPSUITS */]: 'Jumpsuits',\n [\"knit\" /* Subcategory.KNIT */]: 'Knit',\n [\"leggings\" /* Subcategory.LEGGINGS */]: 'Leggings',\n [\"mom\" /* Subcategory.MOM */]: 'Mom',\n [\"overalls\" /* Subcategory.OVERALLS */]: 'Overalls',\n [\"parkas\" /* Subcategory.PARKAS */]: 'Parkas',\n [\"peacoats\" /* Subcategory.PEACOATS */]: 'Peacoats',\n [\"pencil\" /* Subcategory.PENCIL */]: 'Pencil',\n [\"pleated\" /* Subcategory.PLEATED */]: 'Pleated',\n [\"polos\" /* Subcategory.POLOS */]: 'Polos',\n [\"puffer_jackets\" /* Subcategory.PUFFER_JACKETS */]: 'Puffer Jackets',\n [\"raincoats\" /* Subcategory.RAINCOATS */]: 'Raincoats',\n [\"relaxed\" /* Subcategory.RELAXED */]: 'Relaxed',\n [\"rompers\" /* Subcategory.ROMPERS */]: 'Rompers',\n [\"shackets\" /* Subcategory.SHACKETS */]: 'Shackets',\n [\"shirt\" /* Subcategory.SHIRT */]: 'Shirt',\n [\"shirts_and_blouses\" /* Subcategory.SHIRTS_AND_BLOUSES */]: 'Shirts and Blouses',\n [\"skater\" /* Subcategory.SKATER */]: 'Skater',\n [\"skinny\" /* Subcategory.SKINNY */]: 'Skinny',\n [\"slim\" /* Subcategory.SLIM */]: 'Slim',\n [\"slip\" /* Subcategory.SLIP */]: 'Slip',\n [\"sports_bras\" /* Subcategory.SPORTS_BRAS */]: 'Sports Bras',\n [\"straight\" /* Subcategory.STRAIGHT */]: 'Straight',\n [\"suit_jackets\" /* Subcategory.SUIT_JACKETS */]: 'Suit Jackets',\n [\"suit_skirts\" /* Subcategory.SUIT_SKIRTS */]: 'Suit Skirts',\n [\"suit_trousers\" /* Subcategory.SUIT_TROUSERS */]: 'Suit Trousers',\n [\"suit_vests\" /* Subcategory.SUIT_VESTS */]: 'Suit Vests',\n [\"sweatshirts\" /* Subcategory.SWEATSHIRTS */]: 'Sweatshirts',\n [\"t_shirts\" /* Subcategory.T_SHIRTS */]: 'T-Shirts',\n [\"tank_tops_and_camisoles\" /* Subcategory.TANK_TOPS_AND_CAMISOLES */]: 'Tank Tops and Camisoles',\n [\"tapered\" /* Subcategory.TAPERED */]: 'Tapered',\n [\"trench_coats\" /* Subcategory.TRENCH_COATS */]: 'Trench Coats',\n [\"trousers\" /* Subcategory.TROUSERS */]: 'Trousers',\n [\"turtlenecks\" /* Subcategory.TURTLENECKS */]: 'Turtleneck',\n [\"unitards\" /* Subcategory.UNITARDS */]: 'Unitards',\n [\"v_necks\" /* Subcategory.V_NECKS */]: 'V-Necks',\n [\"wide_leg\" /* Subcategory.WIDE_LEG */]: 'Wide Leg',\n [\"wrap\" /* Subcategory.WRAP */]: 'Wrap',\n};\nconst Taxonomy = {\n [\"activewear\" /* Category.ACTIVEWEAR */]: {\n [\"leggings\" /* Subcategory.LEGGINGS */]: Classification.PANTS,\n [\"joggers\" /* Subcategory.JOGGERS */]: Classification.PANTS,\n [\"sweatshirts\" /* Subcategory.SWEATSHIRTS */]: Classification.SWEATERS,\n },\n [\"dresses\" /* Category.DRESSES */]: {\n [\"a_line\" /* Subcategory.A_LINE */]: Classification.DRESSES,\n [\"bodycon\" /* Subcategory.BODYCON */]: Classification.DRESSES,\n [\"fit_and_flare\" /* Subcategory.FIT_AND_FLARE */]: Classification.DRESSES,\n [\"knit\" /* Subcategory.KNIT */]: Classification.DRESSES,\n [\"shirt\" /* Subcategory.SHIRT */]: Classification.DRESSES,\n [\"slip\" /* Subcategory.SLIP */]: Classification.DRESSES,\n [\"straight\" /* Subcategory.STRAIGHT */]: Classification.DRESSES,\n [\"wrap\" /* Subcategory.WRAP */]: Classification.DRESSES,\n },\n [\"jackets_and_coats\" /* Category.JACKETS_AND_COATS */]: {\n [\"denim_jackets\" /* Subcategory.DENIM_JACKETS */]: Classification.JACKETS,\n [\"parkas\" /* Subcategory.PARKAS */]: Classification.PUFFERS_AND_PARKAS,\n [\"peacoats\" /* Subcategory.PEACOATS */]: Classification.COATS,\n [\"puffer_jackets\" /* Subcategory.PUFFER_JACKETS */]: Classification.PUFFERS_AND_PARKAS,\n [\"raincoats\" /* Subcategory.RAINCOATS */]: Classification.COATS,\n [\"rompers\" /* Subcategory.ROMPERS */]: Classification.COATS,\n [\"shackets\" /* Subcategory.SHACKETS */]: Classification.JACKETS,\n [\"trench_coats\" /* Subcategory.TRENCH_COATS */]: Classification.COATS,\n },\n [\"jeans\" /* Category.JEANS */]: {\n [\"bootcut\" /* Subcategory.BOOTCUT */]: Classification.PANTS,\n [\"flared\" /* Subcategory.FLARED */]: Classification.PANTS,\n [\"mom\" /* Subcategory.MOM */]: Classification.PANTS,\n [\"relaxed\" /* Subcategory.RELAXED */]: Classification.PANTS,\n [\"skinny\" /* Subcategory.SKINNY */]: Classification.PANTS,\n [\"slim\" /* Subcategory.SLIM */]: Classification.PANTS,\n [\"straight\" /* Subcategory.STRAIGHT */]: Classification.PANTS,\n [\"tapered\" /* Subcategory.TAPERED */]: Classification.PANTS,\n [\"wide_leg\" /* Subcategory.WIDE_LEG */]: Classification.PANTS,\n },\n [\"jumpsuits_and_rompers\" /* Category.JUMPSUITS_AND_ROMPERS */]: {\n [\"boiler_suits\" /* Subcategory.BOILER_SUITS */]: Classification.DRESSES,\n [\"denim\" /* Subcategory.DENIM */]: Classification.DRESSES,\n [\"jumpsuits\" /* Subcategory.JUMPSUITS */]: Classification.DRESSES,\n [\"overalls\" /* Subcategory.OVERALLS */]: Classification.DRESSES,\n [\"rompers\" /* Subcategory.ROMPERS */]: Classification.DRESSES,\n [\"unitards\" /* Subcategory.UNITARDS */]: Classification.DRESSES,\n },\n [\"pants_and_shorts\" /* Category.PANTS_AND_SHORTS */]: {\n [\"cigarette\" /* Subcategory.CIGARETTE */]: Classification.PANTS,\n [\"culottes\" /* Subcategory.CULOTTES */]: Classification.SHORTS,\n [\"denim_shorts\" /* Subcategory.DENIM_SHORTS */]: Classification.SHORTS,\n [\"flared\" /* Subcategory.FLARED */]: Classification.PANTS,\n [\"joggers\" /* Subcategory.JOGGERS */]: Classification.PANTS,\n [\"leggings\" /* Subcategory.LEGGINGS */]: Classification.PANTS,\n [\"skinny\" /* Subcategory.SKINNY */]: Classification.PANTS,\n [\"wide_leg\" /* Subcategory.WIDE_LEG */]: Classification.PANTS,\n },\n [\"skirts\" /* Category.SKIRTS */]: {\n [\"a_line_flared\" /* Subcategory.A_LINE_FLARED */]: Classification.SKIRTS,\n [\"denim\" /* Subcategory.DENIM */]: Classification.SKIRTS,\n [\"knit\" /* Subcategory.KNIT */]: Classification.SKIRTS,\n [\"pencil\" /* Subcategory.PENCIL */]: Classification.SKIRTS,\n [\"pleated\" /* Subcategory.PLEATED */]: Classification.SKIRTS,\n [\"skater\" /* Subcategory.SKATER */]: Classification.SKIRTS,\n [\"slip\" /* Subcategory.SLIP */]: Classification.SKIRTS,\n [\"wrap\" /* Subcategory.WRAP */]: Classification.SKIRTS,\n },\n [\"suits_and_tailoring\" /* Category.SUITS_AND_TAILORING */]: {\n [\"blazers\" /* Subcategory.BLAZERS */]: Classification.JACKETS,\n [\"suit_jackets\" /* Subcategory.SUIT_JACKETS */]: Classification.JACKETS,\n [\"suit_skirts\" /* Subcategory.SUIT_SKIRTS */]: Classification.SKIRTS,\n [\"suit_trousers\" /* Subcategory.SUIT_TROUSERS */]: Classification.PANTS,\n [\"suit_vests\" /* Subcategory.SUIT_VESTS */]: Classification.SWEATERS,\n [\"trousers\" /* Subcategory.TROUSERS */]: Classification.PANTS,\n },\n [\"sweaters\" /* Category.SWEATERS */]: {\n [\"cardigans\" /* Subcategory.CARDIGANS */]: Classification.SWEATERS,\n [\"crewnecks\" /* Subcategory.CREWNECKS */]: Classification.SWEATERS,\n [\"hoodies_and_zipups\" /* Subcategory.HOODIES_AND_ZIPUPS */]: Classification.SWEATERS,\n [\"sweatshirts\" /* Subcategory.SWEATSHIRTS */]: Classification.SWEATERS,\n [\"turtlenecks\" /* Subcategory.TURTLENECKS */]: Classification.SWEATERS,\n [\"v_necks\" /* Subcategory.V_NECKS */]: Classification.SWEATERS,\n },\n [\"tops\" /* Category.TOPS */]: {\n [\"bodysuits\" /* Subcategory.BODYSUITS */]: Classification.BLOUSES,\n [\"corsets_and_bustiers\" /* Subcategory.CORSETS_AND_BUSTIERS */]: Classification.BLOUSES,\n [\"polos\" /* Subcategory.POLOS */]: Classification.T_SHIRTS_AND_TANKS,\n [\"shirts_and_blouses\" /* Subcategory.SHIRTS_AND_BLOUSES */]: Classification.BLOUSES,\n [\"t_shirts\" /* Subcategory.T_SHIRTS */]: Classification.T_SHIRTS_AND_TANKS,\n [\"tank_tops_and_camisoles\" /* Subcategory.TANK_TOPS_AND_CAMISOLES */]: Classification.T_SHIRTS_AND_TANKS,\n },\n};\nvar Fit;\n(function (Fit) {\n Fit[\"TOO_TIGHT\"] = \"too_tight\";\n Fit[\"TIGHT\"] = \"tight\";\n Fit[\"SLIGHTLY_TIGHT\"] = \"slightly_tight\";\n Fit[\"PERFECT_FIT\"] = \"perfect_fit\";\n Fit[\"SLIGHTLY_LOOSE\"] = \"slightly_loose\";\n Fit[\"LOOSE\"] = \"loose\";\n Fit[\"OVERSIZED\"] = \"oversized\";\n Fit[\"TOO_SHORT\"] = \"too_short\";\n Fit[\"SHORT\"] = \"short\";\n Fit[\"SLIGHTLY_SHORT\"] = \"slightly_short\";\n Fit[\"SLIGHTLY_LONG\"] = \"slightly_long\";\n Fit[\"LONG\"] = \"long\";\n Fit[\"TOO_LONG\"] = \"too_long\";\n})(Fit || (Fit = {}));\nconst FitNames = {\n [Fit.TOO_TIGHT]: 'Too Tight',\n [Fit.TIGHT]: 'Tight',\n [Fit.SLIGHTLY_TIGHT]: 'Slightly Tight',\n [Fit.PERFECT_FIT]: 'Perfect Fit',\n [Fit.SLIGHTLY_LOOSE]: 'Slightly Loose',\n [Fit.LOOSE]: 'Loose',\n [Fit.OVERSIZED]: 'Oversized',\n [Fit.TOO_SHORT]: 'Too Short',\n [Fit.SHORT]: 'Short',\n [Fit.SLIGHTLY_SHORT]: 'Slightly Short',\n [Fit.SLIGHTLY_LONG]: 'Slightly Long',\n [Fit.LONG]: 'Long',\n [Fit.TOO_LONG]: 'Too Long',\n};\n\nvar AvatarState;\n(function (AvatarState) {\n AvatarState[\"NOT_CREATED\"] = \"NOT_CREATED\";\n AvatarState[\"CREATED\"] = \"CREATED\";\n AvatarState[\"PENDING\"] = \"PENDING\";\n})(AvatarState || (AvatarState = {}));\n\nvar index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get AvatarState () { return AvatarState; },\n Categories: Categories,\n CategoryNames: CategoryNames,\n get Classification () { return Classification; },\n ClassificationLocations: ClassificationLocations,\n get Fit () { return Fit; },\n FitNames: FitNames,\n get MeasurementLocation () { return MeasurementLocation; },\n MeasurementLocationName: MeasurementLocationName,\n SubcategoryNames: SubcategoryNames,\n Taxonomy: Taxonomy\n});\n\nexport { errors as Errors, initShop, requests, responses, index as types };\n//# sourceMappingURL=index.js.map\n","import { InitImageSlider } from './slider'\n\nexport class VtoComponent {\n private isInit = false\n private currentSliderValue: number = 0\n private slider: ReturnType<typeof InitImageSlider> = null\n\n constructor(private readonly vtoMainDivId: string) { }\n\n public init() {\n if (this.isInit) return\n\n const vtoMainDiv = document.getElementById(this.vtoMainDivId)\n\n if (!vtoMainDiv) throw new Error(`Element with id ${this.vtoMainDivId} not found`)\n\n vtoMainDiv.innerHTML = `\n <div class=\"tfr-slider-wrapper\">\n <img id=\"tfr-tryon-image\" src=\"\" />\n <input type=\"range\" id=\"tfr-slider\" />\n </div>\n `\n\n const tryOnImage = <HTMLImageElement>document.getElementById('tfr-tryon-image')\n const onChange = (slider, imageUrl) => {\n console.debug('slider change', slider, imageUrl)\n tryOnImage.src = imageUrl\n this.currentSliderValue = parseInt(slider.value)\n }\n\n this.slider = InitImageSlider('tfr-slider', onChange)\n this.isInit = true\n }\n\n public onNewFramesReady(frames: string[]) {\n if (!this.isInit) {\n this.init()\n }\n\n if (Array.isArray(frames) && frames.length > 0) {\n // Ensure the current slider value is within bounds of the new frames array\n const boundedValue = Math.min(this.currentSliderValue, frames.length - 1)\n const e = this.slider.Load(frames, boundedValue)\n if (e instanceof Error) {\n console.error(e)\n return\n }\n\n // Restore previous slider position if it's within bounds\n const sliderElement = document.getElementById('tfr-slider') as HTMLInputElement\n if (sliderElement && this.currentSliderValue < frames.length) {\n sliderElement.value = this.currentSliderValue.toString()\n const tryOnImage = <HTMLImageElement>document.getElementById('tfr-tryon-image')\n tryOnImage.src = frames[this.currentSliderValue]\n }\n }\n }\n}\n","import { createUIError } from './uiError'\n\nvar L = {\n AssociatedEmail: 'If there is an account associated with that email, We have sent a link to reset your password.',\n BackToSignIn: 'Back to sign in',\n BrandUserIdNotSet: 'User not logged in to brand site.',\n ClickHereToDownload: 'Click here to download the app',\n DontHaveAcc: \"Don't have an account?\",\n DontHaveAvatar: \"Whoops! Looks like you don't have an avatar yet.\",\n EmailAddress: 'Email address',\n EmailError: 'Please enter a valid email address.',\n EnterEmailAddress: 'Enter your email address, we will send you a link to reset your password.',\n EnterPhoneNumber: 'Enter your number for download link',\n FailedToLoadLocale: 'Something went wrong when fetching another language.',\n ForgotPasswordWithSymbol: 'Forgot password?',\n GetVirtualTryOnFramesErrorText: 'The try-on request timed out. Please try again!',\n HaveAcc: 'Have an account? Sign in',\n Loading: 'Loading...',\n LoadingAvatar: 'Your avatar is loading...',\n NoSizeAvailable: 'Unfortunately, that size is not available for try on.',\n OrSize: 'or',\n Password: 'Password',\n PasswordError: 'Please enter a valid password (at least 7 characters).',\n PhoneNumber: 'Phone number',\n ReturnToCatalogPage: 'Return to Catalog Page',\n ReturnToProductPage: 'Return to Product Page',\n ReturnToSite: 'Return to site',\n ReturnToTfr: 'Please return to The Fitting Room app to create your avatar.',\n ScanQrToDownload: 'Scan to download the app',\n Send: 'Send',\n SignBackIn: 'Sign back in',\n SignIn: 'Sign in',\n SomethingWentWrong: 'Something went wrong. Try again!',\n SuccessfullyLoggedOut: 'You have successfully logged out!',\n TheFittingRoom: 'The Fitting Room',\n UsernameOrPasswordEmpty: 'Username or password is empty.',\n UsernameOrPasswordIncorrect: 'Username or password is incorrect.',\n\n // Modal\n ModalTagline: 'End size uncertainty with',\n ModalText:\n 'Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.',\n}\n\nfunction findMissingLocales(defaultLocale: any, newLocale: any): { default: any; new: any } {\n const missingLocales = { default: {}, new: {} }\n for (const key in defaultLocale) {\n if (newLocale[key] === undefined) {\n missingLocales.default[key] = defaultLocale[key]\n }\n }\n for (const key in newLocale) {\n if (defaultLocale[key] === undefined) {\n missingLocales.new[key] = newLocale[key]\n }\n }\n return missingLocales\n}\n\nasync function SetLocale(locale: string): Promise<void> {\n return new Promise((resolve, reject) => {\n fetch(`${process.env.LANGUAGE_URL}/${locale}.json`)\n .then((response) => {\n if (response.ok) {\n response\n .json()\n .then((data) => {\n const missingLocales = findMissingLocales(L, data)\n if (Object.keys(missingLocales.default).length > 0) {\n console.warn(\n `The following locales are missing from the new locale: ${JSON.stringify(missingLocales.default)}`,\n )\n }\n if (Object.keys(missingLocales.new).length > 0) {\n console.warn(\n `The following locales are missing from the default locale: ${JSON.stringify(missingLocales.new)}`,\n )\n }\n L = data\n resolve()\n })\n .catch((error) => {\n reject(createUIError(L.FailedToLoadLocale, error))\n })\n } else {\n response\n .text()\n .then((bodyText) => {\n reject(createUIError(L.FailedToLoadLocale, new Error(bodyText)))\n })\n .catch((error) => {\n reject(createUIError(L.FailedToLoadLocale, error))\n })\n }\n })\n .catch((error) => {\n reject(createUIError(L.FailedToLoadLocale, error))\n })\n })\n}\n\nconst InitLocale = (): Promise<string> => {\n return new Promise((resolve, reject) => {\n const searchParams = new URL(window.location.href).searchParams\n const language = searchParams.get('language') || 'en'\n\n SetLocale(language)\n .then(() => {\n resolve(language)\n })\n .catch((error) => {\n reject(error)\n })\n })\n}\n\n//TODO: add OverrideLocale function that rewrites all non-empty keys in the new locale over the old locale\n\nexport { InitLocale, L, SetLocale }\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { ErrorModalProps } from '../../types'\nimport { L } from '../locale'\n\nconst ErrorModal = (props: ErrorModalProps) => {\n const { error } = props\n\n const onNavBack = () => {\n props.onNavBack()\n }\n\n const onClose = () => {\n props.onClose()\n }\n\n const Hook = () => {\n document.getElementById('tfr-back')?.addEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.addEventListener('click', onClose)\n }\n\n const Unhook = () => {\n document.getElementById('tfr-back')?.removeEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.removeEventListener('click', onClose)\n }\n\n const Body = () => {\n if (!error) {\n console.error('ErrorModal: No error provided')\n }\n return `\n <div class=\"tfr-mt-15-p tfr-mb-13-p\">\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-c-black\">${\n error || L.SomethingWentWrong\n }</div>\n </div>\n\n <div class=\"tfr-t-a-center\">\n <span id=\"tfr-back\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20\">${\n L.ReturnToCatalogPage || 'Return to Catalog Page'\n }</span>\n <span id=\"tfr-close\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor\" id=\"returnToSite\">${\n L.ReturnToProductPage || 'Return to Product Page'\n }</span>\n </div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default ErrorModal\n","export const tfrDoor = `\n<svg class=\"tfr-door-icon\" width=\"68\" height=\"124\" viewBox=\"0 0 68 124\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z\" fill=\"currentColor\">\n </path>\n <path d=\"M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z\" fill=\"white\">\n</path>\n</svg>`\n\nexport const userIcon = `<svg class=\"tfr-user-icon\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_82_11365)\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z\"\n fill=\"currentColor\" fill-opacity=\"0.7\" />\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z\"\n fill=\"currentColor\" fill-opacity=\"0.7\" />\n </g>\n <defs>\n <clipPath id=\"clip0_82_11365\">\n <rect width=\"16\" height=\"16\" fill=\"white\" />\n </clipPath>\n </defs>\n</svg>`\n\nexport const infoIcon = `<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<rect width=\"13\" height=\"13\" fill=\"url(#pattern0_641_1375)\"/>\n<defs>\n<pattern id=\"pattern0_641_1375\" patternContentUnits=\"objectBoundingBox\" width=\"1\" height=\"1\">\n<use xlink:href=\"#image0_641_1375\" transform=\"scale(0.00793651)\"/>\n</pattern>\n<image id=\"image0_641_1375\" width=\"126\" height=\"126\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXN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8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg==\"/>\n</defs>\n</svg>\n`\n","import { LoadingAvatarModalProps, ModalContent } from '../../types'\nimport { L } from '../locale'\n\nconst LoadingAvatarModal = (props: LoadingAvatarModalProps): ModalContent => {\n function startProgressBar(milliseconds, progressBar) {\n let percentCount = 0\n const millisecondStep = milliseconds / 200\n progressBar.style.width = percentCount + '%'\n const id = setInterval(() => {\n if (percentCount >= 100) {\n clearInterval(id)\n } else {\n percentCount += 0.5\n progressBar.style.width = percentCount + '%'\n }\n }, millisecondStep)\n }\n\n const Hook = () => {\n const progressBar = document.querySelector('.progress-bar-fill')\n startProgressBar(props.timeoutMS, progressBar)\n }\n\n const Unhook = () => void 0\n\n const Body = () => {\n return `\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60\" > ${L.LoadingAvatar} </div>\n <div class=\"progress-bar\">\n <span class=\"progress-bar-fill\"></span>\n </div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default LoadingAvatarModal\n","import { ModalContent } from '../../types'\nimport { L } from '../locale'\n\ninterface ModalManager {\n open(content: ModalContent): void\n close(): void\n Content(): ModalContent\n}\n\nconst InitModalManager = (elementID: string): ModalManager => {\n const modalRoot = document.getElementById(elementID)\n const body = document.querySelector('body')\n\n if (!modalRoot) {\n throw new Error(`element with id ${elementID} not found`)\n }\n\n let previousContent: ModalContent\n\n const renderBody = (modalBody: string, useFullModalContent: boolean) => {\n console.log({ useFullModalContent })\n return `\n <div class=\"tfr-modal\" id=\"tfr-modal-background\">\n <div class=\"tfr-modal-content-container tfr-p-20\">\n <div class=\"tfr-close-container\">\n <span id=\"tfr-close-container\" class=\"tfr-close tfr-cursor\">&times;</span>\n </div>\n\n <div class=\"tfr-modal-content-flex\">\n <div class=\"tfr-modal-content\">\n ${renderModalContent(useFullModalContent)}\n ${modalBody}\n </div>\n </div>\n </div>\n </div>\n `\n }\n\n const renderModalContent = (useFullModalContent: boolean) => {\n if (!useFullModalContent) return ''\n\n return `\n <div class=\"tfr-modal-title-logo-container\">\n <div tfr-element=\"true\" class=\"trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10\">${L.ModalTagline}</div>\n <div tfr-element=\"true\" class=\"tfr-logo-container\">\n <div class=\"tfr-mr-15\">\n <svg width=\"26\" height=\"47\" viewBox=\"0 0 68 124\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z\" fill=\"#209DA7\">\n </path>\n <path d=\"M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z\" fill=\"white\">\n </path>\n </svg>\n </div>\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10\">${L.TheFittingRoom}</div>\n </div>\n </div>\n `\n }\n\n const Open = (content: ModalContent) => {\n body.style.overflow = 'hidden'\n if (previousContent) {\n previousContent.Unhook()\n }\n modalRoot.innerHTML = renderBody(content.Body(), content.useFullModalContent)\n hook()\n content.Hook()\n modalRoot.style.display = 'block'\n previousContent = content\n }\n\n const Close = () => {\n body.style.overflow = 'auto'\n if (previousContent) {\n previousContent.Unhook()\n unhook()\n }\n modalRoot.style.display = 'none'\n }\n\n const EscClose = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n Close()\n }\n }\n\n const ContainerClose = (e: MouseEvent) => {\n const background = modalRoot.querySelector('#tfr-modal-background')\n if (e.target === background) {\n console.debug('container close')\n Close()\n }\n }\n\n const hook = () => {\n modalRoot.querySelector('#tfr-close-container').addEventListener('click', Close)\n document.addEventListener('keydown', EscClose)\n document.addEventListener('click', ContainerClose)\n }\n\n const unhook = () => {\n const closeLink = modalRoot.querySelector('#tfr-close-container')\n if (closeLink) {\n closeLink.removeEventListener('click', Close)\n } else {\n console.error('#tfr-close-container not found on unhook')\n console.debug(document.getElementById(elementID)?.innerHTML)\n }\n document.removeEventListener('keydown', EscClose)\n document.removeEventListener('click', ContainerClose)\n }\n\n const Content = () => {\n return previousContent\n }\n\n return {\n open: Open,\n close: Close,\n Content,\n }\n}\n\nexport { InitModalManager, ModalManager }\n","import { ModalContent, ScanCodeModalProps } from '../../types'\nimport { L } from '../locale'\n\nconst ScanCodeModal = (props: ScanCodeModalProps): ModalContent => {\n const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)\n\n const onSignInNav = () => {\n props.onSignInNav()\n }\n\n const onCtaClickApple = () => {\n window.open('https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373', '_blank')\n }\n\n const onCtaClickGoogle = () => {\n window.open('https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace', '_blank')\n }\n\n const onHook = () => {\n if (!isMobile) document.getElementById('tfr-sign-in-nav').style.marginBottom = '0'\n if (isMobile) {\n const videoElement = document.getElementById('tfr-video') as HTMLVideoElement\n\n videoElement.classList.add('tfr-video-responsive')\n }\n\n document.getElementById('tfr-sign-in-nav')?.addEventListener('click', onSignInNav)\n document.getElementById('tfr-app-store')?.addEventListener('click', onCtaClickApple)\n document.getElementById('tfr-google-play')?.addEventListener('click', onCtaClickGoogle)\n }\n\n const onUnhook = () => {\n document.getElementById('tfr-sign-in-nav')?.removeEventListener('click', onSignInNav)\n document.getElementById('tfr-app-store')?.removeEventListener('click', onCtaClickApple)\n document.getElementById('tfr-google-play')?.removeEventListener('click', onCtaClickGoogle)\n }\n\n const imageBaseUrl = 'https://assets.dev.thefittingroom.xyz/images/'\n\n const renderMobile = () =>\n !isMobile\n ? ``\n : `<div tfr-element=\"true\" class=\"tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600\">${L.ClickHereToDownload}</div>\n\n <div tfr-element=\"true\" class=\"tfr-flex tfr-space-above\">\n <img class=\"tfr-mobile-logo\" src=\"${imageBaseUrl}apple.png\" id=\"tfr-app-store\" />\n <img class=\"tfr-mobile-logo\" src=\"${imageBaseUrl}google.png\" id=\"tfr-google-play\" />\n </div>\n \n <div id=\"tfr-sign-in-nav\" tfr-element=\"true\" class=\"tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor\">${L.HaveAcc}</div>\n `\n\n const renderDesktop = () =>\n isMobile\n ? ``\n : `<div id=\"tfr-qr-border-box\">\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-24-bold\">${L.ScanQrToDownload}</div>\n \n <img src=\"${imageBaseUrl}qr.png\" class=\"tfr-qr-code\" />\n\n <div id=\"tfr-sign-in-nav\" tfr-element=\"true\" class=\"tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor\">${L.HaveAcc}</div>\n </div>`\n\n const body = () => {\n return `\n <div tfr-element=\"true\">\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-16-300 tfr-mt-10\">${L.ModalText}</div>\n \n </div>\n <div tfr-element=\"true\" class=\"tfr-logo-box\">\n <video id=\"tfr-video\" controls loop autoplay playsinline>\n <source src=\"https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4\" />\n </video>\n\n ${renderDesktop()}\n </div>\n\n ${renderMobile()}\n `\n }\n\n return {\n Hook: onHook,\n Unhook: onUnhook,\n Body: body,\n useFullModalContent: true,\n }\n}\n\nexport default ScanCodeModal\n","import * as modals from './components'\nimport * as types from './types'\n\nexport class TfrModal {\n private readonly manager: modals.ModalManager\n\n constructor(\n modalDivId: string,\n private readonly signIn: types.SignInModalProps['onSignIn'],\n private readonly forgotPassword: types.ForgotPasswordModalProps['onPasswordReset'],\n private readonly submitTel: types.ScanCodeModalProps['onTelSubmit'],\n ) {\n this.manager = modals.InitModalManager(modalDivId)\n }\n\n public close() {\n this.manager.close()\n }\n\n public onSignOut() {\n this.manager.open(\n modals.LoggedOutModal({\n onNavSignIn: () => this.toSignIn(),\n onClose: () => this.close(),\n }),\n )\n }\n\n public onNotCreated() {\n this.manager.open(modals.NoAvatarModal())\n }\n\n public onLoading() {\n this.manager.open(\n modals.LoadingAvatarModal({\n timeoutMS: 10000,\n }),\n )\n }\n\n public toScan() {\n this.manager.open(\n modals.ScanCodeModal({\n onSignInNav: () => this.toSignIn(),\n onTelSubmit: (tel: string) => this.submitTel(tel),\n }),\n )\n }\n\n public toSignIn() {\n this.manager.open(\n modals.SignInModal({\n onSignIn: this.signIn,\n onNavForgotPassword: () => this.toForgotPassword(),\n onNavScanCode: () => this.toScan(),\n }),\n )\n }\n\n public toForgotPassword() {\n this.manager.open(\n modals.ForgotPasswordModal({\n onNavSignIn: () => this.toSignIn(),\n onPasswordReset: this.forgotPassword,\n }),\n )\n }\n\n public toPasswordReset() {}\n\n public onTryOn(frames: types.TryOnFrames) {\n this.manager.open(\n modals.TryOnModal({\n frames,\n onClose: () => this.close(),\n onNavBack: () => this.navBack(),\n }),\n )\n }\n\n public onError(error: string) {\n this.manager.open(\n modals.ErrorModal({\n error,\n onClose: () => this.close(),\n onNavBack: () => this.navBack(),\n }),\n )\n }\n\n public onSizeError(recommended: string, available: string[]) {\n this.manager.open(\n modals.SizeErrorModal({\n sizes: { recommended, available },\n onClose: () => this.close(),\n onNavBack: () => this.navBack(),\n }),\n )\n }\n\n public toFitInfo() {\n this.manager.open(\n modals.FitModal({\n onSignInNav: () => this.toScan(),\n onClose: () => this.close(),\n }),\n )\n }\n\n public navBack() {\n window.history.back()\n }\n}\n","import { LoggedOutModalProps, ModalContent } from '../../types'\nimport { L } from '../locale'\n\nconst LoggedOutModal = (props: LoggedOutModalProps): ModalContent => {\n const onNavSignIn = () => {\n props.onNavSignIn('')\n }\n\n const onClose = () => {\n props.onClose()\n }\n\n const Hook = () => {\n document.getElementById('tfr-sign-in')?.addEventListener('click', onNavSignIn)\n document.getElementById('tfr-close')?.addEventListener('click', onClose)\n }\n\n const Unhook = (): void => {\n document.getElementById('tfr-sign-in')?.removeEventListener('click', onNavSignIn)\n document.getElementById('tfr-close')?.removeEventListener('click', onClose)\n }\n\n const Body = () => {\n return `\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p\">${L.SuccessfullyLoggedOut}</div>\n <div class=\"tfr-t-a-center\">\n <span id=\"tfr-sign-in\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20\">${L.SignBackIn}</span>\n <span id=\"tfr-close\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor\" >${L.ReturnToSite}</span>\n </div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default LoggedOutModal\n","import { ModalContent } from '../../types'\nimport { L } from '../locale'\n\nconst NoAvatarModal = (): ModalContent => {\n const Hook = () => void 0\n const Unhook = () => void 0\n const Body = () => {\n return `\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60\">${L.DontHaveAvatar}</div>\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60\">${L.ReturnToTfr}</div>\n `\n }\n\n return {\n Body,\n Hook,\n Unhook,\n useFullModalContent: true,\n }\n}\n\nexport default NoAvatarModal\n","import { ModalContent, SignInModalProps } from '../../types'\nimport { L } from '../locale'\n\nconst SignInModal = (props: SignInModalProps): ModalContent => {\n const { email } = props\n\n const onSignIn = (e: Event) => {\n e.preventDefault()\n\n const email = (<HTMLInputElement>document.getElementById('email-input')).value\n const password = (<HTMLInputElement>document.getElementById('password-input')).value\n resetValidation()\n props.onSignIn(email, password, validationError)\n }\n\n const onNavForgotPassword = () => {\n const email = (<HTMLInputElement>document.getElementById('email-input')).value\n props.onNavForgotPassword(email)\n }\n\n const onNavScanCode = () => {\n props.onNavScanCode()\n }\n\n const onHook = () => {\n document.getElementById('tfr-sign-in-form')?.addEventListener('submit', onSignIn)\n document.getElementById('tfr-sign-in')?.addEventListener('click', onSignIn)\n document.getElementById('tfr-forgot-password')?.addEventListener('click', onNavForgotPassword)\n document.getElementById('tfr-scan-code')?.addEventListener('click', onNavScanCode)\n }\n\n const onUnhook = () => {\n document.getElementById('tfr-sign-in-form')?.removeEventListener('submit', onSignIn)\n document.getElementById('tfr-sign-in')?.removeEventListener('click', onSignIn)\n document.getElementById('tfr-forgot-password')?.removeEventListener('click', onNavForgotPassword)\n document.getElementById('tfr-scan-code')?.removeEventListener('click', onNavScanCode)\n }\n\n const resetValidation = () => {\n const fieldsetElement = document.querySelectorAll('.tfr-fieldset-element')\n fieldsetElement.forEach((element) => {\n element.classList.remove('tfr-fieldset-err')\n })\n\n const labelElement = document.querySelectorAll('.tfr-label-element')\n labelElement.forEach((element) => {\n element.classList.remove('tfr-c-red')\n })\n\n const formError = document.querySelector('#tfr-form-error')\n formError.classList.remove('tfr-d-block')\n formError.innerHTML = ''\n }\n\n const validationError = (message: string) => {\n const fieldsetElement = document.querySelectorAll('.tfr-fieldset-element')\n fieldsetElement.forEach((element) => {\n element.classList.add('tfr-fieldset-err')\n })\n\n const labelElement = document.querySelectorAll('.tfr-label-element')\n labelElement.forEach((element) => {\n element.classList.add('tfr-c-red')\n })\n\n const formError = document.querySelector('#tfr-form-error')\n formError.innerHTML = message || 'Something went wrong'\n formError.classList.add('tfr-d-block')\n }\n\n const body = () => {\n return `\n <form id=\"tfr-sign-in-form\">\n <div class=\"tfr-title-font tfr-light-22-300 tfr-mt-10\">${L.SignIn}</div>\n\n <fieldset class=\"tfr-fieldset-element tfr-fieldset tfr-mt-20\">\n <legend tfr-element=\"true\" class=\"tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5\">${\n L.EmailAddress\n }</legend>\n <input tfr-element=\"true\" type=\"email\" id=\"email-input\" value=\"${email || ''}\" />\n </fieldset>\n\n <fieldset class=\"tfr-fieldset-element tfr-fieldset tfr-mt-20\">\n <legend tfr-element=\"true\" class=\"tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5\">${\n L.Password\n }</legend>\n <input tfr-element=\"true\" type=\"password\" id=\"password-input\" />\n </fieldset>\n\n <div tfr-element=\"true\" class=\"tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none\" id=\"tfr-form-error\"></div>\n\n <div class=\"tfr-mt-20\">\n <span id=\"tfr-forgot-password\" tfr-element=\"true\" class=\"tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15\">${\n L.ForgotPasswordWithSymbol\n }</span>\n <span id=\"tfr-scan-code\" tfr-element=\"true\" class=\"tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor\">${\n L.DontHaveAcc\n }</span>\n </div>\n\n <button id=\"tfr-sign-in\" tfr-element=\"true\" class=\"tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30\" id=\"sign-in-button\" type=\"submit\">\n ${L.SignIn}\n </button>\n </form>\n `\n }\n\n return {\n Hook: onHook,\n Unhook: onUnhook,\n Body: body,\n useFullModalContent: true,\n }\n}\nexport default SignInModal\n","import { ForgotPasswordModalProps, ModalContent } from '../../types'\nimport { L } from '../locale'\n\nconst ForgotPasswordModal = (props: ForgotPasswordModalProps): ModalContent => {\n const onNavSignIn = () => {\n const email = (<HTMLInputElement>document.getElementById('tfr-email')).value\n props.onNavSignIn(email)\n }\n\n const onPasswordReset = () => {\n const email = (<HTMLInputElement>document.getElementById('tfr-email')).value\n props.onPasswordReset(email)\n }\n\n const Hook = () => {\n document.getElementById('tfr-send-password-reset')?.addEventListener('click', onPasswordReset)\n document.getElementById('tfr-back-to-signin')?.addEventListener('click', onNavSignIn)\n }\n\n const Unhook = () => {\n document.getElementById('tfr-send-password-reset')?.removeEventListener('click', onPasswordReset)\n document.getElementById('tfr-back-to-signin')?.removeEventListener('click', onNavSignIn)\n }\n\n const Body = () => {\n return `\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto\">${L.EnterEmailAddress}</div>\n <fieldset class=\"tfr-fieldset-element tfr-fieldset tfr-mt-30\">\n <legend tfr-element=\"true\" class=\"tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5\">${L.EmailAddress}</legend>\n <input tfr-element=\"true\" type=\"email\" id=\"tfr-email\" />\n </fieldset>\n <div tfr-element=\"true\" class=\"tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none\" id=\"error-msg\"></div>\n <div id=\"tfr-back-to-signin\" tfr-element=\"true\" class=\"tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30\">${L.BackToSignIn}</div>\n <button id=\"tfr-send-password-reset\" tfr-element=\"true\" class=\"tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30\">\n ${L.Send}\n </button>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default ForgotPasswordModal\n","import { InitImageSlider } from '../../components/slider'\nimport { ModalContent, TryOnModalProps } from '../../types'\n\nconst TryOnModal = (props: TryOnModalProps): ModalContent => {\n let close = () => void 0\n\n const onNavBack = () => {\n props.onNavBack()\n }\n\n const onClose = () => {\n props.onClose()\n }\n\n const Hook = () => {\n const tryOnImage = <HTMLImageElement>document.getElementById('tfr-tryon-image')\n const onChange = (slider, imageUrl) => {\n console.debug('slider change', slider, imageUrl)\n tryOnImage.src = imageUrl\n }\n const slider = InitImageSlider('tfr-slider', onChange)\n if (Array.isArray(props.frames) && props.frames.length > 0) {\n const e = slider.Load(props.frames)\n if (e instanceof Error) {\n console.error(e)\n return\n }\n close = e as () => void\n }\n document.getElementById('tfr-back')?.addEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.addEventListener('click', onClose)\n }\n\n const Unhook = () => {\n close()\n document.getElementById('tfr-back')?.removeEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.removeEventListener('click', onClose)\n }\n\n const Body = () => {\n return `\n <div class=\"tfr-slider-wrapper\">\n\t\t\t\t<img id=\"tfr-tryon-image\" src=\"\" />\n\t\t\t\t<input type=\"range\" id=\"tfr-slider\" />\n\t\t\t\t</div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default TryOnModal\n","import { ModalContent, SizeErrorModalProps } from '../../types'\nimport { L } from '../locale'\n\nconst SizeErrorModal = (props: SizeErrorModalProps): ModalContent => {\n const onNavBack = () => {\n props.onNavBack()\n }\n\n const onClose = () => {\n props.onClose()\n }\n\n const Hook = () => {\n document.getElementById('tfr-back')?.addEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.addEventListener('click', onClose)\n }\n\n const Unhook = () => {\n document.getElementById('tfr-back')?.removeEventListener('click', onNavBack)\n document.getElementById('tfr-close')?.removeEventListener('click', onClose)\n }\n\n const Body = () => {\n console.debug('rendering size error modal', props)\n return `\n <div class=\"tfr-mt-15-p tfr-mb-13-p\">\n <div tfr-element=\"true\" class=\"tfr-title-font tfr-light-22-300 tfr-c-black\">\n\t\t\t\t\t\t\t${L.NoSizeAvailable} ${props.sizes?.recommended} ${L.OrSize} ${props.sizes?.available?.join(' or ')}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class=\"tfr-t-a-center\">\n <span id=\"tfr-back\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20\">${\n L.ReturnToCatalogPage || 'Return to Catalog Page'\n }</span>\n <span id=\"tfr-close\" tfr-element=\"true\" class=\"tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor\">${\n L.ReturnToProductPage || 'Return to Product Page'\n }</span>\n </div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: true,\n }\n}\n\nexport default SizeErrorModal\n","import { FitModalProps, ModalContent } from '../../types'\nimport { tfrDoor } from '../svgs'\n\nconst FitModal = (props: FitModalProps): ModalContent => {\n const imageBaseUrl = 'https://assets.dev.thefittingroom.xyz/images/'\n const onSignInNav = () => props.onSignInNav()\n\n const Hook = () => {\n document.getElementById('cta-link').addEventListener('click', onSignInNav)\n }\n\n const Unhook = () => {\n document.getElementById('cta-link').removeEventListener('click', onSignInNav)\n }\n\n const Body = () => {\n return `\n <div>\n <div id=\"fit-title\">Fit Scale</div>\n\n <div id=\"fit-line-container\">\n <div id=\"fit-line-text-container\">\n <div class=\"fit-line-item mobile-hidden\">Too Tight</div>\n\n <div class=\"fit-line-item\">\n <div>Tight <span class=\"light-text\">or</span><br /> More fitted</div>\n\n <div class=\"desktop-hidden margin-top-10\">Too Tight</div>\n </div>\n\n <div class=\"fit-line-item fit-line-item-green\">Slightly tight <br /><span class=\"light-text\">or</span> Fitted</div>\n <div class=\"fit-line-item fit-line-item-green\">Perfect Fit</div>\n <div class=\"fit-line-item fit-line-item-green\">Slightly loose <br /><span class=\"light-text\">or</span> Less fitted</div>\n\n <div class=\"fit-line-item\">\n <div>Loose <span class=\"light-text\">or</span><br /> Not fitted</div>\n\n <div class=\"desktop-hidden margin-top-10\">Oversized</div>\n </div>\n\n <div class=\"fit-line-item mobile-hidden\">Oversized</div>\n </div>\n\n <div id=\"fit-line\">\n <div id=\"fit-line-1\" class=\"mobile-hidden\">&nbsp;</div>\n <div id=\"fit-line-2\">&nbsp;</div>\n <div id=\"fit-line-3\">&nbsp;</div>\n <div id=\"fit-line-4\">&nbsp;</div>\n <div id=\"fit-line-5\">&nbsp;</div>\n <div id=\"fit-line-6\">&nbsp;</div>\n <div id=\"fit-line-7\" class=\"mobile-hidden\">&nbsp;</div>\n </div>\n\n <div id=\"fit-line-texts\">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id=\"fit-subtitle-mobile\" class=\"desktop-hidden\">Measurement&nbsp;Points</div>\n\n <div id=\"fit-outline-container\">\n <div id=\"fit-outline-inner-left\">\n <div class=\"fit-outline-line-text fit-outline-line-p-waist-text\">Pant&nbsp;Waist</div>\n <div class=\"fit-outline-line-text fit-outline-line-thigh-text\">Thigh</div>\n </div>\n\n <div id=\"fit-outline-inner\">\n <div class=\"fit-outline-line fit-outline-line-chest\"></div>\n <div class=\"fit-outline-line fit-outline-line-n-waist\"></div>\n <div class=\"fit-outline-line fit-outline-line-p-waist\"></div>\n <div class=\"fit-outline-line fit-outline-line-h-hip\"></div>\n <div class=\"fit-outline-line fit-outline-line-l-hip\"></div>\n <div class=\"fit-outline-line fit-outline-line-thigh-l\"></div>\n <div class=\"fit-outline-line fit-outline-line-thigh-r\"></div>\n\n <img id=\"tfr-fit-outline-img\" src=\"${imageBaseUrl}fit-outline.png\" />\n </div>\n\n <div id=\"fit-outline-inner-right\">\n <div id=\"fit-subtitle\" class=\"mobile-hidden\">Measurement&nbsp;Points</div>\n\n <div class=\"fit-outline-line-text fit-outline-line-chest-text\">Chest/Bust</div>\n <div class=\"fit-outline-line-text fit-outline-line-n-waist-text\">Natural&nbsp;Waist</div>\n <div class=\"fit-outline-line-text fit-outline-line-h-hip-text\">High&nbsp;Hip</div>\n <div class=\"fit-outline-line-text fit-outline-line-l-hip-text\">Low&nbsp;Hip</div>\n </div>\n </div>\n </div>\n\n <div id=\"cta-section\">\n <div id=\"cta-link\">Sign Up or Login</div>\n\n <div class=\"powered-by\">\n <div>Powered by</div>\n <div class=\"tfr-powered-by-logo\">${tfrDoor}</div>\n <div class=\"tfr-powered-by-text-bold\">The Fitting Room</div>\n </div>\n </div>\n `\n }\n\n return {\n Hook,\n Unhook,\n Body,\n useFullModalContent: false,\n }\n}\n\nexport default FitModal\n","import { infoIcon, tfrDoor, userIcon } from './svgs'\n\nexport type RecommendedSize = {\n recommended: string\n sizes: {\n size: string\n size_id: number\n locations: {\n fit: string\n isPerfect: boolean\n location: string\n }[]\n }[]\n}\n\nexport class SizeRecComponent {\n private _sku: string = ''\n private _styleId: number = null\n\n private sizeRecMainDiv: HTMLDivElement\n\n private tfrInfoIcon: HTMLDivElement\n private tfrLoginToView: HTMLDivElement\n private tfrSizeHowItFits: HTMLDivElement\n private tfrSizeRecActionLogin: HTMLDivElement\n private tfrSizeRecActionLogout: HTMLDivElement\n private tfrSizeRecLoading: HTMLDivElement\n private tfrSizeRecommendationError: HTMLDivElement\n private tfrSizeRecommendationsContainer: HTMLDivElement\n private tfrSizeRecSelect: HTMLDivElement\n private tfrSizeRecSelectContainer: HTMLDivElement\n private tfrSizeRecSize: HTMLDivElement\n private tfrSizeRecTable: HTMLDivElement\n private tfrSizeRecTitle: HTMLDivElement\n private tfrSizeRecTitleToggle: HTMLDivElement\n\n private tfrLoggedInElements: NodeList = [] as any as NodeList\n private tfrLoggedOutElements: NodeList = [] as any as NodeList\n\n private tfrToggleOpenElements: NodeList = [] as any as NodeList\n private tfrToggleClosedElements: NodeList = [] as any as NodeList\n\n private isCollapsed: boolean = false\n private redraw: (index: number) => void = null\n\n constructor(\n sizeRecMainDivId: string,\n private readonly onSignInClick: () => void,\n private readonly onSignOutClick: () => void,\n private readonly onFitInfoClick: () => void,\n private readonly onTryOnClick: (styleId: number, sizeId: number, shouldDisplay: boolean) => Promise<void>,\n ) {\n this.init(sizeRecMainDivId)\n }\n\n public get sku() {\n return this._sku\n }\n\n public setSku(sku: string) {\n this._sku = sku\n }\n\n public get styleId() {\n return this._styleId\n }\n\n public setStyleId(styleId: number) {\n this._styleId = styleId\n }\n\n public setIsLoggedIn(isLoggedIn: boolean) {\n\n this.tfrSizeRecSelectContainer.style.display = 'flex'\n this.tfrSizeRecSelect.style.display = 'flex'\n this.tfrSizeHowItFits.style.display = 'block'\n\n if (isLoggedIn) {\n this.tfrSizeHowItFits.style.opacity = '1'\n this.tfrSizeRecSelect.style.opacity = '1'\n this.tfrLoggedInElements.forEach((element) => ((element as HTMLElement).style.display = 'block'))\n this.tfrLoggedOutElements.forEach((element) => ((element as HTMLElement).style.display = 'none'))\n\n this.tfrSizeRecActionLogin.style.display = 'none'\n this.tfrSizeRecActionLogout.style.display = 'block'\n this.tfrSizeRecTitle.style.display = 'flex'\n this.isCollapsed = false\n this.tfrSizeRecTitleToggle.classList.add('tfr-chevron-up')\n this.tfrSizeRecTitleToggle.classList.remove('tfr-chevron-down')\n\n // Ensure the container is visible\n this.tfrSizeRecSelectContainer.style.display = 'flex'\n this.tfrSizeRecSelectContainer.style.opacity = '1'\n } else {\n this.tfrSizeHowItFits.style.opacity = '0.4'\n this.tfrSizeRecSelect.style.opacity = '0.4'\n this.tfrLoggedInElements.forEach((element) => ((element as HTMLElement).style.display = 'none'))\n this.tfrLoggedOutElements.forEach((element) => ((element as HTMLElement).style.display = 'block'))\n\n this.tfrSizeRecActionLogin.style.display = 'block'\n this.tfrSizeRecActionLogout.style.display = 'none'\n\n this.tfrSizeRecTitle.style.display = 'flex'\n this.tfrSizeRecommendationError.style.display = 'none'\n this.tfrSizeRecommendationError.innerHTML = ''\n\n this.renderSizeRecSelectLoggedOut()\n }\n }\n\n public setLoading(isLoading: boolean) {\n if (isLoading) {\n this.tfrSizeRecLoading.style.display = 'block'\n this.tfrSizeRecommendationsContainer.style.display = 'none'\n } else {\n this.tfrSizeRecLoading.style.display = 'none'\n this.tfrSizeRecommendationsContainer.style.display = 'flex'\n }\n }\n\n public setGarmentLocations(locations: string[]) {\n if (!locations || !locations.length) {\n this.tfrSizeRecTitle.style.display = 'none'\n\n return\n }\n\n this.renderGarmentLocations(locations)\n }\n\n public setRecommendedSize({ recommended, sizes }: RecommendedSize) {\n this.renderSizeRec(recommended, sizes)\n }\n\n public hide() {\n if (this.sizeRecMainDiv) {\n this.sizeRecMainDiv.style.display = 'none'\n }\n }\n\n public show() {\n if (this.sizeRecMainDiv) {\n this.sizeRecMainDiv.style.display = 'block'\n }\n }\n\n private init(sizeRecMainDivId: string) {\n const sizeRecMainDiv = document.getElementById(sizeRecMainDivId) as HTMLDivElement\n\n if (!sizeRecMainDiv) throw new Error('Size rec main div not found')\n\n this.sizeRecMainDiv = sizeRecMainDiv\n this.render(sizeRecMainDiv)\n this.setElements()\n this.bindEvents()\n }\n\n private setElements() {\n this.tfrSizeHowItFits = document.getElementById('tfr-size-how-it-fits') as HTMLDivElement\n this.tfrSizeRecTitle = document.getElementById('tfr-size-rec-title') as HTMLDivElement\n\n this.tfrInfoIcon = document.getElementById('tfr-info-icon') as HTMLDivElement\n this.tfrLoginToView = document.getElementById('tfr-login-to-view') as HTMLDivElement\n this.tfrSizeRecActionLogin = document.getElementById('tfr-size-rec-action-login') as HTMLDivElement\n this.tfrSizeRecActionLogout = document.getElementById('tfr-size-rec-action-logout') as HTMLDivElement\n this.tfrSizeRecTable = document.getElementById('tfr-size-rec-table') as HTMLDivElement\n this.tfrSizeRecommendationError = document.getElementById('tfr-size-recommendation-error') as HTMLDivElement\n this.tfrSizeRecSize = document.getElementById('tfr-size-rec-size') as HTMLDivElement\n this.tfrSizeRecSelect = document.getElementById('tfr-size-rec-select') as HTMLDivElement\n this.tfrSizeRecLoading = document.getElementById('tfr-size-rec-loading') as HTMLDivElement\n this.tfrSizeRecTitleToggle = document.getElementById('tfr-size-rec-title-toggle') as HTMLDivElement\n this.tfrSizeRecSelectContainer = document.getElementById('tfr-size-rec-select-container') as HTMLDivElement\n this.tfrSizeRecommendationsContainer = document.getElementById(\n 'tfr-size-recommendations-container',\n ) as HTMLDivElement\n\n this.tfrLoggedInElements = document.querySelectorAll('.tfr-logged-in')\n this.tfrLoggedOutElements = document.querySelectorAll('.tfr-logged-out')\n this.tfrToggleOpenElements = document.querySelectorAll('.tfr-toggle-open')\n this.tfrToggleClosedElements = document.querySelectorAll('.tfr-toggle-closed')\n }\n\n private bindEvents() {\n this.tfrSizeRecActionLogin.addEventListener('click', this.onSignInClick)\n this.tfrSizeRecActionLogout.addEventListener('click', this.onSignOutClick)\n this.tfrSizeRecSelect.addEventListener('click', this.onSizeRecSelectClick.bind(this))\n this.tfrSizeRecTitleToggle.addEventListener('click', this.toggletSizeRecSelectContainer.bind(this))\n this.tfrInfoIcon.addEventListener('click', this.onFitInfoClick)\n this.tfrLoginToView.addEventListener('click', this.onSignInClick)\n\n const tryOnButton = document.getElementById('tfr-try-on-button')\n if (!tryOnButton) return\n\n tryOnButton.addEventListener('click', async () => {\n // Prevent multiple clicks while loading\n if (tryOnButton.classList.contains('loading')) {\n return\n }\n\n const activeButton = document.querySelector('.tfr-size-rec-select-button.active')\n if (!activeButton) return\n\n const selectedSizeId = Number(activeButton.getAttribute('data-size-id'))\n if (Number.isNaN(selectedSizeId)) return\n\n // Set loading state\n tryOnButton.classList.add('loading')\n const originalText = tryOnButton.textContent\n tryOnButton.textContent = ' '\n tryOnButton.setAttribute('disabled', 'true')\n\n try {\n // Get all size buttons\n const allSizeButtons = Array.from(document.querySelectorAll('.tfr-size-rec-select-button')) as HTMLElement[]\n const activeIndex = allSizeButtons.indexOf(activeButton as HTMLElement)\n\n if (this.styleId !== null) {\n // 1. Fetch and display the VTO for the active (recommended) size\n try {\n await this.onTryOnClick(this.styleId, selectedSizeId, true)\n } catch (e) {\n console.error(`Error trying on active size ${selectedSizeId}:`, e)\n // Optionally, inform the user about the error for the primary VTO\n }\n\n // 2. Fetch VTO for the size to the left (if it exists)\n if (activeIndex > 0) {\n const leftButton = allSizeButtons[activeIndex - 1]\n await this._preloadNeighborVTO(leftButton)\n }\n\n // 3. Fetch VTO for the size to the right (if it exists)\n if (activeIndex >= 0 && activeIndex < allSizeButtons.length - 1) {\n const rightButton = allSizeButtons[activeIndex + 1]\n await this._preloadNeighborVTO(rightButton)\n }\n }\n } catch (error) {\n console.error('Error during sequential try-on process:', error)\n } finally {\n // Reset loading state\n tryOnButton.classList.remove('loading')\n tryOnButton.textContent = originalText\n tryOnButton.removeAttribute('disabled')\n }\n })\n }\n\n private async _preloadNeighborVTO(buttonElement: HTMLElement): Promise<void> {\n // this.styleId is assumed to be non-null here because the calling context (bindEvents)\n // is wrapped in 'if (this.styleId !== null)'\n const sizeId = Number(buttonElement.getAttribute('data-size-id'))\n if (!Number.isNaN(sizeId)) {\n try {\n await this.onTryOnClick(this.styleId!, sizeId, false)\n } catch (e) {\n const buttonText = buttonElement.textContent?.trim() || 'N/A'\n console.error(`Error pre-loading try-on for size ${sizeId} (button: ${buttonText}):`, e)\n }\n }\n }\n\n private onSizeRecSelectClick(e: MouseEvent) {\n const target = e.target as HTMLDivElement\n if (!target.classList.contains('tfr-size-rec-select-button') || target.classList.contains('tfr-disabled')) return\n\n e.preventDefault()\n\n const selectedIndex = Number(target.getAttribute('data-index'))\n if (Number.isNaN(selectedIndex)) return\n\n const allButtons = document.querySelectorAll('.tfr-size-rec-select-button')\n\n allButtons.forEach((button) => button.classList.remove('active'))\n allButtons.item(selectedIndex).classList.add('active')\n\n this.redraw(selectedIndex)\n\n const selectedSizeId = Number(target.getAttribute('data-size-id'))\n if (Number.isNaN(selectedSizeId)) return\n\n this.onTryOnClick(this.styleId, selectedSizeId, true)\n }\n\n private renderSizeRec(recommended: string, sizes: RecommendedSize['sizes']) {\n this.tfrSizeRecSize.innerHTML = `&nbsp;${recommended}`\n\n const selectedSizeIndex = sizes.findIndex(({ size }) => size === recommended)\n\n this.redraw = (index: number) => this.renderSizeRecTable(sizes, index)\n\n this.redraw(selectedSizeIndex)\n this.renderSizeRecSelect(sizes, selectedSizeIndex)\n }\n\n private renderSizeRecTable(sizes: RecommendedSize['sizes'], index: number) {\n const { locations } = sizes[index]\n const html = locations\n .map(({ location, fit, isPerfect }) => this.renderSizeRecTableRow(location, fit, isPerfect))\n .join('')\n\n this.tfrSizeRecTable.innerHTML = html\n }\n\n private renderSizeRecSelect(sizes: RecommendedSize['sizes'], index: number) {\n const sizeNames = sizes.map(({ size }) => size)\n const html = sizeNames\n .map(\n (name, i) =>\n `<div class=\"tfr-size-rec-select-button ${i === index ? 'active' : ''}\" data-index=\"${i}\" data-size-id=\"${sizes[i].size_id\n }\">${name}</div>`,\n )\n .join('')\n\n this.tfrSizeRecSelect.innerHTML = html\n }\n\n private renderSizeRecSelectLoggedOut() {\n const html = [\n `<div class=\"tfr-size-rec-select-button tfr-disabled\">M</div>`,\n `<div class=\"tfr-size-rec-select-button tfr-disabled active\">L</div>`,\n `<div class=\"tfr-size-rec-select-button tfr-disabled\">XL</div>`,\n ].join('')\n\n this.tfrSizeRecSelect.innerHTML = html\n }\n\n private renderSizeRecTableRow(location: string, fit: string, isPerfect: boolean = false) {\n return `<div class=\"tfr-size-rec-table-row\">\n <div class=\"tfr-size-rec-table-cell-left\">${location}</div>\n <div class=\"tfr-size-rec-table-cell-right ${isPerfect ? 'perfect' : ''}\">\n ${fit}\n </div>\n </div>`\n }\n\n private renderGarmentLocations(locations: string[]) {\n const innerHtml = locations\n .map((location, index) => this.renderSizeRecTableRow(location, this.randomFit(index), true))\n .join('')\n const html = `<div id=\"tfr-logged-out-overlay-container\">\n <div id=\"tfr-logged-out-overlay\">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${innerHtml}\n </div>\n </div>`\n\n this.tfrSizeRecTable.innerHTML = html\n }\n\n private randomFit(index: number) {\n const choices = ['Slightly Tight', 'Perfect Fit', 'Perfect Fit', 'Slightly Loose', 'Perfect Fit']\n\n return choices[index % choices.length]\n }\n\n private toggletSizeRecSelectContainer() {\n if (this.isCollapsed) {\n this.isCollapsed = false\n this.tfrSizeRecTitleToggle.classList.add('tfr-chevron-up')\n this.tfrSizeRecTitleToggle.classList.remove('tfr-chevron-down')\n this.tfrToggleOpenElements.forEach((element) => ((element as HTMLElement).style.display = 'block'))\n this.tfrToggleClosedElements.forEach((element) => ((element as HTMLElement).style.display = 'none'))\n } else {\n this.isCollapsed = true\n this.tfrSizeRecTitleToggle.classList.remove('tfr-chevron-up')\n this.tfrSizeRecTitleToggle.classList.add('tfr-chevron-down')\n this.tfrToggleOpenElements.forEach((element) => ((element as HTMLElement).style.display = 'none'))\n this.tfrToggleClosedElements.forEach((element) => ((element as HTMLElement).style.display = 'block'))\n }\n }\n\n private render(sizeRecMainDiv: HTMLDivElement) {\n const body = `<div id=\"tfr-size-recommendations\">\n <div id=\"tfr-size-rec-loading\">\n <div class=\"lds-ellipsis\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id=\"tfr-size-recommendations-container\">\n <div id=\"tfr-size-rec-title-toggle\" class=\"tfr-chevron-up\">v</div>\n\n <div class=\"tfr-logged-out\">\n <div class=\"tfr-flex tfr-gap tfr-mb-2 tfr-mobile-small-text\">\n <div>Uncertain&nbsp;of&nbsp;your&nbsp;size?</div>\n \n <div class=\"tfr-toggle-closed\">\n <div class=\"tfr-flex tfr-items-center\">\n <div>Try</div>\n <div class=\"tfr-powered-by-logo\">${tfrDoor}</div>\n <div class=\"tfr-powered-by-text-bold\">The&nbsp;Fitting&nbsp;Room</div>\n </div>\n </div>\n\n <div class=\"tfr-toggle-open\">\n <div id=\"tfr-login-to-view\" class=\"tfr-flex tfr-items-center\">\n ${userIcon} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"tfr-logged-in\">\n <div id=\"tfr-size-rec-title\">\n Recommended Size:\n <div id=\"tfr-size-rec-size\">\n <div class=\"tfr-size-rec-login-cta\">\n ${userIcon} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"tfr-toggle-open\" style=\"width: 100%\">\n <div id=\"tfr-size-rec-select-container\">\n <div id=\"tfr-size-how-it-fits\">Select size to see how it fits:</div>\n\n <div id=\"tfr-size-rec-select\"></div>\n\n <div id=\"tfr-size-rec-subtitle\">\n How it fits\n <span id=\"tfr-info-icon\">${infoIcon}</span>\n </div>\n\n <div id=\"tfr-size-rec-table\"></div>\n\n <div id=\"tfr-try-on-button\" class=\"tfr-try-on-button\">Try On</div>\n </div>\n </div>\n\n <div id=\"tfr-size-rec-action\">\n <div id=\"tfr-size-rec-action-login\">Sign up or login</div>\n <div id=\"tfr-size-rec-action-logout\">Log out</div>\n </div>\n\n <div class=\"tfr-toggle-open\">\n <div class=\"tfr-powered-by\">\n <div>Powered by</div>\n <div class=\"tfr-powered-by-logo\">${tfrDoor}</div>\n <div class=\"tfr-powered-by-text-bold\">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id=\"tfr-size-recommendation-error\"></div>`\n\n sizeRecMainDiv.innerHTML = body\n }\n}\n","import { types as ShopTypes, TfrShop } from '@thefittingroom/sdk'\n\nimport { RecommendedSize, SizeRecComponent } from './components/SizeRec'\n\nexport type TfrCssVariables = {\n brandColor?: string\n black?: string\n red?: string\n white?: string\n muted?: string\n dark?: string\n grey?: string\n lightGrey?: string\n mainBorderColor?: string\n mainBorderRadius?: string\n mainBorderWidth?: string\n mainBgColor?: string\n mainWidth?: string\n mainVPadding?: string\n mainHPadding?: string\n mainFont?: string\n titleFont?: string\n subtitleFont?: string\n rowFont?: string\n ctaFont?: string\n sizeSelectorTextColor?: string\n sizeSelectorFontSize?: string\n sizeSelectorFontWeight?: string\n sizeSelectorBorderColor?: string\n sizeSelectorBorderWidth?: string\n sizeSelectorBgColor?: string\n sizeSelectorBgColorHover?: string\n sizeSelectorBgColorActive?: string\n sizeSelectorButtonHeight?: string\n sizeSelectorButtonActiveHeight?: string\n sizeSelectorButtonActiveBorderColor?: string\n sizeSelectorButtonActiveBorderWidth?: string\n sizeSelectorButtonRadius?: string\n sizeSelectorButtonShadow?: string\n}\n\nexport class TfrSizeRec {\n private readonly sizeRecComponent: SizeRecComponent\n private readonly perfectFits = [ShopTypes.Fit.PERFECT_FIT, ShopTypes.Fit.SLIGHTLY_LOOSE, ShopTypes.Fit.SLIGHTLY_TIGHT]\n\n constructor(\n sizeRecMainDivId: string,\n cssVariables: TfrCssVariables,\n private readonly tfrShop: TfrShop,\n private readonly onSignInClick: () => void,\n private readonly onSignOutClick: () => void,\n private readonly onFitInfoClick: () => void,\n private readonly onTryOnClick: (styleId: number, sizeId: number, shouldDisplay: boolean) => Promise<void>,\n ) {\n this.setCssVariables(cssVariables)\n this.sizeRecComponent = new SizeRecComponent(\n sizeRecMainDivId,\n this.onSignInClick,\n this.onSignOutClick,\n this.onFitInfoClick,\n this.onTryOnClick,\n )\n }\n\n public get sku() {\n return this.sizeRecComponent.sku\n }\n\n public setSku(sku: string) {\n this.sizeRecComponent.setSku(sku)\n }\n\n public get styleId() {\n return this.sizeRecComponent.styleId\n }\n\n public setStyleId(styleId: number) {\n this.sizeRecComponent.setStyleId(styleId)\n }\n\n public setIsLoggedIn(isLoggedIn: boolean) {\n this.sizeRecComponent.setIsLoggedIn(isLoggedIn)\n }\n\n public async setGarmentLocations(filledLocations: string[] = []) {\n this.sizeRecComponent.setLoading(true)\n // If we already have filledLocations, use them directly instead of making API calls\n const locations = filledLocations.length > 0 ? filledLocations : await this.getGarmentLocations(filledLocations)\n\n console.debug('locations', locations)\n console.debug('filledLocations', filledLocations)\n\n if (locations && locations.length > 0) {\n this.sizeRecComponent.show()\n this.sizeRecComponent.setGarmentLocations(locations)\n }\n this.sizeRecComponent.setLoading(false)\n }\n\n public async recommendSize() {\n this.sizeRecComponent.setLoading(true)\n const sizes = await this.getRecommendedSize()\n\n if (!sizes) {\n console.error('No sizes found for sku')\n this.sizeRecComponent.setLoading(false)\n return\n }\n\n this.sizeRecComponent.show()\n this.sizeRecComponent.setRecommendedSize(sizes)\n this.sizeRecComponent.setLoading(false)\n }\n\n private async getGarmentLocations(filledLocations: string[]): Promise<string[]> {\n try {\n const locations = await this.tfrShop.getMeasurementLocationsFromSku(this.sku, filledLocations)\n\n return locations\n } catch (error) {\n try {\n const style = await this.tfrShop.getStyleByBrandStyleId(this.sku)\n if (!style) {\n console.error('Style not found for brand style ID:', this.sku)\n this.sizeRecComponent.hide()\n return null\n }\n const locations = await this.tfrShop.getMeasurementLocationsFromBrandStyleId(style.id, filledLocations)\n\n return locations\n } catch (error) {\n console.error(error)\n this.sizeRecComponent.hide()\n return null\n }\n }\n }\n\n private async getRecommendedSize() {\n try {\n const colorwaySizeAsset = await this.tfrShop.getColorwaySizeAssetFromSku(this.sku)\n const sizes = await this.getRecommendedSizes(String(colorwaySizeAsset.style_id))\n this.setStyleId(colorwaySizeAsset.style_id)\n\n return sizes\n } catch (error) {\n try {\n const style = await this.tfrShop.getStyleByBrandStyleId(this.sku)\n if (!style) {\n console.error('Style not found for brand style ID:', this.sku)\n this.sizeRecComponent.hide()\n return null\n }\n const sizes = await this.getRecommendedSizes(String(style.id))\n this.setStyleId(style.id)\n\n return sizes\n } catch (error) {\n console.error(error)\n this.sizeRecComponent.hide()\n return null\n }\n }\n }\n\n private async getRecommendedSizes(styleId: string): Promise<RecommendedSize> {\n const sizeRec = await this.tfrShop.getRecommendedSizes(styleId)\n\n if (!sizeRec) return null\n\n return {\n recommended: sizeRec.recommended_size.size_value.name,\n sizes: sizeRec.fits.map((fit) => {\n return {\n size: sizeRec.available_sizes.find((size) => size.id === fit.size_id).size_value.name,\n size_id: fit.size_id,\n locations: fit.measurement_location_fits\n .map((locationFit) => {\n const fitLabel =\n typeof locationFit.fit_label === 'string' && locationFit.fit_label\n ? locationFit.fit_label\n : ShopTypes.FitNames[locationFit.fit]\n\n return {\n fit: fitLabel,\n isPerfect: this.perfectFits.includes(locationFit.fit),\n location: this.tfrShop.getMeasurementLocationName(locationFit.measurement_location),\n sortOrder: this.tfrShop.getMeasurementLocationSortOrder(locationFit.measurement_location),\n }\n })\n .sort((a, b) => (a.sortOrder < b.sortOrder ? -1 : 1)),\n }\n }),\n }\n }\n\n private setCssVariables(cssVariables: TfrCssVariables) {\n const r = document.querySelector<HTMLElement>(':root')\n\n if (cssVariables.brandColor) r.style.setProperty('--tfr-brand-color', cssVariables.brandColor)\n if (cssVariables.black) r.style.setProperty('--tfr-black', cssVariables.black)\n if (cssVariables.red) r.style.setProperty('--tfr-red', cssVariables.red)\n if (cssVariables.white) r.style.setProperty('--tfr-white', cssVariables.white)\n if (cssVariables.muted) r.style.setProperty('--tfr-muted', cssVariables.muted)\n if (cssVariables.dark) r.style.setProperty('--tfr-dark', cssVariables.dark)\n if (cssVariables.grey) r.style.setProperty('--tfr-grey', cssVariables.grey)\n if (cssVariables.lightGrey) r.style.setProperty('--tfr-light-grey', cssVariables.lightGrey)\n if (cssVariables.mainBorderColor) r.style.setProperty('--tfr-main-border-color', cssVariables.mainBorderColor)\n if (cssVariables.mainBorderRadius) r.style.setProperty('--tfr-main-border-radius', cssVariables.mainBorderRadius)\n if (cssVariables.mainBorderWidth) r.style.setProperty('--tfr-main-border-width', cssVariables.mainBorderWidth)\n if (cssVariables.mainBgColor) r.style.setProperty('--tfr-main-bg-color', cssVariables.mainBgColor)\n if (cssVariables.mainWidth) r.style.setProperty('--tfr-main-width', cssVariables.mainWidth)\n if (cssVariables.mainVPadding) r.style.setProperty('--tfr-main-v-padding', cssVariables.mainVPadding)\n if (cssVariables.mainHPadding) r.style.setProperty('--tfr-main-h-padding', cssVariables.mainHPadding)\n if (cssVariables.mainFont) r.style.setProperty('--tfr-main-font', cssVariables.mainFont)\n if (cssVariables.titleFont) r.style.setProperty('--tfr-title-font', cssVariables.titleFont)\n if (cssVariables.subtitleFont) r.style.setProperty('--tfr-subtitle-font', cssVariables.subtitleFont)\n if (cssVariables.rowFont) r.style.setProperty('--tfr-row-font', cssVariables.rowFont)\n if (cssVariables.ctaFont) r.style.setProperty('--tfr-cta-font', cssVariables.ctaFont)\n\n // Size Selector\n if (cssVariables.sizeSelectorTextColor)\n r.style.setProperty('--tfr-size-selector-text-color', cssVariables.sizeSelectorTextColor)\n if (cssVariables.sizeSelectorFontSize)\n r.style.setProperty('--tfr-size-selector-font-size', cssVariables.sizeSelectorFontSize)\n if (cssVariables.sizeSelectorFontWeight)\n r.style.setProperty('--tfr-size-selector-font-weight', cssVariables.sizeSelectorFontWeight)\n if (cssVariables.sizeSelectorBgColor)\n r.style.setProperty('--tfr-size-selector-bg-color', cssVariables.sizeSelectorBgColor)\n if (cssVariables.sizeSelectorBorderColor)\n r.style.setProperty('--tfr-size-selector-border-color', cssVariables.sizeSelectorBorderColor)\n if (cssVariables.sizeSelectorBorderWidth)\n r.style.setProperty('--tfr-size-selector-border-width', cssVariables.sizeSelectorBorderWidth)\n if (cssVariables.sizeSelectorBgColorHover)\n r.style.setProperty('--tfr-size-selector-bg-color-hover', cssVariables.sizeSelectorBgColorHover)\n if (cssVariables.sizeSelectorBgColorActive)\n r.style.setProperty('--tfr-size-selector-bg-color-active', cssVariables.sizeSelectorBgColorActive)\n if (cssVariables.sizeSelectorButtonHeight)\n r.style.setProperty('--tfr-size-selector-button-height', cssVariables.sizeSelectorButtonHeight)\n if (cssVariables.sizeSelectorButtonActiveHeight)\n r.style.setProperty('--tfr-size-selector-button-active-height', cssVariables.sizeSelectorButtonActiveHeight)\n if (cssVariables.sizeSelectorButtonActiveBorderColor)\n r.style.setProperty(\n '--tfr-size-selector-button-active-border-color',\n cssVariables.sizeSelectorButtonActiveBorderColor,\n )\n if (cssVariables.sizeSelectorButtonActiveBorderWidth)\n r.style.setProperty(\n '--tfr-size-selector-button-active-border-width',\n cssVariables.sizeSelectorButtonActiveBorderWidth,\n )\n if (cssVariables.sizeSelectorButtonRadius)\n r.style.setProperty('--tfr-size-selector-button-radius', cssVariables.sizeSelectorButtonRadius)\n if (cssVariables.sizeSelectorButtonShadow)\n r.style.setProperty('--tfr-size-selector-button-shadow', cssVariables.sizeSelectorButtonShadow)\n }\n}\n","import { FirebaseUser, TfrShop } from '@thefittingroom/sdk'\n\nimport { ModalManager } from '../components'\nimport { UIError } from '../components/uiError'\nimport * as types from '../types'\n\nexport const TfrLogo = process.env.ASSETS_URL + '/tfr-logo.svg'\nexport const AposeLogo = process.env.ASSETS_URL + '/apose-logo.svg'\nexport const AppStoreLogo = process.env.ASSETS_URL + '/app-store-logo.svg'\nexport const QrCodeLogo = process.env.ASSETS_URL + '/qr-code-logo.svg'\n\nexport const NotLoggedIn = new Error('user not logged in')\nexport const NoFramesFound = new Error('No frames found for this colorway')\nexport const NoColorwaySizeAssetsFound = new Error('No colorway size assets found')\nexport const NoStylesFound = new Error('No styles found')\n\nexport interface RecommendedAvailableSizes {\n error: string\n recommended_size: string\n available_sizes: string[]\n}\n\nexport interface FittingRoom {\n shop: TfrShop\n manager: ModalManager\n onSignout(colorwaySizeAssetSKU: string): () => Promise<void>\n onClose(): void\n onNavBack(): void\n onTryOn(colorwaySizeAssetSKU: string): void\n whenAvatarNotCreated(colorwaySizeAssetSKU: string): void\n whenAvatarPending(colorwaySizeAssetSKU: string): void\n whenAvatarCreated(colorwaySizeAssetSKU: string): void\n whenNotSignedIn(colorwaySizeAssetSKU: string): void\n\n whenTryOnReady(colorwaySizeAssetSKU: string, frames: types.TryOnFrames): void\n\n whenTryOnLoading(colorwaySizeAssetSKU: string): void\n\n whenTryOnFailed(colorwaySizeAssetSKU: string, error: Error): void\n\n whenError(colorwaySizeAssetSKU: string, error: UIError): void\n whenSignedIn(user: FirebaseUser, colorwaySizeAssetSKU: string): void\n whenSignedOut(colorwaySizeAssetSKU: string): void\n\n onSignIn(\n colorwaySizeAssetSKU: string,\n ): (username: string, password: string, validation: (message: string) => void) => void\n onNavSignIn(colorwaySizeAssetSKU: string): (email: string) => void\n onPasswordReset(colorwaySizeAssetSKU: string): (email: string) => void\n onNavForgotPassword(colorwaySizeAssetSKU: string): (email: string) => void\n onNavScanCode(colorwaySizeAssetSKU: string): void\n TryOn(colorwaySizeAssetSKU: string): void\n}\n\nexport interface ModalContent {\n Body: () => string\n Hook(): void\n Unhook(): void\n useFullModalContent: boolean\n}\n\nexport interface ModalProps { }\n\nexport interface SignInParams {\n email: string\n password: string\n}\nexport interface SignInModalProps extends ModalProps {\n email?: string\n onSignIn: (email: string, password: string, validationError: (message: string) => void) => void\n onNavForgotPassword: (email?: string) => void\n onNavScanCode: () => void\n}\nexport interface ForgotPasswordModalProps extends ModalProps {\n email?: string\n onNavSignIn: (email: string) => void\n onPasswordReset: (email: string) => void\n}\nexport type NoAvatarModalProps = ModalProps\nexport interface LoadingAvatarModalProps extends ModalProps {\n timeoutMS: number\n}\n\nexport interface TryOnModalProps extends ModalProps {\n frames: TryOnFrames\n onNavBack: () => void\n onClose: () => void\n}\n\nexport interface ErrorModalProps extends ModalProps {\n error: string\n onNavBack: () => void\n onClose: () => void\n}\n\nexport interface SizeErrorModalProps {\n onNavBack: () => void\n onClose: () => void\n sizes?: {\n recommended: string\n available: string[]\n }\n}\n\nexport interface ResetLinkModalProps {\n email: string\n onNavSignIn: (email: string) => void\n}\nexport interface ScanCodeModalProps {\n onSignInNav: () => void\n onTelSubmit: (tel: string) => void\n}\nexport interface LoggedOutModalProps {\n onClose: () => void\n onNavSignIn: (email: string) => void\n}\n\nexport interface FitModalProps {\n onSignInNav: () => void\n onClose: () => void\n}\n\nexport type TryOnFrames = string[]\n\nexport enum AvatarState {\n NOT_CREATED = 'NOT_CREATED',\n CREATED = 'CREATED',\n PENDING = 'PENDING',\n}\n\nexport type FirestoreColorwaySizeAsset = {\n id: number\n size_id: number\n style_id: number\n colorway_id: number\n colorway_name: string\n sku: string\n}\n\nexport type FirestoreGarmentMeasurement = {\n id: number\n measurement_location: string\n tolerance: number\n value: number\n}\n\nexport type FirestoreSize = {\n id: number\n size: string\n label: string\n size_system: string\n size_value_id: string\n garment_measurements: Map<string, FirestoreGarmentMeasurement>\n}\n\nexport type FirestoreColorway = {\n id: number\n name: string\n}\n\nexport type FirestoreStyle = {\n id: number\n brand_id: number\n brand_style_id: string\n name: string\n description: string\n garment_category: string\n is_published: boolean\n sale_type: string\n colorways: { [key: number]: FirestoreColorway }\n sizes: { [key: number]: FirestoreSize }\n is_vto: boolean\n}\n","import { types as ShopTypes, TfrShop, initShop } from '@thefittingroom/sdk'\nimport { FirestoreStyleCategory } from '@thefittingroom/sdk/dist/esm/types'\n\nimport { VtoComponent } from './components/Vto'\nimport { L } from './components/locale'\nimport { validateEmail, validatePassword } from './helpers/validations'\nimport { TfrModal } from './tfr-modal'\nimport { TfrCssVariables, TfrSizeRec } from './tfr-size-rec'\nimport * as types from './types'\n\nexport interface TfrHooks {\n onLoading?: () => void\n onLoadingComplete?: () => void\n onError?: (error: string) => void\n onVtoReady?: (frames: types.TryOnFrames) => void\n onLogin?: () => void\n onLogout?: () => void\n}\n\nexport class FittingRoom {\n private isLoggedIn: boolean = false\n\n public style: FirestoreStyleCategory\n\n public readonly tfrModal: TfrModal\n public readonly tfrSizeRec: TfrSizeRec\n private readonly vtoComponent: VtoComponent\n private readonly tfrShop: TfrShop\n private unsub: () => void = null\n\n constructor(\n private readonly shopId: string | number,\n modalDivId: string,\n sizeRecMainDivId: string,\n vtoMainDivId: string,\n private readonly hooks: TfrHooks = {},\n cssVariables: TfrCssVariables,\n _env?: string,\n ) {\n // prettier-ignore\n const env = _env\n ? _env\n : typeof process !== 'undefined'\n ? process.env.NODE_ENV\n : 'dev'\n\n console.log('tfr-env', env)\n\n this.tfrModal = new TfrModal(\n modalDivId,\n this.signIn.bind(this),\n this.forgotPassword.bind(this),\n this.submitTel.bind(this),\n )\n this.tfrShop = initShop(Number(this.shopId), env)\n this.tfrSizeRec = new TfrSizeRec(\n sizeRecMainDivId,\n cssVariables,\n this.tfrShop,\n this.onSignInClick.bind(this),\n this.signOut.bind(this),\n this.onFitInfoClick.bind(this),\n this.onTryOnClick.bind(this),\n )\n\n if (vtoMainDivId) this.vtoComponent = new VtoComponent(vtoMainDivId)\n }\n\n get shop() {\n return this.tfrShop\n }\n\n get sku() {\n return this.tfrSizeRec.sku\n }\n\n public async setSku(sku: string) {\n this.tfrSizeRec.setSku(sku)\n\n const style = await this.getStyle(this.sku)\n\n if (!style) {\n document.getElementById('tfr-size-recommendations').style.display = 'none'\n\n return\n }\n\n this.style = style\n\n if (!style.is_published) {\n document.getElementById('tfr-size-recommendations').style.display = 'none'\n console.log(`style ${style.id} is not published`)\n } else {\n console.log(`style ${style.id} is published`)\n }\n\n console.log(`style ${style.id} virtual try on is disabled`)\n\n if (style.is_vto) {\n document.getElementById('tfr-try-on-button')?.classList.remove('hide')\n } else {\n document.getElementById('tfr-try-on-button')?.classList.add('hide')\n }\n\n if (this.isLoggedIn) this.tfrSizeRec.recommendSize()\n else this.setGarmentLocations(style)\n }\n\n public async onInit() {\n this.isLoggedIn = await this.tfrShop.onInit()\n this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn)\n\n if (this.isLoggedIn) {\n if (this.hooks?.onLogin) this.hooks.onLogin()\n\n this.subscribeToProfileChanges()\n } else {\n if (this.hooks?.onLogout) this.hooks.onLogout()\n\n this.unsubscribeFromProfileChanges()\n }\n\n return this.isLoggedIn\n }\n\n public close() {\n this.tfrModal.close()\n }\n\n public async signOut() {\n await this.tfrShop.user.logout()\n\n if (this.hooks?.onLogout) this.hooks.onLogout()\n\n this.isLoggedIn = false\n this.tfrSizeRec.setIsLoggedIn(false)\n this.setGarmentLocations(this.style)\n this.unsubscribeFromProfileChanges()\n }\n\n public async signIn(username: string, password: string, validationError: (message: string) => void) {\n if (username.length == 0 || password.length == 0) return validationError(L.UsernameOrPasswordEmpty)\n if (!validateEmail(username)) return validationError(L.EmailError)\n if (!validatePassword(password)) return validationError(L.PasswordError)\n\n try {\n await this.tfrShop.user.login(username, password)\n\n if (this.hooks?.onLogin) this.hooks.onLogin()\n this.tfrModal.close()\n\n this.isLoggedIn = true\n this.tfrSizeRec.setIsLoggedIn(true)\n\n this.tfrSizeRec.recommendSize()\n this.subscribeToProfileChanges()\n } catch (e) {\n return validationError(L.UsernameOrPasswordIncorrect)\n }\n }\n\n public setBrandUserId(brandUserId: string | number) {\n this.tfrShop.user.setBrandUserId(brandUserId)\n }\n\n public async submitTel(tel: string) {\n try {\n await this.tfrShop.submitTelephoneNumber(tel)\n this.tfrModal.toSignIn()\n } catch {\n this.tfrModal.onError(L.SomethingWentWrong)\n }\n }\n\n public async forgotPassword(email: string) {\n await this.tfrShop.user.sendPasswordResetEmail(email)\n\n this.tfrModal.toSignIn()\n }\n\n public async passwordReset(code: string, newPassword: string) {\n await this.tfrShop.user.confirmPasswordReset(code, newPassword)\n\n this.tfrModal.toPasswordReset()\n }\n\n public async getMeasurementLocationsFromSku(sku: string) {\n return this.tfrShop.getMeasurementLocationsFromSku(sku)\n }\n\n public onSignInClick() {\n this.tfrModal.toScan()\n }\n\n public onFitInfoClick() {\n this.tfrModal.toFitInfo()\n }\n\n public async onTryOnClick(styleId: number, sizeId: number, shouldDisplay: boolean = true) {\n if (!this.vtoComponent)\n return console.error('VtoComponent is not initialized. Please check if the vtoMainDivId is correct.')\n\n const frames = await this.shop.tryOn(styleId, sizeId)\n\n if (shouldDisplay) {\n try {\n this.vtoComponent.init()\n this.vtoComponent.onNewFramesReady(frames)\n } catch (e) {\n console.error('Error initializing VTO:', e)\n this.tfrModal.onError(L.SomethingWentWrong)\n }\n }\n }\n\n private onUserProfileChange(userProfile: ShopTypes.FirestoreUser) {\n switch (userProfile.avatar_status as types.AvatarState) {\n case types.AvatarState.NOT_CREATED:\n if (this.hooks?.onError) this.hooks.onError(L.DontHaveAvatar)\n this.tfrModal.onNotCreated()\n break\n\n case types.AvatarState.PENDING:\n if (this.hooks?.onLoading) this.hooks.onLoading()\n break\n\n case types.AvatarState.CREATED:\n if (this.hooks?.onLoadingComplete) this.hooks.onLoadingComplete()\n break\n\n default:\n if (this.hooks?.onError) this.hooks.onError(L.SomethingWentWrong)\n this.tfrModal.onError(L.SomethingWentWrong)\n break\n }\n }\n\n private subscribeToProfileChanges() {\n if (this.unsub) return\n\n this.unsub = this.tfrShop.user.watchUserProfileForChanges((userProfile) => this.onUserProfileChange(userProfile))\n }\n\n private unsubscribeFromProfileChanges() {\n if (!this.unsub) return\n\n this.unsub()\n this.unsub = null\n }\n\n private async setGarmentLocations(style: FirestoreStyleCategory) {\n const filledLocations =\n style?.sizes?.[0]?.garment_measurements.map((measurement) => measurement.measurement_location) || ([] as string[])\n\n this.tfrSizeRec.setGarmentLocations(filledLocations)\n }\n\n private async getStyle(brandStyleIdOrSku: string) {\n try {\n const colorwaySizeAsset = await this.tfrShop.getColorwaySizeAssetFromSku(brandStyleIdOrSku)\n const style = await this.tfrShop.getStyle(colorwaySizeAsset.style_id)\n\n return style\n } catch (e) {\n try {\n const style = await this.tfrShop.getStyleByBrandStyleId(brandStyleIdOrSku)\n\n return style\n } catch (e2) {\n return null\n }\n }\n }\n}\n","export const validateEmail = (email: string): boolean => {\n if (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,})+$/.test(email)) {\n return true\n }\n return false\n}\n\nexport const validatePassword = (password: string): boolean => {\n if (password.match(/^.{7,}$/)) {\n return true\n }\n return false\n}\n\n// https://www.w3resource.com/javascript/form/email-validation.php\n// https://www.w3resource.com/javascript/form/password-validation.php\n","import { FittingRoom, TfrHooks } from './tfr'\nimport { TfrCssVariables } from './tfr-size-rec'\n\nexport type TrfConfig = {\n shopId: string | number\n modalDivId: string\n sizeRecMainDivId: string\n vtoMainDivId: string\n hooks?: TfrHooks\n cssVariables?: TfrCssVariables\n env?: string\n}\n\nexport const initFittingRoom = async ({\n shopId,\n modalDivId,\n sizeRecMainDivId,\n vtoMainDivId,\n hooks = {},\n cssVariables = {},\n env = 'dev',\n}: TrfConfig) => {\n const tfr = new FittingRoom(shopId, modalDivId, sizeRecMainDivId, vtoMainDivId, hooks, cssVariables, env)\n await tfr.onInit()\n\n return tfr\n}\n"],"names":["loadImageRecursive","imageURL","imageURLs","next","length","slice","img","Image","onload","onerror","src","loadImages","InitImageSlider","sliderID","onChange","slider","document","getElementById","Error","Load","initialValue","Array","isArray","console","debug","defaultScrollValue","undefined","value","toString","max","handleSliderChange","currentValue","parseInt","removeEventListener","addEventListener","stringToByteArray$1","str","out","p","i","c","charCodeAt","base64","byteToCharMap_","charToByteMap_","byteToCharMapWebSafe_","charToByteMapWebSafe_","ENCODED_VALS_BASE","ENCODED_VALS","this","ENCODED_VALS_WEBSAFE","HAS_NATIVE_SUPPORT","atob","encodeByteArray","input","webSafe","init_","byteToCharMap","output","byte1","haveByte2","byte2","haveByte3","byte3","outByte1","outByte2","outByte3","outByte4","push","join","encodeString","btoa","decodeString","bytes","pos","c1","String","fromCharCode","c2","u","c3","byteArrayToString","decodeStringToByteArray","charToByteMap","charAt","byte4","DecodeBase64StringError","constructor","super","arguments","name","base64urlEncodeWithoutPadding","utf8Bytes","base64Encode","replace","base64Decode","e","error","getDefaultsFromGlobal","self","window","global","getGlobal","__FIREBASE_DEFAULTS__","getDefaults","process","env","defaultsJsonString","JSON","parse","getDefaultsFromEnvVariable","match","cookie","decoded","getDefaultsFromCookie","info","getDefaultEmulatorHost","productName","_a","_b","emulatorHosts","getDefaultAppConfig","config","getExperimentalSetting","Deferred","reject","resolve","promise","Promise","wrapCallback","callback","catch","isCloudWorkstation","url","startsWith","URL","hostname","endsWith","async","pingServer","endpoint","fetch","credentials","ok","emulatorStatus","previouslyDismissed","updateEmulatorBanner","isRunningEmulator","location","host","prefixedId","id","bannerId","showError","summary","prod","emulator","key","Object","keys","getEmulatorSummary","setupCloseBtn","closeBtn","createElement","style","cursor","marginLeft","fontSize","innerHTML","onclick","element","remove","tearDown","setupDom","banner","parentDiv","created","setAttribute","getOrCreateEl","firebaseTextId","firebaseText","learnMoreId","learnMoreLink","prependIconId","prependIcon","createElementNS","bannerEl","display","background","position","bottom","left","padding","borderRadius","alignItems","setupBannerStyles","innerText","href","paddingLeft","textDecoration","setupLinkStyles","iconId","setupIconStyles","append","body","appendChild","readyState","getUA","navigator","isSafari","forceEnvironment","prototype","call","isNode","userAgent","includes","FirebaseError","code","message","customData","setPrototypeOf","captureStackTrace","ErrorFactory","create","service","serviceName","errors","data","fullCode","template","PATTERN","_","replaceTemplate","fullMessage","deepEqual","a","b","aKeys","bKeys","k","aProp","bProp","isObject","thing","querystring","querystringParams","params","entries","forEach","arrayVal","encodeURIComponent","querystringDecode","obj","split","token","decodeURIComponent","extractQuerystring","queryStart","indexOf","fragmentStart","substring","ObserverProxy","executor","onNoObservers","observers","unsubscribes","observerCount","task","finalized","then","forEachObserver","observer","close","complete","subscribe","nextOrObserver","methods","method","implementsAnyMethods","noop","unsub","unsubscribeOne","bind","finalError","fn","sendOne","err","getModularInstance","_delegate","Component","instanceFactory","type","multipleInstances","serviceProps","instantiationMode","onInstanceCreated","setInstantiationMode","mode","setMultipleInstances","setServiceProps","props","setInstanceCreatedCallback","DEFAULT_ENTRY_NAME$1","Provider","container","component","instances","Map","instancesDeferred","instancesOptions","onInitCallbacks","get","identifier","normalizedIdentifier","normalizeInstanceIdentifier","has","deferred","set","isInitialized","shouldAutoInitialize","instance","getOrInitializeService","instanceIdentifier","getImmediate","options","optional","getComponent","setComponent","isComponentEager","instanceDeferred","clearInstance","delete","services","from","values","all","filter","map","INTERNAL","_delete","isComponentSet","getOptions","initialize","opts","onInit","existingCallbacks","Set","add","existingInstance","invokeOnInitCallbacks","callbacks","ComponentContainer","providers","addComponent","provider","getProvider","addOrOverwriteComponent","getProviders","LogLevel","levelStringToEnum","DEBUG","verbose","VERBOSE","INFO","warn","WARN","ERROR","silent","SILENT","defaultLogLevel","ConsoleMethod","defaultLogHandler","logType","args","logLevel","now","Date","toISOString","Logger","_logLevel","_logHandler","_userLogHandler","val","TypeError","setLogLevel","logHandler","userLogHandler","log","idbProxyableTypes","cursorAdvanceMethods","cursorRequestMap","WeakMap","transactionDoneMap","transactionStoreNamesMap","transformCache","reverseTransformCache","idbProxyTraps","target","prop","receiver","IDBTransaction","objectStoreNames","objectStore","wrap","wrapFunction","func","IDBDatabase","transaction","IDBCursor","advance","continue","continuePrimaryKey","apply","unwrap","storeNames","tx","sort","transformCachableValue","done","unlisten","DOMException","cacheDonePromiseForTransaction","object","IDBObjectStore","IDBIndex","some","Proxy","IDBRequest","request","success","result","promisifyRequest","newValue","readMethods","writeMethods","cachedMethods","getMethod","targetFuncName","useIndex","isWrite","storeName","store","index","shift","oldTraps","PlatformLoggerServiceImpl","getPlatformInfoString","isVersionServiceProvider","library","version","logString","name$q","version$1$1","logger","name$p","name$o","name$n","name$m","name$l","name$k","name$j","name$i","name$h","name$g","name$f","name$e","name$d","name$c","name$b","name$a","name$9","name$8","name$7","name$6","name$5","name$4","name$3","name$2","name$1$1","name$r","DEFAULT_ENTRY_NAME","PLATFORM_LOG_STRING","_apps","_serverApps","_components","_addComponent","app","_registerComponent","componentName","serverApp","_getProvider","heartbeatController","triggerHeartbeat","_isFirebaseServerApp","settings","ERROR_FACTORY","FirebaseAppImpl","_isDeleted","_options","assign","_config","_name","_automaticDataCollectionEnabled","automaticDataCollectionEnabled","_container","checkDestroyed","isDeleted","appName","SDK_VERSION","initializeApp","rawConfig","existingApp","newApp","getApp","registerVersion","libraryKeyOrName","variant","libraryMismatch","versionMismatch","warning","STORE_NAME","dbPromise","getDbPromise","blocked","upgrade","blocking","terminated","indexedDB","open","openPromise","event","oldVersion","newVersion","db","openDB","createObjectStore","originalErrorMessage","writeHeartbeatsToIndexedDB","heartbeatObject","put","computeKey","idbGetError","appId","HeartbeatServiceImpl","_heartbeatsCache","_storage","HeartbeatStorageImpl","_heartbeatsCachePromise","read","agent","date","getUTCDateString","heartbeats","lastSentHeartbeatDate","singleDateHeartbeat","earliestHeartbeatIdx","earliestHeartbeatDate","getEarliestHeartbeatIdx","splice","overwrite","getHeartbeatsHeader","heartbeatsToSend","unsentEntries","heartbeatsCache","maxSize","heartbeatEntry","find","hb","dates","countBytes","pop","extractHeartbeatsForHeader","headerString","stringify","_canUseIndexedDBPromise","runIndexedDBEnvironmentCheck","isIndexedDBAvailable","preExist","DB_CHECK_NAME","onsuccess","deleteDatabase","onupgradeneeded","idbHeartbeatObject","readHeartbeatsFromIndexedDB","heartbeatsObject","existingHeartbeatsObject","Integer","Md5","commonjsGlobal$1","globalThis","h","m","blockSize","g","B","o","s","n","f","d","t","D","C","r","v","q","hasOwnProperty","isNaN","isFinite","w","x","z","A","F","G","H","l","I","J","j","Math","floor","ceil","LN2","pow","abs","E","and","or","xor","digest","reset","update","multiply","modulo","compare","toNumber","getBits","fromNumber","fromString","y","min","XhrIo","WebChannel","EventType","ErrorCode","Stat","Event","getStatEventTarget","createWebChannelTransport","commonjsGlobal","aa","defineProperties","defineProperty","ca","ba","configurable","writable","da","Symbol","iterator","ea","fa","ha","ia","ja","unshift","Function","ka","Qb","la","ma","test","oa","pa","toLowerCase","qa","sa","ta","ua","va","wa","setTimeout","xa","za","Ba","Ca","Ea","Da","defaultPrevented","N","Fa","relatedTarget","button","screenY","screenX","clientY","clientX","metaKey","shiftKey","altKey","ctrlKey","state","pointerId","pointerType","changedTouches","srcElement","nodeName","fromElement","toElement","pageX","pageY","Ga","preventDefault","returnValue","random","Ha","Ia","listener","proxy","capture","Ja","Ka","Ma","La","Na","Oa","Qa","Sa","K","Ua","Xa","Va","attachEvent","Wa","addListener","removeListener","Ta","Ya","Za","detachEvent","$a","handleEvent","M","ab","concat","bb","Number","cb","L","eb","clearTimeout","fb","gb","ib","jb","kb","lb","mb","OPEN","wb","nb","ob","pb","qb","rb","sb","STAT_EVENT","stat","tb","size","ub","vb","yb","Cb","Ab","NO_ERROR","TIMEOUT","xb","Bb","Hb","zb","Pb","Db","R","U","S","X","O","W","T","P","Eb","XMLHttpRequest","Fb","Gb","Ib","Jb","Kb","Lb","Mb","Y","Sb","Wb","Ob","Ub","Q","abort","Rb","Xb","Yb","Zb","$b","ac","Aa","ya","getResponseHeader","bc","cc","dc","ec","fc","gc","Z","Nb","TextDecoder","decode","stream","Tb","getAllResponseHeaders","trim","ra","Vb","cancel","hc","ic","PerformanceNavigationTiming","performance","getEntriesByType","nextHopProtocol","chrome","loadTimes","wasFetchedViaSpdy","jc","kc","nc","na","V","mc","lc","clear","oc","RegExp","qc","rc","sc","tc","uc","Dc","Ac","vc","Bc","decodeURI","encodeURI","Cc","wc","xc","yc","zc","pc","Ec","onabort","ontimeout","Hc","Ic","Jc","Kc","status","responseType","responseText","response","statusText","onreadystatechange","Headers","Nc","Pa","ga","Mc","Lc","Oc","Pc","headers","send","cache","Request","arrayBuffer","ReadableStream","getReader","text","Ra","Uint8Array","setRequestHeader","Qc","Rc","Sc","Uc","Vc","Wc","protocol","Tc","mozResponseArrayBuffer","Xc","internalChannelParams","Yc","xmlHttpFactory","useFetchStreams","supportsCrossDomainXhr","concurrentRequestLimit","fastHandshake","encodeInitMessageHeaders","forceLongPolling","detectBufferingProxy","longPollingTimeout","Zc","$c","sendBeacon","ad","ed","dd","round","cd","fd","bd","isActive","Fc","AbortController","signal","Gc","port","gd","hd","messageUrlParams","messageHeaders","clientProtocolHeaderRequired","initMessageHeaders","messageContentType","sendRawJson","httpSessionIdParam","__headers__","statusCode","__status__","__sm__","jd","toUpperCase","getPrototypeOf","FormData","withCredentials","connect","OSID","OAID","__data__","createWebChannel","PROXY","NOPROXY","HTTP_ERROR","COMPLETE","CLOSE","MESSAGE","listen","listenOnce","getLastError","getLastErrorCode","getStatus","getResponseJson","getResponseText","setWithCredentials","M$1","User","uid","isAuthenticated","toKey","isEqual","UNAUTHENTICATED","GOOGLE_CREDENTIALS","FIRST_PARTY","MOCK_USER","__PRIVATE_getLogLevel","__PRIVATE_logDebug","__PRIVATE_argToString","__PRIVATE_logError","__PRIVATE_logWarn","fail","__PRIVATE__fail","__PRIVATE_hardAssert","__PRIVATE_debugCast","OK","CANCELLED","UNKNOWN","INVALID_ARGUMENT","DEADLINE_EXCEEDED","NOT_FOUND","ALREADY_EXISTS","PERMISSION_DENIED","RESOURCE_EXHAUSTED","FAILED_PRECONDITION","ABORTED","OUT_OF_RANGE","UNIMPLEMENTED","UNAVAILABLE","DATA_LOSS","FirestoreError","__PRIVATE_Deferred","__PRIVATE_OAuthToken","user","__PRIVATE_EmptyAuthCredentialsProvider","getToken","invalidateToken","start","enqueueRetryable","shutdown","__PRIVATE_EmulatorAuthCredentialsProvider","changeListener","__PRIVATE_FirebaseAuthCredentialsProvider","currentUser","forceRefresh","auth","__PRIVATE_guardedChangeListener","__PRIVATE_awaitNextToken","__PRIVATE_registerAuth","addAuthTokenListener","accessToken","removeAuthTokenListener","getUid","__PRIVATE_FirstPartyToken","__PRIVATE_FirstPartyAuthCredentialsProvider","AppCheckToken","__PRIVATE_FirebaseAppCheckTokenProvider","appCheck","appCheckToken","onTokenChanged","__PRIVATE_registerAppCheck","addTokenListener","tokenResult","removeTokenListener","__PRIVATE_randomBytes","crypto","msCrypto","getRandomValues","__PRIVATE_newTextEncoder","TextEncoder","__PRIVATE_AutoId","newId","__PRIVATE_primitiveComparator","__PRIVATE_compareUtf8Strings","codePointAt","__PRIVATE_compareByteArrays$1","encode","__PRIVATE_getUtf8SafeSubstring","__PRIVATE_arrayEquals","every","BasePath","offset","range","segments","len","comparator","child","limit","construct","popFirst","popLast","firstSegment","lastSegment","isEmpty","isPrefixOf","isImmediateParentOf","toArray","compareSegments","isNumericId","extractNumericId","ResourcePath","canonicalString","toUriEncodedString","emptyPath","L$1","FieldPath$1","isValidIdentifier","isKeyField","keyField","fromServerFormat","__PRIVATE_addCurrentSegment","DocumentKey","path","fromPath","fromName","empty","collectionGroup","hasCollectionId","getCollectionGroup","getCollectionPath","isDocumentKey","fromSegments","__PRIVATE_validateNonEmptyArgument","__PRIVATE_validateDocumentPath","__PRIVATE_validateCollectionPath","__PRIVATE_isPlainObject","__PRIVATE_valueDescription","__PRIVATE_cast","property","typeString","__PRIVATE_validateJSON","Timestamp","fromMillis","fromDate","getTime","seconds","nanoseconds","toDate","toMillis","_compareTo","toJSON","_jsonSchemaVersion","fromJSON","_jsonSchema","valueOf","padStart","SnapshotVersion","fromTimestamp","timestamp","compareTo","toMicroseconds","toTimestamp","__PRIVATE_newIndexOffsetFromDocument","IndexOffset","readTime","documentKey","largestBatchId","__PRIVATE_indexOffsetComparator","PersistenceTransaction","onCommittedListeners","addOnCommittedListener","raiseOnCommittedEvent","__PRIVATE_ignoreIfPrimaryLeaseLoss","PersistencePromise","nextCallback","catchCallback","isDone","callbackAttached","wrapFailure","wrapSuccess","toPromise","wrapUserFunction","waitFor","mapArray","doWhile","__PRIVATE_isIndexedDbTransactionError","__PRIVATE_ListenSequence","previousValue","sequenceNumberHandler","_e","ae","writeSequenceNumber","ue","__PRIVATE_isNullOrUndefined","__PRIVATE_isNegativeZero","__PRIVATE_encodeSegment","__PRIVATE_encodeSeparator","__PRIVATE_objectSize","SortedMap","root","LLRBNode","EMPTY","insert","copy","BLACK","right","minKey","maxKey","inorderTraversal","reverseTraversal","getIterator","SortedMapIterator","getIteratorFrom","getReverseIterator","getReverseIteratorFrom","isReverse","nodeStack","getNext","hasNext","peek","color","RED","fixUp","removeMin","isRed","moveRedLeft","rotateRight","moveRedRight","rotateLeft","colorFlip","checkMaxDepth","check","SortedSet","first","last","forEachInRange","forEachWhile","firstAfterOrEqual","SortedSetIterator","unionWith","iter","FieldMask","fields","covers","__PRIVATE_Base64DecodeError","ByteString","binaryString","fromBase64String","fromUint8Array","toBase64","toUint8Array","approximateByteSize","EMPTY_BYTE_STRING","it","__PRIVATE_normalizeTimestamp","exec","substr","nanos","__PRIVATE_normalizeNumber","__PRIVATE_normalizeByteString","st","ot","_t","at","__PRIVATE_isServerTimestamp","mapValue","stringValue","__PRIVATE_getPreviousValue","__PRIVATE_getLocalWriteTime","timestampValue","DatabaseInfo","databaseId","persistenceKey","ssl","autoDetectLongPolling","longPollingOptions","isUsingEmulator","ut","DatabaseId","projectId","database","isDefaultDatabase","ct","lt","ht","Pt","Tt","__PRIVATE_typeOrder","__type__","__PRIVATE_isMaxValue","__PRIVATE_isVectorValue","__PRIVATE_valueEquals","booleanValue","bytesValue","referenceValue","geoPointValue","latitude","longitude","integerValue","doubleValue","arrayValue","__PRIVATE_arrayValueContains","__PRIVATE_valueCompare","__PRIVATE_compareTimestamps","__PRIVATE_compareArrays","le","canonicalId","__PRIVATE_canonifyValue","__PRIVATE_estimateByteSize","reduce","__PRIVATE_refValue","isInteger","__PRIVATE_isNullValue","__PRIVATE_isNanValue","__PRIVATE_isMapValue","__PRIVATE_deepClone","ObjectValue","field","getFieldsMap","setAll","applyChanges","clone","__PRIVATE_extractFieldMask","MutableDocument","documentType","createTime","documentState","newInvalidDocument","newFoundDocument","newNoDocument","newUnknownDocument","convertToFoundDocument","convertToNoDocument","convertToUnknownDocument","setHasCommittedMutations","setHasLocalMutations","setReadTime","hasLocalMutations","hasCommittedMutations","hasPendingWrites","isValidDocument","isFoundDocument","isNoDocument","isUnknownDocument","mutableCopy","Bound","inclusive","__PRIVATE_boundCompareToDocument","dir","__PRIVATE_boundEquals","OrderBy","__PRIVATE_orderByEquals","Filter","FieldFilter","op","createKeyFieldInFilter","__PRIVATE_KeyFieldFilter","__PRIVATE_ArrayContainsFilter","__PRIVATE_InFilter","__PRIVATE_NotInFilter","__PRIVATE_ArrayContainsAnyFilter","__PRIVATE_KeyFieldInFilter","__PRIVATE_KeyFieldNotInFilter","matches","nullValue","matchesComparison","operator","isInequality","getFlattenedFilters","getFilters","CompositeFilter","filters","he","__PRIVATE_compositeFilterIsConjunction","__PRIVATE_compositeFilterIsFlatConjunction","__PRIVATE_compositeFilterIsFlat","__PRIVATE_canonifyFilter","__PRIVATE_filterEquals","__PRIVATE_stringifyFilter","__PRIVATE_extractDocumentKeysFromArrayValue","__PRIVATE_TargetImpl","orderBy","startAt","endAt","Pe","__PRIVATE_newTarget","__PRIVATE_canonifyTarget","__PRIVATE_targetEquals","__PRIVATE_targetIsDocumentTarget","__PRIVATE_QueryImpl","explicitOrderBy","limitType","Te","Ie","de","__PRIVATE_newQueryForPath","__PRIVATE_queryMatchesAllDocuments","__PRIVATE_isCollectionGroupQuery","__PRIVATE_queryNormalizedOrderBy","__PRIVATE_queryToTarget","__PRIVATE__queryToTarget","__PRIVATE_queryWithAddedFilter","__PRIVATE_queryWithLimit","__PRIVATE_queryEquals","__PRIVATE_canonifyQuery","__PRIVATE_stringifyQuery","__PRIVATE_queryMatches","__PRIVATE_newQueryComparator","__PRIVATE_compareDocs","direction","ObjectMap","mapKeyFn","equalsFn","inner","innerSize","Et","__PRIVATE_mutableDocumentMap","At","documentMap","__PRIVATE_convertOverlayedDocumentMapToDocumentMap","overlayedDocument","__PRIVATE_newOverlayMap","__PRIVATE_newDocumentKeyMap","__PRIVATE_newMutationMap","Rt","Vt","__PRIVATE_documentKeySet","mt","__PRIVATE_toDouble","useProto3Json","__PRIVATE_toInteger","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","isSafeInteger","TransformOperation","__PRIVATE_applyTransformOperationToLocalView","__PRIVATE_ServerTimestampTransform","__PRIVATE_ArrayUnionTransformOperation","__PRIVATE_applyArrayUnionTransformOperation","__PRIVATE_ArrayRemoveTransformOperation","__PRIVATE_applyArrayRemoveTransformOperation","__PRIVATE_computeTransformOperationBaseValue","asNumber","Ee","serializer","__PRIVATE_applyTransformOperationToRemoteDocument","__PRIVATE_NumericIncrementTransformOperation","elements","__PRIVATE_coercedFieldValuesArray","MutationResult","transformResults","Precondition","updateTime","exists","none","isNone","__PRIVATE_preconditionIsValidForDocument","Mutation","__PRIVATE_calculateOverlayMutation","__PRIVATE_DeleteMutation","__PRIVATE_SetMutation","__PRIVATE_PatchMutation","__PRIVATE_mutationApplyToRemoteDocument","__PRIVATE_serverTransformResults","fieldTransforms","precondition","__PRIVATE_getPatch","__PRIVATE_mutationApplyToLocalView","__PRIVATE_localTransformResults","fieldMask","__PRIVATE_mutationExtractBaseValue","transform","__PRIVATE_mutationEquals","__PRIVATE_fieldTransformEquals","getFieldMask","Ae","Re","__PRIVATE_VerifyMutation","MutationBatch","batchId","localWriteTime","baseMutations","mutations","applyToRemoteDocument","mutationResults","applyToLocalView","applyToLocalDocumentSet","mutatedFields","MutationBatchResult","batch","commitVersion","docVersions","Ve","me","Overlay","mutation","getKey","ExistenceFilter","count","unchangedNames","ft","gt","__PRIVATE_mapCodeFromRpcCode","yt","__PRIVATE_getMd5HashValue","__PRIVATE_get64BitUints","DataView","buffer","getUint32","BloomFilter","bitmap","hashCount","__PRIVATE_BloomFilterError","fe","ge","pe","ye","mightContain","we","RemoteEvent","snapshotVersion","targetChanges","targetMismatches","documentUpdates","resolvedLimboDocuments","createSynthesizedRemoteEventForCurrentChange","TargetChange","createSynthesizedTargetChangeForCurrentChange","resumeToken","current","addedDocuments","modifiedDocuments","removedDocuments","__PRIVATE_DocumentWatchChange","Se","removedTargetIds","be","__PRIVATE_ExistenceFilterChange","targetId","De","__PRIVATE_WatchTargetChange","targetIds","cause","__PRIVATE_TargetState","ve","Ce","__PRIVATE_snapshotChangesMap","Fe","Me","xe","Oe","Ne","Be","Le","changeType","ke","qe","Qe","$e","Ue","Ke","__PRIVATE_WatchChangeAggregator","We","Ge","ze","je","__PRIVATE_documentTargetMap","Je","He","Ye","Ze","Xe","et","forEachTarget","tt","nt","removeTarget","rt","expectedCount","bits","getRemoteKeysForTarget","It","purpose","dt","wt","asc","desc","St","in","bt","JsonProtoSerializer","__PRIVATE_toInt32Proto","__PRIVATE_toBytes","__PRIVATE_toVersion","__PRIVATE_fromVersion","__PRIVATE_toResourceName","__PRIVATE_toResourcePath","__PRIVATE_fromResourceName","__PRIVATE_isValidResourceName","__PRIVATE_toName","__PRIVATE_extractLocalPathFromResourceName","__PRIVATE_toQueryPath","__PRIVATE_getEncodedDatabaseId","__PRIVATE_toMutationDocument","__PRIVATE_toDocumentsTarget","documents","__PRIVATE_toQueryTarget","structuredQuery","collectionId","allDescendants","parent","__PRIVATE_toFilter","where","__PRIVATE_toFieldPathReference","__PRIVATE_toDirection","before","__PRIVATE_convertQueryTargetToQuery","__PRIVATE_fromQueryPath","__PRIVATE_fromFilter","__PRIVATE_fromFieldPathReference","__PRIVATE_newQuery","unaryFilter","NaN","fieldFilter","compositeFilter","__PRIVATE_toOperatorName","__PRIVATE_toCompositeOperatorName","fieldPath","__PRIVATE_toDocumentMask","fieldPaths","TargetData","sequenceNumber","lastLimboFreeSnapshotVersion","withSequenceNumber","withResumeToken","withExpectedCount","withLastLimboFreeSnapshotVersion","__PRIVATE_LocalSerializer","__PRIVATE_fromBundledQuery","__PRIVATE_MemoryIndexManager","Dn","__PRIVATE_MemoryCollectionParentIndex","addToCollectionParentIndex","getCollectionParents","getEntries","addFieldIndex","deleteFieldIndex","deleteAllFieldIndexes","createTargetIndexes","getDocumentsMatchingTarget","getIndexType","getFieldIndexes","getNextCollectionGroupToUpdate","getMinOffset","getMinOffsetFromCollectionGroup","updateCollectionGroup","updateIndexEntries","Ft","didRun","sequenceNumbersCollected","targetsRemoved","documentsRemoved","Mt","LruParams","withCacheSize","DEFAULT_COLLECTION_PERCENTILE","DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT","cacheSizeCollectionThreshold","percentileToCollect","maximumSequenceNumbersToCollect","DEFAULT","DISABLED","__PRIVATE_TargetIdGenerator","_r","ar","ur","xt","__PRIVATE_bufferEntryComparator","__PRIVATE_RollingSequenceNumberBuffer","Tr","Ir","dr","Er","maxValue","__PRIVATE_LruScheduler","garbageCollector","asyncQueue","localStore","Ar","Rr","stop","started","enqueueAfterDelay","collectGarbage","__PRIVATE_LruGarbageCollectorImpl","Vr","calculateTargetCount","mr","nthSequenceNumber","gr","removeTargets","removeOrphanedDocuments","collect","getCacheSize","pr","RemoteDocumentChangeBuffer","changes","changesApplied","addEntry","assertNotApplied","removeEntry","getEntry","getFromCache","getAllFromCache","OverlayedDocument","LocalDocumentsView","remoteDocumentCache","mutationQueue","documentOverlayCache","indexManager","getDocument","getOverlay","getDocuments","getLocalViewOfDocuments","populateOverlays","computeViews","getOverlayedDocuments","getOverlays","recalculateAndSaveOverlays","getAllMutationBatchesAffectingDocumentKeys","saveOverlays","recalculateAndSaveOverlaysForDocumentKeys","getDocumentsMatchingQuery","getDocumentsMatchingDocumentQuery","getDocumentsMatchingCollectionGroupQuery","getDocumentsMatchingCollectionQuery","getNextDocuments","getAllFromCollectionGroup","getOverlaysForCollectionGroup","getOverlaysForCollection","__PRIVATE_MemoryBundleCache","Br","Lr","getBundleMetadata","saveBundleMetadata","getNamedQuery","saveNamedQuery","query","bundledQuery","__PRIVATE_MemoryDocumentOverlayCache","overlays","kr","removeOverlaysForBatchId","__PRIVATE_MemoryGlobalsCache","sessionToken","getSessionToken","setSessionToken","__PRIVATE_ReferenceSet","qr","__PRIVATE_DocReference","Qr","$r","Ur","addReference","Kr","removeReference","Wr","Gr","zr","jr","Jr","containsKey","Hr","__PRIVATE_MemoryMutationQueue","referenceDelegate","er","Yr","checkEmpty","addMutationBatch","lookupMutationBatch","Zr","getNextMutationBatchAfterBatchId","Xr","getHighestUnacknowledgedBatchId","getAllMutationBatches","getAllMutationBatchesAffectingDocumentKey","POSITIVE_INFINITY","ei","getAllMutationBatchesAffectingQuery","removeMutationBatch","ti","markPotentiallyOrphaned","rr","performConsistencyCheck","__PRIVATE_MemoryRemoteDocumentCacheImpl","ni","docs","setIndexManager","ri","newChangeBuffer","__PRIVATE_MemoryRemoteDocumentChangeBuffer","getSize","Or","__PRIVATE_MemoryTargetCache","persistence","ii","lastRemoteSnapshotVersion","highestTargetId","si","oi","targetCount","_i","getLastRemoteSnapshotVersion","getHighestSequenceNumber","allocateTargetId","setTargetsMetadata","hr","addTargetData","updateTargetData","removeTargetData","removeMatchingKeysForTargetId","getTargetCount","getTargetData","addMatchingKeys","removeMatchingKeys","getMatchingKeysForTargetId","__PRIVATE_MemoryPersistence","ai","ui","ci","li","hi","Pi","Ti","setDatabaseDeletedListener","setNetworkEnabled","getIndexManager","getDocumentOverlayCache","getMutationQueue","getGlobalsCache","getTargetCache","getRemoteDocumentCache","getBundleCache","runTransaction","__PRIVATE_MemoryTransaction","Ii","di","Ei","currentSequenceNumber","__PRIVATE_MemoryEagerDelegate","Ai","Ri","Vi","mi","fi","updateLimboDocument","__PRIVATE_MemoryLruDelegate","gi","__PRIVATE_encodeResourcePath","__PRIVATE_newLruGarbageCollector","yr","Sr","__PRIVATE_LocalViewChanges","fromCache","Is","ds","Es","docChanges","doc","QueryContext","_documentReadCount","documentReadCount","incrementDocumentReadCount","__PRIVATE_QueryEngine","As","Rs","Vs","fs","__PRIVATE_getAndroidVersion","gs","ps","ys","ws","Ss","bs","Ds","vs","__PRIVATE_newIndexOffsetSuccessorFromReadTime","Qt","__PRIVATE_LocalStoreImpl","Cs","Fs","Ms","xs","Os","Ns","localDocuments","__PRIVATE_localStoreHandleUserChange","Bs","removedBatchIds","addedBatchIds","__PRIVATE_localStoreGetLastRemoteSnapshotVersion","__PRIVATE_localStoreApplyRemoteEventToLocalCache","trackRemovals","Ls","ks","__PRIVATE_populateDocumentChangeBuffer","__PRIVATE_localStoreGetNextMutationBatch","__PRIVATE_localStoreReleaseTarget","__PRIVATE_localStoreExecuteQuery","__PRIVATE_setMaxReadTime","__PRIVATE_queryCollectionGroup","qs","__PRIVATE_LocalClientState","activeTargetIds","Gs","zs","Ws","updateTimeMs","__PRIVATE_MemorySharedClientState","Fo","Mo","onlineStateHandler","addPendingMutation","updateMutationState","addLocalQueryTarget","updateQueryState","removeLocalQueryTarget","isLocalQueryTarget","clearQueryState","getAllActiveQueryTargets","isActiveQueryTarget","handleUserChange","setOnlineState","notifyBundleLoaded","__PRIVATE_NoopConnectivityMonitor","xo","zt","__PRIVATE_BrowserConnectivityMonitor","Oo","No","Bo","Lo","ko","qo","jt","__PRIVATE_generateUniqueDebugId","Jt","Ht","BatchGetDocuments","Commit","RunQuery","RunAggregationQuery","__PRIVATE_RestConnection","Qo","databaseInfo","$o","Uo","Ko","Wo","Go","zo","jo","Jo","terminate","__PRIVATE_StreamBridge","Ho","Yo","Zo","Xo","e_","t_","n_","r_","onMessage","i_","s_","o_","__","a_","Yt","__PRIVATE_WebChannelConnection","u_","c_","streamId","l_","h_","P_","forwardChannelRequestTimeoutMs","timeoutSeconds","T_","__PRIVATE_unguardedEventListen","I_","__PRIVATE_newSerializer","__PRIVATE_ExponentialBackoff","Fi","timerId","d_","E_","A_","R_","V_","m_","f_","g_","p_","y_","skipDelay","Zt","__PRIVATE_PersistentStream","w_","S_","connection","authCredentialsProvider","appCheckCredentialsProvider","b_","D_","v_","C_","F_","M_","x_","O_","N_","B_","L_","k_","q_","Q_","U_","K_","W_","G_","z_","j_","onNext","enqueueAndForget","__PRIVATE_PersistentListenStream","targetChange","targetChangeType","Buffer","documentChange","documentDelete","documentRemove","__PRIVATE_fromWatchChange","J_","H_","addTarget","__PRIVATE_toListenRequestLabels","labels","Y_","__PRIVATE_PersistentWriteStream","Z_","lastStreamToken","X_","streamToken","writeResults","__PRIVATE_fromWriteResults","commitTime","writes","updateMask","verify","updateTransforms","setToServerValue","appendMissingElements","removeAllFromArray","increment","currentDocument","toMutation","Datastore","__PRIVATE_DatastoreImpl","authCredentials","appCheckCredentials","__PRIVATE_OnlineStateTracker","Xt","__PRIVATE_RemoteStoreImpl","datastore","remoteSyncer","__PRIVATE_canUseNetwork","__PRIVATE_disableNetworkInternal","__PRIVATE_enableNetworkInternal","__PRIVATE_remoteStoreListen","__PRIVATE_shouldStartWatchStream","__PRIVATE_startWatchStream","__PRIVATE_ensureWatchStream","__PRIVATE_sendWatchRequest","__PRIVATE_remoteStoreUnlisten","__PRIVATE_sendUnwatchRequest","__PRIVATE_cleanUpWatchStreamState","__PRIVATE_onWatchStreamConnected","__PRIVATE_onWatchStreamOpen","__PRIVATE_onWatchStreamClose","__PRIVATE_onWatchStreamChange","rejectListen","__PRIVATE_disableNetworkUntilRecovery","applyRemoteEvent","__PRIVATE_executeWithRecovery","__PRIVATE_fillWritePipeline","__PRIVATE_ensureWriteStream","__PRIVATE_canAddToWritePipeline","__PRIVATE_addToWritePipeline","__PRIVATE_shouldStartWriteStream","__PRIVATE_startWriteStream","__PRIVATE_onWriteStreamOpen","__PRIVATE_onWriteHandshakeComplete","__PRIVATE_onMutationResult","applySuccessfulWrite","__PRIVATE_onWriteStreamClose","__PRIVATE_isPermanentError","rejectFailedWrite","__PRIVATE_remoteStoreHandleCredentialChange","verifyOperationInProgress","handleCredentialChange","DelayedOperation","targetTimeMs","removalCallback","createAndSchedule","timerHandle","handleDelayElapsed","__PRIVATE_wrapInUserErrorIfRecoverable","DocumentSet","emptySet","keyedMap","sortedSet","__PRIVATE_DocumentChangeSet","track","ViewSnapshot","oldDocs","mutatedKeys","syncStateChanged","excludesMetadataChanges","hasCachedResults","fromInitialDocuments","__PRIVATE_QueryListenersInfo","__PRIVATE_EventManagerImpl","queries","__PRIVATE_newQueriesObjectMap","onlineState","onError","__PRIVATE_eventManagerListen","onListen","onFirstRemoteStoreListen","__PRIVATE_raiseSnapshotsInSyncEvent","__PRIVATE_eventManagerUnlisten","onUnlisten","onLastRemoteStoreUnlisten","__PRIVATE_eventManagerOnWatchChange","__PRIVATE_eventManagerOnWatchError","en$1","tn","Cache","__PRIVATE_QueryListener","includeMetadataChanges","source","__PRIVATE_AddedLimboDocument","__PRIVATE_RemovedLimboDocument","__PRIVATE_View","eu","tu","nu","ru","iu","order","su","ou","snapshot","_u","au","uu","cu","nn","__PRIVATE_QueryView","view","LimboResolution","lu","__PRIVATE_SyncEngineImpl","remoteStore","eventManager","sharedClientState","maxConcurrentLimboResolutions","hu","Pu","Tu","Iu","du","Eu","Au","Ru","Vu","mu","fu","isPrimaryClient","__PRIVATE_syncEngineListen","__PRIVATE_ensureWatchCallbacks","__PRIVATE_allocateTargetAndMaybeListen","__PRIVATE_triggerRemoteStoreListen","__PRIVATE_localStoreAllocateTarget","gu","__PRIVATE_updateTrackedLimbos","__PRIVATE_initializeViewAndComputeSnapshot","__PRIVATE_syncEngineUnlisten","__PRIVATE_removeAndCleanupTarget","__PRIVATE_triggerRemoteStoreUnlisten","__PRIVATE_syncEngineWrite","__PRIVATE_syncEngineApplySuccessfulWrite","__PRIVATE_syncEngineRejectFailedWrite","__PRIVATE_syncEngineEnsureWriteCallbacks","__PRIVATE_syncEngineEmitNewSnapsAndNotifyLocalStore","__PRIVATE_syncEngineApplyRemoteEvent","__PRIVATE_syncEngineApplyOnlineStateChange","__PRIVATE_syncEngineRejectListen","__PRIVATE_pumpEnqueuedLimboResolutions","__PRIVATE_localStoreAcknowledgeBatch","__PRIVATE_processUserCallback","__PRIVATE_triggerPendingWritesCallbacks","pu","__PRIVATE_removeLimboTarget","__PRIVATE_trackLimboChange","yu","__PRIVATE_syncEngineHandleCredentialChange","__PRIVATE_syncEngineGetRemoteKeysForTarget","__PRIVATE_MemoryOfflineComponentProvider","kind","synchronizeTabs","bu","Du","vu","gcScheduler","Cu","indexBackfillerScheduler","Fu","__PRIVATE_newLocalStore","initialUser","build","__PRIVATE_LruGcMemoryOfflineComponentProvider","cacheSizeBytes","OnlineComponentProvider","createDatastore","createRemoteStore","createEventManager","syncEngine","createSyncEngine","__PRIVATE_remoteStoreApplyPrimaryState","__PRIVATE_AsyncObserver","muted","xu","Ou","rn","FirestoreClient","clientId","authCredentialListener","appCheckCredentialListener","_uninitializedComponentsProvider","configuration","setCredentialChangeListener","setAppCheckTokenChangeListener","enterRestrictedMode","enqueueAndForgetEvenWhileRestricted","_onlineComponents","_offlineComponents","__PRIVATE_setOfflineComponentProvider","__PRIVATE_setOnlineComponentProvider","_offline","__PRIVATE_ensureOfflineComponents","__PRIVATE_ensureOnlineComponents","_online","__PRIVATE_getEventManager","__PRIVATE_cloneLongPollingOptions","sn","on","_n","FirestoreSettingsImpl","emulatorOptions","ignoreUndefinedProperties","localCache","__PRIVATE_validateIsNotUsedTogether","experimentalForceLongPolling","experimentalAutoDetectLongPolling","experimentalLongPollingOptions","Firestore$1","_authCredentials","_appCheckCredentials","_databaseId","_app","_persistenceKey","_settings","_settingsFrozen","_emulatorOptions","_terminateTask","_initialized","_terminated","_setSettings","sessionIndex","iamToken","authTokenFactory","client","_getSettings","_getEmulatorOptions","_freezeSettings","_terminate","_restart","connectFirestoreEmulator","mockUserToken","project","iat","sub","user_id","payload","iss","aud","exp","auth_time","firebase","sign_in_provider","identities","alg","createMockUserToken","Query","converter","_query","firestore","withConverter","DocumentReference","_key","_path","CollectionReference","referencePath","collection","an","__PRIVATE_AsyncQueueImpl","Zu","Xu","visibilityState","_c","isShuttingDown","enqueue","__PRIVATE_getMessageOrStack","stack","__PRIVATE_isPartialObserver","Firestore","_queue","_firestoreClient","getFirestore","separatorIndex","lastIndexOf","getDefaultEmulatorHostnameAndPort","ensureFirestoreConfigured","_componentsProvider","_offlineComponentProvider","_onlineComponentProvider","__PRIVATE_configureFirestore","Bytes","_byteString","FieldPath","_internalPath","documentId","FieldValue","_methodName","GeoPoint","_lat","_long","VectorValue","_values","vectorValues","cn","ParsedSetData","__PRIVATE_isWrite","__PRIVATE_ParseContextImpl","__PRIVATE_createError","methodName","contains","__PRIVATE_UserDataReader","__PRIVATE_newUserDataReader","__PRIVATE_parseSetData","merge","mergeFields","__PRIVATE_validatePlainObject","__PRIVATE_parseObject","__PRIVATE_fieldPathFromArgument$1","__PRIVATE_fieldMaskContains","__PRIVATE_parseData","__PRIVATE_looksLikeJsonObject","_toFieldTransform","__PRIVATE_fieldPathFromDotSeparatedString","ln","search","DocumentSnapshot$1","_firestore","_userDataWriter","_document","_converter","ref","QueryDocumentSnapshot$1","fromFirestore","convertValue","__PRIVATE_fieldPathFromArgument","__PRIVATE_validateHasExplicitOrderByForLimitToLast","AppliableConstraint","QueryConstraint","QueryCompositeFilterConstraint","QueryFieldFilterConstraint","_apply","_field","_op","_value","_create","_parse","__PRIVATE_validateNewFieldFilter","__PRIVATE_validateDisjunctiveFilterElements","__PRIVATE_parseDocumentIdValue","__PRIVATE_parseQueryValue","_queryConstraints","_getOperator","_getQueryConstraints","AbstractUserDataWriter","convertTimestamp","convertServerTimestamp","convertBytes","convertReference","convertGeoPoint","convertArray","convertObject","convertVectorValue","convertObjectMap","convertDocumentKey","SnapshotMetadata","DocumentSnapshot","_firestoreImpl","metadata","QueryDocumentSnapshot","serverTimestamps","bundle","bundleSource","bundleName","QuerySnapshot","_snapshot","_cachedChanges","_cachedChangesIncludeMetadataChanges","oldIndex","newIndex","__PRIVATE_resultChangeType","getDoc","__PRIVATE_firestoreClientGetDocumentViaSnapshotListener","__PRIVATE_convertToDocSnapshot","__PRIVATE_ExpUserDataWriter","getDocs","__PRIVATE_firestoreClientGetDocumentsViaSnapshotListener","setDoc","toFirestore","__PRIVATE_applyFirestoreDataConverter","__PRIVATE_getSyncEngine","executeWrite","onSnapshot","Config","getInstance","setEnv","prodKeys","devKeys","api","apiKey","authDomain","storageBucket","messagingSenderId","avatarTimeout","vtoTimeout","MILLISECONDS_A_SECOND","MILLISECONDS_A_MINUTE","SECONDS_A_MINUTE","MILLISECONDS_A_HOUR","SECONDS_A_HOUR","MS","MIN","DATE","INVALID_DATE_STRING","REGEX_PARSE","REGEX_FORMAT","en","weekdays","months","ordinal","string","pad","negMinutes","utcOffset","minutes","hourOffset","minuteOffset","monthDiff","wholeMonthDiff","year","month","anchor","anchor2","ms","IS_DAYJS","isDayjs","Dayjs","parseLocale","preset","isLocal","presetLower","presetSplit","dayjs","cfg","Utils","locale","$L","utc","$u","$x","$offset","_proto","$d","UTC","parseDate","init","$y","getFullYear","$M","getMonth","$D","getDate","$W","getDay","$H","getHours","$m","getMinutes","$s","getSeconds","$ms","getMilliseconds","$utils","isValid","isSame","that","units","other","startOf","endOf","isAfter","isBefore","$g","unix","_startOf","_this","isStartOf","unit","ins","instanceFactorySet","utcPad","weekStart","$locale","gap","arg","$set","_int","_C$D$C$DATE$C$M$C$Y$C","daysInMonth","_int2","number","_C$MIN$C$H$C$S$unit","_this2","step","nextTimeStamp","subtract","format","formatStr","_this3","invalidDate","zoneStr","meridiem","getShort","arr","full","get$H","num","meridiemFunc","hour","minute","isLowercase","$1","monthsShort","weekdaysMin","weekdaysShort","getTimezoneOffset","diff","_float","_this4","zoneDelta","SECONDS_A_WEEK","SECONDS_A_DAY","nextLocaleName","toUTCString","proto","__rest","getOwnPropertySymbols","propertyIsEnumerable","_prodErrorMap","extend","plugin","option","$i","SuppressedError","prodErrorMap","_DEFAULT_AUTH_ERROR_FACTORY","AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY","logClient","_logError","msg","_fail","authOrCode","rest","createErrorInternal","_createError","_errorWithCustomMessage","errorMap","_serverAppCurrentUserOperationNotSupportedError","fullParams","_errorFactory","_assert","assertion","debugFail","failure","debugAssert","_getCurrentUrl","_getCurrentScheme","_isOnline","onLine","runtime","browser","isBrowserExtension","Delay","shortDelay","longDelay","isMobile","_emulatorUrl","FetchProvider","fetchImpl","headersImpl","responseImpl","Response","SERVER_ERROR_MAP","CREDENTIAL_MISMATCH","MISSING_CUSTOM_TOKEN","INVALID_IDENTIFIER","MISSING_CONTINUE_URI","INVALID_PASSWORD","MISSING_PASSWORD","INVALID_LOGIN_CREDENTIALS","EMAIL_EXISTS","PASSWORD_LOGIN_DISABLED","INVALID_IDP_RESPONSE","INVALID_PENDING_TOKEN","FEDERATED_USER_ID_ALREADY_LINKED","MISSING_REQ_TYPE","EMAIL_NOT_FOUND","RESET_PASSWORD_EXCEED_LIMIT","EXPIRED_OOB_CODE","INVALID_OOB_CODE","MISSING_OOB_CODE","CREDENTIAL_TOO_OLD_LOGIN_AGAIN","INVALID_ID_TOKEN","TOKEN_EXPIRED","USER_NOT_FOUND","TOO_MANY_ATTEMPTS_TRY_LATER","PASSWORD_DOES_NOT_MEET_REQUIREMENTS","INVALID_CODE","INVALID_SESSION_INFO","INVALID_TEMPORARY_PROOF","MISSING_SESSION_INFO","SESSION_EXPIRED","MISSING_ANDROID_PACKAGE_NAME","UNAUTHORIZED_DOMAIN","INVALID_OAUTH_CLIENT_ID","ADMIN_ONLY_OPERATION","INVALID_MFA_PENDING_CREDENTIAL","MFA_ENROLLMENT_NOT_FOUND","MISSING_MFA_ENROLLMENT_ID","MISSING_MFA_PENDING_CREDENTIAL","SECOND_FACTOR_EXISTS","SECOND_FACTOR_LIMIT_EXCEEDED","BLOCKING_FUNCTION_ERROR_RESPONSE","RECAPTCHA_NOT_ENABLED","MISSING_RECAPTCHA_TOKEN","INVALID_RECAPTCHA_TOKEN","INVALID_RECAPTCHA_ACTION","MISSING_CLIENT_TYPE","MISSING_RECAPTCHA_VERSION","INVALID_RECAPTCHA_VERSION","INVALID_REQ_TYPE","CookieAuthProxiedEndpoints","DEFAULT_API_TIMEOUT_MS","_addTidIfNecessary","tenantId","_performApiRequest","customErrorMap","_performFetchWithErrorHandling","_getAdditionalHeaders","languageCode","fetchArgs","referrerPolicy","emulatorConfig","_getFinalTarget","apiHost","fetchFn","_canInitEmulator","networkTimeout","NetworkTimeout","race","clearNetworkTimeout","json","_makeTaggedError","errorMessage","serverErrorCode","serverErrorMessage","authError","_performSignInRequest","serverResponse","_serverResponse","base","authInternal","finalTarget","apiScheme","_persistenceManagerAvailable","_getPersistenceType","_getPersistence","_parseEnforcementState","enforcementStateStr","timer","errorParams","email","phoneNumber","_tokenResponse","isEnterprise","grecaptcha","enterprise","RecaptchaConfig","siteKey","recaptchaEnforcementState","recaptchaKey","getProviderEnforcementState","providerStr","enforcementState","isProviderEnabled","isAnyProviderEnabled","getAccountInfo","utcTimestampToDateString","utcTimestamp","secondsStringToMilliseconds","_parseToken","algorithm","signature","_tokenExpiresIn","parsedToken","_logoutIfInvalidated","bypassAuthState","isUserInvalidated","signOut","ProactiveRefresh","isRunning","errorBackoff","_start","schedule","_stop","getInterval","wasError","interval","stsTokenManager","expirationTime","iteration","getIdToken","UserMetadata","createdAt","lastLoginAt","_initializeTime","lastSignInTime","creationTime","_copy","_reloadWithoutSaving","idToken","users","coreAccount","_notifyReloadListener","newProviderData","providerUserInfo","extractProviderData","providerData","original","newData","providerId","oldIsAnonymous","isAnonymous","newIsAnonymous","passwordHash","updates","localId","displayName","photoURL","photoUrl","emailVerified","rawId","StsTokenManager","refreshToken","isExpired","updateFromServerResponse","expiresIn","updateTokensAndExpiration","updateFromIdToken","refresh","clearRefreshToken","oldToken","grant_type","refresh_token","tokenApiHost","access_token","expires_in","requestStsToken","expiresInSec","manager","_assign","_clone","_performRefresh","assertStringOrUndefined","UserImpl","opt","proactiveRefresh","reloadUserInfo","reloadListener","_persistUserIfCurrent","_notifyListenersIfCurrent","getIdTokenResult","userInternal","claims","signInProvider","authTime","issuedAtTime","signInSecondFactor","reload","userInfo","newUser","_onReload","_startProactiveRefresh","_stopProactiveRefresh","_updateTokensIfNecessary","tokensRefreshed","deleteAccount","_redirectEventId","_fromJSON","_d","_f","_g","_h","plainObjectTokenManager","_fromIdTokenResponse","idTokenResponse","_fromGetAccountInfoResponse","instanceCache","_getInstance","cls","InMemoryPersistence","storage","_isAvailable","_set","_get","_remove","_addListener","_listener","_removeListener","inMemoryPersistence","_persistenceKeyName","PersistenceUserManager","userKey","fullUserKey","fullPersistenceKey","boundEventHandler","_onStorageEvent","setCurrentUser","getCurrentUser","blob","removeCurrentUser","savePersistenceForRedirect","setPersistence","newPersistence","persistenceHierarchy","availablePersistences","selectedPersistence","userToMigrate","migrationHierarchy","_shouldAllowMigration","_getBrowserName","_isIEMobile","_isFirefox","_isBlackBerry","_isWebOS","_isSafari","_isChromeIOS","_isAndroid","re","_isIOS","_isIE10","isIE","documentMode","_isMobileBrowser","_getClientVersion","clientPlatform","frameworks","reportedPlatform","reportedFrameworks","AuthMiddlewareQueue","queue","pushCallback","onAbort","wrappedCallback","runMiddleware","nextUser","onAbortStack","beforeStateCallback","reverse","originalMessage","PasswordPolicyImpl","responseOptions","customStrengthOptions","minPasswordLength","maxPasswordLength","containsLowercaseCharacter","containsLowercaseLetter","containsUppercaseCharacter","containsUppercaseLetter","containsNumericCharacter","containsNonAlphanumericCharacter","allowedNonAlphanumericCharacters","forceUpgradeOnSignin","schemaVersion","validatePassword","password","passwordPolicy","validatePasswordLengthOptions","validatePasswordCharacterOptions","meetsMinPasswordLength","meetsMaxPasswordLength","passwordChar","updatePasswordCharacterOptionsStatuses","AuthImpl","heartbeatServiceProvider","appCheckServiceProvider","operations","authStateSubscription","Subscription","idTokenSubscription","beforeStateQueue","redirectUser","isProactiveRefreshEnabled","EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION","_isInitialized","_deleted","_initializationPromise","_popupRedirectResolver","_agentRecaptchaConfig","_tenantRecaptchaConfigs","_projectPasswordPolicy","_tenantPasswordPolicies","_resolvePersistenceManagerAvailable","lastNotifiedUid","appVerificationDisabledForTesting","clientVersion","sdkClientVersion","_initializeWithPersistence","popupRedirectResolver","persistenceManager","_shouldInitProactively","_initialize","initializeCurrentUser","assertedPersistence","_currentUser","_updateCurrentUser","initializeCurrentUserFromIdToken","directlySetCurrentUser","authIdToken","previouslyStoredUser","futureCurrentUser","needsTocheckMiddleware","getOrInitRedirectPersistenceManager","redirectUserEventId","storedUserEventId","tryRedirectSignIn","_overrideRedirectResult","reloadAndSetCurrentUserOrClear","redirectResolver","_completeRedirectFn","_setRedirectUser","useDeviceLanguage","navigatorLanguage","languages","language","_getUserLanguage","updateCurrentUser","userExtern","skipBeforeStateCallbacks","notifyAuthListeners","redirectPersistenceManager","_getRecaptchaConfig","_getPasswordPolicyInternal","_updatePasswordPolicy","_getPasswordPolicy","_updateErrorMap","onAuthStateChanged","completed","registerStateListener","beforeAuthStateChanged","onIdTokenChanged","authStateReady","unsubscribe","revokeAccessToken","tokenType","revokeToken","redirectManager","resolver","_redirectPersistence","_redirectUserForId","currentUid","subscription","isUnsubscribed","addObserver","action","_logFramework","framework","_getFrameworks","heartbeatsHeader","_getAppCheckToken","appCheckTokenResult","_logWarn","_castAuth","createSubscribe","externalJSProvider","loadJS","recaptchaV2Script","recaptchaEnterpriseScript","gapiScript","_loadJS","MockGreCAPTCHATopLevel","MockGreCAPTCHA","ready","execute","_siteKey","render","_parameters","FAKE_TOKEN","RecaptchaEnterpriseVerifier","authExtern","retrieveSiteKey","getRecaptchaConfig","clientType","retrieveRecaptchaToken","injectRecaptchaFields","isCaptchaResp","isFakeToken","verifier","captchaResponse","newRequest","phoneEnrollmentInfo","recaptchaToken","recaptchaVersion","phoneSignInInfo","captchaResp","handleRecaptchaFlow","authInstance","actionName","actionMethod","recaptchaAuthProvider","requestWithRecaptcha","connectAuthEmulator","extractProtocol","authority","hostAndPort","bracketedIPv6","parsePort","extractHostAndPort","portStr","freeze","disableWarnings","attachBanner","el","sty","width","backgroundColor","border","margin","zIndex","textAlign","classList","emitEmulatorWarning","protocolEnd","AuthCredential","signInMethod","_getIdTokenResponse","_auth","_linkToIdToken","_idToken","_getReauthenticationResolver","linkEmailPassword","signInWithPassword","sendPasswordResetEmail$1","sendOobCode","EmailAuthCredential","_email","_password","_tenantId","_fromEmailAndPassword","_fromEmailAndCode","oobCode","returnSecureToken","signInWithEmailLink$1","signInWithEmailLinkForLinking","signInWithIdp","OAuthCredential","pendingToken","_fromParams","cred","nonce","oauthToken","oauthTokenSecret","secret","buildRequest","autoCreate","requestUri","postBody","ActionCodeURL","actionLink","searchParams","operation","parseMode","continueUrl","parseLink","link","doubleDeepLink","iOSDeepLink","parseDeepLink","EmailAuthProvider","PROVIDER_ID","credential","credentialWithLink","emailLink","actionCodeUrl","EMAIL_PASSWORD_SIGN_IN_METHOD","EMAIL_LINK_SIGN_IN_METHOD","FederatedAuthProvider","defaultLanguageCode","customParameters","setDefaultLanguage","setCustomParameters","customOAuthParameters","getCustomParameters","BaseOAuthProvider","scopes","addScope","scope","getScopes","FacebookAuthProvider","FACEBOOK_SIGN_IN_METHOD","credentialFromResult","userCredential","credentialFromTaggedObject","credentialFromError","tokenResponse","oauthAccessToken","GoogleAuthProvider","GOOGLE_SIGN_IN_METHOD","oauthIdToken","GithubAuthProvider","GITHUB_SIGN_IN_METHOD","TwitterAuthProvider","TWITTER_SIGN_IN_METHOD","UserCredentialImpl","operationType","providerIdForResponse","_forOperation","MultiFactorError","_fromErrorAndOperation","_processCredentialSavingMfaContextIfNecessary","_signInWithCredential","recachePasswordPolicy","confirmPasswordReset","newPassword","resetPassword","signInWithEmailAndPassword","signInWithCredential","STORAGE_AVAILABLE_KEY","BrowserPersistenceClass","storageRetriever","setItem","removeItem","getItem","BrowserLocalPersistence","localStorage","poll","onStorageEvent","listeners","pollTimer","fallbackToPolling","forAllChangedKeys","oldValue","_oldValue","notifyListeners","detachListener","stopPolling","triggerListeners","storedValue","startPolling","setInterval","StorageEvent","clearInterval","attachListener","browserLocalPersistence","BrowserSessionPersistence","sessionStorage","browserSessionPersistence","Receiver","eventTarget","handlersMap","receivers","isListeningto","newInstance","messageEvent","eventId","eventType","handlers","ports","postMessage","promises","handler","origin","fulfilled","reason","_allSettled","_subscribe","eventHandler","_unsubscribe","_generateEventId","prefix","digits","Sender","removeMessageHandler","messageChannel","port1","_send","timeout","MessageChannel","completionTimer","ackTimer","port2","finally","_window","_isWorker","DB_NAME","DB_OBJECTSTORE_NAME","DB_DATA_KEYPATH","DBPromise","getObjectStore","isReadWrite","_openDatabase","keyPath","_deleteDatabase","_putObject","_deleteObject","IndexedDBLocalPersistence","pendingWrites","sender","serviceWorkerReceiverAvailable","activeServiceWorker","_workerInitializationPromise","initializeServiceWorkerMessaging","_openDb","_withRetries","numAttempts","initializeReceiver","initializeSender","_origin","keyProcessed","_poll","_data","serviceWorker","active","_getActiveServiceWorker","results","notifyServiceWorker","controller","_withPendingWrite","write","getObject","getAllRequest","getAll","keysInResult","fbase_key","localKey","indexedDBLocalPersistence","IdpCredential","_buildIdpRequest","sessionId","returnIdpCredential","_signIn","_reauth","parsed","_reauthenticate","_link","_link$1","AbstractPopupRedirectOperation","pendingPromise","onExecution","registerConsumer","onAuthEvent","urlResponse","getIdpTask","unregisterAndCleanUp","unregisterConsumer","cleanUp","_POLL_WINDOW_CLOSE_TIMEOUT","PopupOperation","authWindow","pollId","currentPopupAction","executeNotNull","_openPopup","associatedEvent","_originValidation","_isIframeWebStorageSupported","isSupported","pollUserCancellation","closed","PENDING_REDIRECT_KEY","redirectOutcomeMap","RedirectAction","readyOutcome","pendingRedirectKey","resolverPersistence","hasPendingRedirect","_getAndClearPendingRedirectStatus","_getRedirectResult","resolverExtern","resolverOverride","_withDefaultResolver","AuthEventManager","cachedEventUids","consumers","queuedRedirectEvent","hasHandledPotentialRedirect","lastProcessedEventTime","authEventConsumer","isEventForConsumer","sendToConsumer","saveEventToCache","onEvent","hasEventBeenHandled","handled","consumer","isNullRedirectEvent","isRedirectEvent","eventIdMatches","eventUid","IP_ADDRESS_REGEX","HTTP_REGEX","_validateOrigin","authorizedDomains","_getProjectConfig","domain","matchDomain","expected","currentUrl","ceUrl","escapedDomainPattern","NETWORK_TIMEOUT","resetUnloadedGapiModules","beacon","___jsl","hint","CP","loadGapi","loadGapiIframe","gapi","load","iframes","getContext","Iframe","cbName","cachedGApiLoader","PING_TIMEOUT","IFRAME_ATTRIBUTES","top","height","tabindex","EID_FROM_APIHOST","getIframeUrl","eid","fw","_openIframe","context","_loadGapi","messageHandlersFilter","CROSS_ORIGIN_IFRAMES_FILTER","attributes","dontclear","iframe","restyle","setHideOnLeave","networkError","networkErrorTimer","clearTimerAndResolve","ping","BASE_POPUP_OPTIONS","resizable","statusbar","toolbar","AuthPopup","_open","screen","availHeight","availWidth","scrollbars","optionsString","accum","standalone","_isIOSStandalone","click","createEvent","initMouseEvent","dispatchEvent","openAsNewWindowIOS","newWin","focus","WIDGET_PATH","EMULATOR_WIDGET_PATH","FIREBASE_APP_CHECK_FRAGMENT_ID","_getRedirectUrl","authType","redirectUrl","additionalParams","isEmpty$1","tid","paramsDict","appCheckTokenFragment","getHandlerBase","WEB_STORAGE_SUPPORT_KEY","browserPopupRedirectResolver","eventManagers","originValidationPromises","_openRedirect","_setWindowLocation","initAndGetManager","register","iframeEvent","authEvent","AuthInterop","internalListeners","assertAuthConfigured","updateProactiveRefresh","authIdTokenMaxAge","lastPostedIdToken","getAuth","deps","initializeAuth","authTokenSyncPath","isSecureContext","authTokenSyncUrl","mintCookie","idTokenResult","idTokenAge","Authorization","authEmulatorHost","charset","getElementsByTagName","hierarchy","_initializeAuthInstance","_instanceIdentifier","_instance","getVersionForPlatform","AvatarNotCreatedError","UserNotLoggedInError","NoColorwaySizeAssetsFoundError","BrandUserIdNotSetError","NoFramesFoundError","NoStylesFoundError","AvatarNotCreated","FirebaseUser","brandUserId","brandId","setUser","logUserLogin","setBrandUserId","Boolean","userLoggingDoc","savedDoc","lastLogin","savedData","lastBrandLogin","brands","last_login","logins","userLoggingData","brand_id","last_brand_id","created_at","updated_at","userId","getUserProfile","watchUserProfileForChanges","watchUserProfileForFrames","predicate","login","username","logout","sendPasswordResetEmail","requestType","Firebase","promisefyOnSnapshot","unsubscribeWhenData","firebaseApp","collectionName","constraint","constraints","docRef","docSnap","getFirebaseError","Fetcher","Fetch","endpointPath","useToken","getUrl","getHeaders","res","Get","Post","Put","Patch","Delete","testImage","TfrShop","measurementLocations","isLoggedIn","getMeasurementLocations","getRecommendedSizes","styleId","fits","recommended_size","submitTelephoneNumber","tel","sanitizedTel","phone_number","getColorwaySizeAssetFromSku","colorwaySizeAssetSku","assets","getColorwaySizeAssets","getColorwaySizeAssetFromBrandStyleId","brandStyleId","getMeasurementLocationsFromSku","sku","filledLocations","asset","styleCategory","getStyle","style_id","taxonomy","getGetTaxonomy","style_garment_category_id","measurement_locations","female","sort_order","Infinity","getMeasurementLocationsFromBrandStyleId","getStyleByBrandStyleId","skus","querySnapshot","colorwaySizeAssets","colorwaySizeAsset","getMeasurementLocationName","getMeasurementLocationSortOrder","tryOn","sizeId","getColorwaySizeAssetSkuFromStyleIdAndSizeId","getColorwaySizeAssetFrames","requestThenGetColorwaySizeAssetFrames","fetchMeasurementLocations","garment_label","requestColorwaySizeAssetFrames","awaitColorwaySizeAssetFrames","colorwaySizeAssetSKU","userProfile","frames","vto","colorwaySizeAssetId","brand_user_id","MeasurementLocation","MeasurementLocationName","ACROSS_BACK","ACROSS_FRONT","ACROSS_SHOULDER","ANKLE","ARMEYE","ARM_LENGTH_FROM_SHOULDER","BACK_CROTCH_LENGTH","BACK_NECK_TO_EBLOW","BELOW_KNEE","BICEP","BUST","BUST_POINT_TO_BUST_POINT","CALF","CB_NECK_TO_WAIST","CB_NECK_TO_WRIST","CF_NECK_TO_WAIST","ELBOW","FOREARM","FRONT_CROTCH_LENGTH","HIGH_HIP_PLACEMENT_FROM_WAIST","HIGH_HIP","HSP_TO_ACROSS_BACK","HSP_TO_ACROSS_FRONT","HSP_TO_BUST_POINT","HSP_TO_LOW_HIP_POSITION","HSP_TO_WAIST_POSITION","INSEAM","KNEE","LOW_HIP","LOW_HIP_PLACEMENT_FROM_WAIST","MID_NECK","NECK_AT_BASE","SHOULDER_DROP","SHOULDER_TO_SHOULDER","SIDE_WAIST_TO_FLOOR","SIDE_WAIST_TO_KNEE","THIGH","TOTAL_RISE_LENGTH","UNDER_BUST","VERTICAL_TRUNK","WAIST","WRIST","Classification","ClassificationLocations","BLOUSES","COATS","DRESSES","JACKETS","PANTS","PUFFERS_AND_PARKAS","SHORTS","SKIRTS","SWEATERS","T_SHIRTS_AND_TANKS","CategoryNames","activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops","SubcategoryNames","a_line","a_line_flared","blazers","bodycon","bodysuits","boiler_suits","bootcut","cardigans","cigarette","corsets_and_bustiers","crewnecks","culottes","denim","denim_jackets","denim_shorts","fit_and_flare","flared","hoodies_and_zipups","joggers","jumpsuits","knit","leggings","mom","overalls","parkas","peacoats","pencil","pleated","polos","puffer_jackets","raincoats","relaxed","rompers","shackets","shirt","shirts_and_blouses","skater","skinny","slim","slip","sports_bras","straight","suit_jackets","suit_skirts","suit_trousers","suit_vests","sweatshirts","t_shirts","tank_tops_and_camisoles","tapered","trench_coats","trousers","turtlenecks","unitards","v_necks","wide_leg","Taxonomy","Fit","FitNames","TOO_TIGHT","TIGHT","SLIGHTLY_TIGHT","PERFECT_FIT","SLIGHTLY_LOOSE","LOOSE","OVERSIZED","TOO_SHORT","SHORT","SLIGHTLY_SHORT","SLIGHTLY_LONG","LONG","TOO_LONG","AvatarState","__proto__","Categories","VtoComponent","vtoMainDivId","isInit","currentSliderValue","vtoMainDiv","tryOnImage","imageUrl","onNewFramesReady","boundedValue","sliderElement","styleInject","css","insertAt","head","firstChild","insertBefore","styleSheet","cssText","createTextNode","tfrDoor","userIcon","LoadingAvatarModal","Hook","progressBar","querySelector","milliseconds","percentCount","millisecondStep","startProgressBar","timeoutMS","Unhook","Body","useFullModalContent","InitModalManager","elementID","modalRoot","previousContent","renderModalContent","Close","overflow","unhook","EscClose","ContainerClose","hook","closeLink","content","modalBody","Content","ScanCodeModal","onSignInNav","onCtaClickApple","onCtaClickGoogle","imageBaseUrl","marginBottom","TfrModal","modalDivId","signIn","forgotPassword","submitTel","modals.InitModalManager","onSignOut","onNavSignIn","onClose","modals.LoggedOutModal","toSignIn","onNotCreated","onLoading","modals.LoadingAvatarModal","toScan","modals.ScanCodeModal","onTelSubmit","onSignIn","resetValidation","validationError","onNavForgotPassword","onNavScanCode","querySelectorAll","formError","modals.SignInModal","toForgotPassword","onPasswordReset","modals.ForgotPasswordModal","toPasswordReset","onTryOn","onNavBack","modals.TryOnModal","navBack","modals.ErrorModal","onSizeError","recommended","available","sizes","modals.SizeErrorModal","toFitInfo","modals.FitModal","history","back","SizeRecComponent","sizeRecMainDivId","onSignInClick","onSignOutClick","onFitInfoClick","onTryOnClick","_sku","_styleId","tfrLoggedInElements","tfrLoggedOutElements","tfrToggleOpenElements","tfrToggleClosedElements","isCollapsed","redraw","setSku","setStyleId","setIsLoggedIn","tfrSizeRecSelectContainer","tfrSizeRecSelect","tfrSizeHowItFits","opacity","tfrSizeRecActionLogin","tfrSizeRecActionLogout","tfrSizeRecTitle","tfrSizeRecTitleToggle","tfrSizeRecommendationError","renderSizeRecSelectLoggedOut","setLoading","isLoading","tfrSizeRecLoading","tfrSizeRecommendationsContainer","setGarmentLocations","locations","renderGarmentLocations","setRecommendedSize","renderSizeRec","hide","sizeRecMainDiv","show","setElements","bindEvents","tfrInfoIcon","tfrLoginToView","tfrSizeRecTable","tfrSizeRecSize","onSizeRecSelectClick","toggletSizeRecSelectContainer","tryOnButton","activeButton","selectedSizeId","getAttribute","originalText","textContent","allSizeButtons","activeIndex","leftButton","_preloadNeighborVTO","rightButton","removeAttribute","buttonElement","buttonText","selectedIndex","allButtons","item","selectedSizeIndex","findIndex","renderSizeRecTable","renderSizeRecSelect","html","fit","isPerfect","renderSizeRecTableRow","size_id","innerHtml","randomFit","choices","TfrSizeRec","cssVariables","tfrShop","perfectFits","ShopTypes","setCssVariables","sizeRecComponent","getGarmentLocations","recommendSize","getRecommendedSize","sizeRec","size_value","available_sizes","measurement_location_fits","locationFit","fit_label","measurement_location","sortOrder","brandColor","setProperty","black","red","white","dark","grey","lightGrey","mainBorderColor","mainBorderRadius","mainBorderWidth","mainBgColor","mainWidth","mainVPadding","mainHPadding","mainFont","titleFont","subtitleFont","rowFont","ctaFont","sizeSelectorTextColor","sizeSelectorFontSize","sizeSelectorFontWeight","sizeSelectorBgColor","sizeSelectorBorderColor","sizeSelectorBorderWidth","sizeSelectorBgColorHover","sizeSelectorBgColorActive","sizeSelectorButtonHeight","sizeSelectorButtonActiveHeight","sizeSelectorButtonActiveBorderColor","sizeSelectorButtonActiveBorderWidth","sizeSelectorButtonRadius","sizeSelectorButtonShadow","FittingRoom","shopId","hooks","_env","NODE_ENV","tfrModal","initShop","tfrSizeRec","vtoComponent","shop","is_published","is_vto","onLogin","subscribeToProfileChanges","onLogout","unsubscribeFromProfileChanges","passwordReset","shouldDisplay","onUserProfileChange","avatar_status","types.AvatarState","NOT_CREATED","PENDING","CREATED","onLoadingComplete","garment_measurements","measurement","brandStyleIdOrSku","e2","initFittingRoom","tfr"],"mappings":";;;;AAAA,SAASA,EAAmBC,EAAUC,GACpC,IAAIC,EAAO,WACgB,IAArBD,EAAUE,QAGdJ,EAAmBE,EAAUG,OAAM,GAAKH,EAAUG,MAAM,GAAG,GAC7D,EACA,IAAIC,EAAM,IAAIC,MACdD,EAAIE,OAASL,EACbG,EAAIG,QAAUN,EACdG,EAAII,IAAMT,CACZ,CAEA,SAASU,EAAWT,GAClBF,EAAmBE,EAAUG,OAAM,GAAKH,EAAUG,MAAM,GAAG,GAC7D,OAEaO,EAAkB,CAACC,EAAkBC,KAChD,MAAMC,EAA2BC,SAASC,eAAeJ,GACzD,IAAKE,EACH,MAAM,IAAIG,MAAM,kBAAkBL,eAGpC,MAAO,CACL,IAAAM,CAAKjB,EAAqBkB,GACxB,IAAKC,MAAMC,QAAQpB,KAAeA,EAAUE,OAE1C,O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