0x1998 - MANAGER
Düzenlenen Dosya: pipelines.esm.js.map
{"version":3,"file":"pipelines.esm.js","sources":["../src/util/proto.ts","../src/lite-api/expressions.ts","../src/core/pipeline-util.ts","../src/lite-api/stage.ts","../src/lite-api/pipeline-source.ts","../src/lite-api/pipeline-result.ts","../src/util/pipeline_util.ts","../src/lite-api/pipeline.ts","../src/api/pipeline.ts","../src/api/pipeline_impl.ts"],"sourcesContent":["/**\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\nimport {\n ArrayValue as ProtoArrayValue,\n Function as ProtoFunction,\n LatLng as ProtoLatLng,\n MapValue as ProtoMapValue,\n Pipeline as ProtoPipeline,\n Timestamp as ProtoTimestamp,\n Value as ProtoValue\n} from '../protos/firestore_proto_api';\n\nimport { isPlainObject } from './input_validation';\n\n/* eslint @typescript-eslint/no-explicit-any: 0 */\n\nfunction isITimestamp(obj: any): obj is ProtoTimestamp {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if (\n 'seconds' in obj &&\n (obj.seconds === null ||\n typeof obj.seconds === 'number' ||\n typeof obj.seconds === 'string') &&\n 'nanos' in obj &&\n (obj.nanos === null || typeof obj.nanos === 'number')\n ) {\n return true;\n }\n\n return false;\n}\nfunction isILatLng(obj: any): obj is ProtoLatLng {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if (\n 'latitude' in obj &&\n (obj.latitude === null || typeof obj.latitude === 'number') &&\n 'longitude' in obj &&\n (obj.longitude === null || typeof obj.longitude === 'number')\n ) {\n return true;\n }\n\n return false;\n}\nfunction isIArrayValue(obj: any): obj is ProtoArrayValue {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if ('values' in obj && (obj.values === null || Array.isArray(obj.values))) {\n return true;\n }\n\n return false;\n}\nfunction isIMapValue(obj: any): obj is ProtoMapValue {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if ('fields' in obj && (obj.fields === null || isPlainObject(obj.fields))) {\n return true;\n }\n\n return false;\n}\nfunction isIFunction(obj: any): obj is ProtoFunction {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if (\n 'name' in obj &&\n (obj.name === null || typeof obj.name === 'string') &&\n 'args' in obj &&\n (obj.args === null || Array.isArray(obj.args))\n ) {\n return true;\n }\n\n return false;\n}\n\nfunction isIPipeline(obj: any): obj is ProtoPipeline {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n if ('stages' in obj && (obj.stages === null || Array.isArray(obj.stages))) {\n return true;\n }\n\n return false;\n}\n\nexport function isFirestoreValue(obj: any): obj is ProtoValue {\n if (typeof obj !== 'object' || obj === null) {\n return false; // Must be a non-null object\n }\n\n // Check optional properties and their types\n if (\n ('nullValue' in obj &&\n (obj.nullValue === null || obj.nullValue === 'NULL_VALUE')) ||\n ('booleanValue' in obj &&\n (obj.booleanValue === null || typeof obj.booleanValue === 'boolean')) ||\n ('integerValue' in obj &&\n (obj.integerValue === null ||\n typeof obj.integerValue === 'number' ||\n typeof obj.integerValue === 'string')) ||\n ('doubleValue' in obj &&\n (obj.doubleValue === null || typeof obj.doubleValue === 'number')) ||\n ('timestampValue' in obj &&\n (obj.timestampValue === null || isITimestamp(obj.timestampValue))) ||\n ('stringValue' in obj &&\n (obj.stringValue === null || typeof obj.stringValue === 'string')) ||\n ('bytesValue' in obj &&\n (obj.bytesValue === null || obj.bytesValue instanceof Uint8Array)) ||\n ('referenceValue' in obj &&\n (obj.referenceValue === null ||\n typeof obj.referenceValue === 'string')) ||\n ('geoPointValue' in obj &&\n (obj.geoPointValue === null || isILatLng(obj.geoPointValue))) ||\n ('arrayValue' in obj &&\n (obj.arrayValue === null || isIArrayValue(obj.arrayValue))) ||\n ('mapValue' in obj &&\n (obj.mapValue === null || isIMapValue(obj.mapValue))) ||\n ('fieldReferenceValue' in obj &&\n (obj.fieldReferenceValue === null ||\n typeof obj.fieldReferenceValue === 'string')) ||\n ('functionValue' in obj &&\n (obj.functionValue === null || isIFunction(obj.functionValue))) ||\n ('pipelineValue' in obj &&\n (obj.pipelineValue === null || isIPipeline(obj.pipelineValue)))\n ) {\n return true;\n }\n\n return false;\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\nimport { FirestoreError } from '../api';\nimport { ParseContext } from '../api/parse_context';\nimport {\n DOCUMENT_KEY_NAME,\n FieldPath as InternalFieldPath\n} from '../model/path';\nimport { Value as ProtoValue } from '../protos/firestore_proto_api';\nimport {\n JsonProtoSerializer,\n ProtoValueSerializable,\n toMapValue,\n toStringValue\n} from '../remote/serializer';\nimport { hardAssert } from '../util/assert';\nimport { isPlainObject } from '../util/input_validation';\nimport { isFirestoreValue } from '../util/proto';\nimport { isString } from '../util/types';\n\nimport { Bytes } from './bytes';\nimport { documentId as documentIdFieldPath, FieldPath } from './field_path';\nimport { vector } from './field_value_impl';\nimport { GeoPoint } from './geo_point';\nimport { DocumentReference } from './reference';\nimport { Timestamp } from './timestamp';\nimport { fieldPathFromArgument, parseData, UserData } from './user_data_reader';\nimport { VectorValue } from './vector_value';\n\n/**\n * @beta\n *\n * An enumeration of the different types of expressions.\n */\nexport type ExpressionType =\n | 'Field'\n | 'Constant'\n | 'Function'\n | 'AggregateFunction'\n | 'ListOfExpressions'\n | 'AliasedExpression';\n\n/**\n * @beta\n *\n * An enumeration of the different types generated by the Firestore backend.\n *\n * <ul>\n * <li>Numerics evaluate directly to backend representation (`int64` or `float64`), not JS `number`.</li>\n * <li>JavaScript `Date` and firestore `Timestamp` objects strictly evaluate to `'timestamp'`.</li>\n * <li>Advanced configurations parsing backend types (such as `decimal128`, `max_key` or `min_key` from BSON) are also incorporated in this union string type. Note that `decimal128` is a backend-only numeric type that the JavaScript SDK cannot create natively, but can be evaluated in pipelines.</li>\n * </ul>\n */\nexport type Type =\n | 'null'\n | 'array'\n | 'boolean'\n | 'bytes'\n | 'timestamp'\n | 'geo_point'\n | 'number'\n | 'int32'\n | 'int64'\n | 'float64'\n | 'decimal128'\n | 'map'\n | 'reference'\n | 'string'\n | 'vector'\n | 'max_key'\n | 'min_key'\n | 'object_id'\n | 'regex'\n | 'request_timestamp';\n\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n *\n * @private\n * @internal\n * @param value\n */\nfunction valueToDefaultExpr(value: unknown): Expression {\n let result: Expression | undefined;\n if (value instanceof Expression) {\n return value;\n } else if (isPlainObject(value)) {\n result = _map(value as Record<string, unknown>, undefined);\n } else if (value instanceof Array) {\n result = array(value);\n } else {\n result = _constant(value, undefined);\n }\n\n return result;\n}\n\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n *\n * @private\n * @internal\n * @param value\n */\nfunction vectorToExpr(value: VectorValue | number[] | Expression): Expression {\n if (value instanceof Expression) {\n return value;\n } else if (value instanceof VectorValue) {\n return constant(value);\n } else if (Array.isArray(value)) {\n return constant(vector(value));\n } else {\n throw new Error('Unsupported value: ' + typeof value);\n }\n}\n\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n * If the input is a string, it is assumed to be a field name, and a\n * field(value) is returned.\n *\n * @private\n * @internal\n * @param value\n */\nfunction fieldOrExpression(value: unknown): Expression {\n if (isString(value)) {\n const result = field(value);\n return result;\n } else {\n return valueToDefaultExpr(value);\n }\n}\n\n/**\n * @beta\n *\n * Represents an expression that can be evaluated to a value within the execution of a {@link\n * @firebase/firestore/pipelines#Pipeline}.\n *\n * Expressions are the building blocks for creating complex queries and transformations in\n * Firestore pipelines. They can represent:\n *\n * - **Field references:** Access values from document fields.\n * - **Literals:** Represent constant values (strings, numbers, booleans).\n * - **Function calls:** Apply functions to one or more expressions.\n *\n * The `Expression` class provides a fluent API for building expressions. You can chain together\n * method calls to create complex expressions.\n */\nexport abstract class Expression implements ProtoValueSerializable, UserData {\n abstract readonly expressionType: ExpressionType;\n\n abstract readonly _methodName?: string;\n\n /**\n * @private\n * @internal\n */\n abstract _toProto(serializer: JsonProtoSerializer): ProtoValue;\n _protoValueType = 'ProtoValue' as const;\n\n /**\n * @private\n * @internal\n */\n abstract _readUserData(context: ParseContext): void;\n\n /**\n * Creates an expression that adds this expression to another expression.\n *\n * @example\n * ```typescript\n * // Add the value of the 'quantity' field and the 'reserve' field.\n * field(\"quantity\").add(field(\"reserve\"));\n * ```\n *\n * @param second - The expression or literal to add to this expression.\n * @param others - Optional additional expressions or literals to add to this expression.\n * @returns A new `Expression` representing the addition operation.\n */\n add(second: Expression | unknown): FunctionExpression {\n return new FunctionExpression(\n 'add',\n [this, valueToDefaultExpr(second)],\n 'add'\n );\n }\n\n /**\n * @beta\n * Wraps the expression in a [BooleanExpression].\n *\n * @returns A [BooleanExpression] representing the same expression.\n */\n asBoolean(): BooleanExpression {\n if (this instanceof BooleanExpression) {\n return this;\n } else if (this instanceof Constant) {\n return new BooleanConstant(this);\n } else if (this instanceof Field) {\n return new BooleanField(this);\n } else if (this instanceof FunctionExpression) {\n return new BooleanFunctionExpression(this);\n } else {\n throw new FirestoreError(\n 'invalid-argument',\n `Conversion of type ${typeof this} to BooleanExpression not supported.`\n );\n }\n }\n\n /**\n * @beta\n * Creates an expression that subtracts another expression from this expression.\n *\n * @example\n * ```typescript\n * // Subtract the 'discount' field from the 'price' field\n * field(\"price\").subtract(field(\"discount\"));\n * ```\n *\n * @param subtrahend - The expression to subtract from this expression.\n * @returns A new `Expression` representing the subtraction operation.\n */\n subtract(subtrahend: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that subtracts a constant value from this expression.\n *\n * @example\n * ```typescript\n * // Subtract 20 from the value of the 'total' field\n * field(\"total\").subtract(20);\n * ```\n *\n * @param subtrahend - The constant value to subtract.\n * @returns A new `Expression` representing the subtraction operation.\n */\n subtract(subtrahend: number): FunctionExpression;\n subtract(subtrahend: number | Expression): FunctionExpression {\n return new FunctionExpression(\n 'subtract',\n [this, valueToDefaultExpr(subtrahend)],\n 'subtract'\n );\n }\n\n /**\n * @beta\n * Creates an expression that multiplies this expression by another expression.\n *\n * @example\n * ```typescript\n * // Multiply the 'quantity' field by the 'price' field\n * field(\"quantity\").multiply(field(\"price\"));\n * ```\n *\n * @param second - The second expression or literal to multiply by.\n * @param others - Optional additional expressions or literals to multiply by.\n * @returns A new `Expression` representing the multiplication operation.\n */\n multiply(second: Expression | number): FunctionExpression {\n return new FunctionExpression(\n 'multiply',\n [this, valueToDefaultExpr(second)],\n 'multiply'\n );\n }\n\n /**\n * @beta\n * Creates an expression that divides this expression by another expression.\n *\n * @example\n * ```typescript\n * // Divide the 'total' field by the 'count' field\n * field(\"total\").divide(field(\"count\"));\n * ```\n *\n * @param divisor - The expression to divide by.\n * @returns A new `Expression` representing the division operation.\n */\n divide(divisor: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that divides this expression by a constant value.\n *\n * @example\n * ```typescript\n * // Divide the 'value' field by 10\n * field(\"value\").divide(10);\n * ```\n *\n * @param divisor - The constant value to divide by.\n * @returns A new `Expression` representing the division operation.\n */\n divide(divisor: number): FunctionExpression;\n divide(divisor: number | Expression): FunctionExpression {\n return new FunctionExpression(\n 'divide',\n [this, valueToDefaultExpr(divisor)],\n 'divide'\n );\n }\n\n /**\n * @beta\n * Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing the 'value' field by the 'divisor' field\n * field(\"value\").mod(field(\"divisor\"));\n * ```\n *\n * @param expression - The expression to divide by.\n * @returns A new `Expression` representing the modulo operation.\n */\n mod(expression: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing the 'value' field by 10\n * field(\"value\").mod(10);\n * ```\n *\n * @param value - The constant value to divide by.\n * @returns A new `Expression` representing the modulo operation.\n */\n mod(value: number): FunctionExpression;\n mod(other: number | Expression): FunctionExpression {\n return new FunctionExpression(\n 'mod',\n [this, valueToDefaultExpr(other)],\n 'mod'\n );\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is equal to another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is equal to 21\n * field(\"age\").equal(21);\n * ```\n *\n * @param expression - The expression to compare for equality.\n * @returns A new `Expression` representing the equality comparison.\n */\n equal(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'city' field is equal to \"London\"\n * field(\"city\").equal(\"London\");\n * ```\n *\n * @param value - The constant value to compare for equality.\n * @returns A new `Expression` representing the equality comparison.\n */\n equal(value: unknown): BooleanExpression;\n equal(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'equal',\n [this, valueToDefaultExpr(other)],\n 'equal'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is not equal to another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to \"completed\"\n * field(\"status\").notEqual(\"completed\");\n * ```\n *\n * @param expression - The expression to compare for inequality.\n * @returns A new `Expression` representing the inequality comparison.\n */\n notEqual(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is not equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'country' field is not equal to \"USA\"\n * field(\"country\").notEqual(\"USA\");\n * ```\n *\n * @param value - The constant value to compare for inequality.\n * @returns A new `Expression` representing the inequality comparison.\n */\n notEqual(value: unknown): BooleanExpression;\n notEqual(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'not_equal',\n [this, valueToDefaultExpr(other)],\n 'notEqual'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is less than another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is less than 'limit'\n * field(\"age\").lessThan(field('limit'));\n * ```\n *\n * @param experession - The expression to compare for less than.\n * @returns A new `Expression` representing the less than comparison.\n */\n lessThan(experession: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is less than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is less than 50\n * field(\"price\").lessThan(50);\n * ```\n *\n * @param value - The constant value to compare for less than.\n * @returns A new `Expression` representing the less than comparison.\n */\n lessThan(value: unknown): BooleanExpression;\n lessThan(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'less_than',\n [this, valueToDefaultExpr(other)],\n 'lessThan'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is less than or equal to another\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is less than or equal to 20\n * field(\"quantity\").lessThan(constant(20));\n * ```\n *\n * @param expression - The expression to compare for less than or equal to.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\n lessThanOrEqual(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is less than or equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'score' field is less than or equal to 70\n * field(\"score\").lessThan(70);\n * ```\n *\n * @param value - The constant value to compare for less than or equal to.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\n lessThanOrEqual(value: unknown): BooleanExpression;\n lessThanOrEqual(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'less_than_or_equal',\n [this, valueToDefaultExpr(other)],\n 'lessThanOrEqual'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is greater than another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is greater than the 'limit' field\n * field(\"age\").greaterThan(field(\"limit\"));\n * ```\n *\n * @param expression - The expression to compare for greater than.\n * @returns A new `Expression` representing the greater than comparison.\n */\n greaterThan(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is greater than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is greater than 100\n * field(\"price\").greaterThan(100);\n * ```\n *\n * @param value - The constant value to compare for greater than.\n * @returns A new `Expression` representing the greater than comparison.\n */\n greaterThan(value: unknown): BooleanExpression;\n greaterThan(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'greater_than',\n [this, valueToDefaultExpr(other)],\n 'greaterThan'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is greater than or equal to another\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1\n * field(\"quantity\").greaterThanOrEqual(field('requirement').add(1));\n * ```\n *\n * @param expression - The expression to compare for greater than or equal to.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\n greaterThanOrEqual(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is greater than or equal to a constant\n * value.\n *\n * @example\n * ```typescript\n * // Check if the 'score' field is greater than or equal to 80\n * field(\"score\").greaterThanOrEqual(80);\n * ```\n *\n * @param value - The constant value to compare for greater than or equal to.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\n greaterThanOrEqual(value: unknown): BooleanExpression;\n greaterThanOrEqual(other: unknown): BooleanExpression {\n return new FunctionExpression(\n 'greater_than_or_equal',\n [this, valueToDefaultExpr(other)],\n 'greaterThanOrEqual'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that concatenates an array expression with one or more other arrays.\n *\n * @example\n * ```typescript\n * // Combine the 'items' array with another array field.\n * field(\"items\").arrayConcat(field(\"otherItems\"));\n * ```\n * @param secondArray - Second array expression or array literal to concatenate.\n * @param otherArrays - Optional additional array expressions or array literals to concatenate.\n * @returns A new `Expression` representing the concatenated array.\n */\n arrayConcat(\n secondArray: Expression | unknown[],\n ...otherArrays: Array<Expression | unknown[]>\n ): FunctionExpression {\n const elements = [secondArray, ...otherArrays];\n const exprValues = elements.map(value => valueToDefaultExpr(value));\n return new FunctionExpression(\n 'array_concat',\n [this, ...exprValues],\n 'arrayConcat'\n );\n }\n\n /**\n * @beta\n * Creates an expression that checks if an array contains a specific element.\n *\n * @example\n * ```typescript\n * // Check if the 'sizes' array contains the value from the 'selectedSize' field\n * field(\"sizes\").arrayContains(field(\"selectedSize\"));\n * ```\n *\n * @param expression - The element to search for in the array.\n * @returns A new `Expression` representing the 'array_contains' comparison.\n */\n arrayContains(expression: Expression): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if an array contains a specific value.\n *\n * @example\n * ```typescript\n * // Check if the 'colors' array contains \"red\"\n * field(\"colors\").arrayContains(\"red\");\n * ```\n *\n * @param value - The element to search for in the array.\n * @returns A new `Expression` representing the 'array_contains' comparison.\n */\n arrayContains(value: unknown): BooleanExpression;\n arrayContains(element: unknown): BooleanExpression {\n return new FunctionExpression(\n 'array_contains',\n [this, valueToDefaultExpr(element)],\n 'arrayContains'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if an array contains all the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the 'tags' array contains both the value in field \"tag1\" and the literal value \"tag2\"\n * field(\"tags\").arrayContainsAll([field(\"tag1\"), \"tag2\"]);\n * ```\n *\n * @param values - The elements to check for in the array.\n * @returns A new `Expression` representing the 'array_contains_all' comparison.\n */\n arrayContainsAll(values: Array<Expression | unknown>): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if an array contains all the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the 'tags' array contains both of the values from field \"tag1\" and the literal value \"tag2\"\n * field(\"tags\").arrayContainsAll(array([field(\"tag1\"), \"tag2\"]));\n * ```\n *\n * @param arrayExpression - The elements to check for in the array.\n * @returns A new `Expression` representing the 'array_contains_all' comparison.\n */\n arrayContainsAll(arrayExpression: Expression): BooleanExpression;\n arrayContainsAll(values: unknown[] | Expression): BooleanExpression {\n const normalizedExpr = Array.isArray(values)\n ? new ListOfExprs(values.map(valueToDefaultExpr), 'arrayContainsAll')\n : values;\n return new FunctionExpression(\n 'array_contains_all',\n [this, normalizedExpr],\n 'arrayContainsAll'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if an array contains any of the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the 'categories' array contains either values from field \"cate1\" or \"cate2\"\n * field(\"categories\").arrayContainsAny([field(\"cate1\"), field(\"cate2\")]);\n * ```\n *\n * @param values - The elements to check for in the array.\n * @returns A new `Expression` representing the 'array_contains_any' comparison.\n */\n arrayContainsAny(values: Array<Expression | unknown>): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if an array contains any of the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the 'groups' array contains either the value from the 'userGroup' field\n * // or the value \"guest\"\n * field(\"groups\").arrayContainsAny(array([field(\"userGroup\"), \"guest\"]));\n * ```\n *\n * @param arrayExpression - The elements to check for in the array.\n * @returns A new `Expression` representing the 'array_contains_any' comparison.\n */\n arrayContainsAny(arrayExpression: Expression): BooleanExpression;\n arrayContainsAny(\n values: Array<unknown | Expression> | Expression\n ): BooleanExpression {\n const normalizedExpr = Array.isArray(values)\n ? new ListOfExprs(values.map(valueToDefaultExpr), 'arrayContainsAny')\n : values;\n return new FunctionExpression(\n 'array_contains_any',\n [this, normalizedExpr],\n 'arrayContainsAny'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that reverses an array.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myArray' field.\n * field(\"myArray\").arrayReverse();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array.\n */\n arrayReverse(): FunctionExpression {\n return new FunctionExpression('array_reverse', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that calculates the length of an array.\n *\n * @example\n * ```typescript\n * // Get the number of items in the 'cart' array\n * field(\"cart\").arrayLength();\n * ```\n *\n * @returns A new `Expression` representing the length of the array.\n */\n arrayLength(): FunctionExpression {\n return new FunctionExpression('array_length', [this], 'arrayLength');\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is either \"Electronics\" or value of field 'primaryType'\n * field(\"category\").equalAny(\"Electronics\", field(\"primaryType\"));\n * ```\n *\n * @param values - The values or expressions to check against.\n * @returns A new `Expression` representing the 'IN' comparison.\n */\n equalAny(values: Array<Expression | unknown>): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is either \"Electronics\" or value of field 'primaryType'\n * field(\"category\").equalAny(array([\"Electronics\", field(\"primaryType\")]));\n * ```\n *\n * @param arrayExpression - An expression that evaluates to an array of values to check against.\n * @returns A new `Expression` representing the 'IN' comparison.\n */\n equalAny(arrayExpression: Expression): BooleanExpression;\n equalAny(others: unknown[] | Expression): BooleanExpression {\n const exprOthers = Array.isArray(others)\n ? new ListOfExprs(others.map(valueToDefaultExpr), 'equalAny')\n : others;\n return new FunctionExpression(\n 'equal_any',\n [this, exprOthers],\n 'equalAny'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if this expression is not equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is neither \"pending\" nor the value of 'rejectedStatus'\n * field(\"status\").notEqualAny([\"pending\", field(\"rejectedStatus\")]);\n * ```\n *\n * @param values - The values or expressions to check against.\n * @returns A new `Expression` representing the 'notEqualAny' comparison.\n */\n notEqualAny(values: Array<Expression | unknown>): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses'\n * field(\"status\").notEqualAny(field('rejectedStatuses'));\n * ```\n *\n * @param arrayExpression - The values or expressions to check against.\n * @returns A new `Expression` representing the 'notEqualAny' comparison.\n */\n notEqualAny(arrayExpression: Expression): BooleanExpression;\n notEqualAny(others: unknown[] | Expression): BooleanExpression {\n const exprOthers = Array.isArray(others)\n ? new ListOfExprs(others.map(valueToDefaultExpr), 'notEqualAny')\n : others;\n return new FunctionExpression(\n 'not_equal_any',\n [this, exprOthers],\n 'notEqualAny'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if a field exists in the document.\n *\n * @example\n * ```typescript\n * // Check if the document has a field named \"phoneNumber\"\n * field(\"phoneNumber\").exists();\n * ```\n *\n * @returns A new `Expression` representing the 'exists' check.\n */\n exists(): BooleanExpression {\n return new FunctionExpression('exists', [this], 'exists').asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that calculates the character length of a string in UTF-8.\n *\n * @example\n * ```typescript\n * // Get the character length of the 'name' field in its UTF-8 form.\n * field(\"name\").charLength();\n * ```\n *\n * @returns A new `Expression` representing the length of the string.\n */\n charLength(): FunctionExpression {\n return new FunctionExpression('char_length', [this], 'charLength');\n }\n\n /**\n * @beta\n * Creates an expression that performs a case-sensitive string comparison.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the word \"guide\" (case-sensitive)\n * field(\"title\").like(\"%guide%\");\n * ```\n *\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new `Expression` representing the 'like' comparison.\n */\n like(pattern: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that performs a case-sensitive string comparison.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the word \"guide\" (case-sensitive)\n * field(\"title\").like(\"%guide%\");\n * ```\n *\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new `Expression` representing the 'like' comparison.\n */\n like(pattern: Expression): BooleanExpression;\n like(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'like',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'like'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if a string contains a specified regular expression as a\n * substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\" (case-insensitive)\n * field(\"description\").regexContains(\"(?i)example\");\n * ```\n *\n * @param pattern - The regular expression to use for the search.\n * @returns A new `Expression` representing the 'contains' comparison.\n */\n regexContains(pattern: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if a string contains a specified regular expression as a\n * substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains the regular expression stored in field 'regex'\n * field(\"description\").regexContains(field(\"regex\"));\n * ```\n *\n * @param pattern - The regular expression to use for the search.\n * @returns A new `Expression` representing the 'contains' comparison.\n */\n regexContains(pattern: Expression): BooleanExpression;\n regexContains(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'regex_contains',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'regexContains'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that returns the first substring of a string expression that matches\n * a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract the domain from an email address\n * field(\"email\").regexFind(\"@.+\")\n * ```\n *\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\n regexFind(pattern: string): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that returns the first substring of a string expression that matches\n * a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract the domain from an email address\n * field(\"email\").regexFind(field(\"domain\"))\n * ```\n *\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\n regexFind(pattern: Expression): FunctionExpression;\n regexFind(stringOrExpr: string | Expression): FunctionExpression {\n return new FunctionExpression(\n 'regex_find',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'regexFind'\n );\n }\n\n /**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in this string expression that\n * match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all hashtags from a post content field\n * field(\"content\").regexFindAll(\"#[A-Za-z0-9_]+\")\n * ```\n *\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} that evaluates to an array of matched substrings.\n */\n regexFindAll(pattern: string): FunctionExpression;\n\n /**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in this string expression that\n * match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all names from a post content field\n * field(\"content\").regexFindAll(field(\"names\"))\n * ```\n *\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} that evaluates to an array of matched substrings.\n */\n regexFindAll(pattern: Expression): FunctionExpression;\n regexFindAll(stringOrExpr: string | Expression): FunctionExpression {\n return new FunctionExpression(\n 'regex_find_all',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'regexFindAll'\n );\n }\n\n /**\n * @beta\n * Creates an expression that checks if a string matches a specified regular expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a valid email pattern\n * field(\"email\").regexMatch(\"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,}\");\n * ```\n *\n * @param pattern - The regular expression to use for the match.\n * @returns A new `Expression` representing the regular expression match.\n */\n regexMatch(pattern: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if a string matches a specified regular expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a regular expression stored in field 'regex'\n * field(\"email\").regexMatch(field(\"regex\"));\n * ```\n *\n * @param pattern - The regular expression to use for the match.\n * @returns A new `Expression` representing the regular expression match.\n */\n regexMatch(pattern: Expression): BooleanExpression;\n regexMatch(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'regex_match',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'regexMatch'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if a string contains a specified substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\".\n * field(\"description\").stringContains(\"example\");\n * ```\n *\n * @param substring - The substring to search for.\n * @returns A new `Expression` representing the 'contains' comparison.\n */\n stringContains(substring: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if a string contains the string represented by another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains the value of the 'keyword' field.\n * field(\"description\").stringContains(field(\"keyword\"));\n * ```\n *\n * @param expr - The expression representing the substring to search for.\n * @returns A new `Expression` representing the 'contains' comparison.\n */\n stringContains(expr: Expression): BooleanExpression;\n stringContains(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'string_contains',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'stringContains'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if a string starts with a given prefix.\n *\n * @example\n * ```typescript\n * // Check if the 'name' field starts with \"Mr.\"\n * field(\"name\").startsWith(\"Mr.\");\n * ```\n *\n * @param prefix - The prefix to check for.\n * @returns A new `Expression` representing the 'starts with' comparison.\n */\n startsWith(prefix: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if a string starts with a given prefix (represented as an\n * expression).\n *\n * @example\n * ```typescript\n * // Check if the 'fullName' field starts with the value of the 'firstName' field\n * field(\"fullName\").startsWith(field(\"firstName\"));\n * ```\n *\n * @param prefix - The prefix expression to check for.\n * @returns A new `Expression` representing the 'starts with' comparison.\n */\n startsWith(prefix: Expression): BooleanExpression;\n startsWith(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'starts_with',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'startsWith'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that checks if a string ends with a given postfix.\n *\n * @example\n * ```typescript\n * // Check if the 'filename' field ends with \".txt\"\n * field(\"filename\").endsWith(\".txt\");\n * ```\n *\n * @param suffix - The postfix to check for.\n * @returns A new `Expression` representing the 'ends with' comparison.\n */\n endsWith(suffix: string): BooleanExpression;\n\n /**\n * @beta\n * Creates an expression that checks if a string ends with a given postfix (represented as an\n * expression).\n *\n * @example\n * ```typescript\n * // Check if the 'url' field ends with the value of the 'extension' field\n * field(\"url\").endsWith(field(\"extension\"));\n * ```\n *\n * @param suffix - The postfix expression to check for.\n * @returns A new `Expression` representing the 'ends with' comparison.\n */\n endsWith(suffix: Expression): BooleanExpression;\n endsWith(stringOrExpr: string | Expression): BooleanExpression {\n return new FunctionExpression(\n 'ends_with',\n [this, valueToDefaultExpr(stringOrExpr)],\n 'endsWith'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that converts a string to lowercase.\n *\n * @example\n * ```typescript\n * // Convert the 'name' field to lowercase\n * field(\"name\").toLower();\n * ```\n *\n * @returns A new `Expression` representing the lowercase string.\n */\n toLower(): FunctionExpression {\n return new FunctionExpression('to_lower', [this], 'toLower');\n }\n\n /**\n * @beta\n * Creates an expression that converts a string to uppercase.\n *\n * @example\n * ```typescript\n * // Convert the 'title' field to uppercase\n * field(\"title\").toUpper();\n * ```\n *\n * @returns A new `Expression` representing the uppercase string.\n */\n toUpper(): FunctionExpression {\n return new FunctionExpression('to_upper', [this], 'toUpper');\n }\n\n /**\n * @beta\n * Creates an expression that removes leading and trailing characters from a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the 'userInput' field\n * field(\"userInput\").trim();\n *\n * // Trim quotes from the 'userInput' field\n * field(\"userInput\").trim('\"');\n * ```\n * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be\n * trimmed from the input. If not specified, then whitespace will be trimmed.\n * @returns A new `Expression` representing the trimmed string or byte array.\n */\n trim(valueToTrim?: string | Expression | Bytes): FunctionExpression {\n const args: Expression[] = [this];\n if (valueToTrim) {\n args.push(valueToDefaultExpr(valueToTrim));\n }\n return new FunctionExpression('trim', args, 'trim');\n }\n\n /**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the beginning of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the beginning of the 'userInput' field\n * field(\"userInput\").ltrim();\n *\n * // Trim quotes from the beginning of the 'userInput' field\n * field(\"userInput\").ltrim('\"');\n * ```\n *\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new `Expression` representing the trimmed string.\n */\n ltrim(valueToTrim?: string | Expression | Bytes): FunctionExpression {\n const args: Expression[] = [this];\n if (valueToTrim) {\n args.push(valueToDefaultExpr(valueToTrim));\n }\n return new FunctionExpression('ltrim', args, 'ltrim');\n }\n\n /**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the end of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the end of the 'userInput' field\n * field(\"userInput\").rtrim();\n *\n * // Trim quotes from the end of the 'userInput' field\n * field(\"userInput\").rtrim('\"');\n * ```\n *\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new `Expression` representing the trimmed string or byte array.\n */\n rtrim(valueToTrim?: string | Expression | Bytes): FunctionExpression {\n const args: Expression[] = [this];\n if (valueToTrim) {\n args.push(valueToDefaultExpr(valueToTrim));\n }\n return new FunctionExpression('rtrim', args, 'rtrim');\n }\n\n /**\n * @beta\n * Creates an expression that returns the data type of this expression's result, as a string.\n *\n * @remarks\n * This is evaluated on the backend. This means:\n * 1. Generic typed elements (like `array<string>`) evaluate strictly to the primitive `'array'`.\n * 2. Any custom `FirestoreDataConverter` mappings are ignored.\n * 3. For numeric values, the backend does not yield the JavaScript `\"number\"` type; it evaluates\n * precisely as `\"int64\"` or `\"float64\"`.\n * 4. For date or timestamp objects, the backend evaluates to `\"timestamp\"`.\n *\n * @example\n * ```typescript\n * // Get the data type of the value in field 'title'\n * field('title').type()\n * ```\n *\n * @returns A new `Expression` representing the data type.\n */\n type(): FunctionExpression {\n return new FunctionExpression('type', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that checks if the result of this expression is of the given type.\n *\n * @remarks Null or undefined fields evaluate to skip/error. Use `ifAbsent()` / `isAbsent()` to evaluate missing data.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is specifically an integer (not just 'number')\n * field('price').isType('int64');\n * ```\n *\n * @param type - The type to check for.\n * @returns A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise.\n */\n isType(type: Type): BooleanExpression {\n return new FunctionExpression(\n 'is_type',\n [this, constant(type)],\n 'isType'\n ).asBoolean();\n }\n\n /**\n * @beta\n * Creates an expression that concatenates string expressions together.\n *\n * @example\n * ```typescript\n * // Combine the 'firstName', \" \", and 'lastName' fields into a single string\n * field(\"firstName\").stringConcat(constant(\" \"), field(\"lastName\"));\n * ```\n *\n * @param secondString - The additional expression or string literal to concatenate.\n * @param otherStrings - Optional additional expressions or string literals to concatenate.\n * @returns A new `Expression` representing the concatenated string.\n */\n stringConcat(\n secondString: Expression | string,\n ...otherStrings: Array<Expression | string>\n ): FunctionExpression {\n const elements = [secondString, ...otherStrings];\n const exprs = elements.map(valueToDefaultExpr);\n return new FunctionExpression(\n 'string_concat',\n [this, ...exprs],\n 'stringConcat'\n );\n }\n\n /**\n * @beta\n * Creates an expression that finds the index of the first occurrence of a substring or byte sequence.\n *\n * @example\n * ```typescript\n * // Find the index of \"foo\" in the 'text' field\n * field(\"text\").stringIndexOf(\"foo\");\n * ```\n *\n * @param search - The substring or byte sequence to search for.\n * @returns A new `Expression` representing the index of the first occurrence.\n */\n stringIndexOf(search: string | Expression | Bytes): FunctionExpression {\n return new FunctionExpression(\n 'string_index_of',\n [this, valueToDefaultExpr(search)],\n 'stringIndexOf'\n );\n }\n\n /**\n * @beta\n * Creates an expression that repeats a string or byte array a specified number of times.\n *\n * @example\n * ```typescript\n * // Repeat the 'label' field 3 times\n * field(\"label\").stringRepeat(3);\n * ```\n *\n * @param repetitions - The number of times to repeat the string or byte array.\n * @returns A new `Expression` representing the repeated string or byte array.\n */\n stringRepeat(repetitions: number | Expression): FunctionExpression {\n return new FunctionExpression(\n 'string_repeat',\n [this, valueToDefaultExpr(repetitions)],\n 'stringRepeat'\n );\n }\n\n /**\n * @beta\n * Creates an expression that replaces all occurrences of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace all occurrences of \"foo\" with \"bar\" in the 'text' field\n * field(\"text\").stringReplaceAll(\"foo\", \"bar\");\n * ```\n *\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new `Expression` representing the string or byte array with replacements.\n */\n stringReplaceAll(\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n ): FunctionExpression {\n return new FunctionExpression(\n 'string_replace_all',\n [this, valueToDefaultExpr(find), valueToDefaultExpr(replacement)],\n 'stringReplaceAll'\n );\n }\n\n /**\n * @beta\n * Creates an expression that replaces the first occurrence of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace the first occurrence of \"foo\" with \"bar\" in the 'text' field\n * field(\"text\").stringReplaceOne(\"foo\", \"bar\");\n * ```\n *\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new `Expression` representing the string or byte array with the replacement.\n */\n stringReplaceOne(\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n ): FunctionExpression {\n return new FunctionExpression(\n 'string_replace_one',\n [this, valueToDefaultExpr(find), valueToDefaultExpr(replacement)],\n 'stringReplaceOne'\n );\n }\n\n /**\n * @beta\n * Creates an expression that concatenates expression results together.\n *\n * @example\n * ```typescript\n * // Combine the 'firstName', ' ', and 'lastName' fields into a single value.\n * field(\"firstName\").concat(constant(\" \"), field(\"lastName\"));\n * ```\n *\n * @param second - The additional expression or literal to concatenate.\n * @param others - Optional additional expressions or literals to concatenate.\n * @returns A new `Expression` representing the concatenated value.\n */\n concat(\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n ): FunctionExpression {\n const elements = [second, ...others];\n const exprs = elements.map(valueToDefaultExpr);\n return new FunctionExpression('concat', [this, ...exprs], 'concat');\n }\n\n /**\n * @beta\n * Creates an expression that reverses this string expression.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * field(\"myString\").reverse();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\n reverse(): FunctionExpression {\n return new FunctionExpression('reverse', [this], 'reverse');\n }\n\n /**\n * @beta\n * Creates an expression that calculates the length of this string expression in bytes.\n *\n * @example\n * ```typescript\n * // Calculate the length of the 'myString' field in bytes.\n * field(\"myString\").byteLength();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes.\n */\n byteLength(): FunctionExpression {\n return new FunctionExpression('byte_length', [this], 'byteLength');\n }\n\n /**\n * @beta\n * Creates an expression that computes the ceiling of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the ceiling of the 'price' field.\n * field(\"price\").ceil();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value.\n */\n ceil(): FunctionExpression {\n return new FunctionExpression('ceil', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes the floor of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the floor of the 'price' field.\n * field(\"price\").floor();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value.\n */\n floor(): FunctionExpression {\n return new FunctionExpression('floor', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes the absolute value of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the absolute value of the 'price' field.\n * field(\"price\").abs();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value.\n */\n abs(): FunctionExpression {\n return new FunctionExpression('abs', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes e to the power of this expression.\n *\n * @example\n * ```typescript\n * // Compute e to the power of the 'value' field.\n * field(\"value\").exp();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value.\n */\n exp(): FunctionExpression {\n return new FunctionExpression('exp', [this]);\n }\n\n /**\n * @beta\n * Accesses a value from a map (object) field using the provided key.\n *\n * @example\n * ```typescript\n * // Get the 'city' value from the 'address' map field\n * field(\"address\").mapGet(\"city\");\n * ```\n *\n * @param subfield - The key to access in the map.\n * @returns A new `Expression` representing the value associated with the given key in the map.\n */\n mapGet(subfield: string): FunctionExpression {\n return new FunctionExpression(\n 'map_get',\n [this, constant(subfield)],\n 'mapGet'\n );\n }\n\n /**\n * @beta\n * Creates an expression that returns a new map with the specified entries added or updated.\n *\n * @remarks\n * Note that `mapSet` only performs shallow updates to the map. Setting a value to `null`\n * will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.\n *\n * @example\n * ```typescript\n * // Set the 'city' to \"San Francisco\" in the 'address' map\n * field(\"address\").mapSet(\"city\", \"San Francisco\");\n * ```\n *\n * @param key - The key to set. Must be a string or a constant string expression.\n * @param value - The value to set.\n * @param moreKeyValues - Additional key-value pairs to set.\n * @returns A new `Expression` representing the map with the entries set.\n */\n mapSet(\n key: string | Expression,\n value: unknown,\n ...moreKeyValues: unknown[]\n ): FunctionExpression {\n const args = [\n this,\n valueToDefaultExpr(key),\n valueToDefaultExpr(value),\n ...moreKeyValues.map(valueToDefaultExpr)\n ];\n return new FunctionExpression('map_set', args, 'mapSet');\n }\n\n /**\n * @beta\n * Creates an expression that returns the keys of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the keys of the 'address' map\n * field(\"address\").mapKeys();\n * ```\n *\n * @returns A new `Expression` representing the keys of the map.\n */\n mapKeys(): FunctionExpression {\n return new FunctionExpression('map_keys', [this], 'mapKeys');\n }\n\n /**\n * @beta\n * Creates an expression that returns the values of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the values of the 'address' map\n * field(\"address\").mapValues();\n * ```\n *\n * @returns A new `Expression` representing the values of the map.\n */\n mapValues(): FunctionExpression {\n return new FunctionExpression('map_values', [this], 'mapValues');\n }\n\n /**\n * @beta\n * Creates an expression that returns the entries of a map as an array of maps,\n * where each map contains a `\"k\"` property for the key and a `\"v\"` property for the value.\n * For example: `[{ k: \"key1\", v: \"value1\" }, ...]`.\n *\n * @example\n * ```typescript\n * // Get the entries of the 'address' map\n * field(\"address\").mapEntries();\n * ```\n *\n * @returns A new `Expression` representing the entries of the map.\n */\n mapEntries(): FunctionExpression {\n return new FunctionExpression('map_entries', [this], 'mapEntries');\n }\n\n /**\n * @beta\n * Creates an aggregation that counts the number of stage inputs with valid evaluations of the\n * expression or field.\n *\n * @example\n * ```typescript\n * // Count the total number of products\n * field(\"productId\").count().as(\"totalProducts\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'count' aggregation.\n */\n count(): AggregateFunction {\n return AggregateFunction._create('count', [this], 'count');\n }\n\n /**\n * @beta\n * Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Calculate the total revenue from a set of orders\n * field(\"orderAmount\").sum().as(\"totalRevenue\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'sum' aggregation.\n */\n sum(): AggregateFunction {\n return AggregateFunction._create('sum', [this], 'sum');\n }\n\n /**\n * @beta\n * Creates an aggregation that calculates the average (mean) of a numeric field across multiple\n * stage inputs.\n *\n * @example\n * ```typescript\n * // Calculate the average age of users\n * field(\"age\").average().as(\"averageAge\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'average' aggregation.\n */\n average(): AggregateFunction {\n return AggregateFunction._create('average', [this], 'average');\n }\n\n /**\n * @beta\n * Creates an aggregation that finds the minimum value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the lowest price of all products\n * field(\"price\").minimum().as(\"lowestPrice\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'minimum' aggregation.\n */\n minimum(): AggregateFunction {\n return AggregateFunction._create('minimum', [this], 'minimum');\n }\n\n /**\n * @beta\n * Creates an aggregation that finds the maximum value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the highest score in a leaderboard\n * field(\"score\").maximum().as(\"highestScore\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'maximum' aggregation.\n */\n maximum(): AggregateFunction {\n return AggregateFunction._create('maximum', [this], 'maximum');\n }\n\n /**\n * @beta\n * Creates an aggregation that finds the first value of an expression across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the first value of the 'rating' field\n * field(\"rating\").first().as(\"firstRating\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'first' aggregation.\n */\n first(): AggregateFunction {\n return AggregateFunction._create('first', [this], 'first');\n }\n\n /**\n * @beta\n * Creates an aggregation that finds the last value of an expression across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the last value of the 'rating' field\n * field(\"rating\").last().as(\"lastRating\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'last' aggregation.\n */\n last(): AggregateFunction {\n return AggregateFunction._create('last', [this], 'last');\n }\n\n /**\n * @beta\n * Creates an aggregation that collects all values of an expression across multiple stage inputs\n * into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all tags from books into an array\n * field(\"tags\").arrayAgg().as(\"allTags\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'array_agg' aggregation.\n */\n arrayAgg(): AggregateFunction {\n return AggregateFunction._create('array_agg', [this], 'arrayAgg');\n }\n\n /**\n * @beta\n * Creates an aggregation that collects all distinct values of an expression across multiple stage\n * inputs into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all distinct tags from books into an array\n * field(\"tags\").arrayAggDistinct().as(\"allDistinctTags\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'array_agg_distinct' aggregation.\n */\n arrayAggDistinct(): AggregateFunction {\n return AggregateFunction._create(\n 'array_agg_distinct',\n [this],\n 'arrayAggDistinct'\n );\n }\n\n /**\n * @beta\n * Creates an aggregation that counts the number of distinct values of the expression or field.\n *\n * @example\n * ```typescript\n * // Count the distinct number of products\n * field(\"productId\").countDistinct().as(\"distinctProducts\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'count_distinct' aggregation.\n */\n countDistinct(): AggregateFunction {\n return AggregateFunction._create('count_distinct', [this], 'countDistinct');\n }\n\n /**\n * @beta\n * Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the larger value between the 'timestamp' field and the current timestamp.\n * field(\"timestamp\").logicalMaximum(Function.currentTimestamp());\n * ```\n *\n * @param second - The second expression or literal to compare with.\n * @param others - Optional additional expressions or literals to compare with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation.\n */\n logicalMaximum(\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n ): FunctionExpression {\n const values = [second, ...others];\n return new FunctionExpression(\n 'maximum',\n [this, ...values.map(valueToDefaultExpr)],\n 'logicalMaximum'\n );\n }\n\n /**\n * @beta\n * Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the smaller value between the 'timestamp' field and the current timestamp.\n * field(\"timestamp\").logicalMinimum(Function.currentTimestamp());\n * ```\n *\n * @param second - The second expression or literal to compare with.\n * @param others - Optional additional expressions or literals to compare with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation.\n */\n logicalMinimum(\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n ): FunctionExpression {\n const values = [second, ...others];\n return new FunctionExpression(\n 'minimum',\n [this, ...values.map(valueToDefaultExpr)],\n 'minimum'\n );\n }\n\n /**\n * @beta\n * Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression.\n *\n * @example\n * ```typescript\n * // Get the vector length (dimension) of the field 'embedding'.\n * field(\"embedding\").vectorLength();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the vector.\n */\n vectorLength(): FunctionExpression {\n return new FunctionExpression('vector_length', [this], 'vectorLength');\n }\n\n /**\n * @beta\n * Calculates the cosine distance between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field\n * field(\"userVector\").cosineDistance(field(\"itemVector\"));\n * ```\n *\n * @param vectorExpression - The other vector (represented as an Expression) to compare against.\n * @returns A new `Expression` representing the cosine distance between the two vectors.\n */\n cosineDistance(vectorExpression: Expression): FunctionExpression;\n /**\n * @beta\n * Calculates the Cosine distance between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the Cosine distance between the 'location' field and a target location\n * field(\"location\").cosineDistance(new VectorValue([37.7749, -122.4194]));\n * ```\n *\n * @param vector - The other vector (as a VectorValue) to compare against.\n * @returns A new `Expression` representing the Cosine* distance between the two vectors.\n */\n cosineDistance(vector: VectorValue | number[]): FunctionExpression;\n cosineDistance(\n other: Expression | VectorValue | number[]\n ): FunctionExpression {\n return new FunctionExpression(\n 'cosine_distance',\n [this, vectorToExpr(other)],\n 'cosineDistance'\n );\n }\n\n /**\n * @beta\n * Calculates the dot product between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the dot product between a feature vector and a target vector\n * field(\"features\").dotProduct([0.5, 0.8, 0.2]);\n * ```\n *\n * @param vectorExpression - The other vector (as an array of numbers) to calculate with.\n * @returns A new `Expression` representing the dot product between the two vectors.\n */\n dotProduct(vectorExpression: Expression): FunctionExpression;\n\n /**\n * @beta\n * Calculates the dot product between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the dot product between a feature vector and a target vector\n * field(\"features\").dotProduct(new VectorValue([0.5, 0.8, 0.2]));\n * ```\n *\n * @param vector - The other vector (as an array of numbers) to calculate with.\n * @returns A new `Expression` representing the dot product between the two vectors.\n */\n dotProduct(vector: VectorValue | number[]): FunctionExpression;\n dotProduct(other: Expression | VectorValue | number[]): FunctionExpression {\n return new FunctionExpression(\n 'dot_product',\n [this, vectorToExpr(other)],\n 'dotProduct'\n );\n }\n\n /**\n * @beta\n * Calculates the Euclidean distance between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between the 'location' field and a target location\n * field(\"location\").euclideanDistance([37.7749, -122.4194]);\n * ```\n *\n * @param vectorExpression - The other vector (as an array of numbers) to calculate with.\n * @returns A new `Expression` representing the Euclidean distance between the two vectors.\n */\n euclideanDistance(vectorExpression: Expression): FunctionExpression;\n\n /**\n * @beta\n * Calculates the Euclidean distance between two vectors.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between the 'location' field and a target location\n * field(\"location\").euclideanDistance(new VectorValue([37.7749, -122.4194]));\n * ```\n *\n * @param vector - The other vector (as a VectorValue) to compare against.\n * @returns A new `Expression` representing the Euclidean distance between the two vectors.\n */\n euclideanDistance(vector: VectorValue | number[]): FunctionExpression;\n euclideanDistance(\n other: Expression | VectorValue | number[]\n ): FunctionExpression {\n return new FunctionExpression(\n 'euclidean_distance',\n [this, vectorToExpr(other)],\n 'euclideanDistance'\n );\n }\n\n /**\n * @beta\n * Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'microseconds' field as microseconds since epoch.\n * field(\"microseconds\").unixMicrosToTimestamp();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\n unixMicrosToTimestamp(): FunctionExpression {\n return new FunctionExpression(\n 'unix_micros_to_timestamp',\n [this],\n 'unixMicrosToTimestamp'\n );\n }\n\n /**\n * @beta\n * Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to microseconds since epoch.\n * field(\"timestamp\").timestampToUnixMicros();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch.\n */\n timestampToUnixMicros(): FunctionExpression {\n return new FunctionExpression(\n 'timestamp_to_unix_micros',\n [this],\n 'timestampToUnixMicros'\n );\n }\n\n /**\n * @beta\n * Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'milliseconds' field as milliseconds since epoch.\n * field(\"milliseconds\").unixMillisToTimestamp();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\n unixMillisToTimestamp(): FunctionExpression {\n return new FunctionExpression(\n 'unix_millis_to_timestamp',\n [this],\n 'unixMillisToTimestamp'\n );\n }\n\n /**\n * @beta\n * Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to milliseconds since epoch.\n * field(\"timestamp\").timestampToUnixMillis();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch.\n */\n timestampToUnixMillis(): FunctionExpression {\n return new FunctionExpression(\n 'timestamp_to_unix_millis',\n [this],\n 'timestampToUnixMillis'\n );\n }\n\n /**\n * @beta\n * Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'seconds' field as seconds since epoch.\n * field(\"seconds\").unixSecondsToTimestamp();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\n unixSecondsToTimestamp(): FunctionExpression {\n return new FunctionExpression(\n 'unix_seconds_to_timestamp',\n [this],\n 'unixSecondsToTimestamp'\n );\n }\n\n /**\n * @beta\n * Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to seconds since epoch.\n * field(\"timestamp\").timestampToUnixSeconds();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch.\n */\n timestampToUnixSeconds(): FunctionExpression {\n return new FunctionExpression(\n 'timestamp_to_unix_seconds',\n [this],\n 'timestampToUnixSeconds'\n );\n }\n\n /**\n * @beta\n * Creates an expression that adds a specified amount of time to this timestamp expression.\n *\n * @example\n * ```typescript\n * // Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field.\n * field(\"timestamp\").timestampAdd(field(\"unit\"), field(\"amount\"));\n * ```\n *\n * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'.\n * @param amount - The expression evaluates to amount of the unit.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\n timestampAdd(unit: Expression, amount: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that adds a specified amount of time to this timestamp expression.\n *\n * @example\n * ```typescript\n * // Add 1 day to the 'timestamp' field.\n * field(\"timestamp\").timestampAdd(\"day\", 1);\n * ```\n *\n * @param unit - The unit of time to add (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\n timestampAdd(\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n ): FunctionExpression;\n timestampAdd(\n unit:\n | Expression\n | 'microsecond'\n | 'millisecond'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day',\n amount: Expression | number\n ): FunctionExpression {\n return new FunctionExpression(\n 'timestamp_add',\n [this, valueToDefaultExpr(unit), valueToDefaultExpr(amount)],\n 'timestampAdd'\n );\n }\n\n /**\n * @beta\n * Creates an expression that subtracts a specified amount of time from this timestamp expression.\n *\n * @example\n * ```typescript\n * // Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field.\n * field(\"timestamp\").timestampSubtract(field(\"unit\"), field(\"amount\"));\n * ```\n *\n * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'.\n * @param amount - The expression evaluates to amount of the unit.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\n timestampSubtract(unit: Expression, amount: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that subtracts a specified amount of time from this timestamp expression.\n *\n * @example\n * ```typescript\n * // Subtract 1 day from the 'timestamp' field.\n * field(\"timestamp\").timestampSubtract(\"day\", 1);\n * ```\n *\n * @param unit - The unit of time to subtract (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\n timestampSubtract(\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n ): FunctionExpression;\n timestampSubtract(\n unit:\n | Expression\n | 'microsecond'\n | 'millisecond'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day',\n amount: Expression | number\n ): FunctionExpression {\n return new FunctionExpression(\n 'timestamp_subtract',\n [this, valueToDefaultExpr(unit), valueToDefaultExpr(amount)],\n 'timestampSubtract'\n );\n }\n\n /**\n * @beta\n *\n * Creates an expression that returns the document ID from a path.\n *\n * @example\n * ```typescript\n * // Get the document ID from a path.\n * field(\"__path__\").documentId();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation.\n */\n documentId(): FunctionExpression {\n return new FunctionExpression('document_id', [this], 'documentId');\n }\n\n /**\n * @beta\n *\n * Creates an expression that returns a substring of the results of this expression.\n *\n * @param position - Index of the first character of the substring.\n * @param length - Length of the substring. If not provided, the substring will\n * end at the end of the input.\n */\n substring(position: number, length?: number): FunctionExpression;\n\n /**\n * @beta\n *\n * Creates an expression that returns a substring of the results of this expression.\n *\n * @param position - An expression returning the index of the first character of the substring.\n * @param length - An expression returning the length of the substring. If not provided the\n * substring will end at the end of the input.\n */\n substring(position: Expression, length?: Expression): FunctionExpression;\n substring(\n position: Expression | number,\n length?: Expression | number\n ): FunctionExpression {\n const positionExpr = valueToDefaultExpr(position);\n if (length === undefined) {\n return new FunctionExpression(\n 'substring',\n [this, positionExpr],\n 'substring'\n );\n } else {\n return new FunctionExpression(\n 'substring',\n [this, positionExpr, valueToDefaultExpr(length)],\n 'substring'\n );\n }\n }\n\n /**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and returns the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the 'tags' field array at index `1`.\n * field('tags').arrayGet(1);\n * ```\n *\n * @param offset - The index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\n arrayGet(offset: number): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and returns the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the tags field array at index specified by field\n * // 'favoriteTag'.\n * field('tags').arrayGet(field('favoriteTag'));\n * ```\n *\n * @param offsetExpr - An `Expression` evaluating to the index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\n arrayGet(offsetExpr: Expression): FunctionExpression;\n arrayGet(offset: Expression | number): FunctionExpression {\n return new FunctionExpression(\n 'array_get',\n [this, valueToDefaultExpr(offset)],\n 'arrayGet'\n );\n }\n\n /**\n * @beta\n *\n * Creates an expression that checks if a given expression produces an error.\n *\n * @example\n * ```typescript\n * // Check if the result of a calculation is an error\n * field(\"title\").arrayContains(1).isError();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#BooleanExpression} representing the 'isError' check.\n */\n isError(): BooleanExpression {\n return new FunctionExpression('is_error', [this], 'isError').asBoolean();\n }\n\n /**\n * @beta\n *\n * Creates an expression that returns the result of the `catchExpr` argument\n * if there is an error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Returns the first item in the title field arrays, or returns\n * // the entire title field if the array is empty or the field is another type.\n * field(\"title\").arrayGet(0).ifError(field(\"title\"));\n * ```\n *\n * @param catchExpr - The catch expression that will be evaluated and\n * returned if this expression produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchExpr: Expression): FunctionExpression;\n\n /**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Returns the first item in the title field arrays, or returns\n * // \"Default Title\"\n * field(\"title\").arrayGet(0).ifError(\"Default Title\");\n * ```\n *\n * @param catchValue - The value that will be returned if this expression\n * produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchValue: unknown): FunctionExpression;\n ifError(catchValue: unknown): FunctionExpression | BooleanExpression {\n const result = new FunctionExpression(\n 'if_error',\n [this, valueToDefaultExpr(catchValue)],\n 'ifError'\n );\n\n return catchValue instanceof BooleanExpression\n ? result.asBoolean()\n : result;\n }\n\n /**\n * @beta\n *\n * Creates an expression that returns `true` if the result of this expression\n * is absent. Otherwise, returns `false` even if the value is `null`.\n *\n * @example\n * ```typescript\n * // Check if the field `value` is absent.\n * field(\"value\").isAbsent();\n * @example\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#BooleanExpression} representing the 'isAbsent' check.\n */\n isAbsent(): BooleanExpression {\n return new FunctionExpression('is_absent', [this], 'isAbsent').asBoolean();\n }\n\n /**\n * @beta\n *\n * Creates an expression that removes a key from the map produced by evaluating this expression.\n *\n * @example\n * ```\n * // Removes the key 'baz' from the input map.\n * map({foo: 'bar', baz: true}).mapRemove('baz');\n * ```\n *\n * @param key - The name of the key to remove from the input map.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapRemove' operation.\n */\n mapRemove(key: string): FunctionExpression;\n /**\n * @beta\n *\n * Creates an expression that removes a key from the map produced by evaluating this expression.\n *\n * @example\n * ```\n * // Removes the key 'baz' from the input map.\n * map({foo: 'bar', baz: true}).mapRemove(constant('baz'));\n * @example\n * ```\n *\n * @param keyExpr - An expression that produces the name of the key to remove from the input map.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapRemove' operation.\n */\n mapRemove(keyExpr: Expression): FunctionExpression;\n mapRemove(stringExpr: Expression | string): FunctionExpression {\n return new FunctionExpression(\n 'map_remove',\n [this, valueToDefaultExpr(stringExpr)],\n 'mapRemove'\n );\n }\n\n /**\n * @beta\n *\n * Creates an expression that merges multiple map values.\n *\n * @example\n * ```\n * // Merges the map in the settings field with, a map literal, and a map in\n * // that is conditionally returned by another expression\n * field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {})\n * ```\n *\n * @param secondMap - A required second map to merge. Represented as a literal or\n * an expression that returns a map.\n * @param otherMaps - Optional additional maps to merge. Each map is represented\n * as a literal or an expression that returns a map.\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapMerge' operation.\n */\n mapMerge(\n secondMap: Record<string, unknown> | Expression,\n ...otherMaps: Array<Record<string, unknown> | Expression>\n ): FunctionExpression {\n const secondMapExpr = valueToDefaultExpr(secondMap);\n const otherMapExprs = otherMaps.map(valueToDefaultExpr);\n return new FunctionExpression(\n 'map_merge',\n [this, secondMapExpr, ...otherMapExprs],\n 'mapMerge'\n );\n }\n\n /**\n * @beta\n * Creates an expression that returns the value of this expression raised to the power of another expression.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of the 'exponent' field.\n * field(\"base\").pow(field(\"exponent\"));\n * ```\n *\n * @param exponent - The expression to raise this expression to the power of.\n * @returns A new `Expression` representing the power operation.\n */\n pow(exponent: Expression): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that returns the value of this expression raised to the power of a constant value.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of 2.\n * field(\"base\").pow(2);\n * ```\n *\n * @param exponent - The constant value to raise this expression to the power of.\n * @returns A new `Expression` representing the power operation.\n */\n pow(exponent: number): FunctionExpression;\n pow(exponent: number | Expression): FunctionExpression {\n return new FunctionExpression('pow', [this, valueToDefaultExpr(exponent)]);\n }\n\n /**\n * @beta\n * Creates an expression that truncates the numeric value to an integer.\n *\n * @example\n * ```typescript\n * // Truncate the 'rating' field\n * field(\"rating\").trunc();\n * ```\n *\n * @returns A new `Expression` representing the truncated value.\n */\n trunc(): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that truncates a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field to two decimal places.\n * field(\"rating\").trunc(2);\n * ```\n *\n * @param decimalPlaces - A constant specifying the truncation precision in decimal places.\n * @returns A new `Expression` representing the truncated value.\n */\n trunc(decimalPlaces: number): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that truncates a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field to two decimal places.\n * field(\"rating\").trunc(constant(2));\n * ```\n *\n * @param decimalPlaces - An expression specifying the truncation precision in decimal places.\n * @returns A new `Expression` representing the truncated value.\n */\n trunc(decimalPlaces: Expression): FunctionExpression;\n trunc(decimalPlaces?: number | Expression): FunctionExpression {\n if (decimalPlaces === undefined) {\n return new FunctionExpression('trunc', [this]);\n } else {\n return new FunctionExpression(\n 'trunc',\n [this, valueToDefaultExpr(decimalPlaces)],\n 'trunc'\n );\n }\n }\n\n /**\n * @beta\n * Creates an expression that rounds a numeric value to the nearest whole number.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field.\n * field(\"price\").round();\n * ```\n *\n * @returns A new `Expression` representing the rounded value.\n */\n round(): FunctionExpression;\n /**\n * @beta\n * Creates an expression that rounds a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field to two decimal places.\n * field(\"price\").round(2);\n * ```\n *\n * @param decimalPlaces - A constant specifying the rounding precision in decimal places.\n *\n * @returns A new `Expression` representing the rounded value.\n */\n round(decimalPlaces: number): FunctionExpression;\n /**\n * @beta\n * Creates an expression that rounds a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field to two decimal places.\n * field(\"price\").round(constant(2));\n * ```\n *\n * @param decimalPlaces - An expression specifying the rounding precision in decimal places.\n *\n * @returns A new `Expression` representing the rounded value.\n */\n round(decimalPlaces: Expression): FunctionExpression;\n round(decimalPlaces?: number | Expression): FunctionExpression {\n if (decimalPlaces === undefined) {\n return new FunctionExpression('round', [this]);\n } else {\n return new FunctionExpression(\n 'round',\n [this, valueToDefaultExpr(decimalPlaces)],\n 'round'\n );\n }\n }\n\n /**\n * @beta\n * Creates an expression that returns the collection ID from a path.\n *\n * @example\n * ```typescript\n * // Get the collection ID from a path.\n * field(\"__path__\").collectionId();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation.\n */\n collectionId(): FunctionExpression {\n return new FunctionExpression('collection_id', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that calculates the length of a string, array, map, vector, or bytes.\n *\n * @example\n * ```typescript\n * // Get the length of the 'name' field.\n * field(\"name\").length();\n *\n * // Get the number of items in the 'cart' array.\n * field(\"cart\").length();\n * ```\n *\n * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes.\n */\n length(): FunctionExpression {\n return new FunctionExpression('length', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes the natural logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the natural logarithm of the 'value' field.\n * field(\"value\").ln();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the natural logarithm of the numeric value.\n */\n ln(): FunctionExpression {\n return new FunctionExpression('ln', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes the square root of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the square root of the 'value' field.\n * field(\"value\").sqrt();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value.\n */\n sqrt(): FunctionExpression {\n return new FunctionExpression('sqrt', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that reverses a string.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * field(\"myString\").stringReverse();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\n stringReverse(): FunctionExpression {\n return new FunctionExpression('string_reverse', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else\n * return the result of the this expression evaluation.\n *\n * @example\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or returns 'default_value'\n * // if the field is absent.\n * field(\"optional_field\").ifAbsent(\"default_value\")\n * ```\n *\n * @param elseValue - The value that will be returned if this Expression evaluates to an absent value.\n * @returns A new [Expression] representing the ifAbsent operation.\n */\n ifAbsent(elseValue: unknown): Expression;\n\n /**\n * @beta\n * Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else\n * return the result of this expression evaluation.\n *\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or if that is\n * // absent, then returns the value of the field `\n * field(\"optional_field\").ifAbsent(field('default_field'))\n * ```\n *\n * @param elseExpression - The Expression that will be evaluated if this Expression evaluates to an absent value.\n * @returns A new [Expression] representing the ifAbsent operation.\n */\n ifAbsent(elseExpression: unknown): Expression;\n\n ifAbsent(elseValueOrExpression: Expression | unknown): Expression {\n return new FunctionExpression(\n 'if_absent',\n [this, valueToDefaultExpr(elseValueOrExpression)],\n 'ifAbsent'\n );\n }\n\n /**\n * @beta\n * Creates an expression that joins the elements of an array into a string.\n *\n * @example\n * ```typescript\n * // Join the elements of the 'tags' field with the delimiter from the 'separator' field.\n * field(\"tags\").join(field(\"separator\"))\n * ```\n *\n * @param delimiterExpression - The expression that evaluates to the delimiter string.\n * @returns A new Expression representing the join operation.\n */\n join(delimiterExpression: Expression): Expression;\n\n /**\n * @beta\n * Creates an expression that joins the elements of an array field into a string.\n *\n * @example\n * ```typescript\n * // Join the elements of the 'tags' field with a comma and space.\n * field(\"tags\").join(\", \")\n * ```\n *\n * @param delimiter - The string to use as a delimiter.\n * @returns A new Expression representing the join operation.\n */\n join(delimiter: string): Expression;\n\n join(delimeterValueOrExpression: string | Expression): Expression {\n return new FunctionExpression(\n 'join',\n [this, valueToDefaultExpr(delimeterValueOrExpression)],\n 'join'\n );\n }\n\n /**\n * @beta\n * Creates an expression that computes the base-10 logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the base-10 logarithm of the 'value' field.\n * field(\"value\").log10();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the base-10 logarithm of the numeric value.\n */\n log10(): FunctionExpression {\n return new FunctionExpression('log10', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that computes the sum of the elements in an array.\n *\n * @example\n * ```typescript\n * // Compute the sum of the elements in the 'scores' field.\n * field(\"scores\").arraySum();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the sum of the elements in the array.\n */\n arraySum(): FunctionExpression {\n return new FunctionExpression('sum', [this]);\n }\n\n /**\n * @beta\n * Creates an expression that splits the result of this expression into an\n * array of substrings based on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scoresCsv' field on delimiter ','\n * field('scoresCsv').split(',')\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\n split(delimiter: string): FunctionExpression;\n\n /**\n * @beta\n * Creates an expression that splits the result of this expression into an\n * array of substrings based on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scores' field on delimiter ',' or ':' depending on the stored format\n * field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':'))\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\n split(delimiter: Expression): FunctionExpression;\n split(delimiter: string | Expression): FunctionExpression {\n return new FunctionExpression('split', [\n this,\n valueToDefaultExpr(delimiter)\n ]);\n }\n\n /**\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the beginning of the day.\n * field('createdAt').timestampTruncate('day')\n * ```\n *\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\n timestampTruncate(\n granularity: TimeGranularity,\n timezone?: string | Expression\n ): FunctionExpression;\n\n /**\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the granularity specified in the field 'granularity'.\n * field('createdAt').timestampTruncate(field('granularity'))\n * ```\n *\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\n timestampTruncate(\n granularity: Expression,\n timezone?: string | Expression\n ): FunctionExpression;\n timestampTruncate(\n granularity: TimeGranularity | Expression,\n timezone?: string | Expression\n ): FunctionExpression {\n const internalGranularity = isString(granularity)\n ? granularity.toLowerCase()\n : granularity;\n\n const args = [this, valueToDefaultExpr(internalGranularity)];\n if (timezone) {\n args.push(valueToDefaultExpr(timezone));\n }\n return new FunctionExpression('timestamp_trunc', args);\n }\n\n // TODO(new-expression): Add new expression method definitions above this line\n\n /**\n * @beta\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on this expression.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'name' field in ascending order\n * pipeline().collection(\"users\")\n * .sort(field(\"name\").ascending());\n * ```\n *\n * @returns A new `Ordering` for ascending sorting.\n */\n ascending(): Ordering {\n return ascending(this);\n }\n\n /**\n * @beta\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on this expression.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'createdAt' field in descending order\n * firestore.pipeline().collection(\"users\")\n * .sort(field(\"createdAt\").descending());\n * ```\n *\n * @returns A new `Ordering` for descending sorting.\n */\n descending(): Ordering {\n return descending(this);\n }\n\n /**\n * @beta\n * Assigns an alias to this expression.\n *\n * Aliases are useful for renaming fields in the output of a stage or for giving meaningful\n * names to calculated values.\n *\n * @example\n * ```typescript\n * // Calculate the total price and assign it the alias \"totalPrice\" and add it to the output.\n * firestore.pipeline().collection(\"items\")\n * .addFields(field(\"price\").multiply(field(\"quantity\")).as(\"totalPrice\"));\n * ```\n *\n * @param name - The alias to assign to this expression.\n * @returns A new {@link @firebase/firestore/pipelines#AliasedExpression} that wraps this\n * expression and associates it with the provided alias.\n */\n as(name: string): AliasedExpression {\n return new AliasedExpression(this, name, 'as');\n }\n}\n\n/**\n * @beta\n * Specify time granularity for expressions.\n */\nexport type TimeGranularity =\n | 'microsecond'\n | 'millisecond'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day'\n | 'week'\n | 'week(monday)'\n | 'week(tuesday)'\n | 'week(wednesday)'\n | 'week(thursday)'\n | 'week(friday)'\n | 'week(saturday)'\n | 'week(sunday)'\n | 'isoWeek'\n | 'month'\n | 'quarter'\n | 'year'\n | 'isoYear';\n\n/**\n * @beta\n *\n * An interface that represents a selectable expression.\n */\nexport interface Selectable {\n selectable: true;\n /**\n * @private\n * @internal\n */\n readonly alias: string;\n /**\n * @private\n * @internal\n */\n readonly expr: Expression;\n}\n\n/**\n * @beta\n *\n * A class that represents an aggregate function.\n */\nexport class AggregateFunction implements ProtoValueSerializable, UserData {\n exprType: ExpressionType = 'AggregateFunction';\n\n /**\n * @internal\n */\n _methodName?: string;\n\n constructor(private name: string, private params: Expression[]) {}\n\n /**\n * @internal\n * @private\n */\n static _create(\n name: string,\n params: Expression[],\n methodName: string\n ): AggregateFunction {\n const af = new AggregateFunction(name, params);\n af._methodName = methodName;\n\n return af;\n }\n\n /**\n * @beta\n * Assigns an alias to this AggregateFunction. The alias specifies the name that\n * the aggregated value will have in the output document.\n *\n * @example\n * ```typescript\n * // Calculate the average price of all items and assign it the alias \"averagePrice\".\n * firestore.pipeline().collection(\"items\")\n * .aggregate(field(\"price\").average().as(\"averagePrice\"));\n * ```\n *\n * @param name - The alias to assign to this AggregateFunction.\n * @returns A new {@link @firebase/firestore/pipelines#AliasedAggregate} that wraps this\n * AggregateFunction and associates it with the provided alias.\n */\n as(name: string): AliasedAggregate {\n return new AliasedAggregate(this, name, 'as');\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return {\n functionValue: {\n name: this.name,\n args: this.params.map(p => p._toProto(serializer))\n }\n };\n }\n\n _protoValueType = 'ProtoValue' as const;\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n context = this._methodName\n ? context.contextWith({ methodName: this._methodName })\n : context;\n this.params.forEach(expr => {\n return expr._readUserData(context);\n });\n }\n}\n\n/**\n * @beta\n *\n * An AggregateFunction with alias.\n */\nexport class AliasedAggregate implements UserData {\n constructor(\n readonly aggregate: AggregateFunction,\n readonly alias: string,\n readonly _methodName: string | undefined\n ) {}\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n this.aggregate._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class AliasedExpression implements Selectable, UserData {\n exprType: ExpressionType = 'AliasedExpression';\n selectable = true as const;\n\n constructor(\n readonly expr: Expression,\n readonly alias: string,\n readonly _methodName: string | undefined\n ) {}\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n this.expr._readUserData(context);\n }\n}\n\n/**\n * @internal\n */\nclass ListOfExprs extends Expression implements UserData {\n expressionType: ExpressionType = 'ListOfExpressions';\n\n constructor(\n private exprs: Expression[],\n readonly _methodName: string | undefined\n ) {\n super();\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return {\n arrayValue: {\n values: this.exprs.map(p => p._toProto(serializer)!)\n }\n };\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n this.exprs.forEach((expr: Expression) => expr._readUserData(context));\n }\n}\n\n/**\n * @beta\n *\n * Represents a reference to a field in a Firestore document, or outputs of a {@link @firebase/firestore/pipelines#Pipeline} stage.\n *\n * <p>Field references are used to access document field values in expressions and to specify fields\n * for sorting, filtering, and projecting data in Firestore pipelines.\n *\n * <p>You can create a `Field` instance using the static {@link @firebase/firestore/pipelines#field} method:\n *\n * @example\n * ```typescript\n * // Create a Field instance for the 'name' field\n * const nameField = field(\"name\");\n *\n * // Create a Field instance for a nested field 'address.city'\n * const cityField = field(\"address.city\");\n * ```\n */\nexport class Field extends Expression implements Selectable {\n readonly expressionType: ExpressionType = 'Field';\n selectable = true as const;\n\n /**\n * @internal\n * @private\n * @hideconstructor\n * @param fieldPath\n */\n constructor(\n private fieldPath: InternalFieldPath,\n readonly _methodName: string | undefined\n ) {\n super();\n }\n\n get fieldName(): string {\n return this.fieldPath.canonicalString();\n }\n\n get alias(): string {\n return this.fieldName;\n }\n\n get expr(): Expression {\n return this;\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return {\n fieldReferenceValue: this.fieldPath.canonicalString()\n };\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {}\n}\n\n/**\n * @beta\n * Creates a {@link @firebase/firestore/pipelines#Field} instance representing the field at the given path.\n *\n * The path can be a simple field name (e.g., \"name\") or a dot-separated path to a nested field\n * (e.g., \"address.city\").\n *\n * @example\n * ```typescript\n * // Create a Field instance for the 'title' field\n * const titleField = field(\"title\");\n *\n * // Create a Field instance for a nested field 'author.firstName'\n * const authorFirstNameField = field(\"author.firstName\");\n * ```\n *\n * @param name - The path to the field.\n * @returns A new {@link @firebase/firestore/pipelines#Field} instance representing the specified field.\n */\nexport function field(name: string): Field;\n\n/**\n * @beta\n * Creates a {@link @firebase/firestore/pipelines#Field} instance representing the field at the given path.\n *\n * @param path - A FieldPath specifying the field.\n * @returns A new {@link @firebase/firestore/pipelines#Field} instance representing the specified field.\n */\nexport function field(path: FieldPath): Field;\nexport function field(nameOrPath: string | FieldPath): Field {\n return _field(nameOrPath, 'field');\n}\n\nexport function _field(\n nameOrPath: string | FieldPath,\n methodName: string | undefined\n): Field {\n if (typeof nameOrPath === 'string') {\n if (DOCUMENT_KEY_NAME === nameOrPath) {\n return new Field(documentIdFieldPath()._internalPath, methodName);\n }\n return new Field(fieldPathFromArgument('field', nameOrPath), methodName);\n } else {\n return new Field(nameOrPath._internalPath, methodName);\n }\n}\n\n/**\n * @internal\n *\n * Represents a constant value that can be used in a Firestore pipeline expression.\n *\n * You can create a `Constant` instance using the static {@link @firebase/firestore/pipelines#field} method:\n *\n * @example\n * ```typescript\n * // Create a Constant instance for the number 10\n * const ten = constant(10);\n *\n * // Create a Constant instance for the string \"hello\"\n * const hello = constant(\"hello\");\n * ```\n */\nexport class Constant extends Expression {\n readonly expressionType: ExpressionType = 'Constant';\n\n private _protoValue?: ProtoValue;\n\n /**\n * @private\n * @internal\n * @hideconstructor\n * @param value - The value of the constant.\n */\n constructor(\n private value: unknown,\n readonly _methodName: string | undefined\n ) {\n super();\n }\n\n /**\n * @private\n * @internal\n */\n static _fromProto(value: ProtoValue): Constant {\n const result = new Constant(value, undefined);\n result._protoValue = value;\n return result;\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(_: JsonProtoSerializer): ProtoValue {\n hardAssert(\n this._protoValue !== undefined,\n 0x00ed,\n 'Value of this constant has not been serialized to proto value'\n );\n return this._protoValue;\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n context = this._methodName\n ? context.contextWith({ methodName: this._methodName })\n : context;\n if (isFirestoreValue(this._protoValue)) {\n return;\n } else {\n this._protoValue = parseData(this.value, context)!;\n }\n }\n}\n\n/**\n * @beta\n * Creates a `Constant` instance for a number value.\n *\n * @param value - The number value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: number): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a string value.\n *\n * @param value - The string value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: string): Expression;\n\n/**\n * @beta\n * Creates a `BooleanExpression` instance for a boolean value.\n *\n * @param value - The boolean value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: boolean): BooleanExpression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a null value.\n *\n * @param value - The null value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: null): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a GeoPoint value.\n *\n * @param value - The GeoPoint value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: GeoPoint): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a Timestamp value.\n *\n * @param value - The Timestamp value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: Timestamp): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a Date value.\n *\n * @param value - The Date value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: Date): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a Bytes value.\n *\n * @param value - The Bytes value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: Bytes): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a DocumentReference value.\n *\n * @param value - The DocumentReference value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: DocumentReference): Expression;\n\n/**\n * Creates a `Constant` instance for a Firestore proto value.\n * For internal use only.\n * @private\n * @internal\n * @param value - The Firestore proto value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: ProtoValue): Expression;\n\n/**\n * @beta\n * Creates a `Constant` instance for a VectorValue value.\n *\n * @param value - The VectorValue value.\n * @returns A new `Constant` instance.\n */\nexport function constant(value: VectorValue): Expression;\n\nexport function constant(value: unknown): Expression | BooleanExpression {\n return _constant(value, 'constant');\n}\n\n/**\n * @internal\n * @private\n * @param value\n * @param methodName\n */\nexport function _constant(\n value: unknown,\n methodName: string | undefined\n): Constant | BooleanExpression {\n const c = new Constant(value, methodName);\n if (typeof value === 'boolean') {\n return new BooleanConstant(c);\n } else {\n return c;\n }\n}\n\n/**\n * Internal only\n * @internal\n * @private\n */\nexport class MapValue extends Expression {\n constructor(\n private plainObject: Map<string, Expression>,\n readonly _methodName: string | undefined\n ) {\n super();\n }\n\n expressionType: ExpressionType = 'Constant';\n\n _readUserData(context: ParseContext): void {\n context = this._methodName\n ? context.contextWith({ methodName: this._methodName })\n : context;\n this.plainObject.forEach(expr => {\n expr._readUserData(context);\n });\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return toMapValue(serializer, this.plainObject);\n }\n}\n\n/**\n * @beta\n *\n * This class defines the base class for Firestore {@link @firebase/firestore/pipelines#Pipeline} functions, which can be evaluated within pipeline\n * execution.\n *\n * Typically, you would not use this class or its children directly. Use either the functions like {@link @firebase/firestore/pipelines#and}, {@link @firebase/firestore/pipelines#(equal:1)},\n * or the methods on {@link @firebase/firestore/pipelines#Expression} ({@link @firebase/firestore/pipelines#Expression.(equal:1)}, {@link @firebase/firestore/pipelines#Expression.(lessThan:1)}, etc.) to construct new Function instances.\n */\nexport class FunctionExpression extends Expression {\n readonly expressionType: ExpressionType = 'Function';\n\n constructor(name: string, params: Expression[]);\n constructor(\n name: string,\n params: Expression[],\n _methodName: string | undefined\n );\n constructor(\n private name: string,\n private params: Expression[],\n readonly _methodName?: string\n ) {\n super();\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return {\n functionValue: {\n name: this.name,\n args: this.params.map(p => p._toProto(serializer))\n }\n };\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n context = this._methodName\n ? context.contextWith({ methodName: this._methodName })\n : context;\n this.params.forEach(expr => {\n return expr._readUserData(context);\n });\n }\n}\n\n/**\n * @beta\n *\n * An interface that represents a filter condition.\n */\nexport abstract class BooleanExpression extends Expression {\n abstract get _expr(): Expression;\n\n get _methodName(): string | undefined {\n return this._expr._methodName;\n }\n\n /**\n * @beta\n * Creates an aggregation that finds the count of input documents satisfying\n * this boolean expression.\n *\n * @example\n * ```typescript\n * // Find the count of documents with a score greater than 90\n * field(\"score\").greaterThan(90).countIf().as(\"highestScore\");\n * ```\n *\n * @returns A new `AggregateFunction` representing the 'countIf' aggregation.\n */\n countIf(): AggregateFunction {\n return AggregateFunction._create('count_if', [this], 'countIf');\n }\n\n /**\n * @beta\n * Creates an expression that negates this boolean expression.\n *\n * @example\n * ```typescript\n * // Find documents where the 'tags' field does not contain 'completed'\n * field(\"tags\").arrayContains(\"completed\").not();\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the negated filter condition.\n */\n not(): BooleanExpression {\n return new FunctionExpression('not', [this], 'not').asBoolean();\n }\n\n /**\n * @beta\n * Creates a conditional expression that evaluates to the 'then' expression\n * if `this` expression evaluates to `true`,\n * or evaluates to the 'else' expression if `this` expressions evaluates `false`.\n *\n * @example\n * ```typescript\n * // If 'age' is greater than 18, return \"Adult\"; otherwise, return \"Minor\".\n * field(\"age\").greaterThanOrEqual(18).conditional(constant(\"Adult\"), constant(\"Minor\"));\n * ```\n *\n * @param thenExpr - The expression to evaluate if the condition is true.\n * @param elseExpr - The expression to evaluate if the condition is false.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the conditional expression.\n */\n conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression {\n return new FunctionExpression(\n 'conditional',\n [this, thenExpr, elseExpr],\n 'conditional'\n );\n }\n\n /**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Create an expression that protects against a divide by zero error\n * // but always returns a boolean expression.\n * constant(50).divide('length').gt(1).ifError(constant(false));\n * ```\n *\n * @param catchValue - The value that will be returned if this expression\n * produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchValue: BooleanExpression): BooleanExpression;\n\n /**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Create an expression that protects against a divide by zero error\n * // but always returns a boolean expression.\n * constant(50).divide('length').gt(1).ifError(false);\n * ```\n *\n * @param catchValue - The value that will be returned if this expression\n * produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchValue: boolean): BooleanExpression;\n\n /**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Create an expression that protects against a divide by zero error.\n * constant(50).divide('length').gt(1).ifError(constant(0));\n * ```\n *\n * @param catchValue - The value that will be returned if this expression\n * produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchValue: Expression): FunctionExpression;\n\n /**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of this expression.\n *\n * @example\n * ```typescript\n * // Create an expression that protects against a divide by zero error.\n * constant(50).divide('length').gt(1).ifError(0);\n * ```\n *\n * @param catchValue - The value that will be returned if this expression\n * produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\n ifError(catchValue: unknown): FunctionExpression;\n ifError(catchValue: unknown): unknown {\n const normalizedCatchValue = valueToDefaultExpr(catchValue);\n const expr = new FunctionExpression(\n 'if_error',\n [this, normalizedCatchValue],\n 'ifError'\n );\n\n return normalizedCatchValue instanceof BooleanExpression\n ? expr.asBoolean()\n : expr;\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return this._expr._toProto(serializer);\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n this._expr._readUserData(context);\n }\n}\n\nexport class BooleanFunctionExpression extends BooleanExpression {\n readonly expressionType: ExpressionType = 'Function';\n constructor(readonly _expr: FunctionExpression) {\n super();\n }\n}\n\nexport class BooleanConstant extends BooleanExpression {\n readonly expressionType: ExpressionType = 'Constant';\n constructor(readonly _expr: Constant) {\n super();\n }\n}\n\nexport class BooleanField extends BooleanExpression {\n readonly expressionType: ExpressionType = 'Field';\n constructor(readonly _expr: Field) {\n super();\n }\n}\n\n/**\n * @beta\n * Creates an aggregation that counts the number of stage inputs where the provided\n * boolean expression evaluates to true.\n *\n * @example\n * ```typescript\n * // Count the number of documents where 'is_active' field equals true\n * countIf(field(\"is_active\").equal(true)).as(\"numActiveDocuments\");\n * ```\n *\n * @param booleanExpr - The boolean expression to evaluate on each input.\n * @returns A new `AggregateFunction` representing the 'countIf' aggregation.\n */\nexport function countIf(booleanExpr: BooleanExpression): AggregateFunction {\n return booleanExpr.countIf();\n}\n\n/**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and return the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the tags field array at index 1.\n * arrayGet('tags', 1);\n * ```\n *\n * @param arrayField - The name of the array field.\n * @param offset - The index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\nexport function arrayGet(\n arrayField: string,\n offset: number\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and return the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the tags field array at index specified by field\n * // 'favoriteTag'.\n * arrayGet('tags', field('favoriteTag'));\n * ```\n *\n * @param arrayField - The name of the array field.\n * @param offsetExpr - An `Expression` evaluating to the index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\nexport function arrayGet(\n arrayField: string,\n offsetExpr: Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and return the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the tags field array at index 1.\n * arrayGet(field('tags'), 1);\n * ```\n *\n * @param arrayExpression - An `Expression` evaluating to an array.\n * @param offset - The index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\nexport function arrayGet(\n arrayExpression: Expression,\n offset: number\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that indexes into an array from the beginning or end\n * and return the element. If the offset exceeds the array length, an error is\n * returned. A negative offset, starts from the end.\n *\n * @example\n * ```typescript\n * // Return the value in the tags field array at index specified by field\n * // 'favoriteTag'.\n * arrayGet(field('tags'), field('favoriteTag'));\n * ```\n *\n * @param arrayExpression - An `Expression` evaluating to an array.\n * @param offsetExpr - An `Expression` evaluating to the index of the element to return.\n * @returns A new `Expression` representing the 'arrayGet' operation.\n */\nexport function arrayGet(\n arrayExpression: Expression,\n offsetExpr: Expression\n): FunctionExpression;\nexport function arrayGet(\n array: Expression | string,\n offset: Expression | number\n): FunctionExpression {\n return fieldOrExpression(array).arrayGet(valueToDefaultExpr(offset));\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a given expression produces an error.\n *\n * @example\n * ```typescript\n * // Check if the result of a calculation is an error\n * isError(field(\"title\").arrayContains(1));\n * ```\n *\n * @param value - The expression to check.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isError' check.\n */\nexport function isError(value: Expression): BooleanExpression {\n return value.isError().asBoolean();\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of the `try` argument evaluation.\n *\n * This overload is useful when a BooleanExpression is required.\n *\n * @example\n * ```typescript\n * // Create an expression that protects against a divide by zero error\n * // but always returns a boolean expression.\n * ifError(constant(50).divide('length').gt(1), constant(false));\n * ```\n *\n * @param tryExpr - The try expression.\n * @param catchExpr - The catch expression that will be evaluated and\n * returned if the tryExpr produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\nexport function ifError(\n tryExpr: BooleanExpression,\n catchExpr: BooleanExpression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of the `try` argument evaluation.\n *\n * @example\n * ```typescript\n * // Returns the first item in the title field arrays, or returns\n * // the entire title field if the array is empty or the field is another type.\n * ifError(field(\"title\").arrayGet(0), field(\"title\"));\n * ```\n *\n * @param tryExpr - The try expression.\n * @param catchExpr - The catch expression that will be evaluated and\n * returned if the tryExpr produces an error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\nexport function ifError(\n tryExpr: Expression,\n catchExpr: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the `catch` argument if there is an\n * error, else return the result of the `try` argument evaluation.\n *\n * @example\n * ```typescript\n * // Returns the first item in the title field arrays, or returns\n * // \"Default Title\"\n * ifError(field(\"title\").arrayGet(0), \"Default Title\");\n * ```\n *\n * @param tryExpr - The try expression.\n * @param catchValue - The value that will be returned if the tryExpr produces an\n * error.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation.\n */\nexport function ifError(\n tryExpr: Expression,\n catchValue: unknown\n): FunctionExpression;\n\nexport function ifError(\n tryExpr: Expression,\n catchValue: unknown\n): FunctionExpression | BooleanExpression {\n if (\n tryExpr instanceof BooleanExpression &&\n catchValue instanceof BooleanExpression\n ) {\n return tryExpr.ifError(catchValue).asBoolean();\n } else {\n return tryExpr.ifError(valueToDefaultExpr(catchValue));\n }\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns `true` if a value is absent. Otherwise,\n * returns `false` even if the value is `null`.\n *\n * @example\n * ```typescript\n * // Check if the field `value` is absent.\n * isAbsent(field(\"value\"));\n * ```\n *\n * @param value - The expression to check.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isAbsent' check.\n */\nexport function isAbsent(value: Expression): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns `true` if a field is absent. Otherwise,\n * returns `false` even if the field value is `null`.\n *\n * @example\n * ```typescript\n * // Check if the field `value` is absent.\n * isAbsent(\"value\");\n * ```\n *\n * @param field - The field to check.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isAbsent' check.\n */\nexport function isAbsent(field: string): BooleanExpression;\nexport function isAbsent(value: Expression | string): BooleanExpression {\n return fieldOrExpression(value).isAbsent();\n}\n\n/**\n * @beta\n *\n * Creates an expression that removes a key from the map at the specified field name.\n *\n * @example\n * ```\n * // Removes the key 'city' field from the map in the address field of the input document.\n * mapRemove('address', 'city');\n * ```\n *\n * @param mapField - The name of a field containing a map value.\n * @param key - The name of the key to remove from the input map.\n */\nexport function mapRemove(mapField: string, key: string): FunctionExpression;\n/**\n * @beta\n *\n * Creates an expression that removes a key from the map produced by evaluating an expression.\n *\n * @example\n * ```\n * // Removes the key 'baz' from the input map.\n * mapRemove(map({foo: 'bar', baz: true}), 'baz');\n * @example\n * ```\n *\n * @param mapExpr - An expression return a map value.\n * @param key - The name of the key to remove from the input map.\n */\nexport function mapRemove(mapExpr: Expression, key: string): FunctionExpression;\n/**\n * @beta\n *\n * Creates an expression that removes a key from the map at the specified field name.\n *\n * @example\n * ```\n * // Removes the key 'city' field from the map in the address field of the input document.\n * mapRemove('address', constant('city'));\n * ```\n *\n * @param mapField - The name of a field containing a map value.\n * @param keyExpr - An expression that produces the name of the key to remove from the input map.\n */\nexport function mapRemove(\n mapField: string,\n keyExpr: Expression\n): FunctionExpression;\n/**\n * @beta\n *\n * Creates an expression that removes a key from the map produced by evaluating an expression.\n *\n * @example\n * ```\n * // Removes the key 'baz' from the input map.\n * mapRemove(map({foo: 'bar', baz: true}), constant('baz'));\n * @example\n * ```\n *\n * @param mapExpr - An expression return a map value.\n * @param keyExpr - An expression that produces the name of the key to remove from the input map.\n */\nexport function mapRemove(\n mapExpr: Expression,\n keyExpr: Expression\n): FunctionExpression;\n\nexport function mapRemove(\n mapExpr: Expression | string,\n stringExpr: Expression | string\n): FunctionExpression {\n return fieldOrExpression(mapExpr).mapRemove(valueToDefaultExpr(stringExpr));\n}\n\n/**\n * @beta\n *\n * Creates an expression that merges multiple map values.\n *\n * @example\n * ```\n * // Merges the map in the settings field with, a map literal, and a map in\n * // that is conditionally returned by another expression\n * mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {})\n * ```\n *\n * @param mapField - Name of a field containing a map value that will be merged.\n * @param secondMap - A required second map to merge. Represented as a literal or\n * an expression that returns a map.\n * @param otherMaps - Optional additional maps to merge. Each map is represented\n * as a literal or an expression that returns a map.\n */\nexport function mapMerge(\n mapField: string,\n secondMap: Record<string, unknown> | Expression,\n ...otherMaps: Array<Record<string, unknown> | Expression>\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that merges multiple map values.\n *\n * @example\n * ```\n * // Merges the map in the settings field with, a map literal, and a map in\n * // that is conditionally returned by another expression\n * mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {})\n * ```\n *\n * @param firstMap - An expression or literal map value that will be merged.\n * @param secondMap - A required second map to merge. Represented as a literal or\n * an expression that returns a map.\n * @param otherMaps - Optional additional maps to merge. Each map is represented\n * as a literal or an expression that returns a map.\n */\nexport function mapMerge(\n firstMap: Record<string, unknown> | Expression,\n secondMap: Record<string, unknown> | Expression,\n ...otherMaps: Array<Record<string, unknown> | Expression>\n): FunctionExpression;\n\nexport function mapMerge(\n firstMap: string | Record<string, unknown> | Expression,\n secondMap: Record<string, unknown> | Expression,\n ...otherMaps: Array<Record<string, unknown> | Expression>\n): FunctionExpression {\n const secondMapExpr = valueToDefaultExpr(secondMap);\n const otherMapExprs = otherMaps.map(valueToDefaultExpr);\n return fieldOrExpression(firstMap).mapMerge(secondMapExpr, ...otherMapExprs);\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns the document ID from a path.\n *\n * @example\n * ```typescript\n * // Get the document ID from a path.\n * documentId(myDocumentReference);\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation.\n */\nexport function documentId(\n documentPath: string | DocumentReference\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the document ID from a path.\n *\n * @example\n * ```typescript\n * // Get the document ID from a path.\n * documentId(field(\"__path__\"));\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation.\n */\nexport function documentId(documentPathExpr: Expression): FunctionExpression;\n\nexport function documentId(\n documentPath: Expression | string | DocumentReference\n): FunctionExpression {\n // @ts-ignore\n const documentPathExpr = valueToDefaultExpr(documentPath);\n return documentPathExpr.documentId();\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns a substring of a string or byte array.\n *\n * @param field - The name of a field containing a string or byte array to compute the substring from.\n * @param position - Index of the first character of the substring.\n * @param length - Length of the substring.\n */\nexport function substring(\n field: string,\n position: number,\n length?: number\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns a substring of a string or byte array.\n *\n * @param input - An expression returning a string or byte array to compute the substring from.\n * @param position - Index of the first character of the substring.\n * @param length - Length of the substring.\n */\nexport function substring(\n input: Expression,\n position: number,\n length?: number\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns a substring of a string or byte array.\n *\n * @param field - The name of a field containing a string or byte array to compute the substring from.\n * @param position - An expression that returns the index of the first character of the substring.\n * @param length - An expression that returns the length of the substring.\n */\nexport function substring(\n field: string,\n position: Expression,\n length?: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns a substring of a string or byte array.\n *\n * @param input - An expression returning a string or byte array to compute the substring from.\n * @param position - An expression that returns the index of the first character of the substring.\n * @param length - An expression that returns the length of the substring.\n */\nexport function substring(\n input: Expression,\n position: Expression,\n length?: Expression\n): FunctionExpression;\n\nexport function substring(\n field: Expression | string,\n position: Expression | number,\n length?: Expression | number\n): FunctionExpression {\n const fieldExpr = fieldOrExpression(field);\n const positionExpr = valueToDefaultExpr(position);\n const lengthExpr =\n length === undefined ? undefined : valueToDefaultExpr(length);\n return fieldExpr.substring(positionExpr, lengthExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that adds two expressions together.\n *\n * @example\n * ```typescript\n * // Add the value of the 'quantity' field and the 'reserve' field.\n * add(field(\"quantity\"), field(\"reserve\"));\n * ```\n *\n * @param first - The first expression to add.\n * @param second - The second expression or literal to add.\n * @param others - Optional other expressions or literals to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the addition operation.\n */\nexport function add(\n first: Expression,\n second: Expression | unknown\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that adds a field's value to an expression.\n *\n * @example\n * ```typescript\n * // Add the value of the 'quantity' field and the 'reserve' field.\n * add(\"quantity\", field(\"reserve\"));\n * ```\n *\n * @param fieldName - The name of the field containing the value to add.\n * @param second - The second expression or literal to add.\n * @param others - Optional other expressions or literals to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the addition operation.\n */\nexport function add(\n fieldName: string,\n second: Expression | unknown\n): FunctionExpression;\n\nexport function add(\n first: Expression | string,\n second: Expression | unknown\n): FunctionExpression {\n return fieldOrExpression(first).add(valueToDefaultExpr(second));\n}\n\n/**\n * @beta\n *\n * Creates an expression that subtracts two expressions.\n *\n * @example\n * ```typescript\n * // Subtract the 'discount' field from the 'price' field\n * subtract(field(\"price\"), field(\"discount\"));\n * ```\n *\n * @param left - The expression to subtract from.\n * @param right - The expression to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation.\n */\nexport function subtract(\n left: Expression,\n right: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that subtracts a constant value from an expression.\n *\n * @example\n * ```typescript\n * // Subtract the constant value 2 from the 'value' field\n * subtract(field(\"value\"), 2);\n * ```\n *\n * @param expression - The expression to subtract from.\n * @param value - The constant value to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation.\n */\nexport function subtract(\n expression: Expression,\n value: unknown\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that subtracts an expression from a field's value.\n *\n * @example\n * ```typescript\n * // Subtract the 'discount' field from the 'price' field\n * subtract(\"price\", field(\"discount\"));\n * ```\n *\n * @param fieldName - The field name to subtract from.\n * @param expression - The expression to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation.\n */\nexport function subtract(\n fieldName: string,\n expression: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that subtracts a constant value from a field's value.\n *\n * @example\n * ```typescript\n * // Subtract 20 from the value of the 'total' field\n * subtract(\"total\", 20);\n * ```\n *\n * @param fieldName - The field name to subtract from.\n * @param value - The constant value to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation.\n */\nexport function subtract(fieldName: string, value: unknown): FunctionExpression;\nexport function subtract(\n left: Expression | string,\n right: Expression | unknown\n): FunctionExpression {\n const normalizedLeft = typeof left === 'string' ? field(left) : left;\n const normalizedRight = valueToDefaultExpr(right);\n return normalizedLeft.subtract(normalizedRight);\n}\n\n/**\n * @beta\n *\n * Creates an expression that multiplies two expressions together.\n *\n * @example\n * ```typescript\n * // Multiply the 'quantity' field by the 'price' field\n * multiply(field(\"quantity\"), field(\"price\"));\n * ```\n *\n * @param first - The first expression to multiply.\n * @param second - The second expression or literal to multiply.\n * @param others - Optional additional expressions or literals to multiply.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the multiplication operation.\n */\nexport function multiply(\n first: Expression,\n second: Expression | unknown\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that multiplies a field's value by an expression.\n *\n * @example\n * ```typescript\n * // Multiply the 'quantity' field by the 'price' field\n * multiply(\"quantity\", field(\"price\"));\n * ```\n *\n * @param fieldName - The name of the field containing the value to add.\n * @param second - The second expression or literal to add.\n * @param others - Optional other expressions or literals to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the multiplication operation.\n */\nexport function multiply(\n fieldName: string,\n second: Expression | unknown\n): FunctionExpression;\n\nexport function multiply(\n first: Expression | string,\n second: Expression | unknown\n): FunctionExpression {\n return fieldOrExpression(first).multiply(valueToDefaultExpr(second));\n}\n\n/**\n * @beta\n *\n * Creates an expression that divides two expressions.\n *\n * @example\n * ```typescript\n * // Divide the 'total' field by the 'count' field\n * divide(field(\"total\"), field(\"count\"));\n * ```\n *\n * @param left - The expression to be divided.\n * @param right - The expression to divide by.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation.\n */\nexport function divide(left: Expression, right: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that divides an expression by a constant value.\n *\n * @example\n * ```typescript\n * // Divide the 'value' field by 10\n * divide(field(\"value\"), 10);\n * ```\n *\n * @param expression - The expression to be divided.\n * @param value - The constant value to divide by.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation.\n */\nexport function divide(\n expression: Expression,\n value: unknown\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that divides a field's value by an expression.\n *\n * @example\n * ```typescript\n * // Divide the 'total' field by the 'count' field\n * divide(\"total\", field(\"count\"));\n * ```\n *\n * @param fieldName - The field name to be divided.\n * @param expressions - The expression to divide by.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation.\n */\nexport function divide(\n fieldName: string,\n expressions: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that divides a field's value by a constant value.\n *\n * @example\n * ```typescript\n * // Divide the 'value' field by 10\n * divide(\"value\", 10);\n * ```\n *\n * @param fieldName - The field name to be divided.\n * @param value - The constant value to divide by.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation.\n */\nexport function divide(fieldName: string, value: unknown): FunctionExpression;\nexport function divide(\n left: Expression | string,\n right: Expression | unknown\n): FunctionExpression {\n const normalizedLeft = typeof left === 'string' ? field(left) : left;\n const normalizedRight = valueToDefaultExpr(right);\n return normalizedLeft.divide(normalizedRight);\n}\n\n/**\n * @beta\n *\n * Creates an expression that calculates the modulo (remainder) of dividing two expressions.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing 'field1' by 'field2'.\n * mod(field(\"field1\"), field(\"field2\"));\n * ```\n *\n * @param left - The dividend expression.\n * @param right - The divisor expression.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation.\n */\nexport function mod(left: Expression, right: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing 'field1' by 5.\n * mod(field(\"field1\"), 5);\n * ```\n *\n * @param expression - The dividend expression.\n * @param value - The divisor constant.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation.\n */\nexport function mod(expression: Expression, value: unknown): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing 'field1' by 'field2'.\n * mod(\"field1\", field(\"field2\"));\n * ```\n *\n * @param fieldName - The dividend field name.\n * @param expression - The divisor expression.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation.\n */\nexport function mod(\n fieldName: string,\n expression: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant.\n *\n * @example\n * ```typescript\n * // Calculate the remainder of dividing 'field1' by 5.\n * mod(\"field1\", 5);\n * ```\n *\n * @param fieldName - The dividend field name.\n * @param value - The divisor constant.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation.\n */\nexport function mod(fieldName: string, value: unknown): FunctionExpression;\nexport function mod(\n left: Expression | string,\n right: Expression | unknown\n): FunctionExpression {\n const normalizedLeft = typeof left === 'string' ? field(left) : left;\n const normalizedRight = valueToDefaultExpr(right);\n return normalizedLeft.mod(normalizedRight);\n}\n\n/**\n * @beta\n *\n * Creates an expression that creates a Firestore map value from an input object.\n *\n * @example\n * ```typescript\n * // Create a map from the input object and reference the 'baz' field value from the input document.\n * map({foo: 'bar', baz: Field.of('baz')}).as('data');\n * ```\n *\n * @param elements - The input map to evaluate in the expression.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the map function.\n */\nexport function map(elements: Record<string, unknown>): FunctionExpression {\n return _map(elements, 'map');\n}\nexport function _map(\n elements: Record<string, unknown>,\n methodName: string | undefined\n): FunctionExpression {\n const result: Expression[] = [];\n for (const key in elements) {\n if (Object.prototype.hasOwnProperty.call(elements, key)) {\n const value = elements[key];\n result.push(constant(key));\n result.push(valueToDefaultExpr(value));\n }\n }\n return new FunctionExpression('map', result, 'map');\n}\n\n/**\n * Internal use only\n * Converts a plainObject to a mapValue in the proto representation,\n * rather than a functionValue+map that is the result of the map(...) function.\n * This behaves different from constant(plainObject) because it\n * traverses the input object, converts values in the object to expressions,\n * and calls _readUserData on each of these expressions.\n * @private\n * @internal\n * @param plainObject\n */\nexport function _mapValue(plainObject: Record<string, unknown>): MapValue {\n const result: Map<string, Expression> = new Map<string, Expression>();\n for (const key in plainObject) {\n if (Object.prototype.hasOwnProperty.call(plainObject, key)) {\n const value = plainObject[key];\n result.set(key, valueToDefaultExpr(value));\n }\n }\n return new MapValue(result, undefined);\n}\n\n/**\n * @beta\n *\n * Creates an expression that creates a Firestore array value from an input array.\n *\n * @example\n * ```typescript\n * // Create an array value from the input array and reference the 'baz' field value from the input document.\n * array(['bar', Field.of('baz')]).as('foo');\n * ```\n *\n * @param elements - The input array to evaluate in the expression.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the array function.\n */\nexport function array(elements: unknown[]): FunctionExpression {\n return _array(elements, 'array');\n}\nexport function _array(\n elements: unknown[],\n methodName: string | undefined\n): FunctionExpression {\n return new FunctionExpression(\n 'array',\n elements.map(element => valueToDefaultExpr(element)),\n methodName\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if two expressions are equal.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is equal to an expression\n * equal(field(\"age\"), field(\"minAge\").add(10));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the equality comparison.\n */\nexport function equal(left: Expression, right: Expression): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is equal to 21\n * equal(field(\"age\"), 21);\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the equality comparison.\n */\nexport function equal(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is equal to an expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is equal to the 'limit' field\n * equal(\"age\", field(\"limit\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param expression - The expression to compare to.\n * @returns A new `Expression` representing the equality comparison.\n */\nexport function equal(\n fieldName: string,\n expression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'city' field is equal to string constant \"London\"\n * equal(\"city\", \"London\");\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the equality comparison.\n */\nexport function equal(fieldName: string, value: unknown): BooleanExpression;\nexport function equal(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.equal(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if two expressions are not equal.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to field 'finalState'\n * notEqual(field(\"status\"), field(\"finalState\"));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the inequality comparison.\n */\nexport function notEqual(\n left: Expression,\n right: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is not equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to \"completed\"\n * notEqual(field(\"status\"), \"completed\");\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the inequality comparison.\n */\nexport function notEqual(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is not equal to an expression.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to the value of 'expectedStatus'\n * notEqual(\"status\", field(\"expectedStatus\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param expression - The expression to compare to.\n * @returns A new `Expression` representing the inequality comparison.\n */\nexport function notEqual(\n fieldName: string,\n expression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is not equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'country' field is not equal to \"USA\"\n * notEqual(\"country\", \"USA\");\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the inequality comparison.\n */\nexport function notEqual(fieldName: string, value: unknown): BooleanExpression;\nexport function notEqual(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.notEqual(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if the first expression is less than the second expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is less than 30\n * lessThan(field(\"age\"), field(\"limit\"));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the less than comparison.\n */\nexport function lessThan(\n left: Expression,\n right: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is less than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is less than 30\n * lessThan(field(\"age\"), 30);\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the less than comparison.\n */\nexport function lessThan(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is less than an expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is less than the 'limit' field\n * lessThan(\"age\", field(\"limit\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param expression - The expression to compare to.\n * @returns A new `Expression` representing the less than comparison.\n */\nexport function lessThan(\n fieldName: string,\n expression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is less than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is less than 50\n * lessThan(\"price\", 50);\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the less than comparison.\n */\nexport function lessThan(fieldName: string, value: unknown): BooleanExpression;\nexport function lessThan(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.lessThan(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if the first expression is less than or equal to the second\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is less than or equal to 20\n * lessThan(field(\"quantity\"), field(\"limit\"));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\nexport function lessThanOrEqual(\n left: Expression,\n right: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is less than or equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is less than or equal to 20\n * lessThan(field(\"quantity\"), 20);\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\nexport function lessThanOrEqual(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n * Creates an expression that checks if a field's value is less than or equal to an expression.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is less than or equal to the 'limit' field\n * lessThan(\"quantity\", field(\"limit\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param expression - The expression to compare to.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\nexport function lessThanOrEqual(\n fieldName: string,\n expression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is less than or equal to a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'score' field is less than or equal to 70\n * lessThan(\"score\", 70);\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the less than or equal to comparison.\n */\nexport function lessThanOrEqual(\n fieldName: string,\n value: unknown\n): BooleanExpression;\nexport function lessThanOrEqual(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.lessThanOrEqual(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if the first expression is greater than the second\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is greater than 18\n * greaterThan(field(\"age\"), Constant(9).add(9));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the greater than comparison.\n */\nexport function greaterThan(\n left: Expression,\n right: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is greater than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is greater than 18\n * greaterThan(field(\"age\"), 18);\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the greater than comparison.\n */\nexport function greaterThan(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is greater than an expression.\n *\n * @example\n * ```typescript\n * // Check if the value of field 'age' is greater than the value of field 'limit'\n * greaterThan(\"age\", field(\"limit\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param expression - The expression to compare to.\n * @returns A new `Expression` representing the greater than comparison.\n */\nexport function greaterThan(\n fieldName: string,\n expression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is greater than a constant value.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is greater than 100\n * greaterThan(\"price\", 100);\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the greater than comparison.\n */\nexport function greaterThan(\n fieldName: string,\n value: unknown\n): BooleanExpression;\nexport function greaterThan(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.greaterThan(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if the first expression is greater than or equal to the\n * second expression.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is greater than or equal to the field \"threshold\"\n * greaterThanOrEqual(field(\"quantity\"), field(\"threshold\"));\n * ```\n *\n * @param left - The first expression to compare.\n * @param right - The second expression to compare.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\nexport function greaterThanOrEqual(\n left: Expression,\n right: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is greater than or equal to a constant\n * value.\n *\n * @example\n * ```typescript\n * // Check if the 'quantity' field is greater than or equal to 10\n * greaterThanOrEqual(field(\"quantity\"), 10);\n * ```\n *\n * @param expression - The expression to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\nexport function greaterThanOrEqual(\n expression: Expression,\n value: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is greater than or equal to an expression.\n *\n * @example\n * ```typescript\n * // Check if the value of field 'age' is greater than or equal to the value of field 'limit'\n * greaterThanOrEqual(\"age\", field(\"limit\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The expression to compare to.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\nexport function greaterThanOrEqual(\n fieldName: string,\n value: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is greater than or equal to a constant\n * value.\n *\n * @example\n * ```typescript\n * // Check if the 'score' field is greater than or equal to 80\n * greaterThanOrEqual(\"score\", 80);\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param value - The constant value to compare to.\n * @returns A new `Expression` representing the greater than or equal to comparison.\n */\nexport function greaterThanOrEqual(\n fieldName: string,\n value: unknown\n): BooleanExpression;\nexport function greaterThanOrEqual(\n left: Expression | string,\n right: unknown\n): BooleanExpression {\n const leftExpr = left instanceof Expression ? left : field(left);\n const rightExpr = valueToDefaultExpr(right);\n return leftExpr.greaterThanOrEqual(rightExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that concatenates an array expression with other arrays.\n *\n * @example\n * ```typescript\n * // Combine the 'items' array with two new item arrays\n * arrayConcat(field(\"items\"), [field(\"newItems\"), field(\"otherItems\")]);\n * ```\n *\n * @param firstArray - The first array expression to concatenate to.\n * @param secondArray - The second array expression or array literal to concatenate to.\n * @param otherArrays - Optional additional array expressions or array literals to concatenate.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated array.\n */\nexport function arrayConcat(\n firstArray: Expression,\n secondArray: Expression | unknown[],\n ...otherArrays: Array<Expression | unknown[]>\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that concatenates a field's array value with other arrays.\n *\n * @example\n * ```typescript\n * // Combine the 'items' array with two new item arrays\n * arrayConcat(\"items\", [field(\"newItems\"), field(\"otherItems\")]);\n * ```\n *\n * @param firstArrayField - The first array to concatenate to.\n * @param secondArray - The second array expression or array literal to concatenate to.\n * @param otherArrays - Optional additional array expressions or array literals to concatenate.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated array.\n */\nexport function arrayConcat(\n firstArrayField: string,\n secondArray: Expression | unknown[],\n ...otherArrays: Array<Expression | unknown[]>\n): FunctionExpression;\n\nexport function arrayConcat(\n firstArray: Expression | string,\n secondArray: Expression | unknown[],\n ...otherArrays: Array<Expression | unknown[]>\n): FunctionExpression {\n const exprValues = otherArrays.map(element => valueToDefaultExpr(element));\n return fieldOrExpression(firstArray).arrayConcat(\n fieldOrExpression(secondArray),\n ...exprValues\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains a specific element.\n *\n * @example\n * ```typescript\n * // Check if the 'colors' array contains the value of field 'selectedColor'\n * arrayContains(field(\"colors\"), field(\"selectedColor\"));\n * ```\n *\n * @param array - The array expression to check.\n * @param element - The element to search for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison.\n */\nexport function arrayContains(\n array: Expression,\n element: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains a specific element.\n *\n * @example\n * ```typescript\n * // Check if the 'colors' array contains \"red\"\n * arrayContains(field(\"colors\"), \"red\");\n * ```\n *\n * @param array - The array expression to check.\n * @param element - The element to search for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison.\n */\nexport function arrayContains(\n array: Expression,\n element: unknown\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains a specific element.\n *\n * @example\n * ```typescript\n * // Check if the 'colors' array contains the value of field 'selectedColor'\n * arrayContains(\"colors\", field(\"selectedColor\"));\n * ```\n *\n * @param fieldName - The field name to check.\n * @param element - The element to search for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison.\n */\nexport function arrayContains(\n fieldName: string,\n element: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains a specific value.\n *\n * @example\n * ```typescript\n * // Check if the 'colors' array contains \"red\"\n * arrayContains(\"colors\", \"red\");\n * ```\n *\n * @param fieldName - The field name to check.\n * @param element - The element to search for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison.\n */\nexport function arrayContains(\n fieldName: string,\n element: unknown\n): BooleanExpression;\nexport function arrayContains(\n array: Expression | string,\n element: unknown\n): BooleanExpression {\n const arrayExpr = fieldOrExpression(array);\n const elementExpr = valueToDefaultExpr(element);\n return arrayExpr.arrayContains(elementExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains any of the specified\n * elements.\n *\n * @example\n * ```typescript\n * // Check if the 'categories' array contains either values from field \"cate1\" or \"Science\"\n * arrayContainsAny(field(\"categories\"), [field(\"cate1\"), \"Science\"]);\n * ```\n *\n * @param array - The array expression to check.\n * @param values - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison.\n */\nexport function arrayContainsAny(\n array: Expression,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains any of the specified\n * elements.\n *\n * @example\n * ```typescript\n * // Check if the 'groups' array contains either the value from the 'userGroup' field\n * // or the value \"guest\"\n * arrayContainsAny(\"categories\", [field(\"cate1\"), \"Science\"]);\n * ```\n *\n * @param fieldName - The field name to check.\n * @param values - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison.\n */\nexport function arrayContainsAny(\n fieldName: string,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains any of the specified\n * elements.\n *\n * @example\n * ```typescript\n * // Check if the 'categories' array contains either values from field \"cate1\" or \"Science\"\n * arrayContainsAny(field(\"categories\"), array([field(\"cate1\"), \"Science\"]));\n * ```\n *\n * @param array - The array expression to check.\n * @param values - An expression that evaluates to an array, whose elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison.\n */\nexport function arrayContainsAny(\n array: Expression,\n values: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains any of the specified\n * elements.\n *\n * @example\n * ```typescript\n * // Check if the 'groups' array contains either the value from the 'userGroup' field\n * // or the value \"guest\"\n * arrayContainsAny(\"categories\", array([field(\"cate1\"), \"Science\"]));\n * ```\n *\n * @param fieldName - The field name to check.\n * @param values - An expression that evaluates to an array, whose elements to check for in the array field.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison.\n */\nexport function arrayContainsAny(\n fieldName: string,\n values: Expression\n): BooleanExpression;\nexport function arrayContainsAny(\n array: Expression | string,\n values: unknown[] | Expression\n): BooleanExpression {\n // @ts-ignore implementation accepts both types\n return fieldOrExpression(array).arrayContainsAny(values);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains all the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the \"tags\" array contains all of the values: \"SciFi\", \"Adventure\", and the value from field \"tag1\"\n * arrayContainsAll(field(\"tags\"), [field(\"tag1\"), constant(\"SciFi\"), \"Adventure\"]);\n * ```\n *\n * @param array - The array expression to check.\n * @param values - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison.\n */\nexport function arrayContainsAll(\n array: Expression,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains all the specified values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'tags' array contains both of the values from field 'tag1', the value \"SciFi\", and \"Adventure\"\n * arrayContainsAll(\"tags\", [field(\"tag1\"), \"SciFi\", \"Adventure\"]);\n * ```\n *\n * @param fieldName - The field name to check.\n * @param values - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison.\n */\nexport function arrayContainsAll(\n fieldName: string,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an array expression contains all the specified elements.\n *\n * @example\n * ```typescript\n * // Check if the \"tags\" array contains all of the values: \"SciFi\", \"Adventure\", and the value from field \"tag1\"\n * arrayContainsAll(field(\"tags\"), [field(\"tag1\"), constant(\"SciFi\"), \"Adventure\"]);\n * ```\n *\n * @param array - The array expression to check.\n * @param arrayExpression - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison.\n */\nexport function arrayContainsAll(\n array: Expression,\n arrayExpression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's array value contains all the specified values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'tags' array contains both of the values from field 'tag1', the value \"SciFi\", and \"Adventure\"\n * arrayContainsAll(\"tags\", [field(\"tag1\"), \"SciFi\", \"Adventure\"]);\n * ```\n *\n * @param fieldName - The field name to check.\n * @param arrayExpression - The elements to check for in the array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison.\n */\nexport function arrayContainsAll(\n fieldName: string,\n arrayExpression: Expression\n): BooleanExpression;\nexport function arrayContainsAll(\n array: Expression | string,\n values: unknown[] | Expression\n): BooleanExpression {\n // @ts-ignore implementation accepts both types\n return fieldOrExpression(array).arrayContainsAll(values);\n}\n\n/**\n * @beta\n *\n * Creates an expression that calculates the length of an array in a specified field.\n *\n * @example\n * ```typescript\n * // Get the number of items in field 'cart'\n * arrayLength('cart');\n * ```\n *\n * @param fieldName - The name of the field containing an array to calculate the length of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array.\n */\nexport function arrayLength(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the length of an array expression.\n *\n * @example\n * ```typescript\n * // Get the number of items in the 'cart' array\n * arrayLength(field(\"cart\"));\n * ```\n *\n * @param array - The array expression to calculate the length of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array.\n */\nexport function arrayLength(array: Expression): FunctionExpression;\nexport function arrayLength(array: Expression | string): FunctionExpression {\n return fieldOrExpression(array).arrayLength();\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is either \"Electronics\" or value of field 'primaryType'\n * equalAny(field(\"category\"), [constant(\"Electronics\"), field(\"primaryType\")]);\n * ```\n *\n * @param expression - The expression whose results to compare.\n * @param values - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison.\n */\nexport function equalAny(\n expression: Expression,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is equal to any of the provided values.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is set to a value in the disabledCategories field\n * equalAny(field(\"category\"), field('disabledCategories'));\n * ```\n *\n * @param expression - The expression whose results to compare.\n * @param arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison.\n */\nexport function equalAny(\n expression: Expression,\n arrayExpression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is either \"Electronics\" or value of field 'primaryType'\n * equalAny(\"category\", [constant(\"Electronics\"), field(\"primaryType\")]);\n * ```\n *\n * @param fieldName - The field to compare.\n * @param values - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison.\n */\nexport function equalAny(\n fieldName: string,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is equal to any of the provided values or\n * expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'category' field is either \"Electronics\" or value of field 'primaryType'\n * equalAny(\"category\", [\"Electronics\", field(\"primaryType\")]);\n * ```\n *\n * @param fieldName - The field to compare.\n * @param arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input field.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison.\n */\nexport function equalAny(\n fieldName: string,\n arrayExpression: Expression\n): BooleanExpression;\nexport function equalAny(\n element: Expression | string,\n values: unknown[] | Expression\n): BooleanExpression {\n // @ts-ignore implementation accepts both types\n return fieldOrExpression(element).equalAny(values);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is not equal to any of the provided values\n * or expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is neither \"pending\" nor the value of 'rejectedStatus'\n * notEqualAny(field(\"status\"), [\"pending\", field(\"rejectedStatus\")]);\n * ```\n *\n * @param element - The expression to compare.\n * @param values - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison.\n */\nexport function notEqualAny(\n element: Expression,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is not equal to any of the provided values\n * or expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is neither \"pending\" nor the value of 'rejectedStatus'\n * notEqualAny(\"status\", [constant(\"pending\"), field(\"rejectedStatus\")]);\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param values - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison.\n */\nexport function notEqualAny(\n fieldName: string,\n values: Array<Expression | unknown>\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if an expression is not equal to any of the provided values\n * or expressions.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is neither \"pending\" nor the value of the field 'rejectedStatus'\n * notEqualAny(field(\"status\"), [\"pending\", field(\"rejectedStatus\")]);\n * ```\n *\n * @param element - The expression to compare.\n * @param arrayExpression - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison.\n */\nexport function notEqualAny(\n element: Expression,\n arrayExpression: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression.\n *\n * @example\n * ```typescript\n * // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses'\n * notEqualAny(\"status\", field(\"rejectedStatuses\"));\n * ```\n *\n * @param fieldName - The field name to compare.\n * @param arrayExpression - The values to check against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison.\n */\nexport function notEqualAny(\n fieldName: string,\n arrayExpression: Expression\n): BooleanExpression;\n\nexport function notEqualAny(\n element: Expression | string,\n values: unknown[] | Expression\n): BooleanExpression {\n // @ts-ignore implementation accepts both types\n return fieldOrExpression(element).notEqualAny(values);\n}\n\n/**\n * @beta\n *\n * Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions.\n *\n * @example\n * ```typescript\n * // Check if only one of the conditions is true: 'age' greater than 18, 'city' is \"London\",\n * // or 'status' is \"active\".\n * const condition = xor(\n * greaterThan(\"age\", 18),\n * equal(\"city\", \"London\"),\n * equal(\"status\", \"active\"));\n * ```\n *\n * @param first - The first condition.\n * @param second - The second condition.\n * @param additionalConditions - Additional conditions to 'XOR' together.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'XOR' operation.\n */\nexport function xor(\n first: BooleanExpression,\n second: BooleanExpression,\n ...additionalConditions: BooleanExpression[]\n): BooleanExpression {\n return new FunctionExpression(\n 'xor',\n [first, second, ...additionalConditions],\n 'xor'\n ).asBoolean();\n}\n\n/**\n * @beta\n *\n * Creates a conditional expression that evaluates to a 'then' expression if a condition is true\n * and an 'else' expression if the condition is false.\n *\n * @example\n * ```typescript\n * // If 'age' is greater than 18, return \"Adult\"; otherwise, return \"Minor\".\n * conditional(\n * greaterThan(\"age\", 18), constant(\"Adult\"), constant(\"Minor\"));\n * ```\n *\n * @param condition - The condition to evaluate.\n * @param thenExpr - The expression to evaluate if the condition is true.\n * @param elseExpr - The expression to evaluate if the condition is false.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the conditional expression.\n */\nexport function conditional(\n condition: BooleanExpression,\n thenExpr: Expression,\n elseExpr: Expression\n): FunctionExpression {\n return new FunctionExpression(\n 'conditional',\n [condition, thenExpr, elseExpr],\n 'conditional'\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that negates a filter condition.\n *\n * @example\n * ```typescript\n * // Find documents where the 'completed' field is NOT true\n * not(equal(\"completed\", true));\n * ```\n *\n * @param booleanExpr - The filter condition to negate.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the negated filter condition.\n */\nexport function not(booleanExpr: BooleanExpression): BooleanExpression {\n return booleanExpr.not();\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns the largest value between multiple input\n * expressions or literal values. Based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the largest value between the 'field1' field, the 'field2' field,\n * // and 1000\n * logicalMaximum(field(\"field1\"), field(\"field2\"), 1000);\n * ```\n *\n * @param first - The first operand expression.\n * @param second - The second expression or literal.\n * @param others - Optional additional expressions or literals.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation.\n */\nexport function logicalMaximum(\n first: Expression,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the largest value between multiple input\n * expressions or literal values. Based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the largest value between the 'field1' field, the 'field2' field,\n * // and 1000.\n * logicalMaximum(\"field1\", field(\"field2\"), 1000);\n * ```\n *\n * @param fieldName - The first operand field name.\n * @param second - The second expression or literal.\n * @param others - Optional additional expressions or literals.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation.\n */\nexport function logicalMaximum(\n fieldName: string,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\nexport function logicalMaximum(\n first: Expression | string,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression {\n return fieldOrExpression(first).logicalMaximum(\n valueToDefaultExpr(second),\n ...others.map(value => valueToDefaultExpr(value))\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns the smallest value between multiple input\n * expressions and literal values. Based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the smallest value between the 'field1' field, the 'field2' field,\n * // and 1000.\n * logicalMinimum(field(\"field1\"), field(\"field2\"), 1000);\n * ```\n *\n * @param first - The first operand expression.\n * @param second - The second expression or literal.\n * @param others - Optional additional expressions or literals.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation.\n */\nexport function logicalMinimum(\n first: Expression,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the smallest value between a field's value\n * and other input expressions or literal values.\n * Based on Firestore's value type ordering.\n *\n * @example\n * ```typescript\n * // Returns the smallest value between the 'field1' field, the 'field2' field,\n * // and 1000.\n * logicalMinimum(\"field1\", field(\"field2\"), 1000);\n * ```\n *\n * @param fieldName - The first operand field name.\n * @param second - The second expression or literal.\n * @param others - Optional additional expressions or literals.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation.\n */\nexport function logicalMinimum(\n fieldName: string,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\nexport function logicalMinimum(\n first: Expression | string,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression {\n return fieldOrExpression(first).logicalMinimum(\n valueToDefaultExpr(second),\n ...others.map(value => valueToDefaultExpr(value))\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field exists.\n *\n * @example\n * ```typescript\n * // Check if the document has a field named \"phoneNumber\"\n * exists(field(\"phoneNumber\"));\n * ```\n *\n * @param value - An expression evaluates to the name of the field to check.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'exists' check.\n */\nexport function exists(value: Expression): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field exists.\n *\n * @example\n * ```typescript\n * // Check if the document has a field named \"phoneNumber\"\n * exists(\"phoneNumber\");\n * ```\n *\n * @param fieldName - The field name to check.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'exists' check.\n */\nexport function exists(fieldName: string): BooleanExpression;\nexport function exists(valueOrField: Expression | string): BooleanExpression {\n return fieldOrExpression(valueOrField).exists();\n}\n\n/**\n * @beta\n *\n * Creates an expression that reverses a string.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * reverse(field(\"myString\"));\n * ```\n *\n * @param stringExpression - An expression evaluating to a string value, which will be reversed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\nexport function reverse(stringExpression: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that reverses a string value in the specified field.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * reverse(\"myString\");\n * ```\n *\n * @param field - The name of the field representing the string to reverse.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\nexport function reverse(field: string): FunctionExpression;\nexport function reverse(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).reverse();\n}\n\n/**\n * @beta\n *\n * Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob.\n *\n * @example\n * ```typescript\n * // Calculate the length of the 'myString' field in bytes.\n * byteLength(field(\"myString\"));\n * ```\n *\n * @param expr - The expression representing the string.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes.\n */\nexport function byteLength(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob.\n *\n * @example\n * ```typescript\n * // Calculate the length of the 'myString' field in bytes.\n * byteLength(\"myString\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes.\n */\nexport function byteLength(fieldName: string): FunctionExpression;\nexport function byteLength(expr: Expression | string): FunctionExpression {\n const normalizedExpr = fieldOrExpression(expr);\n return normalizedExpr.byteLength();\n}\n\n/**\n * @beta\n * Creates an expression that reverses an array.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myArray' field.\n * arrayReverse(\"myArray\");\n * ```\n *\n * @param fieldName - The name of the field to reverse.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array.\n */\nexport function arrayReverse(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that reverses an array.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myArray' field.\n * arrayReverse(field(\"myArray\"));\n * ```\n *\n * @param arrayExpression - An expression evaluating to an array value, which will be reversed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array.\n */\nexport function arrayReverse(arrayExpression: Expression): FunctionExpression;\nexport function arrayReverse(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).arrayReverse();\n}\n\n/**\n * @beta\n * Creates an expression that computes e to the power of the expression's result.\n *\n * @example\n * ```typescript\n * // Compute e to the power of 2.\n * exp(constant(2));\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value.\n */\nexport function exp(expression: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes e to the power of the expression's result.\n *\n * @example\n * ```typescript\n * // Compute e to the power of the 'value' field.\n * exp('value');\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value.\n */\nexport function exp(fieldName: string): FunctionExpression;\n\nexport function exp(\n expressionOrFieldName: Expression | string\n): FunctionExpression {\n return fieldOrExpression(expressionOrFieldName).exp();\n}\n\n/**\n * @beta\n * Creates an expression that computes the ceiling of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the ceiling of the 'price' field.\n * ceil(\"price\");\n * ```\n *\n * @param fieldName - The name of the field to compute the ceiling of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value.\n */\nexport function ceil(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the ceiling of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the ceiling of the 'price' field.\n * ceil(field(\"price\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the ceiling will be computed for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value.\n */\nexport function ceil(expression: Expression): FunctionExpression;\nexport function ceil(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).ceil();\n}\n\n/**\n * @beta\n * Creates an expression that computes the floor of a numeric value.\n *\n * @param expr - The expression to compute the floor of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value.\n */\nexport function floor(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the floor of a numeric value.\n *\n * @param fieldName - The name of the field to compute the floor of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value.\n */\nexport function floor(fieldName: string): FunctionExpression;\nexport function floor(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).floor();\n}\n\n/**\n * @beta\n * Creates an aggregation that counts the number of distinct values of a field.\n *\n * @param expr - The expression or field to count distinct values of.\n * @returns A new `AggregateFunction` representing the 'count_distinct' aggregation.\n */\nexport function countDistinct(expr: Expression | string): AggregateFunction {\n return fieldOrExpression(expr).countDistinct();\n}\n\n/**\n * @beta\n *\n * Creates an expression that calculates the character length of a string field in UTF8.\n *\n * @example\n * ```typescript\n * // Get the character length of the 'name' field in UTF-8.\n * strLength(\"name\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string.\n */\nexport function charLength(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the character length of a string expression in UTF-8.\n *\n * @example\n * ```typescript\n * // Get the character length of the 'name' field in UTF-8.\n * strLength(field(\"name\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to calculate the length of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string.\n */\nexport function charLength(stringExpression: Expression): FunctionExpression;\nexport function charLength(value: Expression | string): FunctionExpression {\n const valueExpr = fieldOrExpression(value);\n return valueExpr.charLength();\n}\n\n/**\n * @beta\n *\n * Creates an expression that performs a case-sensitive wildcard string comparison against a\n * field.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the string \"guide\"\n * like(\"title\", \"%guide%\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison.\n */\nexport function like(fieldName: string, pattern: string): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that performs a case-sensitive wildcard string comparison against a\n * field.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the string \"guide\"\n * like(\"title\", field(\"pattern\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison.\n */\nexport function like(fieldName: string, pattern: Expression): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that performs a case-sensitive wildcard string comparison.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the string \"guide\"\n * like(field(\"title\"), \"%guide%\");\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison.\n */\nexport function like(\n stringExpression: Expression,\n pattern: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that performs a case-sensitive wildcard string comparison.\n *\n * @example\n * ```typescript\n * // Check if the 'title' field contains the string \"guide\"\n * like(field(\"title\"), field(\"pattern\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param pattern - The pattern to search for. You can use \"%\" as a wildcard character.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison.\n */\nexport function like(\n stringExpression: Expression,\n pattern: Expression\n): BooleanExpression;\nexport function like(\n left: Expression | string,\n pattern: Expression | string\n): BooleanExpression {\n const leftExpr = fieldOrExpression(left);\n const patternExpr = valueToDefaultExpr(pattern);\n return leftExpr.like(patternExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field contains a specified regular expression as\n * a substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\" (case-insensitive)\n * regexContains(\"description\", \"(?i)example\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The regular expression to use for the search.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function regexContains(\n fieldName: string,\n pattern: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field contains a specified regular expression as\n * a substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\" (case-insensitive)\n * regexContains(\"description\", field(\"pattern\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The regular expression to use for the search.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function regexContains(\n fieldName: string,\n pattern: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression contains a specified regular\n * expression as a substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\" (case-insensitive)\n * regexContains(field(\"description\"), \"(?i)example\");\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param pattern - The regular expression to use for the search.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function regexContains(\n stringExpression: Expression,\n pattern: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression contains a specified regular\n * expression as a substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\" (case-insensitive)\n * regexContains(field(\"description\"), field(\"pattern\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param pattern - The regular expression to use for the search.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function regexContains(\n stringExpression: Expression,\n pattern: Expression\n): BooleanExpression;\nexport function regexContains(\n left: Expression | string,\n pattern: Expression | string\n): BooleanExpression {\n const leftExpr = fieldOrExpression(left);\n const patternExpr = valueToDefaultExpr(pattern);\n return leftExpr.regexContains(patternExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that returns the first substring of a string field that matches a\n * specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract the domain name from an email field\n * regexFind(\"email\", \"@[A-Za-z0-9.-]+\");\n * ```\n *\n * @param fieldName - The name of the field containing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\nexport function regexFind(\n fieldName: string,\n pattern: string\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the first substring of a string field that matches a\n * specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract a substring from 'email' based on a pattern stored in another field\n * regexFind(\"email\", field(\"pattern\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\nexport function regexFind(\n fieldName: string,\n pattern: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the first substring of a string expression that matches\n * a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract the domain from a lower-cased email address\n * regexFind(field(\"email\"), \"@[A-Za-z0-9.-]+\");\n * ```\n *\n * @param stringExpression - The expression representing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\nexport function regexFind(\n stringExpression: Expression,\n pattern: string\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that returns the first substring of a string expression that matches\n * a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract a substring based on a dynamic pattern field\n * regexFind(field(\"email\"), field(\"pattern\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression find function.\n */\nexport function regexFind(\n stringExpression: Expression,\n pattern: Expression\n): FunctionExpression;\nexport function regexFind(\n left: Expression | string,\n pattern: Expression | string\n): FunctionExpression {\n const leftExpr = fieldOrExpression(left);\n const patternExpr = valueToDefaultExpr(pattern);\n return leftExpr.regexFind(patternExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in a string field that\n * match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all hashtags from a post content field\n * regexFindAll(\"content\", \"#[A-Za-z0-9_]+\");\n * ```\n *\n * @param fieldName - The name of the field containing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#FunctionExpression} that evaluates to an array of matched substrings.\n */\nexport function regexFindAll(\n fieldName: string,\n pattern: string\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in a string field that\n * match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all matches from 'content' based on a pattern stored in another field\n * regexFindAll(\"content\", field(\"pattern\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#FunctionExpression} that evaluates to an array of matched substrings.\n */\nexport function regexFindAll(\n fieldName: string,\n pattern: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in a string expression\n * that match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all mentions from a lower-cased comment\n * regexFindAll(field(\"comment\"), \"@[A-Za-z0-9_]+\");\n * ```\n *\n * @param stringExpression - The expression representing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#FunctionExpression} that evaluates to an array of matched substrings.\n */\nexport function regexFindAll(\n stringExpression: Expression,\n pattern: string\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that evaluates to a list of all substrings in a string expression\n * that match a specified regular expression.\n *\n * This expression uses the {@link https://github.com/google/re2/wiki/Syntax | RE2} regular expression syntax.\n *\n * @example\n * ```typescript\n * // Extract all matches based on a dynamic pattern expression\n * regexFindAll(field(\"comment\"), field(\"pattern\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to search.\n * @param pattern - The regular expression to search for.\n * @returns A new {@link @firebase/firestore/pipelines#FunctionExpression} that evaluates to an array of matched substrings.\n */\nexport function regexFindAll(\n stringExpression: Expression,\n pattern: Expression\n): FunctionExpression;\nexport function regexFindAll(\n left: Expression | string,\n pattern: Expression | string\n): FunctionExpression {\n const leftExpr = fieldOrExpression(left);\n const patternExpr = valueToDefaultExpr(pattern);\n return leftExpr.regexFindAll(patternExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field matches a specified regular expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a valid email pattern\n * regexMatch(\"email\", \"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,}\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The regular expression to use for the match.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match.\n */\nexport function regexMatch(\n fieldName: string,\n pattern: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field matches a specified regular expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a valid email pattern\n * regexMatch(\"email\", field(\"pattern\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param pattern - The regular expression to use for the match.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match.\n */\nexport function regexMatch(\n fieldName: string,\n pattern: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression matches a specified regular\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a valid email pattern\n * regexMatch(field(\"email\"), \"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,}\");\n * ```\n *\n * @param stringExpression - The expression representing the string to match against.\n * @param pattern - The regular expression to use for the match.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match.\n */\nexport function regexMatch(\n stringExpression: Expression,\n pattern: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression matches a specified regular\n * expression.\n *\n * @example\n * ```typescript\n * // Check if the 'email' field matches a valid email pattern\n * regexMatch(field(\"email\"), field(\"pattern\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to match against.\n * @param pattern - The regular expression to use for the match.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match.\n */\nexport function regexMatch(\n stringExpression: Expression,\n pattern: Expression\n): BooleanExpression;\nexport function regexMatch(\n left: Expression | string,\n pattern: Expression | string\n): BooleanExpression {\n const leftExpr = fieldOrExpression(left);\n const patternExpr = valueToDefaultExpr(pattern);\n return leftExpr.regexMatch(patternExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field contains a specified substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\".\n * stringContains(\"description\", \"example\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param substring - The substring to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function stringContains(\n fieldName: string,\n substring: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string field contains a substring specified by an expression.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains the value of the 'keyword' field.\n * stringContains(\"description\", field(\"keyword\"));\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @param substring - The expression representing the substring to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function stringContains(\n fieldName: string,\n substring: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression contains a specified substring.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains \"example\".\n * stringContains(field(\"description\"), \"example\");\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param substring - The substring to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function stringContains(\n stringExpression: Expression,\n substring: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression contains a substring specified by another expression.\n *\n * @example\n * ```typescript\n * // Check if the 'description' field contains the value of the 'keyword' field.\n * stringContains(field(\"description\"), field(\"keyword\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to perform the comparison on.\n * @param substring - The expression representing the substring to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison.\n */\nexport function stringContains(\n stringExpression: Expression,\n substring: Expression\n): BooleanExpression;\nexport function stringContains(\n left: Expression | string,\n substring: Expression | string\n): BooleanExpression {\n const leftExpr = fieldOrExpression(left);\n const substringExpr = valueToDefaultExpr(substring);\n return leftExpr.stringContains(substringExpr);\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value starts with a given prefix.\n *\n * @example\n * ```typescript\n * // Check if the 'name' field starts with \"Mr.\"\n * startsWith(\"name\", \"Mr.\");\n * ```\n *\n * @param fieldName - The field name to check.\n * @param prefix - The prefix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison.\n */\nexport function startsWith(\n fieldName: string,\n prefix: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value starts with a given prefix.\n *\n * @example\n * ```typescript\n * // Check if the 'fullName' field starts with the value of the 'firstName' field\n * startsWith(\"fullName\", field(\"firstName\"));\n * ```\n *\n * @param fieldName - The field name to check.\n * @param prefix - The expression representing the prefix.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison.\n */\nexport function startsWith(\n fieldName: string,\n prefix: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression starts with a given prefix.\n *\n * @example\n * ```typescript\n * // Check if the result of concatenating 'firstName' and 'lastName' fields starts with \"Mr.\"\n * startsWith(field(\"fullName\"), \"Mr.\");\n * ```\n *\n * @param stringExpression - The expression to check.\n * @param prefix - The prefix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison.\n */\nexport function startsWith(\n stringExpression: Expression,\n prefix: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression starts with a given prefix.\n *\n * @example\n * ```typescript\n * // Check if the result of concatenating 'firstName' and 'lastName' fields starts with \"Mr.\"\n * startsWith(field(\"fullName\"), field(\"prefix\"));\n * ```\n *\n * @param stringExpression - The expression to check.\n * @param prefix - The prefix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison.\n */\nexport function startsWith(\n stringExpression: Expression,\n prefix: Expression\n): BooleanExpression;\nexport function startsWith(\n expr: Expression | string,\n prefix: Expression | string\n): BooleanExpression {\n return fieldOrExpression(expr).startsWith(valueToDefaultExpr(prefix));\n}\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value ends with a given postfix.\n *\n * @example\n * ```typescript\n * // Check if the 'filename' field ends with \".txt\"\n * endsWith(\"filename\", \".txt\");\n * ```\n *\n * @param fieldName - The field name to check.\n * @param suffix - The postfix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison.\n */\nexport function endsWith(fieldName: string, suffix: string): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a field's value ends with a given postfix.\n *\n * @example\n * ```typescript\n * // Check if the 'url' field ends with the value of the 'extension' field\n * endsWith(\"url\", field(\"extension\"));\n * ```\n *\n * @param fieldName - The field name to check.\n * @param suffix - The expression representing the postfix.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison.\n */\nexport function endsWith(\n fieldName: string,\n suffix: Expression\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression ends with a given postfix.\n *\n * @example\n * ```typescript\n * // Check if the result of concatenating 'firstName' and 'lastName' fields ends with \"Jr.\"\n * endsWith(field(\"fullName\"), \"Jr.\");\n * ```\n *\n * @param stringExpression - The expression to check.\n * @param suffix - The postfix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison.\n */\nexport function endsWith(\n stringExpression: Expression,\n suffix: string\n): BooleanExpression;\n\n/**\n * @beta\n *\n * Creates an expression that checks if a string expression ends with a given postfix.\n *\n * @example\n * ```typescript\n * // Check if the result of concatenating 'firstName' and 'lastName' fields ends with \"Jr.\"\n * endsWith(field(\"fullName\"), constant(\"Jr.\"));\n * ```\n *\n * @param stringExpression - The expression to check.\n * @param suffix - The postfix to check for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison.\n */\nexport function endsWith(\n stringExpression: Expression,\n suffix: Expression\n): BooleanExpression;\nexport function endsWith(\n expr: Expression | string,\n suffix: Expression | string\n): BooleanExpression {\n return fieldOrExpression(expr).endsWith(valueToDefaultExpr(suffix));\n}\n\n/**\n * @beta\n *\n * Creates an expression that converts a string field to lowercase.\n *\n * @example\n * ```typescript\n * // Convert the 'name' field to lowercase\n * toLower(\"name\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the lowercase string.\n */\nexport function toLower(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that converts a string expression to lowercase.\n *\n * @example\n * ```typescript\n * // Convert the 'name' field to lowercase\n * toLower(field(\"name\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to convert to lowercase.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the lowercase string.\n */\nexport function toLower(stringExpression: Expression): FunctionExpression;\nexport function toLower(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).toLower();\n}\n\n/**\n * @beta\n *\n * Creates an expression that converts a string field to uppercase.\n *\n * @example\n * ```typescript\n * // Convert the 'title' field to uppercase\n * toUpper(\"title\");\n * ```\n *\n * @param fieldName - The name of the field containing the string.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the uppercase string.\n */\nexport function toUpper(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that converts a string expression to uppercase.\n *\n * @example\n * ```typescript\n * // Convert the 'title' field to uppercase\n * toUppercase(field(\"title\"));\n * ```\n *\n * @param stringExpression - The expression representing the string to convert to uppercase.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the uppercase string.\n */\nexport function toUpper(stringExpression: Expression): FunctionExpression;\nexport function toUpper(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).toUpper();\n}\n\n/**\n * @beta\n *\n * Creates an expression that removes leading and trailing whitespace from a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the 'userInput' field\n * trim(\"userInput\");\n *\n * // Trim quotes from the 'userInput' field\n * trim(\"userInput\", '\"');\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be\n * trimmed from the input. If not specified, then whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string.\n */\nexport function trim(\n fieldName: string,\n valueToTrim?: string | Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that removes leading and trailing characters from a string or byte array expression.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the 'userInput' field\n * trim(field(\"userInput\"));\n *\n * // Trim quotes from the 'userInput' field\n * trim(field(\"userInput\"), '\"');\n * ```\n *\n * @param stringExpression - The expression representing the string or byte array to trim.\n * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be\n * trimmed from the input. If not specified, then whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array.\n */\nexport function trim(\n stringExpression: Expression,\n valueToTrim?: string | Expression\n): FunctionExpression;\nexport function trim(\n expr: Expression | string,\n valueToTrim?: string | Expression\n): FunctionExpression {\n return fieldOrExpression(expr).trim(valueToTrim);\n}\n\n/**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the beginning of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the beginning of the 'userInput' field\n * ltrim(field(\"userInput\"));\n *\n * // Trim quotes from the beginning of the 'userInput' field\n * ltrim(field(\"userInput\"), '\"');\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array.\n */\nexport function ltrim(\n fieldName: string,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression;\n\n/**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the beginning of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the beginning of the 'userInput' field\n * ltrim(field(\"userInput\"));\n *\n * // Trim quotes from the beginning of the 'userInput' field\n * ltrim(field(\"userInput\"), '\"');\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array.\n */\nexport function ltrim(\n expression: Expression,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression;\nexport function ltrim(\n expr: Expression | string,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression {\n return fieldOrExpression(expr).ltrim(valueToTrim);\n}\n\n/**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the end of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the end of the 'userInput' field\n * rtrim(field(\"userInput\"));\n *\n * // Trim quotes from the end of the 'userInput' field\n * rtrim(field(\"userInput\"), '\"');\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array.\n */\nexport function rtrim(\n fieldName: string,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression;\n\n/**\n * @beta\n * Trims whitespace or a specified set of characters/bytes from the end of a string or byte array.\n *\n * @example\n * ```typescript\n * // Trim whitespace from the end of the 'userInput' field\n * rtrim(field(\"userInput\"));\n *\n * // Trim quotes from the end of the 'userInput' field\n * rtrim(field(\"userInput\"), '\"');\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param valueToTrim - Optional. A string or byte array containing the characters/bytes to trim.\n * If not specified, whitespace will be trimmed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array.\n */\nexport function rtrim(\n expression: Expression,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression;\nexport function rtrim(\n expr: Expression | string,\n valueToTrim?: string | Expression | Bytes\n): FunctionExpression {\n return fieldOrExpression(expr).rtrim(valueToTrim);\n}\n\n/**\n * @beta\n * Creates an expression that returns the data type of the data in the specified field.\n *\n * @remarks\n * String inputs passed iteratively to this global function act as `field()` path lookups.\n * If you wish to pass a string literal value, it must be wrapped: `type(constant(\"my_string\"))`.\n *\n * @example\n * ```typescript\n * // Get the data type of the value in field 'title'\n * type('title')\n * ```\n *\n * @returns A new `Expression` representing the data type.\n */\nexport function type(fieldName: string): FunctionExpression;\n/**\n * @beta\n * Creates an expression that returns the data type of an expression's result.\n *\n * @example\n * ```typescript\n * // Get the data type of a conditional expression\n * type(conditional(exists('foo'), constant(1), constant(true)))\n * ```\n *\n * @returns A new `Expression` representing the data type.\n */\nexport function type(expression: Expression): FunctionExpression;\nexport function type(\n fieldNameOrExpression: string | Expression\n): FunctionExpression {\n return fieldOrExpression(fieldNameOrExpression).type();\n}\n\n/**\n * @beta\n * Creates an expression that checks if the value in the specified field is of the given type.\n *\n * @remarks Null or undefined fields evaluate to skip/error. Use `ifAbsent()` / `isAbsent()` to evaluate missing data.\n *\n * @example\n * ```typescript\n * // Check if the 'price' field is a floating point number (evaluating to true inside pipeline conditionals)\n * isType('price', 'float64');\n * ```\n *\n * @param fieldName - The name of the field to check.\n * @param type - The type to check for.\n * @returns A new `BooleanExpression` that evaluates to true if the field's value is of the given type, false otherwise.\n */\nexport function isType(fieldName: string, type: Type): BooleanExpression;\n\n/**\n * @beta\n * Creates an expression that checks if the result of an expression is of the given type.\n *\n * @remarks Null or undefined fields evaluate to skip/error. Use `ifAbsent()` / `isAbsent()` to evaluate missing data.\n *\n * @example\n * ```typescript\n * // Check if the result of a calculation is a number\n * isType(add('count', 1), 'number')\n * ```\n *\n * @param expression - The expression to check.\n * @param type - The type to check for.\n * @returns A new `BooleanExpression` that evaluates to true if the expression's result is of the given type, false otherwise.\n */\nexport function isType(expression: Expression, type: Type): BooleanExpression;\nexport function isType(\n fieldNameOrExpression: string | Expression,\n type: Type\n): BooleanExpression {\n return fieldOrExpression(fieldNameOrExpression).isType(type);\n}\n\n/**\n * @beta\n *\n * Creates an expression that concatenates string functions, fields or constants together.\n *\n * @example\n * ```typescript\n * // Combine the 'firstName', \" \", and 'lastName' fields into a single string\n * stringConcat(\"firstName\", \" \", field(\"lastName\"));\n * ```\n *\n * @param fieldName - The field name containing the initial string value.\n * @param secondString - An expression or string literal to concatenate.\n * @param otherStrings - Optional additional expressions or literals (typically strings) to concatenate.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated string.\n */\nexport function stringConcat(\n fieldName: string,\n secondString: Expression | string,\n ...otherStrings: Array<Expression | string>\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that concatenates string expressions together.\n *\n * @example\n * ```typescript\n * // Combine the 'firstName', \" \", and 'lastName' fields into a single string\n * stringConcat(field(\"firstName\"), \" \", field(\"lastName\"));\n * ```\n *\n * @param firstString - The initial string expression to concatenate to.\n * @param secondString - An expression or string literal to concatenate.\n * @param otherStrings - Optional additional expressions or literals (typically strings) to concatenate.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated string.\n */\nexport function stringConcat(\n firstString: Expression,\n secondString: Expression | string,\n ...otherStrings: Array<Expression | string>\n): FunctionExpression;\nexport function stringConcat(\n first: string | Expression,\n second: string | Expression,\n ...elements: Array<string | Expression>\n): FunctionExpression {\n return fieldOrExpression(first).stringConcat(\n valueToDefaultExpr(second),\n ...elements.map(valueToDefaultExpr)\n );\n}\n\n/**\n * @beta\n * Creates an expression that finds the index of the first occurrence of a substring or byte sequence.\n *\n * @example\n * ```typescript\n * // Find the index of \"foo\" in the 'text' field\n * stringIndexOf(\"text\", \"foo\");\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param search - The substring or byte sequence to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the index of the first occurrence.\n */\nexport function stringIndexOf(\n fieldName: string,\n search: string | Expression | Bytes\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that finds the index of the first occurrence of a substring or byte sequence.\n *\n * @example\n * ```typescript\n * // Find the index of \"foo\" in the 'text' field\n * stringIndexOf(field(\"text\"), \"foo\");\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param search - The substring or byte sequence to search for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the index of the first occurrence.\n */\nexport function stringIndexOf(\n expression: Expression,\n search: string | Expression | Bytes\n): FunctionExpression;\nexport function stringIndexOf(\n expr: Expression | string,\n search: string | Expression | Bytes\n): FunctionExpression {\n return fieldOrExpression(expr).stringIndexOf(search);\n}\n\n/**\n * @beta\n * Creates an expression that repeats a string or byte array a specified number of times.\n *\n * @example\n * ```typescript\n * // Repeat the 'label' field 3 times\n * stringRepeat(\"label\", 3);\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param repetitions - The number of times to repeat the string or byte array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the repeated string or byte array.\n */\nexport function stringRepeat(\n fieldName: string,\n repetitions: number | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that repeats a string or byte array a specified number of times.\n *\n * @example\n * ```typescript\n * // Repeat the 'label' field 3 times\n * stringRepeat(field(\"label\"), 3);\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param repetitions - The number of times to repeat the string or byte array.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the repeated string or byte array.\n */\nexport function stringRepeat(\n expression: Expression,\n repetitions: number | Expression\n): FunctionExpression;\nexport function stringRepeat(\n expr: Expression | string,\n repetitions: number | Expression\n): FunctionExpression {\n return fieldOrExpression(expr).stringRepeat(repetitions);\n}\n\n/**\n * @beta\n * Creates an expression that replaces all occurrences of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace all occurrences of \"foo\" with \"bar\" in the 'text' field\n * stringReplaceAll(\"text\", \"foo\", \"bar\");\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the string or byte array with replacements.\n */\nexport function stringReplaceAll(\n fieldName: string,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that replaces all occurrences of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace all occurrences of \"foo\" with \"bar\" in the 'text' field\n * stringReplaceAll(field(\"text\"), \"foo\", \"bar\");\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the string or byte array with replacements.\n */\nexport function stringReplaceAll(\n expression: Expression,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression;\nexport function stringReplaceAll(\n expr: Expression | string,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression {\n return fieldOrExpression(expr).stringReplaceAll(find, replacement);\n}\n\n/**\n * @beta\n * Creates an expression that replaces the first occurrence of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace the first occurrence of \"foo\" with \"bar\" in the 'text' field\n * stringReplaceOne(\"text\", \"foo\", \"bar\");\n * ```\n *\n * @param fieldName - The name of the field containing the string or byte array.\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the string or byte array with the replacement.\n */\nexport function stringReplaceOne(\n fieldName: string,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that replaces the first occurrence of a substring or byte sequence with a replacement.\n *\n * @example\n * ```typescript\n * // Replace the first occurrence of \"foo\" with \"bar\" in the 'text' field\n * stringReplaceOne(field(\"text\"), \"foo\", \"bar\");\n * ```\n *\n * @param expression - The expression representing the string or byte array.\n * @param find - The substring or byte sequence to search for.\n * @param replacement - The replacement string or byte sequence.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the string or byte array with the replacement.\n */\nexport function stringReplaceOne(\n expression: Expression,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression;\nexport function stringReplaceOne(\n expr: Expression | string,\n find: string | Expression | Bytes,\n replacement: string | Expression | Bytes\n): FunctionExpression {\n return fieldOrExpression(expr).stringReplaceOne(find, replacement);\n}\n\n/**\n * @beta\n *\n * Accesses a value from a map (object) field using the provided key.\n *\n * @example\n * ```typescript\n * // Get the 'city' value from the 'address' map field\n * mapGet(\"address\", \"city\");\n * ```\n *\n * @param fieldName - The field name of the map field.\n * @param subField - The key to access in the map.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the value associated with the given key in the map.\n */\nexport function mapGet(fieldName: string, subField: string): FunctionExpression;\n\n/**\n * @beta\n *\n * Accesses a value from a map (object) expression using the provided key.\n *\n * @example\n * ```typescript\n * // Get the 'city' value from the 'address' map field\n * mapGet(field(\"address\"), \"city\");\n * ```\n *\n * @param mapExpression - The expression representing the map.\n * @param subField - The key to access in the map.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the value associated with the given key in the map.\n */\nexport function mapGet(\n mapExpression: Expression,\n subField: string\n): FunctionExpression;\nexport function mapGet(\n fieldOrExpr: string | Expression,\n subField: string\n): FunctionExpression {\n return fieldOrExpression(fieldOrExpr).mapGet(subField);\n}\n\n/**\n * @beta\n * Creates an expression that returns a new map with the specified entries added or updated.\n *\n * @remarks\n * This only performs shallow updates to the map. Setting a value to `null`\n * will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.\n *\n * @example\n * ```typescript\n * // Set the 'city' to 'San Francisco' in the 'address' map field\n * mapSet(\"address\", \"city\", \"San Francisco\");\n * ```\n *\n * @param mapField - The map field to set entries in.\n * @param key - The key to set. Must be a string or a constant string expression.\n * @param value - The value to set.\n * @param moreKeyValues - Additional key-value pairs to set.\n * @returns A new `Expression` representing the map with the entries set.\n */\nexport function mapSet(\n mapField: string,\n key: string | Expression,\n value: unknown,\n ...moreKeyValues: unknown[]\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns a new map with the specified entries added or updated.\n *\n * @remarks\n * This only performs shallow updates to the map. Setting a value to `null`\n * will retain the key with a `null` value. To remove a key entirely, use `mapRemove`.\n *\n * @example\n * ```typescript\n * // Set the 'city' to \"San Francisco\"\n * mapSet(map({\"state\": \"California\"}), \"city\", \"San Francisco\");\n * ```\n *\n * @param mapExpression - The expression representing the map.\n * @param key - The key to set. Must be a string or a constant string expression.\n * @param value - The value to set.\n * @param moreKeyValues - Additional key-value pairs to set.\n * @returns A new `Expression` representing the map with the entries set.\n */\nexport function mapSet(\n mapExpression: Expression,\n key: string | Expression,\n value: unknown,\n ...moreKeyValues: unknown[]\n): FunctionExpression;\nexport function mapSet(\n fieldOrExpr: string | Expression,\n key: string | Expression,\n value: unknown,\n ...moreKeyValues: unknown[]\n): FunctionExpression {\n return fieldOrExpression(fieldOrExpr).mapSet(key, value, ...moreKeyValues);\n}\n\n/**\n * @beta\n * Creates an expression that returns the keys of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the keys of the 'address' map field\n * mapKeys(\"address\");\n * ```\n *\n * @param mapField - The map field to get the keys of.\n * @returns A new `Expression` representing the keys of the map.\n */\nexport function mapKeys(mapField: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the keys of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the keys of the map expression\n * mapKeys(map({\"city\": \"San Francisco\"}));\n * ```\n *\n * @param mapExpression - The expression representing the map to get the keys of.\n * @returns A new `Expression` representing the keys of the map.\n */\nexport function mapKeys(mapExpression: Expression): FunctionExpression;\nexport function mapKeys(fieldOrExpr: string | Expression): FunctionExpression {\n return fieldOrExpression(fieldOrExpr).mapKeys();\n}\n\n/**\n * @beta\n * Creates an expression that returns the values of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the values of the 'address' map field\n * mapValues(\"address\");\n * ```\n *\n * @param mapField - The map field to get the values of.\n * @returns A new `Expression` representing the values of the map.\n */\nexport function mapValues(mapField: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the values of a map.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the values of the map expression\n * mapValues(map({\"city\": \"San Francisco\"}));\n * ```\n *\n * @param mapExpression - The expression representing the map to get the values of.\n * @returns A new `Expression` representing the values of the map.\n */\nexport function mapValues(mapExpression: Expression): FunctionExpression;\nexport function mapValues(\n fieldOrExpr: string | Expression\n): FunctionExpression {\n return fieldOrExpression(fieldOrExpr).mapValues();\n}\n\n/**\n * @beta\n * Creates an expression that returns the entries of a map as an array of maps,\n * where each map contains a `\"k\"` property for the key and a `\"v\"` property for the value.\n * For example: `[{ k: \"key1\", v: \"value1\" }, ...]`.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the entries of the 'address' map field\n * mapEntries(\"address\");\n * ```\n *\n * @param mapField - The map field to get the entries of.\n * @returns A new `Expression` representing the entries of the map.\n */\nexport function mapEntries(mapField: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the entries of a map as an array of maps,\n * where each map contains a `\"k\"` property for the key and a `\"v\"` property for the value.\n * For example: `[{ k: \"key1\", v: \"value1\" }, ...]`.\n *\n * @remarks\n * While the backend generally preserves insertion order, relying on the\n * order of the output array is not guaranteed and should be avoided.\n *\n * @example\n * ```typescript\n * // Get the entries of the map expression\n * mapEntries(map({\"city\": \"San Francisco\"}));\n * ```\n *\n * @param mapExpression - The expression representing the map to get the entries of.\n * @returns A new `Expression` representing the entries of the map.\n */\nexport function mapEntries(mapExpression: Expression): FunctionExpression;\nexport function mapEntries(\n fieldOrExpr: string | Expression\n): FunctionExpression {\n return fieldOrExpression(fieldOrExpr).mapEntries();\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that counts the total number of stage inputs.\n *\n * @example\n * ```typescript\n * // Count the total number of input documents\n * countAll().as(\"totalDocument\");\n * ```\n *\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'countAll' aggregation.\n */\nexport function countAll(): AggregateFunction {\n return AggregateFunction._create('count', [], 'count');\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that counts the number of stage inputs with valid evaluations of the\n * provided expression.\n *\n * @example\n * ```typescript\n * // Count the number of items where the price is greater than 10\n * count(field(\"price\").greaterThan(10)).as(\"expensiveItemCount\");\n * ```\n *\n * @param expression - The expression to count.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'count' aggregation.\n */\nexport function count(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n * Creates an aggregation that counts the number of stage inputs where the input field exists.\n *\n * @example\n * ```typescript\n * // Count the total number of products\n * count(\"productId\").as(\"totalProducts\");\n * ```\n *\n * @param fieldName - The name of the field to count.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'count' aggregation.\n */\nexport function count(fieldName: string): AggregateFunction;\nexport function count(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).count();\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that calculates the sum of values from an expression across multiple\n * stage inputs.\n *\n * @example\n * ```typescript\n * // Calculate the total revenue from a set of orders\n * sum(field(\"orderAmount\")).as(\"totalRevenue\");\n * ```\n *\n * @param expression - The expression to sum up.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'sum' aggregation.\n */\nexport function sum(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n *\n * Creates an aggregation that calculates the sum of a field's values across multiple stage\n * inputs.\n *\n * @example\n * ```typescript\n * // Calculate the total revenue from a set of orders\n * sum(\"orderAmount\").as(\"totalRevenue\");\n * ```\n *\n * @param fieldName - The name of the field containing numeric values to sum up.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'sum' aggregation.\n */\nexport function sum(fieldName: string): AggregateFunction;\nexport function sum(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).sum();\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that calculates the average (mean) of values from an expression across\n * multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Calculate the average age of users\n * average(field(\"age\")).as(\"averageAge\");\n * ```\n *\n * @param expression - The expression representing the values to average.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'average' aggregation.\n */\nexport function average(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n *\n * Creates an aggregation that calculates the average (mean) of a field's values across multiple\n * stage inputs.\n *\n * @example\n * ```typescript\n * // Calculate the average age of users\n * average(\"age\").as(\"averageAge\");\n * ```\n *\n * @param fieldName - The name of the field containing numeric values to average.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'average' aggregation.\n */\nexport function average(fieldName: string): AggregateFunction;\nexport function average(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).average();\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that finds the minimum value of an expression across multiple stage\n * inputs.\n *\n * @example\n * ```typescript\n * // Find the lowest price of all products\n * minimum(field(\"price\")).as(\"lowestPrice\");\n * ```\n *\n * @param expression - The expression to find the minimum value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'minimum' aggregation.\n */\nexport function minimum(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n *\n * Creates an aggregation that finds the minimum value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the lowest price of all products\n * minimum(\"price\").as(\"lowestPrice\");\n * ```\n *\n * @param fieldName - The name of the field to find the minimum value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'minimum' aggregation.\n */\nexport function minimum(fieldName: string): AggregateFunction;\nexport function minimum(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).minimum();\n}\n\n/**\n * @beta\n *\n * Creates an aggregation that finds the maximum value of an expression across multiple stage\n * inputs.\n *\n * @example\n * ```typescript\n * // Find the highest score in a leaderboard\n * maximum(field(\"score\")).as(\"highestScore\");\n * ```\n *\n * @param expression - The expression to find the maximum value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'maximum' aggregation.\n */\nexport function maximum(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n *\n * Creates an aggregation that finds the maximum value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the highest score in a leaderboard\n * maximum(\"score\").as(\"highestScore\");\n * ```\n *\n * @param fieldName - The name of the field to find the maximum value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'maximum' aggregation.\n */\nexport function maximum(fieldName: string): AggregateFunction;\nexport function maximum(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).maximum();\n}\n\n/**\n * @beta\n * Creates an aggregation that finds the first value of an expression across multiple stage\n * inputs.\n *\n * @example\n * ```typescript\n * // Find the first value of the 'rating' field\n * first(field(\"rating\")).as(\"firstRating\");\n * ```\n *\n * @param expression - The expression to find the first value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'first' aggregation.\n */\nexport function first(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n * Creates an aggregation that finds the first value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the first value of the 'rating' field\n * first(\"rating\").as(\"firstRating\");\n * ```\n *\n * @param fieldName - The name of the field to find the first value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'first' aggregation.\n */\nexport function first(fieldName: string): AggregateFunction;\nexport function first(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).first();\n}\n\n/**\n * @beta\n * Creates an aggregation that finds the last value of an expression across multiple stage\n * inputs.\n *\n * @example\n * ```typescript\n * // Find the last value of the 'rating' field\n * last(field(\"rating\")).as(\"lastRating\");\n * ```\n *\n * @param expression - The expression to find the last value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'last' aggregation.\n */\nexport function last(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n * Creates an aggregation that finds the last value of a field across multiple stage inputs.\n *\n * @example\n * ```typescript\n * // Find the last value of the 'rating' field\n * last(\"rating\").as(\"lastRating\");\n * ```\n *\n * @param fieldName - The name of the field to find the last value of.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'last' aggregation.\n */\nexport function last(fieldName: string): AggregateFunction;\nexport function last(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).last();\n}\n\n/**\n * @beta\n * Creates an aggregation that collects all values of an expression across multiple stage\n * inputs into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all tags from books into an array\n * arrayAgg(field(\"tags\")).as(\"allTags\");\n * ```\n *\n * @param expression - The expression to collect values from.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'array_agg' aggregation.\n */\nexport function arrayAgg(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n * Creates an aggregation that collects all values of a field across multiple stage inputs\n * into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all tags from books into an array\n * arrayAgg(\"tags\").as(\"allTags\");\n * ```\n *\n * @param fieldName - The name of the field to collect values from.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'array_agg' aggregation.\n */\nexport function arrayAgg(fieldName: string): AggregateFunction;\nexport function arrayAgg(value: Expression | string): AggregateFunction {\n return fieldOrExpression(value).arrayAgg();\n}\n\n/**\n * @beta\n * Creates an aggregation that collects all distinct values of an expression across multiple stage\n * inputs into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all distinct tags from books into an array\n * arrayAggDistinct(field(\"tags\")).as(\"allDistinctTags\");\n * ```\n *\n * @param expression - The expression to collect values from.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'array_agg_distinct' aggregation.\n */\nexport function arrayAggDistinct(expression: Expression): AggregateFunction;\n\n/**\n * @beta\n * Creates an aggregation that collects all distinct values of a field across multiple stage inputs\n * into an array.\n *\n * @remarks\n * If the expression resolves to an absent value, it is converted to `null`.\n * The order of elements in the output array is not stable and shouldn't be relied upon.\n *\n * @example\n * ```typescript\n * // Collect all distinct tags from books into an array\n * arrayAggDistinct(\"tags\").as(\"allDistinctTags\");\n * ```\n *\n * @param fieldName - The name of the field to collect values from.\n * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'array_agg_distinct' aggregation.\n */\nexport function arrayAggDistinct(fieldName: string): AggregateFunction;\nexport function arrayAggDistinct(\n value: Expression | string\n): AggregateFunction {\n return fieldOrExpression(value).arrayAggDistinct();\n}\n\n/**\n * @beta\n *\n * Calculates the Cosine distance between a field's vector value and a literal vector value.\n *\n * @example\n * ```typescript\n * // Calculate the Cosine distance between the 'location' field and a target location\n * cosineDistance(\"location\", [37.7749, -122.4194]);\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vector - The other vector (as an array of doubles) or {@link VectorValue} to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Cosine distance between the two vectors.\n */\nexport function cosineDistance(\n fieldName: string,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Cosine distance between a field's vector value and a vector expression.\n *\n * @example\n * ```typescript\n * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field\n * cosineDistance(\"userVector\", field(\"itemVector\"));\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vectorExpression - The other vector (represented as an `Expression`) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors.\n */\nexport function cosineDistance(\n fieldName: string,\n vectorExpression: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Cosine distance between a vector expression and a vector literal.\n *\n * @example\n * ```typescript\n * // Calculate the cosine distance between the 'location' field and a target location\n * cosineDistance(field(\"location\"), [37.7749, -122.4194]);\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to compare against.\n * @param vector - The other vector (as an array of doubles or VectorValue) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors.\n */\nexport function cosineDistance(\n vectorExpression: Expression,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Cosine distance between two vector expressions.\n *\n * @example\n * ```typescript\n * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field\n * cosineDistance(field(\"userVector\"), field(\"itemVector\"));\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to compare against.\n * @param otherVectorExpression - The other vector (represented as an `Expression`) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors.\n */\nexport function cosineDistance(\n vectorExpression: Expression,\n otherVectorExpression: Expression\n): FunctionExpression;\nexport function cosineDistance(\n expr: Expression | string,\n other: Expression | number[] | VectorValue\n): FunctionExpression {\n const expr1 = fieldOrExpression(expr);\n const expr2 = vectorToExpr(other);\n return expr1.cosineDistance(expr2);\n}\n\n/**\n * @beta\n *\n * Calculates the dot product between a field's vector value and a double array.\n *\n * @example\n * ```typescript\n * // Calculate the dot product distance between a feature vector and a target vector\n * dotProduct(\"features\", [0.5, 0.8, 0.2]);\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vector - The other vector (as an array of doubles or VectorValue) to calculate with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors.\n */\nexport function dotProduct(\n fieldName: string,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the dot product between a field's vector value and a vector expression.\n *\n * @example\n * ```typescript\n * // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2'\n * dotProduct(\"docVector1\", field(\"docVector2\"));\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vectorExpression - The other vector (represented as an `Expression`) to calculate with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors.\n */\nexport function dotProduct(\n fieldName: string,\n vectorExpression: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the dot product between a vector expression and a double array.\n *\n * @example\n * ```typescript\n * // Calculate the dot product between a feature vector and a target vector\n * dotProduct(field(\"features\"), [0.5, 0.8, 0.2]);\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to calculate with.\n * @param vector - The other vector (as an array of doubles or VectorValue) to calculate with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors.\n */\nexport function dotProduct(\n vectorExpression: Expression,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the dot product between two vector expressions.\n *\n * @example\n * ```typescript\n * // Calculate the dot product between two document vectors: 'docVector1' and 'docVector2'\n * dotProduct(field(\"docVector1\"), field(\"docVector2\"));\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to calculate with.\n * @param otherVectorExpression - The other vector (represented as an `Expression`) to calculate with.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors.\n */\nexport function dotProduct(\n vectorExpression: Expression,\n otherVectorExpression: Expression\n): FunctionExpression;\nexport function dotProduct(\n expr: Expression | string,\n other: Expression | number[] | VectorValue\n): FunctionExpression {\n const expr1 = fieldOrExpression(expr);\n const expr2 = vectorToExpr(other);\n return expr1.dotProduct(expr2);\n}\n\n/**\n * @beta\n *\n * Calculates the Euclidean distance between a field's vector value and a double array.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between the 'location' field and a target location\n * euclideanDistance(\"location\", [37.7749, -122.4194]);\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vector - The other vector (as an array of doubles or VectorValue) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors.\n */\nexport function euclideanDistance(\n fieldName: string,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Euclidean distance between a field's vector value and a vector expression.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB'\n * euclideanDistance(\"pointA\", field(\"pointB\"));\n * ```\n *\n * @param fieldName - The name of the field containing the first vector.\n * @param vectorExpression - The other vector (represented as an `Expression`) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors.\n */\nexport function euclideanDistance(\n fieldName: string,\n vectorExpression: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Euclidean distance between a vector expression and a double array.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between the 'location' field and a target location\n *\n * euclideanDistance(field(\"location\"), [37.7749, -122.4194]);\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to compare against.\n * @param vector - The other vector (as an array of doubles or VectorValue) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors.\n */\nexport function euclideanDistance(\n vectorExpression: Expression,\n vector: number[] | VectorValue\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Calculates the Euclidean distance between two vector expressions.\n *\n * @example\n * ```typescript\n * // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB'\n * euclideanDistance(field(\"pointA\"), field(\"pointB\"));\n * ```\n *\n * @param vectorExpression - The first vector (represented as an `Expression`) to compare against.\n * @param otherVectorExpression - The other vector (represented as an `Expression`) to compare against.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors.\n */\nexport function euclideanDistance(\n vectorExpression: Expression,\n otherVectorExpression: Expression\n): FunctionExpression;\nexport function euclideanDistance(\n expr: Expression | string,\n other: Expression | number[] | VectorValue\n): FunctionExpression {\n const expr1 = fieldOrExpression(expr);\n const expr2 = vectorToExpr(other);\n return expr1.euclideanDistance(expr2);\n}\n\n/**\n * @beta\n *\n * Creates an expression that calculates the length of a Firestore Vector.\n *\n * @example\n * ```typescript\n * // Get the vector length (dimension) of the field 'embedding'.\n * vectorLength(field(\"embedding\"));\n * ```\n *\n * @param vectorExpression - The expression representing the Firestore Vector.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array.\n */\nexport function vectorLength(vectorExpression: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that calculates the length of a Firestore Vector represented by a field.\n *\n * @example\n * ```typescript\n * // Get the vector length (dimension) of the field 'embedding'.\n * vectorLength(\"embedding\");\n * ```\n *\n * @param fieldName - The name of the field representing the Firestore Vector.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array.\n */\nexport function vectorLength(fieldName: string): FunctionExpression;\nexport function vectorLength(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).vectorLength();\n}\n\n/**\n * @beta\n *\n * Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'microseconds' field as microseconds since epoch.\n * unixMicrosToTimestamp(field(\"microseconds\"));\n * ```\n *\n * @param expr - The expression representing the number of microseconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixMicrosToTimestamp(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'microseconds' field as microseconds since epoch.\n * unixMicrosToTimestamp(\"microseconds\");\n * ```\n *\n * @param fieldName - The name of the field representing the number of microseconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixMicrosToTimestamp(fieldName: string): FunctionExpression;\nexport function unixMicrosToTimestamp(\n expr: Expression | string\n): FunctionExpression {\n return fieldOrExpression(expr).unixMicrosToTimestamp();\n}\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to microseconds since epoch.\n * timestampToUnixMicros(field(\"timestamp\"));\n * ```\n *\n * @param expr - The expression representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch.\n */\nexport function timestampToUnixMicros(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to microseconds since epoch.\n * timestampToUnixMicros(\"timestamp\");\n * ```\n *\n * @param fieldName - The name of the field representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch.\n */\nexport function timestampToUnixMicros(fieldName: string): FunctionExpression;\nexport function timestampToUnixMicros(\n expr: Expression | string\n): FunctionExpression {\n return fieldOrExpression(expr).timestampToUnixMicros();\n}\n\n/**\n * @beta\n *\n * Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'milliseconds' field as milliseconds since epoch.\n * unixMillisToTimestamp(field(\"milliseconds\"));\n * ```\n *\n * @param expr - The expression representing the number of milliseconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixMillisToTimestamp(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'milliseconds' field as milliseconds since epoch.\n * unixMillisToTimestamp(\"milliseconds\");\n * ```\n *\n * @param fieldName - The name of the field representing the number of milliseconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixMillisToTimestamp(fieldName: string): FunctionExpression;\nexport function unixMillisToTimestamp(\n expr: Expression | string\n): FunctionExpression {\n const normalizedExpr = fieldOrExpression(expr);\n return normalizedExpr.unixMillisToTimestamp();\n}\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to milliseconds since epoch.\n * timestampToUnixMillis(field(\"timestamp\"));\n * ```\n *\n * @param expr - The expression representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch.\n */\nexport function timestampToUnixMillis(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to milliseconds since epoch.\n * timestampToUnixMillis(\"timestamp\");\n * ```\n *\n * @param fieldName - The name of the field representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch.\n */\nexport function timestampToUnixMillis(fieldName: string): FunctionExpression;\nexport function timestampToUnixMillis(\n expr: Expression | string\n): FunctionExpression {\n const normalizedExpr = fieldOrExpression(expr);\n return normalizedExpr.timestampToUnixMillis();\n}\n\n/**\n * @beta\n *\n * Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'seconds' field as seconds since epoch.\n * unixSecondsToTimestamp(field(\"seconds\"));\n * ```\n *\n * @param expr - The expression representing the number of seconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixSecondsToTimestamp(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC)\n * and returns a timestamp.\n *\n * @example\n * ```typescript\n * // Interpret the 'seconds' field as seconds since epoch.\n * unixSecondsToTimestamp(\"seconds\");\n * ```\n *\n * @param fieldName - The name of the field representing the number of seconds since epoch.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp.\n */\nexport function unixSecondsToTimestamp(fieldName: string): FunctionExpression;\nexport function unixSecondsToTimestamp(\n expr: Expression | string\n): FunctionExpression {\n const normalizedExpr = fieldOrExpression(expr);\n return normalizedExpr.unixSecondsToTimestamp();\n}\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to seconds since epoch.\n * timestampToUnixSeconds(field(\"timestamp\"));\n * ```\n *\n * @param expr - The expression representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch.\n */\nexport function timestampToUnixSeconds(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).\n *\n * @example\n * ```typescript\n * // Convert the 'timestamp' field to seconds since epoch.\n * timestampToUnixSeconds(\"timestamp\");\n * ```\n *\n * @param fieldName - The name of the field representing the timestamp.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch.\n */\nexport function timestampToUnixSeconds(fieldName: string): FunctionExpression;\nexport function timestampToUnixSeconds(\n expr: Expression | string\n): FunctionExpression {\n const normalizedExpr = fieldOrExpression(expr);\n return normalizedExpr.timestampToUnixSeconds();\n}\n\n/**\n * @beta\n *\n * Creates an expression that adds a specified amount of time to a timestamp.\n *\n * @example\n * ```typescript\n * // Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field.\n * timestampAdd(field(\"timestamp\"), field(\"unit\"), field(\"amount\"));\n * ```\n *\n * @param timestamp - The expression representing the timestamp.\n * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'.\n * @param amount - The expression evaluates to amount of the unit.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampAdd(\n timestamp: Expression,\n unit: Expression,\n amount: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that adds a specified amount of time to a timestamp.\n *\n * @example\n * ```typescript\n * // Add 1 day to the 'timestamp' field.\n * timestampAdd(field(\"timestamp\"), \"day\", 1);\n * ```\n *\n * @param timestamp - The expression representing the timestamp.\n * @param unit - The unit of time to add (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampAdd(\n timestamp: Expression,\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that adds a specified amount of time to a timestamp represented by a field.\n *\n * @example\n * ```typescript\n * // Add 1 day to the 'timestamp' field.\n * timestampAdd(\"timestamp\", \"day\", 1);\n * ```\n *\n * @param fieldName - The name of the field representing the timestamp.\n * @param unit - The unit of time to add (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to add.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampAdd(\n fieldName: string,\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n): FunctionExpression;\nexport function timestampAdd(\n timestamp: Expression | string,\n unit:\n | Expression\n | 'microsecond'\n | 'millisecond'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day',\n amount: Expression | number\n): FunctionExpression {\n const normalizedTimestamp = fieldOrExpression(timestamp);\n const normalizedUnit = valueToDefaultExpr(unit);\n const normalizedAmount = valueToDefaultExpr(amount);\n return normalizedTimestamp.timestampAdd(normalizedUnit, normalizedAmount);\n}\n\n/**\n * @beta\n *\n * Creates an expression that subtracts a specified amount of time from a timestamp.\n *\n * @example\n * ```typescript\n * // Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field.\n * timestampSubtract(field(\"timestamp\"), field(\"unit\"), field(\"amount\"));\n * ```\n *\n * @param timestamp - The expression representing the timestamp.\n * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'.\n * @param amount - The expression evaluates to amount of the unit.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampSubtract(\n timestamp: Expression,\n unit: Expression,\n amount: Expression\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that subtracts a specified amount of time from a timestamp.\n *\n * @example\n * ```typescript\n * // Subtract 1 day from the 'timestamp' field.\n * timestampSubtract(field(\"timestamp\"), \"day\", 1);\n * ```\n *\n * @param timestamp - The expression representing the timestamp.\n * @param unit - The unit of time to subtract (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampSubtract(\n timestamp: Expression,\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n): FunctionExpression;\n\n/**\n * @beta\n *\n * Creates an expression that subtracts a specified amount of time from a timestamp represented by a field.\n *\n * @example\n * ```typescript\n * // Subtract 1 day from the 'timestamp' field.\n * timestampSubtract(\"timestamp\", \"day\", 1);\n * ```\n *\n * @param fieldName - The name of the field representing the timestamp.\n * @param unit - The unit of time to subtract (e.g., \"day\", \"hour\").\n * @param amount - The amount of time to subtract.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp.\n */\nexport function timestampSubtract(\n fieldName: string,\n unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day',\n amount: number\n): FunctionExpression;\nexport function timestampSubtract(\n timestamp: Expression | string,\n unit:\n | Expression\n | 'microsecond'\n | 'millisecond'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day',\n amount: Expression | number\n): FunctionExpression {\n const normalizedTimestamp = fieldOrExpression(timestamp);\n const normalizedUnit = valueToDefaultExpr(unit);\n const normalizedAmount = valueToDefaultExpr(amount);\n return normalizedTimestamp.timestampSubtract(\n normalizedUnit,\n normalizedAmount\n );\n}\n\n/**\n * @beta\n *\n * Creates an expression that evaluates to the current server timestamp.\n *\n * @example\n * ```typescript\n * // Get the current server timestamp\n * currentTimestamp()\n * ```\n *\n * @returns A new Expression representing the current server timestamp.\n */\nexport function currentTimestamp(): FunctionExpression {\n return new FunctionExpression('current_timestamp', [], 'currentTimestamp');\n}\n\n/**\n * @beta\n *\n * Creates an expression that performs a logical 'AND' operation on multiple filter conditions.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is greater than 18 AND the 'city' field is \"London\" AND\n * // the 'status' field is \"active\"\n * const condition = and(greaterThan(\"age\", 18), equal(\"city\", \"London\"), equal(\"status\", \"active\"));\n * ```\n *\n * @param first - The first filter condition.\n * @param second - The second filter condition.\n * @param more - Additional filter conditions to 'AND' together.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'AND' operation.\n */\nexport function and(\n first: BooleanExpression,\n second: BooleanExpression,\n ...more: BooleanExpression[]\n): BooleanExpression {\n return new FunctionExpression(\n 'and',\n [first, second, ...more],\n 'and'\n ).asBoolean();\n}\n\n/**\n * @beta\n *\n * Creates an expression that performs a logical 'OR' operation on multiple filter conditions.\n *\n * @example\n * ```typescript\n * // Check if the 'age' field is greater than 18 OR the 'city' field is \"London\" OR\n * // the 'status' field is \"active\"\n * const condition = or(greaterThan(\"age\", 18), equal(\"city\", \"London\"), equal(\"status\", \"active\"));\n * ```\n *\n * @param first - The first filter condition.\n * @param second - The second filter condition.\n * @param more - Additional filter conditions to 'OR' together.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'OR' operation.\n */\nexport function or(\n first: BooleanExpression,\n second: BooleanExpression,\n ...more: BooleanExpression[]\n): BooleanExpression {\n return new FunctionExpression(\n 'or',\n [first, second, ...more],\n 'xor'\n ).asBoolean();\n}\n\n/**\n * @beta\n * Creates an expression that returns the value of the base expression raised to the power of the exponent expression.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of the 'exponent' field.\n * pow(field(\"base\"), field(\"exponent\"));\n * ```\n *\n * @param base - The expression to raise to the power of the exponent.\n * @param exponent - The expression to raise the base to the power of.\n * @returns A new `Expression` representing the power operation.\n */\nexport function pow(base: Expression, exponent: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the value of the base expression raised to the power of the exponent.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of 2.\n * pow(field(\"base\"), 2);\n * ```\n *\n * @param base - The expression to raise to the power of the exponent.\n * @param exponent - The constant value to raise the base to the power of.\n * @returns A new `Expression` representing the power operation.\n */\nexport function pow(base: Expression, exponent: number): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the value of the base field raised to the power of the exponent expression.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of the 'exponent' field.\n * pow(\"base\", field(\"exponent\"));\n * ```\n *\n * @param base - The name of the field to raise to the power of the exponent.\n * @param exponent - The expression to raise the base to the power of.\n * @returns A new `Expression` representing the power operation.\n */\nexport function pow(base: string, exponent: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the value of the base field raised to the power of the exponent.\n *\n * @example\n * ```typescript\n * // Raise the value of the 'base' field to the power of 2.\n * pow(\"base\", 2);\n * ```\n *\n * @param base - The name of the field to raise to the power of the exponent.\n * @param exponent - The constant value to raise the base to the power of.\n * @returns A new `Expression` representing the power operation.\n */\nexport function pow(base: string, exponent: number): FunctionExpression;\nexport function pow(\n base: Expression | string,\n exponent: Expression | number\n): FunctionExpression {\n return fieldOrExpression(base).pow(exponent as number);\n}\n\n/**\n * @beta\n *\n * Creates an expression that generates a random number between 0.0 and 1.0 but not including 1.0.\n *\n * @example\n * ```typescript\n * // Generate a random number between 0.0 and 1.0.\n * rand();\n * ```\n *\n * @returns A new `Expression` representing the rand operation.\n */\nexport function rand(): FunctionExpression {\n return new FunctionExpression('rand', [], 'rand');\n}\n\n/**\n * @beta\n * Creates an expression that rounds a numeric value to the nearest whole number.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field.\n * round(\"price\");\n * ```\n *\n * @param fieldName - The name of the field to round.\n * @returns A new `Expression` representing the rounded value.\n */\nexport function round(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that rounds a numeric value to the nearest whole number.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field.\n * round(field(\"price\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which will be rounded.\n * @returns A new `Expression` representing the rounded value.\n */\nexport function round(expression: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that rounds a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field to two decimal places.\n * round(\"price\", 2);\n * ```\n *\n * @param fieldName - The name of the field to round.\n * @param decimalPlaces - A constant or expression specifying the rounding precision in decimal places.\n * @returns A new `Expression` representing the rounded value.\n */\nexport function round(\n fieldName: string,\n decimalPlaces: number | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that rounds a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Round the value of the 'price' field to two decimal places.\n * round(field(\"price\"), constant(2));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which will be rounded.\n * @param decimalPlaces - A constant or expression specifying the rounding precision in decimal places.\n * @returns A new `Expression` representing the rounded value.\n */\nexport function round(\n expression: Expression,\n decimalPlaces: number | Expression\n): FunctionExpression;\nexport function round(\n expr: Expression | string,\n decimalPlaces?: number | Expression\n): FunctionExpression {\n if (decimalPlaces === undefined) {\n return fieldOrExpression(expr).round();\n } else {\n return fieldOrExpression(expr).round(valueToDefaultExpr(decimalPlaces));\n }\n}\n\n/**\n * @beta\n * Creates an expression that truncates the numeric value of a field to an integer.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field\n * trunc(\"rating\");\n * ```\n *\n * @param fieldName - The name of the field containing the number to truncate.\n * @returns A new `Expression` representing the truncated value.\n */\nexport function trunc(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates the numeric value of an expression to an integer.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field.\n * trunc(field(\"rating\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which will be truncated.\n * @returns A new `Expression` representing the truncated value.\n */\nexport function trunc(expression: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates a numeric expression to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field to two decimal places.\n * trunc(\"rating\", 2);\n * ```\n *\n * @param fieldName - The name of the field to truncate.\n * @param decimalPlaces - A constant or expression specifying the truncation precision in decimal places.\n * @returns A new `Expression` representing the truncated value.\n */\nexport function trunc(\n fieldName: string,\n decimalPlaces: number | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates a numeric value to the specified number of decimal places.\n *\n * @example\n * ```typescript\n * // Truncate the value of the 'rating' field to two decimal places.\n * trunc(field(\"rating\"), constant(2));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which will be truncated.\n * @param decimalPlaces - A constant or expression specifying the truncation precision in decimal places.\n * @returns A new `Expression` representing the truncated value.\n */\nexport function trunc(\n expression: Expression,\n decimalPlaces: number | Expression\n): FunctionExpression;\nexport function trunc(\n expr: Expression | string,\n decimalPlaces?: number | Expression\n): FunctionExpression {\n if (decimalPlaces === undefined) {\n return fieldOrExpression(expr).trunc();\n } else {\n return fieldOrExpression(expr).trunc(valueToDefaultExpr(decimalPlaces));\n }\n}\n\n/**\n * @beta\n * Creates an expression that returns the collection ID from a path.\n *\n * @example\n * ```typescript\n * // Get the collection ID from a path.\n * collectionId(\"__name__\");\n * ```\n *\n * @param fieldName - The name of the field to get the collection ID from.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation.\n */\nexport function collectionId(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that returns the collection ID from a path.\n *\n * @example\n * ```typescript\n * // Get the collection ID from a path.\n * collectionId(field(\"__name__\"));\n * ```\n *\n * @param expression - An expression evaluating to a path, which the collection ID will be extracted from.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation.\n */\nexport function collectionId(expression: Expression): FunctionExpression;\nexport function collectionId(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).collectionId();\n}\n\n/**\n * @beta\n * Creates an expression that calculates the length of a string, array, map, vector, or bytes.\n *\n * @example\n * ```typescript\n * // Get the length of the 'name' field.\n * length(\"name\");\n *\n * // Get the number of items in the 'cart' array.\n * length(\"cart\");\n * ```\n *\n * @param fieldName - The name of the field to calculate the length of.\n * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes.\n */\nexport function length(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that calculates the length of a string, array, map, vector, or bytes.\n *\n * @example\n * ```typescript\n * // Get the length of the 'name' field.\n * length(field(\"name\"));\n *\n * // Get the number of items in the 'cart' array.\n * length(field(\"cart\"));\n * ```\n *\n * @param expression - An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for.\n * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes.\n */\nexport function length(expression: Expression): FunctionExpression;\nexport function length(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).length();\n}\n\n/**\n * @beta\n * Creates an expression that computes the natural logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the natural logarithm of the 'value' field.\n * ln(\"value\");\n * ```\n *\n * @param fieldName - The name of the field to compute the natural logarithm of.\n * @returns A new `Expression` representing the natural logarithm of the numeric value.\n */\nexport function ln(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the natural logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the natural logarithm of the 'value' field.\n * ln(field(\"value\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the natural logarithm will be computed for.\n * @returns A new `Expression` representing the natural logarithm of the numeric value.\n */\nexport function ln(expression: Expression): FunctionExpression;\nexport function ln(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).ln();\n}\n\n/**\n * @beta\n * Creates an expression that computes the logarithm of an expression to a given base.\n *\n * @example\n * ```typescript\n * // Compute the logarithm of the 'value' field with base 10.\n * log(field(\"value\"), 10);\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the logarithm will be computed for.\n * @param base - The base of the logarithm.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value.\n */\nexport function log(expression: Expression, base: number): FunctionExpression;\n/**\n * @beta\n * Creates an expression that computes the logarithm of an expression to a given base.\n *\n * @example\n * ```typescript\n * // Compute the logarithm of the 'value' field with the base in the 'base' field.\n * log(field(\"value\"), field(\"base\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the logarithm will be computed for.\n * @param base - The base of the logarithm.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value.\n */\nexport function log(\n expression: Expression,\n base: Expression\n): FunctionExpression;\n/**\n * @beta\n * Creates an expression that computes the logarithm of a field to a given base.\n *\n * @example\n * ```typescript\n * // Compute the logarithm of the 'value' field with base 10.\n * log(\"value\", 10);\n * ```\n *\n * @param fieldName - The name of the field to compute the logarithm of.\n * @param base - The base of the logarithm.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value.\n */\nexport function log(fieldName: string, base: number): FunctionExpression;\n/**\n * @beta\n * Creates an expression that computes the logarithm of a field to a given base.\n *\n * @example\n * ```typescript\n * // Compute the logarithm of the 'value' field with the base in the 'base' field.\n * log(\"value\", field(\"base\"));\n * ```\n *\n * @param fieldName - The name of the field to compute the logarithm of.\n * @param base - The base of the logarithm.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value.\n */\nexport function log(fieldName: string, base: Expression): FunctionExpression;\nexport function log(\n expr: Expression | string,\n base: number | Expression\n): FunctionExpression {\n return new FunctionExpression('log', [\n fieldOrExpression(expr),\n valueToDefaultExpr(base)\n ]);\n}\n\n/**\n * @beta\n * Creates an expression that computes the square root of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the square root of the 'value' field.\n * sqrt(field(\"value\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the square root will be computed for.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value.\n */\nexport function sqrt(expression: Expression): FunctionExpression;\n/**\n * @beta\n * Creates an expression that computes the square root of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the square root of the 'value' field.\n * sqrt(\"value\");\n * ```\n *\n * @param fieldName - The name of the field to compute the square root of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value.\n */\nexport function sqrt(fieldName: string): FunctionExpression;\nexport function sqrt(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).sqrt();\n}\n\n/**\n * @beta\n * Creates an expression that reverses a string.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * strReverse(field(\"myString\"));\n * ```\n *\n * @param stringExpression - An expression evaluating to a string value, which will be reversed.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\nexport function stringReverse(stringExpression: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that reverses a string value in the specified field.\n *\n * @example\n * ```typescript\n * // Reverse the value of the 'myString' field.\n * strReverse(\"myString\");\n * ```\n *\n * @param field - The name of the field representing the string to reverse.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string.\n */\nexport function stringReverse(field: string): FunctionExpression;\nexport function stringReverse(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).stringReverse();\n}\n\n/**\n * @beta\n * Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.\n *\n * @example\n * ```typescript\n * // Concatenate the 'firstName' and 'lastName' fields with a space in between.\n * concat(field(\"firstName\"), \" \", field(\"lastName\"))\n * ```\n *\n * @param first - The first expressions to concatenate.\n * @param second - The second literal or expression to concatenate.\n * @param others - Additional literals or expressions to concatenate.\n * @returns A new `Expression` representing the concatenation.\n */\nexport function concat(\n first: Expression,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed.\n *\n * @example\n * ```typescript\n * // Concatenate a field with a literal string.\n * concat(field(\"firstName\"), \"Doe\")\n * ```\n *\n * @param fieldName - The name of a field to concatenate.\n * @param second - The second literal or expression to concatenate.\n * @param others - Additional literal or expressions to concatenate.\n * @returns A new `Expression` representing the concatenation.\n */\nexport function concat(\n fieldName: string,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression;\n\nexport function concat(\n fieldNameOrExpression: string | Expression,\n second: Expression | unknown,\n ...others: Array<Expression | unknown>\n): FunctionExpression {\n return new FunctionExpression('concat', [\n fieldOrExpression(fieldNameOrExpression),\n valueToDefaultExpr(second),\n ...others.map(valueToDefaultExpr)\n ]);\n}\n\n/**\n * @beta\n * Creates an expression that computes the absolute value of a numeric value.\n *\n * @param expr - The expression to compute the absolute value of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value.\n */\nexport function abs(expr: Expression): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the absolute value of a numeric value.\n *\n * @param fieldName - The field to compute the absolute value of.\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value.\n */\nexport function abs(fieldName: string): FunctionExpression;\nexport function abs(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).abs();\n}\n\n/**\n * @beta\n * Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return\n * the result of the `ifExpr` argument evaluation.\n *\n * @example\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or returns 'default_value'\n * // if the field is absent.\n * ifAbsent(field(\"optional_field\"), constant(\"default_value\"))\n * ```\n *\n * @param ifExpr - The expression to check for absence.\n * @param elseExpr - The expression that will be evaluated and returned if [ifExpr] is absent.\n * @returns A new Expression representing the ifAbsent operation.\n */\nexport function ifAbsent(ifExpr: Expression, elseExpr: Expression): Expression;\n\n/**\n * @beta\n * Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else\n * return the result of the `ifExpr` argument evaluation.\n *\n * @example\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or returns 'default_value'\n * // if the field is absent.\n * ifAbsent(field(\"optional_field\"), \"default_value\")\n * ```\n *\n * @param ifExpr - The expression to check for absence.\n * @param elseValue - The value that will be returned if `ifExpr` evaluates to an absent value.\n * @returns A new [Expression] representing the ifAbsent operation.\n */\nexport function ifAbsent(ifExpr: Expression, elseValue: unknown): Expression;\n\n/**\n * @beta\n * Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else\n * return the value of the field.\n *\n * @example\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or returns the value of\n * // 'default_field' if 'optional_field' is absent.\n * ifAbsent(\"optional_field\", field(\"default_field\"))\n * ```\n *\n * @param ifFieldName - The field to check for absence.\n * @param elseExpr - The expression that will be evaluated and returned if `ifFieldName` is\n * absent.\n * @returns A new Expression representing the ifAbsent operation.\n */\nexport function ifAbsent(ifFieldName: string, elseExpr: Expression): Expression;\n\n/**\n * @beta\n * Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else\n * return the value of the field.\n *\n * @example\n * ```typescript\n * // Returns the value of the optional field 'optional_field', or returns 'default_value'\n * // if the field is absent.\n * ifAbsent(\"optional_field\", \"default_value\")\n * ```\n *\n * @param ifFieldName - The field to check for absence.\n * @param elseValue - The value that will be returned if [ifFieldName] is absent.\n * @returns A new Expression representing the ifAbsent operation.\n */\nexport function ifAbsent(\n ifFieldName: string | Expression,\n elseValue: Expression | unknown\n): Expression;\nexport function ifAbsent(\n fieldNameOrExpression: string | Expression,\n elseValue: Expression | unknown\n): Expression {\n return fieldOrExpression(fieldNameOrExpression).ifAbsent(\n valueToDefaultExpr(elseValue)\n );\n}\n\n/**\n * @beta\n * Creates an expression that joins the elements of an array into a string.\n *\n * @example\n * ```typescript\n * // Join the elements of the 'tags' field with a comma and space.\n * join(\"tags\", \", \")\n * ```\n *\n * @param arrayFieldName - The name of the field containing the array.\n * @param delimiter - The string to use as a delimiter.\n * @returns A new Expression representing the join operation.\n */\nexport function join(arrayFieldName: string, delimiter: string): Expression;\n\n/**\n * @beta\n * Creates an expression that joins the elements of an array into a string.\n *\n * @example\n * ```typescript\n * // Join an array of string using the delimiter from the 'separator' field.\n * join(array(['foo', 'bar']), field(\"separator\"))\n * ```\n *\n * @param arrayExpression - An expression that evaluates to an array.\n * @param delimiterExpression - The expression that evaluates to the delimiter string.\n * @returns A new Expression representing the join operation.\n */\nexport function join(\n arrayExpression: Expression,\n delimiterExpression: Expression\n): Expression;\n\n/**\n * @beta\n * Creates an expression that joins the elements of an array into a string.\n *\n * @example\n * ```typescript\n * // Join the elements of the 'tags' field with a comma and space.\n * join(field(\"tags\"), \", \")\n * ```\n *\n * @param arrayExpression - An expression that evaluates to an array.\n * @param delimiter - The string to use as a delimiter.\n * @returns A new Expression representing the join operation.\n */\nexport function join(\n arrayExpression: Expression,\n delimiter: string\n): Expression;\n\n/**\n * @beta\n * Creates an expression that joins the elements of an array into a string.\n *\n * @example\n * ```typescript\n * // Join the elements of the 'tags' field with the delimiter from the 'separator' field.\n * join('tags', field(\"separator\"))\n * ```\n *\n * @param arrayFieldName - The name of the field containing the array.\n * @param delimiterExpression - The expression that evaluates to the delimiter string.\n * @returns A new Expression representing the join operation.\n */\nexport function join(\n arrayFieldName: string,\n delimiterExpression: Expression\n): Expression;\nexport function join(\n fieldNameOrExpression: string | Expression,\n delimiterValueOrExpression: Expression | string\n): Expression {\n return fieldOrExpression(fieldNameOrExpression).join(\n valueToDefaultExpr(delimiterValueOrExpression)\n );\n}\n\n/**\n * @beta\n * Creates an expression that computes the base-10 logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the base-10 logarithm of the 'value' field.\n * log10(\"value\");\n * ```\n *\n * @param fieldName - The name of the field to compute the base-10 logarithm of.\n * @returns A new `Expression` representing the base-10 logarithm of the numeric value.\n */\nexport function log10(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the base-10 logarithm of a numeric value.\n *\n * @example\n * ```typescript\n * // Compute the base-10 logarithm of the 'value' field.\n * log10(field(\"value\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric value, which the base-10 logarithm will be computed for.\n * @returns A new `Expression` representing the base-10 logarithm of the numeric value.\n */\nexport function log10(expression: Expression): FunctionExpression;\nexport function log10(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).log10();\n}\n\n/**\n * @beta\n * Creates an expression that computes the sum of the elements in an array.\n *\n * @example\n * ```typescript\n * // Compute the sum of the elements in the 'scores' field.\n * arraySum(\"scores\");\n * ```\n *\n * @param fieldName - The name of the field to compute the sum of.\n * @returns A new `Expression` representing the sum of the elements in the array.\n */\nexport function arraySum(fieldName: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that computes the sum of the elements in an array.\n *\n * @example\n * ```typescript\n * // Compute the sum of the elements in the 'scores' field.\n * arraySum(field(\"scores\"));\n * ```\n *\n * @param expression - An expression evaluating to a numeric array, which the sum will be computed for.\n * @returns A new `Expression` representing the sum of the elements in the array.\n */\nexport function arraySum(expression: Expression): FunctionExpression;\nexport function arraySum(expr: Expression | string): FunctionExpression {\n return fieldOrExpression(expr).arraySum();\n}\n\n/**\n * @beta\n * Creates an expression that splits the value of a field on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scoresCsv' field on delimiter ','\n * split('scoresCsv', ',')\n * ```\n *\n * @param fieldName - Split the value in this field.\n * @param delimiter - Split on this delimiter.\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\nexport function split(fieldName: string, delimiter: string): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that splits the value of a field on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scores' field on delimiter ',' or ':' depending on the stored format\n * split('scores', conditional(field('format').equal('csv'), constant(','), constant(':'))\n * ```\n *\n * @param fieldName - Split the value in this field.\n * @param delimiter - Split on this delimiter returned by evaluating this expression.\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\nexport function split(\n fieldName: string,\n delimiter: Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that splits a string into an array of substrings based on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scoresCsv' field on delimiter ','\n * split(field('scoresCsv'), ',')\n * ```\n *\n * @param expression - Split the result of this expression.\n * @param delimiter - Split on this delimiter.\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\nexport function split(\n expression: Expression,\n delimiter: string\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that splits a string into an array of substrings based on the provided delimiter.\n *\n * @example\n * ```typescript\n * // Split the 'scores' field on delimiter ',' or ':' depending on the stored format\n * split(field('scores'), conditional(field('format').equal('csv'), constant(','), constant(':'))\n * ```\n *\n * @param expression - Split the result of this expression.\n * @param delimiter - Split on this delimiter returned by evaluating this expression.\n *\n * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function.\n */\nexport function split(\n expression: Expression,\n delimiter: Expression\n): FunctionExpression;\nexport function split(\n fieldNameOrExpression: string | Expression,\n delimiter: string | Expression\n): FunctionExpression {\n return fieldOrExpression(fieldNameOrExpression).split(\n valueToDefaultExpr(delimiter)\n );\n}\n\n/**\n * @beta\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the beginning of the day.\n * field('createdAt').timestampTruncate('day')\n * ```\n *\n * @param fieldName - Truncate the timestamp value contained in this field.\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\nexport function timestampTruncate(\n fieldName: string,\n granularity: TimeGranularity,\n timezone?: string | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the granularity specified in the field 'granularity'.\n * field('createdAt').timestampTruncate(field('granularity'))\n * ```\n *\n * @param fieldName - Truncate the timestamp value contained in this field.\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\nexport function timestampTruncate(\n fieldName: string,\n granularity: Expression,\n timezone?: string | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the beginning of the day.\n * field('createdAt').timestampTruncate('day')\n * ```\n *\n * @param timestampExpression - Truncate the timestamp value that is returned by this expression.\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\nexport function timestampTruncate(\n timestampExpression: Expression,\n granularity: TimeGranularity,\n timezone?: string | Expression\n): FunctionExpression;\n\n/**\n * @beta\n * Creates an expression that truncates a timestamp to a specified granularity.\n *\n * @example\n * ```typescript\n * // Truncate the 'createdAt' timestamp to the granularity specified in the field 'granularity'.\n * field('createdAt').timestampTruncate(field('granularity'))\n * ```\n *\n * @param timestampExpression - Truncate the timestamp value that is returned by this expression.\n * @param granularity - The granularity to truncate to.\n * @param timezone - The timezone to use for truncation. Valid values are from\n * the TZ database (e.g., \"America/Los_Angeles\") or in the format \"Etc/GMT-1\".\n * @returns A new `Expression` representing the truncated timestamp.\n */\nexport function timestampTruncate(\n timestampExpression: Expression,\n granularity: Expression,\n timezone?: string | Expression\n): FunctionExpression;\nexport function timestampTruncate(\n fieldNameOrExpression: string | Expression,\n granularity: TimeGranularity | Expression,\n timezone?: string | Expression\n): FunctionExpression {\n const internalGranularity = isString(granularity)\n ? valueToDefaultExpr(granularity.toLowerCase())\n : granularity;\n return fieldOrExpression(fieldNameOrExpression).timestampTruncate(\n internalGranularity,\n timezone\n );\n}\n\n// TODO(new-expression): Add new top-level expression function definitions above this line\n\n/**\n * @beta\n *\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on an expression.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'name' field in lowercase in ascending order\n * firestore.pipeline().collection(\"users\")\n * .sort(ascending(field(\"name\").toLower()));\n * ```\n *\n * @param expr - The expression to create an ascending ordering for.\n * @returns A new `Ordering` for ascending sorting.\n */\nexport function ascending(expr: Expression): Ordering;\n\n/**\n * @beta\n *\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on a field.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'name' field in ascending order\n * firestore.pipeline().collection(\"users\")\n * .sort(ascending(\"name\"));\n * ```\n *\n * @param fieldName - The field to create an ascending ordering for.\n * @returns A new `Ordering` for ascending sorting.\n */\nexport function ascending(fieldName: string): Ordering;\nexport function ascending(field: Expression | string): Ordering {\n return new Ordering(fieldOrExpression(field), 'ascending', 'ascending');\n}\n\n/**\n * @beta\n *\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on an expression.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'name' field in lowercase in descending order\n * firestore.pipeline().collection(\"users\")\n * .sort(descending(field(\"name\").toLower()));\n * ```\n *\n * @param expr - The expression to create a descending ordering for.\n * @returns A new `Ordering` for descending sorting.\n */\nexport function descending(expr: Expression): Ordering;\n\n/**\n * @beta\n *\n * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on a field.\n *\n * @example\n * ```typescript\n * // Sort documents by the 'name' field in descending order\n * firestore.pipeline().collection(\"users\")\n * .sort(descending(\"name\"));\n * ```\n *\n * @param fieldName - The field to create a descending ordering for.\n * @returns A new `Ordering` for descending sorting.\n */\nexport function descending(fieldName: string): Ordering;\nexport function descending(field: Expression | string): Ordering {\n return new Ordering(fieldOrExpression(field), 'descending', 'descending');\n}\n\n/**\n * @beta\n *\n * Represents an ordering criterion for sorting documents in a Firestore pipeline.\n *\n * You create `Ordering` instances using the `ascending` and `descending` helper functions.\n */\nexport class Ordering implements ProtoValueSerializable, UserData {\n constructor(\n public readonly expr: Expression,\n public readonly direction: 'ascending' | 'descending',\n readonly _methodName: string | undefined\n ) {}\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoValue {\n return {\n mapValue: {\n fields: {\n direction: toStringValue(this.direction),\n expression: this.expr._toProto(serializer)\n }\n }\n };\n }\n\n /**\n * @private\n * @internal\n */\n _readUserData(context: ParseContext): void {\n this.expr._readUserData(context);\n }\n\n _protoValueType: 'ProtoValue' = 'ProtoValue';\n}\n\nexport function isSelectable(val: unknown): val is Selectable {\n const candidate = val as Selectable;\n return (\n candidate.selectable && isString(candidate.alias) && isExpr(candidate.expr)\n );\n}\n\nexport function isOrdering(val: unknown): val is Ordering {\n const candidate = val as Ordering;\n return (\n isExpr(candidate.expr) &&\n (candidate.direction === 'ascending' ||\n candidate.direction === 'descending')\n );\n}\n\nexport function isAliasedAggregate(val: unknown): val is AliasedAggregate {\n const candidate = val as AliasedAggregate;\n return (\n isString(candidate.alias) &&\n candidate.aggregate instanceof AggregateFunction\n );\n}\n\nexport function isExpr(val: unknown): val is Expression {\n return val instanceof Expression;\n}\n\nexport function isBooleanExpr(val: unknown): val is BooleanExpression {\n return val instanceof BooleanExpression;\n}\n\nexport function isField(val: unknown): val is Field {\n return val instanceof Field;\n}\n\nexport function toField(value: string | Field): Field {\n if (isString(value)) {\n const result = field(value);\n return result;\n } else {\n return value as Field;\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\nimport { Firestore } from '../lite-api/database';\nimport {\n Constant,\n BooleanExpression,\n and,\n or,\n Ordering,\n lessThan,\n greaterThan,\n field\n} from '../lite-api/expressions';\nimport { Pipeline } from '../lite-api/pipeline';\nimport { doc } from '../lite-api/reference';\nimport { fail } from '../util/assert';\n\nimport { Bound } from './bound';\nimport {\n CompositeFilter as CompositeFilterInternal,\n CompositeOperator,\n FieldFilter as FieldFilterInternal,\n Filter as FilterInternal,\n Operator\n} from './filter';\nimport { Direction } from './order_by';\nimport {\n isCollectionGroupQuery,\n isDocumentQuery,\n LimitType,\n Query,\n queryNormalizedOrderBy\n} from './query';\n\n/* eslint @typescript-eslint/no-explicit-any: 0 */\n\nexport function toPipelineBooleanExpr(f: FilterInternal): BooleanExpression {\n if (f instanceof FieldFilterInternal) {\n const fieldValue = field(f.field.toString());\n // Comparison filters\n const value = f.value;\n switch (f.op) {\n case Operator.LESS_THAN:\n return and(\n fieldValue.exists(),\n fieldValue.lessThan(Constant._fromProto(value))\n );\n case Operator.LESS_THAN_OR_EQUAL:\n return and(\n fieldValue.exists(),\n fieldValue.lessThanOrEqual(Constant._fromProto(value))\n );\n case Operator.GREATER_THAN:\n return and(\n fieldValue.exists(),\n fieldValue.greaterThan(Constant._fromProto(value))\n );\n case Operator.GREATER_THAN_OR_EQUAL:\n return and(\n fieldValue.exists(),\n fieldValue.greaterThanOrEqual(Constant._fromProto(value))\n );\n case Operator.EQUAL:\n return and(\n fieldValue.exists(),\n fieldValue.equal(Constant._fromProto(value))\n );\n case Operator.NOT_EQUAL:\n return fieldValue.notEqual(Constant._fromProto(value));\n case Operator.ARRAY_CONTAINS:\n return and(\n fieldValue.exists(),\n fieldValue.arrayContains(Constant._fromProto(value))\n );\n case Operator.IN: {\n const values = value?.arrayValue?.values?.map((val: any) =>\n Constant._fromProto(val)\n );\n if (!values) {\n return and(fieldValue.exists(), fieldValue.equalAny([]));\n } else if (values.length === 1) {\n return and(fieldValue.exists(), fieldValue.equal(values[0]));\n } else {\n return and(fieldValue.exists(), fieldValue.equalAny(values));\n }\n }\n case Operator.ARRAY_CONTAINS_ANY: {\n const values = value?.arrayValue?.values?.map((val: any) =>\n Constant._fromProto(val)\n );\n return and(fieldValue.exists(), fieldValue.arrayContainsAny(values!));\n }\n case Operator.NOT_IN: {\n const values = value?.arrayValue?.values?.map((val: any) =>\n Constant._fromProto(val)\n );\n if (!values) {\n return fieldValue.notEqualAny([]);\n } else if (values.length === 1) {\n return fieldValue.notEqual(values[0]);\n } else {\n return fieldValue.notEqualAny(values);\n }\n }\n default:\n fail(0x9047, 'Unexpected operator');\n }\n } else if (f instanceof CompositeFilterInternal) {\n switch (f.op) {\n case CompositeOperator.AND: {\n const conditions = f.getFilters().map(f => toPipelineBooleanExpr(f));\n return and(conditions[0], conditions[1], ...conditions.slice(2));\n }\n case CompositeOperator.OR: {\n const conditions = f.getFilters().map(f => toPipelineBooleanExpr(f));\n return or(conditions[0], conditions[1], ...conditions.slice(2));\n }\n default:\n fail(0x89ea, 'Unexpected operator');\n }\n }\n\n throw new Error(`Failed to convert filter to pipeline conditions: ${f}`);\n}\n\nfunction reverseOrderings(orderings: Ordering[]): Ordering[] {\n return orderings.map(\n o =>\n new Ordering(\n o.expr,\n o.direction === 'ascending' ? 'descending' : 'ascending',\n undefined\n )\n );\n}\n\nexport function toPipeline(query: Query, db: Firestore): Pipeline {\n let pipeline: Pipeline;\n if (isCollectionGroupQuery(query)) {\n pipeline = db.pipeline().collectionGroup(query.collectionGroup!);\n } else if (isDocumentQuery(query)) {\n pipeline = db.pipeline().documents([doc(db, query.path.canonicalString())]);\n } else {\n pipeline = db.pipeline().collection(query.path.canonicalString());\n }\n\n // filters\n for (const filter of query.filters) {\n pipeline = pipeline.where(toPipelineBooleanExpr(filter));\n }\n\n // orders\n const orders = queryNormalizedOrderBy(query);\n const existsConditions = query.explicitOrderBy.map(order =>\n field(order.field.canonicalString()).exists()\n );\n if (existsConditions.length > 0) {\n const condition =\n existsConditions.length === 1\n ? existsConditions[0]\n : and(\n existsConditions[0],\n existsConditions[1],\n ...existsConditions.slice(2)\n );\n pipeline = pipeline.where(condition);\n }\n\n const orderings = orders.map(order =>\n order.dir === Direction.ASCENDING\n ? field(order.field.canonicalString()).ascending()\n : field(order.field.canonicalString()).descending()\n );\n\n if (orderings.length > 0) {\n if (query.limitType === LimitType.Last) {\n const actualOrderings = reverseOrderings(orderings);\n pipeline = pipeline.sort(actualOrderings[0], ...actualOrderings.slice(1));\n // cursors\n if (query.startAt !== null) {\n pipeline = pipeline.where(\n whereConditionsFromCursor(query.startAt, orderings, 'after')\n );\n }\n\n if (query.endAt !== null) {\n pipeline = pipeline.where(\n whereConditionsFromCursor(query.endAt, orderings, 'before')\n );\n }\n\n pipeline = pipeline.limit(query.limit!);\n pipeline = pipeline.sort(orderings[0], ...orderings.slice(1));\n } else {\n pipeline = pipeline.sort(orderings[0], ...orderings.slice(1));\n if (query.startAt !== null) {\n pipeline = pipeline.where(\n whereConditionsFromCursor(query.startAt, orderings, 'after')\n );\n }\n if (query.endAt !== null) {\n pipeline = pipeline.where(\n whereConditionsFromCursor(query.endAt, orderings, 'before')\n );\n }\n\n if (query.limit !== null) {\n pipeline = pipeline.limit(query.limit);\n }\n }\n }\n\n return pipeline;\n}\n\nfunction whereConditionsFromCursor(\n bound: Bound,\n orderings: Ordering[],\n position: 'before' | 'after'\n): BooleanExpression {\n // The filterFunc is either greater than or less than\n const filterFunc = position === 'before' ? lessThan : greaterThan;\n const cursors = bound.position.map(value => Constant._fromProto(value));\n const size = cursors.length;\n\n let field = orderings[size - 1].expr;\n let value = cursors[size - 1];\n\n // Add condition for last bound\n let condition: BooleanExpression = filterFunc(field, value);\n if (bound.inclusive) {\n // When the cursor bound is inclusive, then the last bound\n // can be equal to the value, otherwise it's not equal\n condition = or(condition, field.equal(value));\n }\n\n // Iterate backwards over the remaining bounds, adding\n // a condition for each one\n for (let i = size - 2; i >= 0; i--) {\n field = orderings[i].expr;\n value = cursors[i];\n\n // For each field in the orderings, the condition is either\n // a) lt|gt the cursor value,\n // b) or equal the cursor value and lt|gt the cursor values for other fields\n condition = or(\n filterFunc(field, value),\n and(field.equal(value), condition)\n );\n }\n\n return condition;\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\nimport { ParseContext } from '../api/parse_context';\nimport { OptionsUtil } from '../core/options_util';\nimport {\n ApiClientObjectMap,\n firestoreV1ApiClientInterfaces,\n Stage as ProtoStage\n} from '../protos/firestore_proto_api';\nimport { toNumber } from '../remote/number_serializer';\nimport {\n JsonProtoSerializer,\n ProtoSerializable,\n toMapValue,\n toPipelineValue,\n toStringValue\n} from '../remote/serializer';\nimport { hardAssert } from '../util/assert';\n\nimport {\n AggregateFunction,\n BooleanExpression,\n Expression,\n Field,\n field,\n Ordering\n} from './expressions';\nimport { Pipeline } from './pipeline';\nimport { StageOptions } from './stage_options';\nimport { isUserData, UserData } from './user_data_reader';\n\n/**\n * @beta\n */\nexport abstract class Stage implements ProtoSerializable<ProtoStage>, UserData {\n /**\n * Store optionsProto parsed by _readUserData.\n * @private\n * @internal\n * @protected\n */\n protected optionsProto:\n | ApiClientObjectMap<firestoreV1ApiClientInterfaces.Value>\n | undefined = undefined;\n protected knownOptions: Record<string, unknown>;\n protected rawOptions?: Record<string, unknown>;\n\n constructor(options: StageOptions) {\n ({ rawOptions: this.rawOptions, ...this.knownOptions } = options);\n }\n\n _readUserData(context: ParseContext): void {\n this.optionsProto = this._optionsUtil.getOptionsProto(\n context,\n this.knownOptions,\n this.rawOptions\n );\n }\n\n _toProto(_: JsonProtoSerializer): ProtoStage {\n return {\n name: this._name,\n options: this.optionsProto\n };\n }\n\n abstract get _optionsUtil(): OptionsUtil;\n abstract get _name(): string;\n}\n\n/**\n * @beta\n */\nexport class AddFields extends Stage {\n get _name(): string {\n return 'add_fields';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private fields: Map<string, Expression>, options: StageOptions) {\n super(options);\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toMapValue(serializer, this.fields)]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.fields, context);\n }\n}\n\n/**\n * @beta\n */\nexport class RemoveFields extends Stage {\n get _name(): string {\n return 'remove_fields';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private fields: Field[], options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: this.fields.map(f => f._toProto(serializer))\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.fields, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Aggregate extends Stage {\n get _name(): string {\n return 'aggregate';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(\n private groups: Map<string, Expression>,\n private accumulators: Map<string, AggregateFunction>,\n options: StageOptions\n ) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [\n toMapValue(serializer, this.accumulators),\n toMapValue(serializer, this.groups)\n ]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.groups, context);\n readUserDataHelper(this.accumulators, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Distinct extends Stage {\n get _name(): string {\n return 'distinct';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private groups: Map<string, Expression>, options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toMapValue(serializer, this.groups)]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.groups, context);\n }\n}\n\n/**\n * @beta\n */\nexport class CollectionSource extends Stage {\n get _name(): string {\n return 'collection';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({\n forceIndex: {\n serverName: 'force_index'\n }\n });\n }\n\n private formattedCollectionPath: string;\n\n constructor(collection: string, options: StageOptions) {\n super(options);\n\n // prepend slash to collection string\n this.formattedCollectionPath = collection.startsWith('/')\n ? collection\n : '/' + collection;\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [{ referenceValue: this.formattedCollectionPath }]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class CollectionGroupSource extends Stage {\n get _name(): string {\n return 'collection_group';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({\n forceIndex: {\n serverName: 'force_index'\n }\n });\n }\n\n constructor(private collectionId: string, options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [{ referenceValue: '' }, { stringValue: this.collectionId }]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class DatabaseSource extends Stage {\n get _name(): string {\n return 'database';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer)\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class DocumentsSource extends Stage {\n get _name(): string {\n return 'documents';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n private formattedPaths: string[];\n\n constructor(docPaths: string[], options: StageOptions) {\n super(options);\n this.formattedPaths = docPaths.map(path =>\n path.startsWith('/') ? path : '/' + path\n );\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: this.formattedPaths.map(p => {\n return { referenceValue: p };\n })\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class Where extends Stage {\n get _name(): string {\n return 'where';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private condition: BooleanExpression, options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [this.condition._toProto(serializer)]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.condition, context);\n }\n}\n\n/**\n * @beta\n */\nexport class FindNearest extends Stage {\n get _name(): string {\n return 'find_nearest';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({\n limit: {\n serverName: 'limit'\n },\n distanceField: {\n serverName: 'distance_field'\n }\n });\n }\n\n constructor(\n private vectorValue: Expression,\n private field: Field,\n private distanceMeasure: 'euclidean' | 'cosine' | 'dot_product',\n options: StageOptions\n ) {\n super(options);\n }\n\n /**\n * @private\n * @internal\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [\n this.field._toProto(serializer),\n this.vectorValue._toProto(serializer),\n toStringValue(this.distanceMeasure)\n ]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.vectorValue, context);\n readUserDataHelper(this.field, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Limit extends Stage {\n get _name(): string {\n return 'limit';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private limit: number, options: StageOptions) {\n hardAssert(\n !isNaN(limit) && limit !== Infinity && limit !== -Infinity,\n 0x882c,\n 'Invalid limit value'\n );\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toNumber(serializer, this.limit)]\n };\n }\n}\n\n/**\n * @beta\n */\nexport class Offset extends Stage {\n get _name(): string {\n return 'offset';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private offset: number, options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toNumber(serializer, this.offset)]\n };\n }\n}\n\n/**\n * @beta\n */\nexport class Select extends Stage {\n get _name(): string {\n return 'select';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(\n private selections: Map<string, Expression>,\n options: StageOptions\n ) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toMapValue(serializer, this.selections)]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.selections, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Sort extends Stage {\n get _name(): string {\n return 'sort';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private orderings: Ordering[], options: StageOptions) {\n super(options);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: this.orderings.map(o => o._toProto(serializer))\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.orderings, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Sample extends Stage {\n get _name(): string {\n return 'sample';\n }\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(\n private rate: number,\n private mode: 'percent' | 'documents',\n options: StageOptions\n ) {\n super(options);\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toNumber(serializer, this.rate)!, toStringValue(this.mode)!]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class Union extends Stage {\n get _name(): string {\n return 'union';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private other: Pipeline, options: StageOptions) {\n super(options);\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [toPipelineValue(this.other._toProto(serializer))]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n }\n}\n\n/**\n * @beta\n */\nexport class Unnest extends Stage {\n get _name(): string {\n return 'unnest';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({\n indexField: {\n serverName: 'index_field'\n }\n });\n }\n\n constructor(\n private alias: string,\n private expr: Expression,\n options: StageOptions\n ) {\n super(options);\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [\n this.expr._toProto(serializer),\n field(this.alias)._toProto(serializer)\n ]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.expr, context);\n }\n}\n\n/**\n * @beta\n */\nexport class Replace extends Stage {\n static readonly MODE = 'full_replace';\n\n get _name(): string {\n return 'replace_with';\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n\n constructor(private map: Expression, options: StageOptions) {\n super(options);\n }\n\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n ...super._toProto(serializer),\n args: [this.map._toProto(serializer), toStringValue(Replace.MODE)]\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.map, context);\n }\n}\n\n/**\n * @beta\n */\nexport class RawStage extends Stage {\n /**\n * @private\n * @internal\n */\n constructor(\n private name: string,\n private params: Array<AggregateFunction | Expression>,\n rawOptions: Record<string, unknown>\n ) {\n super({ rawOptions });\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(serializer: JsonProtoSerializer): ProtoStage {\n return {\n name: this.name,\n args: this.params.map(o => o._toProto(serializer)),\n options: this.optionsProto\n };\n }\n\n _readUserData(context: ParseContext): void {\n super._readUserData(context);\n readUserDataHelper(this.params, context);\n }\n\n get _name(): string {\n return this.name;\n }\n\n get _optionsUtil(): OptionsUtil {\n return new OptionsUtil({});\n }\n}\n\n/**\n * Helper to read user data across a number of different formats.\n * @param name - Name of the calling function. Used for error messages when invalid user data is encountered.\n * @param expressionMap\n * @returns the expressionMap argument.\n * @private\n */\nfunction readUserDataHelper<\n T extends Map<string, UserData> | UserData[] | UserData\n>(expressionMap: T, context: ParseContext): T {\n if (isUserData(expressionMap)) {\n expressionMap._readUserData(context);\n } else if (Array.isArray(expressionMap)) {\n expressionMap.forEach(readableData => readableData._readUserData(context));\n } else {\n expressionMap.forEach(expr => expr._readUserData(context));\n }\n return expressionMap;\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\nimport { DatabaseId } from '../core/database_info';\nimport { toPipeline } from '../core/pipeline-util';\nimport { Code, FirestoreError } from '../util/error';\nimport { isString } from '../util/types';\n\nimport { Pipeline } from './pipeline';\nimport {\n CollectionReference,\n DocumentReference,\n isCollectionReference,\n Query\n} from './reference';\nimport {\n CollectionGroupSource,\n CollectionSource,\n DatabaseSource,\n DocumentsSource,\n Stage\n} from './stage';\nimport {\n CollectionGroupStageOptions,\n CollectionStageOptions,\n DatabaseStageOptions,\n DocumentsStageOptions\n} from './stage_options';\nimport { UserDataReader, UserDataSource } from './user_data_reader';\n\n/**\n * @beta\n * Provides the entry point for defining the data source of a Firestore {@link @firebase/firestore/pipelines#Pipeline}.\n *\n * Use the methods of this class (e.g., {@link @firebase/firestore/pipelines#PipelineSource.(collection:1)}, {@link @firebase/firestore/pipelines#PipelineSource.(collectionGroup:1)},\n * {@link @firebase/firestore/pipelines#PipelineSource.(database:1)}, or {@link @firebase/firestore/pipelines#PipelineSource.(documents:1)}) to specify the initial data\n * for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents.\n */\nexport class PipelineSource<PipelineType> {\n /**\n * @internal\n * @private\n * @param databaseId\n * @param userDataReader\n * @param _createPipeline\n */\n constructor(\n private databaseId: DatabaseId,\n private userDataReader: UserDataReader,\n /**\n * @internal\n * @private\n */\n public _createPipeline: (stages: Stage[]) => PipelineType\n ) {}\n\n /**\n * @beta\n * Returns all documents from the entire collection. The collection can be nested.\n * @param collection - Name or reference to the collection that will be used as the Pipeline source.\n */\n collection(collection: string | CollectionReference): PipelineType;\n /**\n * @beta\n * Returns all documents from the entire collection. The collection can be nested.\n * @param options - Options defining how this CollectionStage is evaluated.\n */\n collection(options: CollectionStageOptions): PipelineType;\n collection(\n collectionOrOptions: string | CollectionReference | CollectionStageOptions\n ): PipelineType {\n // Process argument union(s) from method overloads\n const options =\n isString(collectionOrOptions) ||\n isCollectionReference(collectionOrOptions)\n ? {}\n : collectionOrOptions;\n const collectionRefOrString =\n isString(collectionOrOptions) ||\n isCollectionReference(collectionOrOptions)\n ? collectionOrOptions\n : collectionOrOptions.collection;\n\n // Validate that a user provided reference is for the same Firestore DB\n if (isCollectionReference(collectionRefOrString)) {\n this._validateReference(collectionRefOrString);\n }\n\n // Convert user land convenience types to internal types\n const normalizedCollection = isString(collectionRefOrString)\n ? (collectionRefOrString as string)\n : collectionRefOrString.path;\n\n // Create stage object\n const stage = new CollectionSource(normalizedCollection, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'collection'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._createPipeline([stage]);\n }\n\n /**\n * @beta\n * Returns all documents from a collection ID regardless of the parent.\n * @param collectionId - ID of the collection group to use as the Pipeline source.\n */\n collectionGroup(collectionId: string): PipelineType;\n /**\n * @beta\n * Returns all documents from a collection ID regardless of the parent.\n * @param options - Options defining how this CollectionGroupStage is evaluated.\n */\n collectionGroup(options: CollectionGroupStageOptions): PipelineType;\n collectionGroup(\n collectionIdOrOptions: string | CollectionGroupStageOptions\n ): PipelineType {\n // Process argument union(s) from method overloads\n let collectionId: string;\n let options: {};\n if (isString(collectionIdOrOptions)) {\n collectionId = collectionIdOrOptions;\n options = {};\n } else {\n ({ collectionId, ...options } = collectionIdOrOptions);\n }\n\n // Create stage object\n const stage = new CollectionGroupSource(collectionId, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'collectionGroup'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._createPipeline([stage]);\n }\n\n /**\n * @beta\n * Returns all documents from the entire database.\n */\n database(): PipelineType;\n /**\n * @beta\n * Returns all documents from the entire database.\n * @param options - Options defining how a DatabaseStage is evaluated.\n */\n database(options: DatabaseStageOptions): PipelineType;\n database(options?: DatabaseStageOptions): PipelineType {\n // Process argument union(s) from method overloads\n options = options ?? {};\n\n // Create stage object\n const stage = new DatabaseSource(options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'database'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._createPipeline([stage]);\n }\n\n /**\n * @beta\n * Set the pipeline's source to the documents specified by the given paths and DocumentReferences.\n *\n * @param docs - An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline.\n * The converters for these DocumentReferences will be ignored and not have an effect on this pipeline.\n *\n * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.\n */\n documents(docs: Array<string | DocumentReference>): PipelineType;\n\n /**\n * @beta\n * Set the pipeline's source to the documents specified by the given paths and DocumentReferences.\n *\n * @param options - Options defining how this DocumentsStage is evaluated.\n *\n * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.\n */\n documents(options: DocumentsStageOptions): PipelineType;\n documents(\n docsOrOptions: Array<string | DocumentReference> | DocumentsStageOptions\n ): PipelineType {\n // Process argument union(s) from method overloads\n let options: {};\n let docs: Array<string | DocumentReference>;\n if (Array.isArray(docsOrOptions)) {\n docs = docsOrOptions;\n options = {};\n } else {\n ({ docs, ...options } = docsOrOptions);\n }\n\n // Validate that all user provided references are for the same Firestore DB\n docs\n .filter(v => v instanceof DocumentReference)\n .forEach(dr => this._validateReference(dr as DocumentReference));\n\n // Convert user land convenience types to internal types\n const normalizedDocs: string[] = docs.map(doc =>\n isString(doc) ? doc : doc.path\n );\n\n // Create stage object\n const stage = new DocumentsSource(normalizedDocs, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'documents'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._createPipeline([stage]);\n }\n\n /**\n * @beta\n * Convert the given Query into an equivalent Pipeline.\n *\n * @param query - A Query to be converted into a Pipeline.\n *\n * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline.\n */\n createFrom(query: Query): Pipeline {\n return toPipeline(query._query, query.firestore);\n }\n\n _validateReference(reference: CollectionReference | DocumentReference): void {\n const refDbId = reference.firestore._databaseId;\n if (!refDbId.isEqual(this.databaseId)) {\n throw new FirestoreError(\n Code.INVALID_ARGUMENT,\n `Invalid ${\n reference instanceof CollectionReference\n ? 'CollectionReference'\n : 'DocumentReference'\n }. ` +\n `The project ID (\"${refDbId.projectId}\") or the database (\"${refDbId.database}\") does not match ` +\n `the project ID (\"${this.databaseId.projectId}\") and database (\"${this.databaseId.database}\") of the target database of this Pipeline.`\n );\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 */\n\nimport { ObjectValue } from '../model/object_value';\nimport { firestoreV1ApiClientInterfaces } from '../protos/firestore_proto_api';\nimport { isOptionalEqual } from '../util/misc';\n\nimport { Field, isField } from './expressions';\nimport { FieldPath } from './field_path';\nimport { Pipeline } from './pipeline';\nimport { DocumentData, DocumentReference, refEqual } from './reference';\nimport { Timestamp } from './timestamp';\nimport { fieldPathFromArgument } from './user_data_reader';\nimport { AbstractUserDataWriter } from './user_data_writer';\n\n/**\n * @beta\n * Represents the results of a Firestore pipeline execution.\n *\n * A `PipelineSnapshot` contains zero or more {@link @firebase/firestore/pipelines#PipelineResult} objects\n * representing the documents returned by a pipeline query. It provides methods\n * to iterate over the documents and access metadata about the query results.\n *\n * @example\n * ```typescript\n * const snapshot: PipelineSnapshot = await firestore\n * .pipeline()\n * .collection('myCollection')\n * .where(field('value').greaterThan(10))\n * .execute();\n *\n * snapshot.results.forEach(doc => {\n * console.log(doc.id, '=>', doc.data());\n * });\n * ```\n */\nexport class PipelineSnapshot {\n private readonly _pipeline: Pipeline;\n private readonly _executionTime: Timestamp | undefined;\n private readonly _results: PipelineResult[];\n constructor(\n pipeline: Pipeline,\n results: PipelineResult[],\n executionTime?: Timestamp\n ) {\n this._pipeline = pipeline;\n this._executionTime = executionTime;\n this._results = results;\n }\n\n /**\n * @beta An array of all the results in the `PipelineSnapshot`.\n */\n get results(): PipelineResult[] {\n return this._results;\n }\n\n /**\n * @beta\n * The time at which the pipeline producing this result is executed.\n *\n * @readonly\n *\n */\n get executionTime(): Timestamp {\n if (this._executionTime === undefined) {\n throw new Error(\n \"'executionTime' is expected to exist, but it is undefined\"\n );\n }\n return this._executionTime;\n }\n}\n\n/**\n * @beta\n *\n * A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the\n * {@link @firebase/firestore/pipelines#PipelineResult.data} or {@link @firebase/firestore/pipelines#PipelineResult.(get:1)} methods.\n *\n * <p>If the PipelineResult represents a non-document result, `ref` will return a undefined\n * value.\n */\nexport class PipelineResult<AppModelType = DocumentData> {\n private readonly _userDataWriter: AbstractUserDataWriter;\n\n private readonly _createTime: Timestamp | undefined;\n private readonly _updateTime: Timestamp | undefined;\n\n /**\n * @internal\n * @private\n */\n readonly _ref: DocumentReference | undefined;\n\n /**\n * @internal\n * @private\n */\n readonly _fields: ObjectValue;\n\n /**\n * @private\n * @internal\n *\n * @param userDataWriter - The serializer used to encode/decode protobuf.\n * @param ref - The reference to the document.\n * @param fields - The fields of the Firestore `Document` Protobuf backing\n * this document.\n * @param createTime - The time when the document was created if the result is a document, undefined otherwise.\n * @param updateTime - The time when the document was last updated if the result is a document, undefined otherwise.\n */\n constructor(\n userDataWriter: AbstractUserDataWriter,\n fields: ObjectValue,\n ref?: DocumentReference,\n createTime?: Timestamp,\n updateTime?: Timestamp\n ) {\n this._ref = ref;\n this._userDataWriter = userDataWriter;\n this._createTime = createTime;\n this._updateTime = updateTime;\n this._fields = fields;\n }\n\n /**\n * @beta\n * The reference of the document, if it is a document; otherwise `undefined`.\n */\n get ref(): DocumentReference | undefined {\n return this._ref;\n }\n\n /**\n * @beta\n * The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`.\n *\n * @readonly\n *\n */\n get id(): string | undefined {\n return this._ref?.id;\n }\n\n /**\n * @beta\n * The time the document was created. Undefined if this result is not a document.\n *\n * @readonly\n */\n get createTime(): Timestamp | undefined {\n return this._createTime;\n }\n\n /**\n * @beta\n * The time the document was last updated (at the time the snapshot was\n * generated). Undefined if this result is not a document.\n *\n * @readonly\n */\n get updateTime(): Timestamp | undefined {\n return this._updateTime;\n }\n\n /**\n * @beta\n * Retrieves all fields in the result as an object.\n *\n * @returns An object containing all fields in the document or\n * 'undefined' if the document doesn't exist.\n *\n * @example\n * ```\n * let p = firestore.pipeline().collection('col');\n *\n * p.execute().then(results => {\n * let data = results[0].data();\n * console.log(`Retrieved data: ${JSON.stringify(data)}`);\n * });\n * ```\n */\n data(): AppModelType {\n return this._userDataWriter.convertValue(\n this._fields.value\n ) as AppModelType;\n }\n\n /**\n * @internal\n * @private\n *\n * Retrieves all fields in the result as a proto value.\n *\n * @returns An `Object` containing all fields in the result.\n */\n _fieldsProto(): { [key: string]: firestoreV1ApiClientInterfaces.Value } {\n // Return a cloned value to prevent manipulation of the Snapshot's data\n return this._fields.clone().value.mapValue.fields!;\n }\n\n /**\n * @beta\n * Retrieves the field specified by `field`.\n *\n * @param field - The field path\n * (e.g. 'foo' or 'foo.bar') to a specific field.\n * @returns The data at the specified field location or `undefined` if no\n * such field exists.\n *\n * @example\n * ```\n * let p = firestore.pipeline().collection('col');\n *\n * p.execute().then(results => {\n * let field = results[0].get('a.b');\n * console.log(`Retrieved field value: ${field}`);\n * });\n * ```\n */\n // We deliberately use `any` in the external API to not impose type-checking\n // on end users.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(fieldPath: string | FieldPath | Field): any {\n if (this._fields === undefined) {\n return undefined;\n }\n if (isField(fieldPath)) {\n fieldPath = fieldPath.fieldName;\n }\n\n const value = this._fields.field(\n fieldPathFromArgument('DocumentSnapshot.get', fieldPath)\n );\n if (value !== null) {\n return this._userDataWriter.convertValue(value);\n }\n }\n}\n\n/**\n * @beta\n * Test equality of two PipelineResults.\n * @param left - First PipelineResult to compare.\n * @param right - Second PipelineResult to compare.\n */\nexport function pipelineResultEqual(\n left: PipelineResult,\n right: PipelineResult\n): boolean {\n if (left === right) {\n return true;\n }\n\n return (\n isOptionalEqual(left._ref, right._ref, refEqual) &&\n isOptionalEqual(left._fields, right._fields, (l, r) => l.isEqual(r))\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\nimport { FirestoreError, vector } from '../api';\nimport {\n _constant,\n AggregateFunction,\n AliasedAggregate,\n array,\n constant,\n Expression,\n AliasedExpression,\n field,\n Field,\n map,\n Selectable\n} from '../lite-api/expressions';\nimport { VectorValue } from '../lite-api/vector_value';\n\nimport { fail } from './assert';\nimport { isPlainObject } from './input_validation';\nimport { isFirestoreValue } from './proto';\nimport { isString } from './types';\n\nexport function selectablesToMap(\n selectables: Array<Selectable | string>\n): Map<string, Expression> {\n const result = new Map<string, Expression>();\n for (const selectable of selectables) {\n let alias: string;\n let expression: Expression;\n if (typeof selectable === 'string') {\n alias = selectable as string;\n expression = field(selectable);\n } else if (selectable instanceof Field) {\n alias = selectable.alias;\n expression = selectable.expr;\n } else if (selectable instanceof AliasedExpression) {\n alias = selectable.alias;\n expression = selectable.expr;\n } else {\n fail(0x5319, '`selectable` has an unsupported type', { selectable });\n }\n\n if (result.get(alias) !== undefined) {\n throw new FirestoreError(\n 'invalid-argument',\n `Duplicate alias or field '${alias}'`\n );\n }\n\n result.set(alias, expression);\n }\n return result;\n}\n\nexport function aliasedAggregateToMap(\n aliasedAggregatees: AliasedAggregate[]\n): Map<string, AggregateFunction> {\n return aliasedAggregatees.reduce(\n (map: Map<string, AggregateFunction>, selectable: AliasedAggregate) => {\n if (map.get(selectable.alias) !== undefined) {\n throw new FirestoreError(\n 'invalid-argument',\n `Duplicate alias or field '${selectable.alias}'`\n );\n }\n\n map.set(selectable.alias, selectable.aggregate as AggregateFunction);\n return map;\n },\n new Map() as Map<string, AggregateFunction>\n );\n}\n\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n *\n * @private\n * @internal\n * @param value\n */\nexport function vectorToExpr(\n value: VectorValue | number[] | Expression\n): Expression {\n if (value instanceof Expression) {\n return value;\n } else if (value instanceof VectorValue) {\n const result = constant(value);\n return result;\n } else if (Array.isArray(value)) {\n const result = constant(vector(value));\n return result;\n } else {\n throw new Error('Unsupported value: ' + typeof value);\n }\n}\n\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n * If the input is a string, it is assumed to be a field name, and a\n * field(value) is returned.\n *\n * @private\n * @internal\n * @param value\n */\nexport function fieldOrExpression(value: unknown): Expression {\n if (isString(value)) {\n const result = field(value);\n return result;\n } else {\n return valueToDefaultExpr(value);\n }\n}\n/**\n * Converts a value to an Expression, Returning either a Constant, MapFunction,\n * ArrayFunction, or the input itself (if it's already an expression).\n *\n * @private\n * @internal\n * @param value\n */\nexport function valueToDefaultExpr(value: unknown): Expression {\n let result: Expression | undefined;\n if (isFirestoreValue(value)) {\n return constant(value);\n }\n if (value instanceof Expression) {\n return value;\n } else if (isPlainObject(value)) {\n result = map(value as Record<string, unknown>);\n } else if (value instanceof Array) {\n result = array(value);\n } else {\n result = _constant(value, undefined);\n }\n\n return result;\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\nimport {\n Pipeline as ProtoPipeline,\n Stage as ProtoStage\n} from '../protos/firestore_proto_api';\nimport { JsonProtoSerializer, ProtoSerializable } from '../remote/serializer';\nimport { isPlainObject } from '../util/input_validation';\nimport {\n aliasedAggregateToMap,\n fieldOrExpression,\n selectablesToMap,\n vectorToExpr\n} from '../util/pipeline_util';\nimport { isNumber, isString } from '../util/types';\n\nimport { Firestore } from './database';\nimport {\n _mapValue,\n AggregateFunction,\n AliasedAggregate,\n BooleanExpression,\n _constant,\n Expression,\n Field,\n field,\n Ordering,\n Selectable,\n _field,\n isSelectable,\n isField,\n isBooleanExpr,\n isAliasedAggregate,\n toField,\n isOrdering,\n isExpr\n} from './expressions';\nimport {\n AddFields,\n Aggregate,\n Distinct,\n FindNearest,\n RawStage,\n Limit,\n Offset,\n RemoveFields,\n Replace,\n Sample,\n Select,\n Sort,\n Stage,\n Union,\n Unnest,\n Where\n} from './stage';\nimport {\n AddFieldsStageOptions,\n AggregateStageOptions,\n DistinctStageOptions,\n FindNearestStageOptions,\n LimitStageOptions,\n OffsetStageOptions,\n RemoveFieldsStageOptions,\n ReplaceWithStageOptions,\n SampleStageOptions,\n SelectStageOptions,\n SortStageOptions,\n StageOptions,\n UnionStageOptions,\n UnnestStageOptions,\n WhereStageOptions\n} from './stage_options';\nimport { UserDataReader, UserDataSource } from './user_data_reader';\nimport { AbstractUserDataWriter } from './user_data_writer';\n\n/**\n * @beta\n *\n * The Pipeline class provides a flexible and expressive framework for building complex data\n * transformation and query pipelines for Firestore.\n *\n * A pipeline takes data sources, such as Firestore collections or collection groups, and applies\n * a series of stages that are chained together. Each stage takes the output from the previous stage\n * (or the data source) and produces an output for the next stage (or as the final output of the\n * pipeline).\n *\n * Expressions can be used within each stage to filter and transform data through the stage.\n *\n * NOTE: The chained stages do not prescribe exactly how Firestore will execute the pipeline.\n * Instead, Firestore only guarantees that the result is the same as if the chained stages were\n * executed in order.\n *\n * Usage Examples:\n *\n * @example\n * ```typescript\n * const db: Firestore; // Assumes a valid firestore instance.\n *\n * // Example 1: Select specific fields and rename 'rating' to 'bookRating'\n * const results1 = await execute(db.pipeline()\n * .collection(\"books\")\n * .select(\"title\", \"author\", field(\"rating\").as(\"bookRating\")));\n *\n * // Example 2: Filter documents where 'genre' is \"Science Fiction\" and 'published' is after 1950\n * const results2 = await execute(db.pipeline()\n * .collection(\"books\")\n * .where(and(field(\"genre\").eq(\"Science Fiction\"), field(\"published\").gt(1950))));\n *\n * // Example 3: Calculate the average rating of books published after 1980\n * const results3 = await execute(db.pipeline()\n * .collection(\"books\")\n * .where(field(\"published\").gt(1980))\n * .aggregate(avg(field(\"rating\")).as(\"averageRating\")));\n * ```\n */\nexport class Pipeline implements ProtoSerializable<ProtoPipeline> {\n /**\n * @internal\n * @private\n * @param _db\n * @param userDataReader\n * @param _userDataWriter\n * @param stages\n */\n constructor(\n /**\n * @internal\n * @private\n */\n public _db: Firestore,\n /**\n * @internal\n * @private\n */\n private userDataReader: UserDataReader,\n /**\n * @internal\n * @private\n */\n public _userDataWriter: AbstractUserDataWriter,\n /**\n * @internal\n * @private\n */\n private stages: Stage[]\n ) {}\n\n /**\n * @beta\n * Adds new fields to outputs from previous stages.\n *\n * This stage allows you to compute values on-the-fly based on existing data from previous\n * stages or constants. You can use this to create new fields or overwrite existing ones (if there\n * is name overlaps).\n *\n * The added fields are defined using {@link @firebase/firestore/pipelines#Selectable}s, which can be:\n *\n * - {@link @firebase/firestore/pipelines#Field}: References an existing document field.\n * - {@link @firebase/firestore/pipelines#Expression}: Either a literal value (see {@link @firebase/firestore/pipelines#(constant:1)}) or a computed value\n * with an assigned alias using {@link @firebase/firestore/pipelines#Expression.(as:1)}.\n *\n * Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection(\"books\")\n * .addFields(\n * field(\"rating\").as(\"bookRating\"), // Rename 'rating' to 'bookRating'\n * add(5, field(\"quantity\")).as(\"totalCost\") // Calculate 'totalCost'\n * );\n * ```\n *\n * @param field - The first field to add to the documents, specified as a {@link @firebase/firestore/pipelines#Selectable}.\n * @param additionalFields - Optional additional fields to add to the documents, specified as {@link @firebase/firestore/pipelines#Selectable}s.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n addFields(field: Selectable, ...additionalFields: Selectable[]): Pipeline;\n /**\n * @beta\n * Adds new fields to outputs from previous stages.\n *\n * This stage allows you to compute values on-the-fly based on existing data from previous\n * stages or constants. You can use this to create new fields or overwrite existing ones (if there\n * is name overlaps).\n *\n * The added fields are defined using {@link @firebase/firestore/pipelines#Selectable}s, which can be:\n *\n * - {@link @firebase/firestore/pipelines#Field}: References an existing document field.\n * - {@link @firebase/firestore/pipelines#Expression}: Either a literal value (see {@link @firebase/firestore/pipelines#(constant:1)}) or a computed value\n * with an assigned alias using {@link @firebase/firestore/pipelines#Expression.(as:1)}.\n *\n * Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection(\"books\")\n * .addFields(\n * field(\"rating\").as(\"bookRating\"), // Rename 'rating' to 'bookRating'\n * add(5, field(\"quantity\")).as(\"totalCost\") // Calculate 'totalCost'\n * );\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n addFields(options: AddFieldsStageOptions): Pipeline;\n addFields(\n fieldOrOptions: Selectable | AddFieldsStageOptions,\n ...additionalFields: Selectable[]\n ): Pipeline {\n // Process argument union(s) from method overloads\n let fields: Selectable[];\n let options: {};\n if (isSelectable(fieldOrOptions)) {\n fields = [fieldOrOptions, ...additionalFields];\n options = {};\n } else {\n ({ fields, ...options } = fieldOrOptions);\n }\n\n // Convert user land convenience types to internal types\n const normalizedFields: Map<string, Expression> = selectablesToMap(fields);\n\n // Create stage object\n const stage = new AddFields(normalizedFields, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'addFields'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Remove fields from outputs of previous stages.\n *\n * Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection('books')\n * // removes field 'rating' and 'cost' from the previous stage outputs.\n * .removeFields(\n * field('rating'),\n * 'cost'\n * );\n * ```\n *\n * @param fieldValue - The first field to remove.\n * @param additionalFields - Optional additional fields to remove.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n removeFields(\n fieldValue: Field | string,\n ...additionalFields: Array<Field | string>\n ): Pipeline;\n /**\n * @beta\n * Remove fields from outputs of previous stages.\n *\n * Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection('books')\n * // removes field 'rating' and 'cost' from the previous stage outputs.\n * .removeFields(\n * field('rating'),\n * 'cost'\n * );\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n removeFields(options: RemoveFieldsStageOptions): Pipeline;\n removeFields(\n fieldValueOrOptions: Field | string | RemoveFieldsStageOptions,\n ...additionalFields: Array<Field | string>\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options =\n isField(fieldValueOrOptions) || isString(fieldValueOrOptions)\n ? {}\n : fieldValueOrOptions;\n const fields: Array<Field | string> =\n isField(fieldValueOrOptions) || isString(fieldValueOrOptions)\n ? [fieldValueOrOptions, ...additionalFields]\n : fieldValueOrOptions.fields;\n\n // Convert user land convenience types to internal types\n const convertedFields: Field[] = fields.map(f =>\n isString(f) ? field(f) : (f as Field)\n );\n\n // Create stage object\n const stage = new RemoveFields(convertedFields, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n stage._readUserData(\n this.userDataReader.createContext(UserDataSource.Argument, 'removeFields')\n );\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Selects or creates a set of fields from the outputs of previous stages.\n *\n * <p>The selected fields are defined using {@link @firebase/firestore/pipelines#Selectable} expressions, which can be:\n *\n * <ul>\n * <li>`string` : Name of an existing field</li>\n * <li>{@link @firebase/firestore/pipelines#Field}: References an existing field.</li>\n * <li>{@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name using\n * {@link @firebase/firestore/pipelines#Expression.(as:1)}</li>\n * </ul>\n *\n * <p>If no selections are provided, the output of this stage is empty. Use {@link\n * @firebase/firestore/pipelines#Pipeline.(addFields:1)} instead if only additions are\n * desired.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * db.pipeline().collection(\"books\")\n * .select(\n * \"firstName\",\n * field(\"lastName\"),\n * field(\"address\").toUppercase().as(\"upperAddress\"),\n * );\n * ```\n *\n * @param selection - The first field to include in the output documents, specified as {@link\n * @firebase/firestore/pipelines#Selectable} expression or string value representing the field name.\n * @param additionalSelections - Optional additional fields to include in the output documents, specified as {@link\n * @firebase/firestore/pipelines#Selectable} expressions or `string` values representing field names.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n select(\n selection: Selectable | string,\n ...additionalSelections: Array<Selectable | string>\n ): Pipeline;\n /**\n * @beta\n * Selects or creates a set of fields from the outputs of previous stages.\n *\n * <p>The selected fields are defined using {@link @firebase/firestore/pipelines#Selectable} expressions, which can be:\n *\n * <ul>\n * <li>`string`: Name of an existing field</li>\n * <li>{@link @firebase/firestore/pipelines#Field}: References an existing field.</li>\n * <li>{@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name using\n * {@link @firebase/firestore/pipelines#Expression.(as:1)}</li>\n * </ul>\n *\n * <p>If no selections are provided, the output of this stage is empty. Use {@link\n * @firebase/firestore/pipelines#Pipeline.(addFields:1)} instead if only additions are\n * desired.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * db.pipeline().collection(\"books\")\n * .select(\n * \"firstName\",\n * field(\"lastName\"),\n * field(\"address\").toUppercase().as(\"upperAddress\"),\n * );\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n select(options: SelectStageOptions): Pipeline;\n select(\n selectionOrOptions: Selectable | string | SelectStageOptions,\n ...additionalSelections: Array<Selectable | string>\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options =\n isSelectable(selectionOrOptions) || isString(selectionOrOptions)\n ? {}\n : selectionOrOptions;\n\n const selections: Array<Selectable | string> =\n isSelectable(selectionOrOptions) || isString(selectionOrOptions)\n ? [selectionOrOptions, ...additionalSelections]\n : selectionOrOptions.selections;\n\n // Convert user land convenience types to internal types\n const normalizedSelections: Map<string, Expression> =\n selectablesToMap(selections);\n\n // Create stage object\n const stage = new Select(normalizedSelections, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'select'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Filters the documents from previous stages to only include those matching the specified {@link\n * @firebase/firestore/pipelines#BooleanExpression}.\n *\n * <p>This stage allows you to apply conditions to the data, similar to a \"WHERE\" clause in SQL.\n * You can filter documents based on their field values, using implementations of {@link\n * @firebase/firestore/pipelines#BooleanExpression}, typically including but not limited to:\n *\n * <ul>\n * <li>field comparators: {@link @firebase/firestore/pipelines#Expression.(equal:1)}, {@link @firebase/firestore/pipelines#Expression.(lessThan:1)}, {@link\n * @firebase/firestore/pipelines#Expression.(greaterThan:1)}, etc.</li>\n * <li>logical operators: {@link @firebase/firestore/pipelines#Expression.(and:1)}, {@link @firebase/firestore/pipelines#Expression.(or:1)}, {@link @firebase/firestore/pipelines#Expression.(not:1)}, etc.</li>\n * <li>advanced functions: {@link @firebase/firestore/pipelines#Expression.(regexMatch:1)}, {@link\n * @firebase/firestore/pipelines#Expression.(arrayContains:1)}, etc.</li>\n * </ul>\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection(\"books\")\n * .where(\n * and(\n * gt(field(\"rating\"), 4.0), // Filter for ratings greater than 4.0\n * field(\"genre\").eq(\"Science Fiction\") // Equivalent to gt(\"genre\", \"Science Fiction\")\n * )\n * );\n * ```\n *\n * @param condition - The {@link @firebase/firestore/pipelines#BooleanExpression} to apply.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n where(condition: BooleanExpression): Pipeline;\n /**\n * @beta\n * Filters the documents from previous stages to only include those matching the specified {@link\n * @firebase/firestore/pipelines#BooleanExpression}.\n *\n * <p>This stage allows you to apply conditions to the data, similar to a \"WHERE\" clause in SQL.\n * You can filter documents based on their field values, using implementations of {@link\n * @firebase/firestore/pipelines#BooleanExpression}, typically including but not limited to:\n *\n * <ul>\n * <li>field comparators: {@link @firebase/firestore/pipelines#Expression.(eq:1)}, {@link @firebase/firestore/pipelines#Expression.(lt:1)} (less than), {@link\n * @firebase/firestore/pipelines#Expression.(greaterThan:1)}, etc.</li>\n * <li>logical operators: {@link @firebase/firestore/pipelines#Expression.(and:1)}, {@link @firebase/firestore/pipelines#Expression.(or:1)}, {@link @firebase/firestore/pipelines#Expression.(not:1)}, etc.</li>\n * <li>advanced functions: {@link @firebase/firestore/pipelines#Expression.(regexMatch:1)}, {@link\n * @firebase/firestore/pipelines#Expression.(arrayContains:1)}, etc.</li>\n * </ul>\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * firestore.pipeline().collection(\"books\")\n * .where(\n * and(\n * gt(field(\"rating\"), 4.0), // Filter for ratings greater than 4.0\n * field(\"genre\").eq(\"Science Fiction\") // Equivalent to gt(\"genre\", \"Science Fiction\")\n * )\n * );\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n where(options: WhereStageOptions): Pipeline;\n where(conditionOrOptions: BooleanExpression | WhereStageOptions): Pipeline {\n // Process argument union(s) from method overloads\n const options = isBooleanExpr(conditionOrOptions) ? {} : conditionOrOptions;\n const condition: BooleanExpression = isBooleanExpr(conditionOrOptions)\n ? conditionOrOptions\n : conditionOrOptions.condition;\n\n // Create stage object\n const stage = new Where(condition, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'where'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Skips the first `offset` number of documents from the results of previous stages.\n *\n * <p>This stage is useful for implementing pagination in your pipelines, allowing you to retrieve\n * results in chunks. It is typically used in conjunction with {@link @firebase/firestore/pipelines#Pipeline.limit} to control the\n * size of each page.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Retrieve the second page of 20 results\n * firestore.pipeline().collection('books')\n * .sort(field('published').descending())\n * .offset(20) // Skip the first 20 results\n * .limit(20); // Take the next 20 results\n * ```\n *\n * @param offset - The number of documents to skip.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n offset(offset: number): Pipeline;\n /**\n * @beta\n * Skips the first `offset` number of documents from the results of previous stages.\n *\n * <p>This stage is useful for implementing pagination in your pipelines, allowing you to retrieve\n * results in chunks. It is typically used in conjunction with {@link @firebase/firestore/pipelines#Pipeline.limit} to control the\n * size of each page.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Retrieve the second page of 20 results\n * firestore.pipeline().collection('books')\n * .sort(field('published').descending())\n * .offset(20) // Skip the first 20 results\n * .limit(20); // Take the next 20 results\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n offset(options: OffsetStageOptions): Pipeline;\n offset(offsetOrOptions: number | OffsetStageOptions): Pipeline {\n // Process argument union(s) from method overloads\n let options: {};\n let offset: number;\n if (isNumber(offsetOrOptions)) {\n options = {};\n offset = offsetOrOptions;\n } else {\n options = offsetOrOptions;\n offset = offsetOrOptions.offset;\n }\n\n // Create stage object\n const stage = new Offset(offset, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'offset'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Limits the maximum number of documents returned by previous stages to `limit`.\n *\n * <p>This stage is particularly useful when you want to retrieve a controlled subset of data from\n * a potentially large result set. It's often used for:\n *\n * <ul>\n * <li>**Pagination:** In combination with {@link @firebase/firestore/pipelines#Pipeline.offset} to retrieve specific pages of\n * results.</li>\n * <li>**Limiting Data Retrieval:** To prevent excessive data transfer and improve performance,\n * especially when dealing with large collections.</li>\n * </ul>\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Limit the results to the top 10 highest-rated books\n * firestore.pipeline().collection('books')\n * .sort(field('rating').descending())\n * .limit(10);\n * ```\n *\n * @param limit - The maximum number of documents to return.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n limit(limit: number): Pipeline;\n /**\n * @beta\n * Limits the maximum number of documents returned by previous stages to `limit`.\n *\n * <p>This stage is particularly useful when you want to retrieve a controlled subset of data from\n * a potentially large result set. It's often used for:\n *\n * <ul>\n * <li>**Pagination:** In combination with {@link @firebase/firestore/pipelines#Pipeline.offset} to retrieve specific pages of\n * results.</li>\n * <li>**Limiting Data Retrieval:** To prevent excessive data transfer and improve performance,\n * especially when dealing with large collections.</li>\n * </ul>\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Limit the results to the top 10 highest-rated books\n * firestore.pipeline().collection('books')\n * .sort(field('rating').descending())\n * .limit(10);\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n limit(options: LimitStageOptions): Pipeline;\n limit(limitOrOptions: number | LimitStageOptions): Pipeline {\n // Process argument union(s) from method overloads\n const options = isNumber(limitOrOptions) ? {} : limitOrOptions;\n const limit: number = isNumber(limitOrOptions)\n ? limitOrOptions\n : limitOrOptions.limit;\n\n // Create stage object\n const stage = new Limit(limit, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'limit'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Returns a set of distinct values from the inputs to this stage.\n *\n * This stage runs through the results from previous stages to include only results with\n * unique combinations of {@link @firebase/firestore/pipelines#Expression} values ({@link @firebase/firestore/pipelines#Field}, {@link @firebase/firestore/pipelines#AliasedExpression}, etc).\n *\n * The parameters to this stage are defined using {@link @firebase/firestore/pipelines#Selectable} expressions or strings:\n *\n * - `string`: Name of an existing field\n * - {@link @firebase/firestore/pipelines#Field}: References an existing document field.\n * - {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name\n * using {@link @firebase/firestore/pipelines#Expression.(as:1)}.\n *\n * Example:\n *\n * @example\n * ```typescript\n * // Get a list of unique author names in uppercase and genre combinations.\n * firestore.pipeline().collection(\"books\")\n * .distinct(toUppercase(field(\"author\")).as(\"authorName\"), field(\"genre\"), \"publishedAt\")\n * .select(\"authorName\");\n * ```\n *\n * @param group - The {@link @firebase/firestore/pipelines#Selectable} expression or field name to consider when determining\n * distinct value combinations.\n * @param additionalGroups - Optional additional {@link @firebase/firestore/pipelines#Selectable} expressions to consider when determining distinct\n * value combinations or strings representing field names.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n distinct(\n group: string | Selectable,\n ...additionalGroups: Array<string | Selectable>\n ): Pipeline;\n /**\n * @beta\n * Returns a set of distinct values from the inputs to this stage.\n *\n * This stage runs through the results from previous stages to include only results with\n * unique combinations of {@link @firebase/firestore/pipelines#Expression} values ({@link @firebase/firestore/pipelines#Field}, {@link @firebase/firestore/pipelines#AliasedExpression}, etc).\n *\n * The parameters to this stage are defined using {@link @firebase/firestore/pipelines#Selectable} expressions or strings:\n *\n * - `string`: Name of an existing field\n * - {@link @firebase/firestore/pipelines#Field}: References an existing document field.\n * - {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name\n * using {@link @firebase/firestore/pipelines#Expression.(as:1)}.\n *\n * Example:\n *\n * @example\n * ```typescript\n * // Get a list of unique author names in uppercase and genre combinations.\n * firestore.pipeline().collection(\"books\")\n * .distinct(toUppercase(field(\"author\")).as(\"authorName\"), field(\"genre\"), \"publishedAt\")\n * .select(\"authorName\");\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n distinct(options: DistinctStageOptions): Pipeline;\n distinct(\n groupOrOptions: string | Selectable | DistinctStageOptions,\n ...additionalGroups: Array<string | Selectable>\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options =\n isString(groupOrOptions) || isSelectable(groupOrOptions)\n ? {}\n : groupOrOptions;\n const groups: Array<string | Selectable> =\n isString(groupOrOptions) || isSelectable(groupOrOptions)\n ? [groupOrOptions, ...additionalGroups]\n : groupOrOptions.groups;\n\n // Convert user land convenience types to internal types\n const convertedGroups: Map<string, Expression> = selectablesToMap(groups);\n\n // Create stage object\n const stage = new Distinct(convertedGroups, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'distinct'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Performs aggregation operations on the documents from previous stages.\n *\n * <p>This stage allows you to calculate aggregate values over a set of documents. You define the\n * aggregations to perform using {@link @firebase/firestore/pipelines#AliasedAggregate} expressions which are typically results of\n * calling {@link @firebase/firestore/pipelines#Expression.(as:1)} on {@link @firebase/firestore/pipelines#AggregateFunction} instances.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Calculate the average rating and the total number of books\n * firestore.pipeline().collection(\"books\")\n * .aggregate(\n * field(\"rating\").avg().as(\"averageRating\"),\n * countAll().as(\"totalBooks\")\n * );\n * ```\n *\n * @param accumulator - The first {@link @firebase/firestore/pipelines#AliasedAggregate}, wrapping an {@link @firebase/firestore/pipelines#AggregateFunction}\n * and providing a name for the accumulated results.\n * @param additionalAccumulators - Optional additional {@link @firebase/firestore/pipelines#AliasedAggregate}, each wrapping an {@link @firebase/firestore/pipelines#AggregateFunction}\n * and providing a name for the accumulated results.\n * @returns A new Pipeline object with this stage appended to the stage list.\n */\n aggregate(\n accumulator: AliasedAggregate,\n ...additionalAccumulators: AliasedAggregate[]\n ): Pipeline;\n /**\n * @beta\n * Performs optionally grouped aggregation operations on the documents from previous stages.\n *\n * <p>This stage allows you to calculate aggregate values over a set of documents, optionally\n * grouped by one or more fields or functions. You can specify:\n *\n * <ul>\n * <li>**Grouping Fields or Functions:** One or more fields or functions to group the documents\n * by. For each distinct combination of values in these fields, a separate group is created.\n * If no grouping fields are provided, a single group containing all documents is used. Not\n * specifying groups is the same as putting the entire inputs into one group.</li>\n * <li>**Accumulators:** One or more accumulation operations to perform within each group. These\n * are defined using {@link @firebase/firestore/pipelines#AliasedAggregate} expressions, which are typically created by\n * calling {@link @firebase/firestore/pipelines#Expression.(as:1)} on {@link @firebase/firestore/pipelines#AggregateFunction} instances. Each aggregation\n * calculates a value (e.g., sum, average, count) based on the documents within its group.</li>\n * </ul>\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Calculate the average rating for each genre.\n * firestore.pipeline().collection(\"books\")\n * .aggregate({\n * accumulators: [avg(field(\"rating\")).as(\"avg_rating\")]\n * groups: [\"genre\"]\n * });\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage\n * list.\n */\n aggregate(options: AggregateStageOptions): Pipeline;\n aggregate(\n targetOrOptions: AliasedAggregate | AggregateStageOptions,\n ...rest: AliasedAggregate[]\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options = isAliasedAggregate(targetOrOptions) ? {} : targetOrOptions;\n const accumulators: AliasedAggregate[] = isAliasedAggregate(targetOrOptions)\n ? [targetOrOptions, ...rest]\n : targetOrOptions.accumulators;\n const groups: Array<Selectable | string> = isAliasedAggregate(\n targetOrOptions\n )\n ? []\n : targetOrOptions.groups ?? [];\n\n // Convert user land convenience types to internal types\n const convertedAccumulators: Map<string, AggregateFunction> =\n aliasedAggregateToMap(accumulators);\n const convertedGroups: Map<string, Expression> = selectablesToMap(groups);\n\n // Create stage object\n const stage = new Aggregate(\n convertedGroups,\n convertedAccumulators,\n options\n );\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'aggregate'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Performs a vector proximity search on the documents from the previous stage, returning the\n * K-nearest documents based on the specified query `vectorValue` and `distanceMeasure`. The\n * returned documents will be sorted in order from nearest to furthest from the query `vectorValue`.\n *\n * <p>Example:\n *\n * ```typescript\n * // Find the 10 most similar books based on the book description.\n * const bookDescription = \"Lorem ipsum...\";\n * const queryVector: number[] = ...; // compute embedding of `bookDescription`\n *\n * firestore.pipeline().collection(\"books\")\n * .findNearest({\n * field: 'embedding',\n * vectorValue: queryVector,\n * distanceMeasure: 'euclidean',\n * limit: 10, // optional\n * distanceField: 'computedDistance' // optional\n * });\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n findNearest(options: FindNearestStageOptions): Pipeline {\n // Convert user land convenience types to internal types\n const field = toField(options.field);\n const vectorValue = vectorToExpr(options.vectorValue);\n const distanceField = options.distanceField\n ? toField(options.distanceField)\n : undefined;\n const internalOptions = {\n distanceField,\n limit: options.limit,\n rawOptions: options.rawOptions\n };\n\n // Create stage object\n const stage = new FindNearest(\n vectorValue,\n field,\n options.distanceMeasure,\n internalOptions\n );\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'addFields'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Sorts the documents from previous stages based on one or more {@link @firebase/firestore/pipelines#Ordering} criteria.\n *\n * <p>This stage allows you to order the results of your pipeline. You can specify multiple {@link\n * @firebase/firestore/pipelines#Ordering} instances to sort by multiple fields in ascending or descending order. If documents\n * have the same value for a field used for sorting, the next specified ordering will be used. If\n * all orderings result in equal comparison, the documents are considered equal and the order is\n * unspecified.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Sort books by rating in descending order, and then by title in ascending order for books\n * // with the same rating\n * firestore.pipeline().collection(\"books\")\n * .sort(\n * Ordering.of(field(\"rating\")).descending(),\n * Ordering.of(field(\"title\")) // Ascending order is the default\n * );\n * ```\n *\n * @param ordering - The first {@link @firebase/firestore/pipelines#Ordering} instance specifying the sorting criteria.\n * @param additionalOrderings - Optional additional {@link @firebase/firestore/pipelines#Ordering} instances specifying the additional sorting criteria.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline;\n /**\n * @beta\n * Sorts the documents from previous stages based on one or more {@link @firebase/firestore/pipelines#Ordering} criteria.\n *\n * <p>This stage allows you to order the results of your pipeline. You can specify multiple {@link\n * @firebase/firestore/pipelines#Ordering} instances to sort by multiple fields in ascending or descending order. If documents\n * have the same value for a field used for sorting, the next specified ordering will be used. If\n * all orderings result in equal comparison, the documents are considered equal and the order is\n * unspecified.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Sort books by rating in descending order, and then by title in ascending order for books\n * // with the same rating\n * firestore.pipeline().collection(\"books\")\n * .sort(\n * Ordering.of(field(\"rating\")).descending(),\n * Ordering.of(field(\"title\")) // Ascending order is the default\n * );\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n sort(options: SortStageOptions): Pipeline;\n sort(\n orderingOrOptions: Ordering | SortStageOptions,\n ...additionalOrderings: Ordering[]\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options = isOrdering(orderingOrOptions) ? {} : orderingOrOptions;\n const orderings: Ordering[] = isOrdering(orderingOrOptions)\n ? [orderingOrOptions, ...additionalOrderings]\n : orderingOrOptions.orderings;\n\n // Create stage object\n const stage = new Sort(orderings, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'sort'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Fully overwrites all fields in a document with those coming from a nested map.\n *\n * <p>This stage allows you to emit a map value as a document. Each key of the map becomes a field\n * on the document that contains the corresponding value.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Input.\n * // {\n * // 'name': 'John Doe Jr.',\n * // 'parents': {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * // }\n *\n * // Emit parents as document.\n * firestore.pipeline().collection('people').replaceWith('parents');\n *\n * // Output\n * // {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * ```\n *\n * @param fieldName - The {@link @firebase/firestore/pipelines#Field} field containing the nested map.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n replaceWith(fieldName: string): Pipeline;\n /**\n * @beta\n * Fully overwrites all fields in a document with those coming from a map.\n *\n * <p>This stage allows you to emit a map value as a document. Each key of the map becomes a field\n * on the document that contains the corresponding value.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Input.\n * // {\n * // 'name': 'John Doe Jr.',\n * // 'parents': {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * // }\n *\n * // Emit parents as document.\n * firestore.pipeline().collection('people').replaceWith(map({\n * foo: 'bar',\n * info: {\n * name: field('name')\n * }\n * }));\n *\n * // Output\n * // {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * ```\n *\n * @param expr - An {@link @firebase/firestore/pipelines#Expression} that when returned evaluates to a map.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n replaceWith(expr: Expression): Pipeline;\n /**\n * @beta\n * Fully overwrites all fields in a document with those coming from a map.\n *\n * <p>This stage allows you to emit a map value as a document. Each key of the map becomes a field\n * on the document that contains the corresponding value.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Input.\n * // {\n * // 'name': 'John Doe Jr.',\n * // 'parents': {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * // }\n *\n * // Emit parents as document.\n * firestore.pipeline().collection('people').replaceWith(map({\n * foo: 'bar',\n * info: {\n * name: field('name')\n * }\n * }));\n *\n * // Output\n * // {\n * // 'father': 'John Doe Sr.',\n * // 'mother': 'Jane Doe'\n * // }\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n replaceWith(options: ReplaceWithStageOptions): Pipeline;\n replaceWith(\n valueOrOptions: Expression | string | ReplaceWithStageOptions\n ): Pipeline {\n // Process argument union(s) from method overloads\n const options =\n isString(valueOrOptions) || isExpr(valueOrOptions) ? {} : valueOrOptions;\n const fieldNameOrExpr: string | Expression =\n isString(valueOrOptions) || isExpr(valueOrOptions)\n ? valueOrOptions\n : valueOrOptions.map;\n\n // Convert user land convenience types to internal types\n const mapExpr = fieldOrExpression(fieldNameOrExpr);\n\n // Create stage object\n const stage = new Replace(mapExpr, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'replaceWith'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Performs a pseudo-random sampling of the documents from the previous stage.\n *\n * <p>This stage will filter documents pseudo-randomly. The parameter specifies how number of\n * documents to be returned.\n *\n * <p>Examples:\n *\n * @example\n * ```typescript\n * // Sample 25 books, if available.\n * firestore.pipeline().collection('books')\n * .sample(25);\n * ```\n *\n * @param documents - The number of documents to sample.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n sample(documents: number): Pipeline;\n\n /**\n * @beta\n * Performs a pseudo-random sampling of the documents from the previous stage.\n *\n * <p>This stage will filter documents pseudo-randomly. The 'options' parameter specifies how\n * sampling will be performed. See {@link @firebase/firestore/pipelines#SampleStageOptions} for more information.\n *\n * @example\n * ```typescript\n * // Sample 10 books, if available.\n * firestore.pipeline().collection(\"books\")\n * .sample({ documents: 10 });\n *\n * // Sample 50% of books.\n * firestore.pipeline().collection(\"books\")\n * .sample({ percentage: 0.5 });\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n sample(options: SampleStageOptions): Pipeline;\n sample(documentsOrOptions: number | SampleStageOptions): Pipeline {\n // Process argument union(s) from method overloads\n const options = isNumber(documentsOrOptions) ? {} : documentsOrOptions;\n let rate: number;\n let mode: 'documents' | 'percent';\n if (isNumber(documentsOrOptions)) {\n rate = documentsOrOptions;\n mode = 'documents';\n } else if (isNumber(documentsOrOptions.documents)) {\n rate = documentsOrOptions.documents;\n mode = 'documents';\n } else {\n rate = documentsOrOptions.percentage!;\n mode = 'percent';\n }\n\n // Create stage object\n const stage = new Sample(rate, mode, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'sample'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Performs union of all documents from two pipelines, including duplicates.\n *\n * <p>This stage will pass through documents from previous stage, and also pass through documents\n * from previous stage of the `other` {@link @firebase/firestore/pipelines#Pipeline} given in parameter. The order of documents\n * emitted from this stage is undefined.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Emit documents from books collection and magazines collection.\n * firestore.pipeline().collection('books')\n * .union(firestore.pipeline().collection('magazines'));\n * ```\n *\n * @param other - The other {@link @firebase/firestore/pipelines#Pipeline} that is part of union.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n union(other: Pipeline): Pipeline;\n /**\n * @beta\n * Performs union of all documents from two pipelines, including duplicates.\n *\n * <p>This stage will pass through documents from previous stage, and also pass through documents\n * from previous stage of the `other` {@link @firebase/firestore/pipelines#Pipeline} given in parameter. The order of documents\n * emitted from this stage is undefined.\n *\n * <p>Example:\n *\n * @example\n * ```typescript\n * // Emit documents from books collection and magazines collection.\n * firestore.pipeline().collection('books')\n * .union(firestore.pipeline().collection('magazines'));\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n union(options: UnionStageOptions): Pipeline;\n union(otherOrOptions: Pipeline | UnionStageOptions): Pipeline {\n // Process argument union(s) from method overloads\n let options: {};\n let otherPipeline: Pipeline;\n if (isPipeline(otherOrOptions)) {\n options = {};\n otherPipeline = otherOrOptions;\n } else {\n ({ other: otherPipeline, ...options } = otherOrOptions);\n }\n\n // Create stage object\n const stage = new Union(otherPipeline, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'union'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Produces a document for each element in an input array.\n *\n * For each previous stage document, this stage will emit zero or more augmented documents. The\n * input array specified by the `selectable` parameter, will emit an augmented document for each input array element. The input array element will\n * augment the previous stage document by setting the `alias` field with the array element value.\n *\n * When `selectable` evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for\n * the current input document, returning it as is with the `alias` field absent.\n *\n * No documents are emitted when `selectable` evaluates to an empty array.\n *\n * Example:\n *\n * @example\n * ```typescript\n * // Input:\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tags\": [ \"comedy\", \"space\", \"adventure\" ], ... }\n *\n * // Emit a book document for each tag of the book.\n * firestore.pipeline().collection(\"books\")\n * .unnest(field(\"tags\").as('tag'), 'tagIndex');\n *\n * // Output:\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"comedy\", \"tagIndex\": 0, ... }\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"space\", \"tagIndex\": 1, ... }\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"adventure\", \"tagIndex\": 2, ... }\n * ```\n *\n * @param selectable - A selectable expression defining the field to unnest and the alias to use for each un-nested element in the output documents.\n * @param indexField - An optional string value specifying the field path to write the offset (starting at zero) into the array the un-nested element is from\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n unnest(selectable: Selectable, indexField?: string): Pipeline;\n /**\n * @beta\n * Produces a document for each element in an input array.\n *\n * For each previous stage document, this stage will emit zero or more augmented documents. The\n * input array specified by the `selectable` parameter, will emit an augmented document for each input array element. The input array element will\n * augment the previous stage document by setting the `alias` field with the array element value.\n *\n * When `selectable` evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for\n * the current input document, returning it as is with the `alias` field absent.\n *\n * No documents are emitted when `selectable` evaluates to an empty array.\n *\n * Example:\n *\n * @example\n * ```typescript\n * // Input:\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tags\": [ \"comedy\", \"space\", \"adventure\" ], ... }\n *\n * // Emit a book document for each tag of the book.\n * firestore.pipeline().collection(\"books\")\n * .unnest(field(\"tags\").as('tag'), 'tagIndex');\n *\n * // Output:\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"comedy\", \"tagIndex\": 0, ... }\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"space\", \"tagIndex\": 1, ... }\n * // { \"title\": \"The Hitchhiker's Guide to the Galaxy\", \"tag\": \"adventure\", \"tagIndex\": 2, ... }\n * ```\n *\n * @param options - An object that specifies required and optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n unnest(options: UnnestStageOptions): Pipeline;\n unnest(\n selectableOrOptions: Selectable | UnnestStageOptions,\n indexField?: string\n ): Pipeline {\n // Process argument union(s) from method overloads\n let options: { indexField?: Field } & StageOptions;\n let selectable: Selectable;\n let indexFieldName: string | undefined;\n if (isSelectable(selectableOrOptions)) {\n options = {};\n selectable = selectableOrOptions;\n indexFieldName = indexField;\n } else {\n ({\n selectable,\n indexField: indexFieldName,\n ...options\n } = selectableOrOptions);\n }\n\n // Convert user land convenience types to internal types\n const alias = selectable.alias;\n const expr = selectable.expr as Expression;\n if (isString(indexFieldName)) {\n options.indexField = _field(indexFieldName, 'unnest');\n }\n\n // Create stage object\n const stage = new Unnest(alias, expr, options);\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'unnest'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @beta\n * Adds a raw stage to the pipeline.\n *\n * <p>This method provides a flexible way to extend the pipeline's functionality by adding custom\n * stages. Each raw stage is defined by a unique `name` and a set of `params` that control its\n * behavior.\n *\n * <p>Example (Assuming there is no 'where' stage available in SDK):\n *\n * @example\n * ```typescript\n * // Assume we don't have a built-in 'where' stage\n * firestore.pipeline().collection('books')\n * .rawStage('where', [field('published').lt(1900)]) // Custom 'where' stage\n * .select('title', 'author');\n * ```\n *\n * @param name - The unique name of the raw stage to add.\n * @param params - A list of parameters to configure the raw stage's behavior.\n * @param options - An object of key value pairs that specifies optional parameters for the stage.\n * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list.\n */\n rawStage(\n name: string,\n params: unknown[],\n options?: { [key: string]: Expression | unknown }\n ): Pipeline {\n // Convert user land convenience types to internal types\n const expressionParams = params.map((value: unknown) => {\n if (value instanceof Expression) {\n return value;\n } else if (value instanceof AggregateFunction) {\n return value;\n } else if (isPlainObject(value)) {\n return _mapValue(value as Record<string, unknown>);\n } else {\n return _constant(value, 'rawStage');\n }\n });\n\n // Create stage object\n const stage = new RawStage(name, expressionParams, options ?? {});\n\n // User data must be read in the context of the API method to\n // provide contextual errors\n const parseContext = this.userDataReader.createContext(\n UserDataSource.Argument,\n 'rawStage'\n );\n stage._readUserData(parseContext);\n\n // Add stage to the pipeline\n return this._addStage(stage);\n }\n\n /**\n * @internal\n * @private\n */\n _toProto(jsonProtoSerializer: JsonProtoSerializer): ProtoPipeline {\n const stages: ProtoStage[] = this.stages.map(stage =>\n stage._toProto(jsonProtoSerializer)\n );\n return { stages };\n }\n\n private _addStage(stage: Stage): Pipeline {\n const copy = this.stages.map(s => s);\n copy.push(stage);\n return this.newPipeline(\n this._db,\n this.userDataReader,\n this._userDataWriter,\n copy\n );\n }\n\n /**\n * @internal\n * @private\n * @param db\n * @param userDataReader\n * @param userDataWriter\n * @param stages\n * @protected\n */\n protected newPipeline(\n db: Firestore,\n userDataReader: UserDataReader,\n userDataWriter: AbstractUserDataWriter,\n stages: Stage[]\n ): Pipeline {\n return new Pipeline(db, userDataReader, userDataWriter, stages);\n }\n}\n\nexport function isPipeline(val: unknown): val is Pipeline {\n return val instanceof Pipeline;\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\nimport { Pipeline as LitePipeline } from '../lite-api/pipeline';\nimport { Stage } from '../lite-api/stage';\nimport { UserDataReader } from '../lite-api/user_data_reader';\nimport { AbstractUserDataWriter } from '../lite-api/user_data_writer';\n\nimport { Firestore } from './database';\n\n/**\n * @beta\n */\nexport class Pipeline extends LitePipeline {\n /**\n * @internal\n * @private\n * @param db\n * @param userDataReader\n * @param userDataWriter\n * @param stages\n * @param converter\n * @protected\n */\n protected newPipeline(\n db: Firestore,\n userDataReader: UserDataReader,\n userDataWriter: AbstractUserDataWriter,\n stages: Stage[]\n ): Pipeline {\n return new Pipeline(db, userDataReader, userDataWriter, stages);\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\nimport { Pipeline } from '../api/pipeline';\nimport { firestoreClientExecutePipeline } from '../core/firestore_client';\nimport {\n StructuredPipeline,\n StructuredPipelineOptions\n} from '../core/structured_pipeline';\nimport { Pipeline as LitePipeline } from '../lite-api/pipeline';\nimport { PipelineResult, PipelineSnapshot } from '../lite-api/pipeline-result';\nimport { PipelineSource } from '../lite-api/pipeline-source';\nimport { PipelineExecuteOptions } from '../lite-api/pipeline_options';\nimport { Stage } from '../lite-api/stage';\nimport {\n newUserDataReader,\n UserDataReader,\n UserDataSource\n} from '../lite-api/user_data_reader';\nimport { cast } from '../util/input_validation';\n\nimport { ensureFirestoreConfigured, Firestore } from './database';\nimport { DocumentReference } from './reference';\nimport { ExpUserDataWriter } from './user_data_writer';\n\ndeclare module './database' {\n /**\n * @beta\n * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}.\n *\n * @example\n * ```\n * let myPipeline: Pipeline = firestore.pipeline().collection('books');\n * ```\n */\n interface Firestore {\n pipeline(): PipelineSource<Pipeline>;\n }\n}\n\n/**\n * @beta\n * Executes a pipeline and returns a Promise to represent the asynchronous operation.\n *\n * The returned Promise can be used to track the progress of the pipeline execution\n * and retrieve the results (or handle any errors) asynchronously.\n *\n * The pipeline results are returned as a {@link @firebase/firestore/pipelines#PipelineSnapshot} that contains\n * a list of {@link @firebase/firestore/pipelines#PipelineResult} objects. Each {@link @firebase/firestore/pipelines#PipelineResult} typically\n * represents a single key/value map that has passed through all the\n * stages of the pipeline, however this might differ depending on the stages involved in the\n * pipeline. For example:\n *\n * <ul>\n * <li>If there are no stages or only transformation stages, each {@link @firebase/firestore/pipelines#PipelineResult}\n * represents a single document.</li>\n * <li>If there is an aggregation, only a single {@link @firebase/firestore/pipelines#PipelineResult} is returned,\n * representing the aggregated results over the entire dataset .</li>\n * <li>If there is an aggregation stage with grouping, each {@link @firebase/firestore/pipelines#PipelineResult} represents a\n * distinct group and its associated aggregated values.</li>\n * </ul>\n *\n * @example\n * ```typescript\n * const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection(\"books\")\n * .where(gt(field(\"rating\"), 4.5))\n * .select(\"title\", \"author\", \"rating\"));\n *\n * const results: PipelineResults = snapshot.results;\n * ```\n *\n * @param pipeline - The pipeline to execute.\n * @returns A Promise representing the asynchronous pipeline execution.\n */\nexport function execute(pipeline: LitePipeline): Promise<PipelineSnapshot>;\n/**\n * @beta\n * Executes a pipeline and returns a Promise to represent the asynchronous operation.\n *\n * The returned Promise can be used to track the progress of the pipeline execution\n * and retrieve the results (or handle any errors) asynchronously.\n *\n * The pipeline results are returned as a {@link @firebase/firestore/pipelines#PipelineSnapshot} that contains\n * a list of {@link @firebase/firestore/pipelines#PipelineResult} objects. Each {@link @firebase/firestore/pipelines#PipelineResult} typically\n * represents a single key/value map that has passed through all the\n * stages of the pipeline, however this might differ depending on the stages involved in the\n * pipeline. For example:\n *\n * <ul>\n * <li>If there are no stages or only transformation stages, each {@link @firebase/firestore/pipelines#PipelineResult}\n * represents a single document.</li>\n * <li>If there is an aggregation, only a single {@link @firebase/firestore/pipelines#PipelineResult} is returned,\n * representing the aggregated results over the entire dataset .</li>\n * <li>If there is an aggregation stage with grouping, each {@link @firebase/firestore/pipelines#PipelineResult} represents a\n * distinct group and its associated aggregated values.</li>\n * </ul>\n *\n * @example\n * ```typescript\n * const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection(\"books\")\n * .where(gt(field(\"rating\"), 4.5))\n * .select(\"title\", \"author\", \"rating\"));\n *\n * const results: PipelineResults = snapshot.results;\n * ```\n *\n * @param options - Specifies the pipeline to execute and other options for execute.\n * @returns A Promise representing the asynchronous pipeline execution.\n */\nexport function execute(\n options: PipelineExecuteOptions\n): Promise<PipelineSnapshot>;\nexport function execute(\n pipelineOrOptions: LitePipeline | PipelineExecuteOptions\n): Promise<PipelineSnapshot> {\n const options: PipelineExecuteOptions = !(\n pipelineOrOptions instanceof LitePipeline\n )\n ? pipelineOrOptions\n : {\n pipeline: pipelineOrOptions\n };\n\n const { pipeline, rawOptions, ...rest } = options;\n\n const firestore = cast(pipeline._db, Firestore);\n const client = ensureFirestoreConfigured(firestore);\n\n const udr = new UserDataReader(\n firestore._databaseId,\n /* ignoreUndefinedProperties */ true\n );\n const context = udr.createContext(UserDataSource.Argument, 'execute');\n\n const structuredPipelineOptions = new StructuredPipelineOptions(\n rest,\n rawOptions\n );\n structuredPipelineOptions._readUserData(context);\n\n const structuredPipeline: StructuredPipeline = new StructuredPipeline(\n pipeline,\n structuredPipelineOptions\n );\n\n return firestoreClientExecutePipeline(client, structuredPipeline).then(\n result => {\n // Get the execution time from the first result.\n // firestoreClientExecutePipeline returns at least one PipelineStreamElement\n // even if the returned document set is empty.\n const executionTime =\n result.length > 0 ? result[0].executionTime?.toTimestamp() : undefined;\n\n const docs = result\n // Currently ignore any response from ExecutePipeline that does\n // not contain any document data in the `fields` property.\n .filter(element => !!element.fields)\n .map(\n element =>\n new PipelineResult(\n pipeline._userDataWriter,\n element.fields!,\n element.key?.path\n ? new DocumentReference(firestore, null, element.key)\n : undefined,\n element.createTime?.toTimestamp(),\n element.updateTime?.toTimestamp()\n )\n );\n\n return new PipelineSnapshot(pipeline, docs, executionTime);\n }\n );\n}\n\n/**\n * @beta\n * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}.\n *\n * @example\n * ```\n * let myPipeline: Pipeline = firestore.pipeline().collection('books');\n * ```\n */\n// Augment the Firestore class with the pipeline() factory method\nFirestore.prototype.pipeline = function (): PipelineSource<Pipeline> {\n const userDataReader = newUserDataReader(this);\n return new PipelineSource<Pipeline>(\n this._databaseId,\n userDataReader,\n (stages: Stage[]) => {\n return new Pipeline(\n this,\n userDataReader,\n new ExpUserDataWriter(this),\n stages\n );\n }\n );\n};\n"],"names":["__PRIVATE_isFirestoreValue","obj","nullValue","booleanValue","integerValue","doubleValue","timestampValue","__PRIVATE_isITimestamp","seconds","nanos","stringValue","bytesValue","Uint8Array","referenceValue","geoPointValue","__PRIVATE_isILatLng","latitude","longitude","arrayValue","__PRIVATE_isIArrayValue","values","Array","isArray","mapValue","__PRIVATE_isIMapValue","fields","__PRIVATE_isPlainObject","fieldReferenceValue","functionValue","__PRIVATE_isIFunction","name","args","pipelineValue","__PRIVATE_isIPipeline","stages","__PRIVATE_valueToDefaultExpr","value","result","Expression","__PRIVATE__map","array","__PRIVATE__constant","undefined","__PRIVATE_vectorToExpr","VectorValue","constant","vector","Error","__PRIVATE_fieldOrExpression","__PRIVATE_isString","field","constructor","this","_protoValueType","add","second","FunctionExpression","asBoolean","BooleanExpression","Constant","__PRIVATE_BooleanConstant","Field","__PRIVATE_BooleanField","__PRIVATE_BooleanFunctionExpression","FirestoreError","subtract","subtrahend","multiply","divide","divisor","mod","other","equal","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","arrayConcat","secondArray","otherArrays","__PRIVATE_exprValues","map","arrayContains","element","arrayContainsAll","__PRIVATE_normalizedExpr","__PRIVATE_ListOfExprs","arrayContainsAny","arrayReverse","arrayLength","equalAny","others","__PRIVATE_exprOthers","notEqualAny","exists","charLength","like","__PRIVATE_stringOrExpr","regexContains","regexFind","regexFindAll","regexMatch","stringContains","startsWith","endsWith","toLower","toUpper","trim","valueToTrim","push","ltrim","rtrim","type","isType","stringConcat","secondString","otherStrings","__PRIVATE_exprs","stringIndexOf","search","stringRepeat","repetitions","stringReplaceAll","find","replacement","stringReplaceOne","concat","reverse","byteLength","ceil","floor","abs","exp","mapGet","subfield","mapSet","key","moreKeyValues","mapKeys","mapValues","mapEntries","count","AggregateFunction","_create","sum","average","minimum","maximum","first","last","arrayAgg","arrayAggDistinct","countDistinct","logicalMaximum","logicalMinimum","vectorLength","cosineDistance","dotProduct","euclideanDistance","unixMicrosToTimestamp","timestampToUnixMicros","unixMillisToTimestamp","timestampToUnixMillis","unixSecondsToTimestamp","timestampToUnixSeconds","timestampAdd","unit","amount","timestampSubtract","documentId","substring","position","length","__PRIVATE_positionExpr","arrayGet","offset","isError","ifError","catchValue","isAbsent","mapRemove","__PRIVATE_stringExpr","mapMerge","secondMap","otherMaps","__PRIVATE_secondMapExpr","__PRIVATE_otherMapExprs","pow","exponent","trunc","decimalPlaces","round","collectionId","ln","sqrt","stringReverse","ifAbsent","__PRIVATE_elseValueOrExpression","join","__PRIVATE_delimeterValueOrExpression","log10","arraySum","split","delimiter","timestampTruncate","granularity","timezone","toLowerCase","ascending","descending","as","AliasedExpression","params","exprType","methodName","__PRIVATE_af","_methodName","AliasedAggregate","_toProto","serializer","p","_readUserData","context","contextWith","forEach","expr","aggregate","alias","selectable","super","expressionType","fieldPath","fieldName","canonicalString","nameOrPath","_field","__PRIVATE_DOCUMENT_KEY_NAME","__PRIVATE_documentIdFieldPath","_internalPath","__PRIVATE_fieldPathFromArgument","_fromProto","_protoValue","_","__PRIVATE_hardAssert","__PRIVATE_parseData","c","MapValue","__PRIVATE_plainObject","__PRIVATE_toMapValue","_expr","countIf","not","conditional","thenExpr","elseExpr","__PRIVATE_normalizedCatchValue","booleanExpr","tryExpr","mapExpr","firstMap","documentPath","__PRIVATE_fieldExpr","__PRIVATE_lengthExpr","left","right","__PRIVATE_normalizedLeft","__PRIVATE_normalizedRight","elements","Object","prototype","hasOwnProperty","call","__PRIVATE__array","__PRIVATE_leftExpr","__PRIVATE_rightExpr","firstArray","__PRIVATE_arrayExpr","__PRIVATE_elementExpr","xor","additionalConditions","condition","__PRIVATE_valueOrField","__PRIVATE_expressionOrFieldName","pattern","__PRIVATE_patternExpr","__PRIVATE_substringExpr","prefix","suffix","__PRIVATE_fieldNameOrExpression","__PRIVATE_fieldOrExpr","subField","countAll","__PRIVATE_expr1","__PRIVATE_expr2","timestamp","__PRIVATE_normalizedTimestamp","__PRIVATE_normalizedUnit","__PRIVATE_normalizedAmount","currentTimestamp","and","more","or","base","rand","log","elseValue","__PRIVATE_delimiterValueOrExpression","__PRIVATE_internalGranularity","Ordering","direction","__PRIVATE_toStringValue","expression","__PRIVATE_isSelectable","val","candidate","__PRIVATE_isExpr","__PRIVATE_isOrdering","__PRIVATE_isAliasedAggregate","__PRIVATE_isBooleanExpr","__PRIVATE_isField","__PRIVATE_toField","__PRIVATE_toPipelineBooleanExpr","f","__PRIVATE_FieldFilterInternal","fieldValue","toString","op","fail","__PRIVATE_CompositeFilterInternal","__PRIVATE_conditions","getFilters","slice","__PRIVATE_toPipeline","query","db","pipeline","__PRIVATE_isCollectionGroupQuery","collectionGroup","__PRIVATE_isDocumentQuery","documents","doc","path","collection","filter","filters","where","__PRIVATE_orders","__PRIVATE_queryNormalizedOrderBy","__PRIVATE_existsConditions","explicitOrderBy","order","orderings","dir","limitType","__PRIVATE_actualOrderings","__PRIVATE_reverseOrderings","o","sort","startAt","__PRIVATE_whereConditionsFromCursor","endAt","limit","bound","__PRIVATE_filterFunc","__PRIVATE_cursors","size","inclusive","__PRIVATE_i","Stage","options","optionsProto","rawOptions","knownOptions","_optionsUtil","getOptionsProto","_name","__PRIVATE_AddFields","OptionsUtil","__PRIVATE_readUserDataHelper","__PRIVATE_RemoveFields","__PRIVATE_Aggregate","groups","accumulators","__PRIVATE_Distinct","__PRIVATE_CollectionSource","forceIndex","serverName","__PRIVATE_formattedCollectionPath","__PRIVATE_CollectionGroupSource","__PRIVATE_DatabaseSource","__PRIVATE_DocumentsSource","__PRIVATE_docPaths","__PRIVATE_formattedPaths","__PRIVATE_Where","__PRIVATE_FindNearest","distanceField","vectorValue","distanceMeasure","__PRIVATE_Limit","isNaN","Infinity","toNumber","__PRIVATE_Offset","__PRIVATE_Select","selections","__PRIVATE_Sort","__PRIVATE_Sample","rate","mode","__PRIVATE_Union","__PRIVATE_toPipelineValue","__PRIVATE_Unnest","indexField","__PRIVATE_Replace","__PRIVATE_MODE","__PRIVATE_RawStage","__PRIVATE_expressionMap","__PRIVATE_isUserData","__PRIVATE_readableData","PipelineSource","databaseId","userDataReader","_createPipeline","__PRIVATE_collectionOrOptions","__PRIVATE_isCollectionReference","__PRIVATE_collectionRefOrString","_validateReference","__PRIVATE_normalizedCollection","__PRIVATE_stage","__PRIVATE_parseContext","createContext","__PRIVATE_collectionIdOrOptions","database","__PRIVATE_docsOrOptions","docs","v","DocumentReference","__PRIVATE_dr","__PRIVATE_normalizedDocs","createFrom","_query","firestore","reference","__PRIVATE_refDbId","_databaseId","isEqual","Code","INVALID_ARGUMENT","CollectionReference","projectId","PipelineSnapshot","results","executionTime","_pipeline","_executionTime","_results","PipelineResult","userDataWriter","ref","createTime","updateTime","_ref","_userDataWriter","_createTime","_updateTime","_fields","id","data","convertValue","_fieldsProto","clone","get","pipelineResultEqual","__PRIVATE_isOptionalEqual","refEqual","l","r","__PRIVATE_selectablesToMap","__PRIVATE_selectables","Map","set","Pipeline","_db","addFields","__PRIVATE_fieldOrOptions","additionalFields","__PRIVATE_normalizedFields","_addStage","removeFields","__PRIVATE_fieldValueOrOptions","__PRIVATE_convertedFields","select","__PRIVATE_selectionOrOptions","additionalSelections","__PRIVATE_normalizedSelections","__PRIVATE_conditionOrOptions","__PRIVATE_offsetOrOptions","__PRIVATE_isNumber","__PRIVATE_limitOrOptions","distinct","__PRIVATE_groupOrOptions","additionalGroups","__PRIVATE_convertedGroups","__PRIVATE_targetOrOptions","__PRIVATE_rest","__PRIVATE_convertedAccumulators","__PRIVATE_aliasedAggregateToMap","__PRIVATE_aliasedAggregatees","reduce","findNearest","__PRIVATE_internalOptions","__PRIVATE_orderingOrOptions","additionalOrderings","replaceWith","__PRIVATE_valueOrOptions","sample","__PRIVATE_documentsOrOptions","percentage","union","__PRIVATE_otherOrOptions","__PRIVATE_otherPipeline","__PRIVATE_isPipeline","unnest","__PRIVATE_selectableOrOptions","__PRIVATE_indexFieldName","rawStage","__PRIVATE_expressionParams","__PRIVATE__mapValue","jsonProtoSerializer","copy","s","newPipeline","__PRIVATE_LitePipeline","execute","__PRIVATE_pipelineOrOptions","__PRIVATE_cast","Firestore","__PRIVATE_client","ensureFirestoreConfigured","UserDataReader","__PRIVATE_structuredPipelineOptions","__PRIVATE_StructuredPipelineOptions","structuredPipeline","StructuredPipeline","__PRIVATE_firestoreClientExecutePipeline","then","toTimestamp","__PRIVATE_newUserDataReader","__PRIVATE_ExpUserDataWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8GM,mDAAA,SAAUA,0BAAiBC,CAAAA,CAAAA,EAAAA;IAC/B,OAAmB,QAAA,IAAA,OAARA,KAA4B,IAARA,KAAAA,CAAAA,IAAAA,CAAAA,EAM5B,eAAeA,CACK,KAAA,IAAA,KAAlBA,EAAIC,SAAwC,IAAA,YAAA,KAAlBD,EAAIC,SAChC,CAAA,IAAA,cAAA,IAAkBD,MACK,IAArBA,KAAAA,CAAAA,CAAIE,gBAAqD,SAArBF,IAAAA,OAAAA,CAAAA,CAAIE,iBAC1C,cAAkBF,IAAAA,CAAAA,KACK,SAArBA,CAAIG,CAAAA,YAAAA,IACyB,mBAArBH,CAAIG,CAAAA,YAAAA,IACiB,mBAArBH,CAAIG,CAAAA,YAAAA,CAAAA,IACd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