{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/utils/parseCEL/utils.ts"],"sourcesContent":["import type { DefaultCombinatorName, DefaultOperatorName } from '../../types';\nimport type {\n  CELAddition,\n  CELBooleanLiteral,\n  CELBytesLiteral,\n  CELConditionalAnd,\n  CELConditionalExpr,\n  CELConditionalOr,\n  CELDivision,\n  CELDynamicPropertyAccessor,\n  CELExpression,\n  CELExpressionGroup,\n  CELExpressionList,\n  CELFieldInit,\n  CELFieldInits,\n  CELMessageInit,\n  CELFloatLiteral,\n  CELFunctionCall,\n  CELIdentifier,\n  CELIntegerLiteral,\n  CELLikeExpression,\n  CELList,\n  CELLiteral,\n  CELMap,\n  CELMapInit,\n  CELMapInits,\n  CELMember,\n  CELMemberIdentifierChain,\n  CELMemberNegatedIdentifier,\n  CELMemberNegatedIdentifierChain,\n  CELModulo,\n  CELMultiplication,\n  CELNegatedLikeExpression,\n  CELNegatedSubqueryExpression,\n  CELNegation,\n  CELNegative,\n  CELNullLiteral,\n  CELNumericLiteral,\n  CELPrimary,\n  CELProperty,\n  CELRelation,\n  CELRelop,\n  CELStringLiteral,\n  CELSubqueryExpression,\n  CELSubtraction,\n  CELUnsignedIntegerLiteral,\n} from './types';\n\nexport const isCELExpressionGroup = (expr: CELExpression): expr is CELExpressionGroup =>\n  expr.type === 'ExpressionGroup';\nexport const isCELConditionalAnd = (expr: CELExpression): expr is CELConditionalAnd =>\n  expr.type === 'ConditionalAnd';\nexport const isCELConditionalOr = (expr: CELExpression): expr is CELConditionalOr =>\n  expr.type === 'ConditionalOr';\nexport const isCELStringLiteral = (expr: CELExpression): expr is CELStringLiteral =>\n  expr.type === 'StringLiteral';\nexport const isCELLiteral = (expr: CELExpression): expr is CELLiteral =>\n  isCELNumericLiteral(expr) ||\n  isCELStringLiteral(expr) ||\n  isCELBooleanLiteral(expr) ||\n  isCELNullLiteral(expr) ||\n  isCELBytesLiteral(expr);\nexport const isCELNumericLiteral = (expr: CELExpression): expr is CELNumericLiteral =>\n  isCELFloatLiteral(expr) || isCELIntegerLiteral(expr) || isCELUnsignedIntegerLiteral(expr);\nexport const isCELRelation = (expr: CELExpression): expr is CELRelation => expr.type === 'Relation';\nexport const isCELList = (expr: CELExpression): expr is CELList => expr.type === 'List';\nexport const isCELMap = (expr: CELExpression): expr is CELMap => expr.type === 'Map';\nexport const isCELIdentifier = (expr: CELExpression): expr is CELIdentifier =>\n  expr.type === 'Identifier';\nexport const isCELNegation = (expr: CELExpression): expr is CELNegation => expr.type === 'Negation';\nexport const isCELMember = (expr: CELExpression): expr is CELMember => expr.type === 'Member';\n\n// v8 ignore next\nexport const isCELAddition = (expr: CELExpression): expr is CELAddition => expr.type === 'Addition';\nexport const isCELBooleanLiteral = (expr: CELExpression): expr is CELBooleanLiteral =>\n  expr.type === 'BooleanLiteral';\nexport const isCELBytesLiteral = (expr: CELExpression): expr is CELBytesLiteral =>\n  expr.type === 'BytesLiteral';\n// v8 ignore next\nexport const isCELConditionalExpr = (expr: CELExpression): expr is CELConditionalExpr =>\n  expr.type === 'ConditionalExpr';\n// v8 ignore next\nexport const isCELDivision = (expr: CELExpression): expr is CELDivision => expr.type === 'Division';\n// v8 ignore next\nexport const isCELDynamicPropertyAccessor = (\n  expr: CELExpression\n): expr is CELDynamicPropertyAccessor => expr.type === 'DynamicPropertyAccessor';\n// v8 ignore next\nexport const isCELExpressionList = (expr: CELExpression): expr is CELExpressionList =>\n  expr.type === 'ExpressionList';\n// v8 ignore next\nexport const isCELFieldInit = (expr: CELExpression): expr is CELFieldInit =>\n  expr.type === 'FieldInit';\n// v8 ignore next\nexport const isCELFieldInits = (expr: CELExpression): expr is CELFieldInits =>\n  expr.type === 'FieldInits';\n// v8 ignore next\nexport const isCELMessageInit = (expr: CELExpression): expr is CELMessageInit =>\n  expr.type === 'MessageInit';\nexport const isCELFloatLiteral = (expr: CELExpression): expr is CELFloatLiteral =>\n  expr.type === 'FloatLiteral';\n// v8 ignore next\nexport const isCELFunctionCall = (expr: CELExpression): expr is CELFunctionCall =>\n  expr.type === 'FunctionCall';\nexport const isCELIntegerLiteral = (expr: CELExpression): expr is CELIntegerLiteral =>\n  expr.type === 'IntegerLiteral';\n// v8 ignore next\nexport const isCELMapInit = (expr: CELExpression): expr is CELMapInit => expr.type === 'MapInit';\n// v8 ignore next\nexport const isCELMapInits = (expr: CELExpression): expr is CELMapInits => expr.type === 'MapInits';\n// v8 ignore next\nexport const isCELModulo = (expr: CELExpression): expr is CELModulo => expr.type === 'Modulo';\n// v8 ignore next\nexport const isCELMultiplication = (expr: CELExpression): expr is CELMultiplication =>\n  expr.type === 'Multiplication';\n// v8 ignore next\nexport const isCELNegative = (expr: CELExpression): expr is CELNegative => expr.type === 'Negative';\nexport const isCELNullLiteral = (expr: CELExpression): expr is CELNullLiteral =>\n  expr.type === 'NullLiteral';\n// v8 ignore next\nexport const isCELProperty = (expr: CELExpression): expr is CELProperty => expr.type === 'Property';\n// v8 ignore next\nexport const isCELSubtraction = (expr: CELExpression): expr is CELSubtraction =>\n  expr.type === 'Subtraction';\nexport const isCELUnsignedIntegerLiteral = (\n  expr: CELExpression\n): expr is CELUnsignedIntegerLiteral => expr.type === 'UnsignedIntegerLiteral';\n\nexport const isCELIdentifierOrChain = (\n  expr: CELExpression\n): expr is CELMemberIdentifierChain | CELIdentifier | CELDynamicPropertyAccessor =>\n  isCELIdentifier(expr) ||\n  isCELDynamicPropertyAccessor(expr) ||\n  (isCELMember(expr) &&\n    !!expr.left &&\n    !!expr.right &&\n    !expr.list &&\n    !expr.value &&\n    isCELIdentifierOrChain(expr.left) &&\n    isCELIdentifier(expr.right));\n\nexport const isCELNegatedIdentifier = (expr: CELExpression): expr is CELMemberNegatedIdentifier =>\n  isCELNegation(expr) && isCELIdentifier(expr.value);\n\nexport const isCELNegatedIdentifierOrChain = (\n  expr: CELExpression\n): expr is CELMemberNegatedIdentifierChain | CELMemberNegatedIdentifier =>\n  isCELNegatedIdentifier(expr) ||\n  (isCELMember(expr) &&\n    !!expr.left &&\n    !!expr.right &&\n    !expr.list &&\n    !expr.value &&\n    isCELIdentifierOrChain(expr.right) &&\n    isCELNegatedIdentifier(expr.left));\n\nexport const isCELLikeExpression = (expr: CELExpression): expr is CELLikeExpression =>\n  isCELMember(expr) &&\n  !!expr.left &&\n  !!expr.right &&\n  !!expr.list &&\n  isCELIdentifierOrChain(expr.left) &&\n  isCELIdentifier(expr.right) &&\n  (expr.right.value === 'contains' ||\n    expr.right.value === 'startsWith' ||\n    expr.right.value === 'endsWith' ||\n    expr.right.value === 'matches') &&\n  expr.list.value.length === 1 &&\n  (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));\n\nexport const isCELNegatedLikeExpression = (expr: CELExpression): expr is CELNegatedLikeExpression =>\n  isCELMember(expr) &&\n  !!expr.left &&\n  !!expr.right &&\n  !!expr.list &&\n  isCELNegatedIdentifierOrChain(expr.left) &&\n  isCELIdentifier(expr.right) &&\n  (expr.right.value === 'contains' ||\n    expr.right.value === 'startsWith' ||\n    expr.right.value === 'endsWith' ||\n    expr.right.value === 'matches') &&\n  expr.list.value.length === 1 &&\n  (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));\n\nexport const isCELSubqueryExpression = (expr: CELExpression): expr is CELSubqueryExpression =>\n  isCELMember(expr) &&\n  !!expr.left &&\n  !!expr.right &&\n  !!expr.list &&\n  isCELIdentifierOrChain(expr.left) &&\n  isCELIdentifier(expr.right) &&\n  (expr.right.value === 'all' || expr.right.value === 'exists') &&\n  expr.list.value.length >= 2;\n\nexport const isCELNegatedSubqueryExpression = (\n  expr: CELExpression\n): expr is CELNegatedSubqueryExpression =>\n  isCELMember(expr) &&\n  !!expr.left &&\n  !!expr.right &&\n  !!expr.list &&\n  isCELNegatedIdentifierOrChain(expr.left) &&\n  isCELIdentifier(expr.right) &&\n  (expr.right.value === 'all' || expr.right.value === 'exists') &&\n  expr.list.value.length >= 2;\n\nexport const extractSubqueryComponents = (\n  expr: CELMember\n): {\n  field: string;\n  method: 'all' | 'exists';\n  alias: string | null;\n  condition: CELExpression;\n} | null => {\n  // v8 ignore next\n  if (!isCELSubqueryExpression(expr)) {\n    return null;\n  }\n\n  const field = getCELIdentifierFromChain(expr.left);\n  const method = expr.right.value;\n  const [aliasExpr, conditionExpr] = expr.list.value;\n\n  const alias = isCELIdentifier(aliasExpr)\n    ? aliasExpr.value\n    : /* v8 ignore next -- @preserve */ null;\n\n  return {\n    field,\n    method,\n    alias,\n    condition: conditionExpr,\n  };\n};\n\nexport const getCELIdentifierFromChain = (\n  expr: CELIdentifier | CELMemberIdentifierChain | CELDynamicPropertyAccessor | CELMember\n): string => {\n  if (isCELIdentifier(expr)) {\n    return expr.value;\n  }\n\n  if (isCELDynamicPropertyAccessor(expr)) {\n    const leftField = getCELIdentifierFromChain(expr.left);\n    // Handle string literals in bracket notation\n    // v8 ignore else\n    if (isCELStringLiteral(expr.right)) {\n      const propertyName = evalCELLiteralValue(expr.right);\n      return `${leftField}[\"${propertyName}\"]`;\n    }\n    // For non-string literals, use a fallback approach\n    // v8 ignore next\n    return `${leftField}[${expr.right.type}]`;\n  }\n\n  // v8 ignore else\n  if (\n    expr.left &&\n    expr.right &&\n    isCELIdentifier(expr.right) &&\n    (isCELIdentifier(expr.left) ||\n      isCELMember(expr.left) ||\n      isCELDynamicPropertyAccessor(expr.left))\n  ) {\n    return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;\n  }\n\n  // Fallback for other CELMember types\n  // v8 ignore next\n  return expr.type;\n};\n\nexport const getCELIdentifierFromNegatedChain = (\n  expr: CELMemberNegatedIdentifier | CELMemberNegatedIdentifierChain\n): string => {\n  if (isCELNegatedIdentifier(expr)) {\n    return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;\n  }\n\n  return `${getCELIdentifierFromNegatedChain(expr.left)}.${expr.right.value}`;\n};\n\nconst celSimpleEscapes: Record<string, string> = {\n  a: '\\u0007',\n  b: '\\b',\n  f: '\\f',\n  n: '\\n',\n  r: '\\r',\n  t: '\\t',\n  v: '\\v',\n};\n\n/** Unescapes CEL string literal body (non-raw) per CEL spec escape sequences. */\nexport const unescapeCELString = (s: string): string =>\n  s.replaceAll(\n    /\\\\(?:([xX][\\dA-Fa-f]{2}|u[\\dA-Fa-f]{4}|U[\\dA-Fa-f]{8})|([0-3][0-7]{2})|([\\S\\s]))/g,\n    (m, hex: string | undefined, oct: string | undefined, ch: string | undefined) => {\n      if (hex) {\n        const cp = Number.parseInt(hex.slice(1), 16);\n        return cp > 0x10_ff_ff ? m : String.fromCodePoint(cp);\n      }\n      if (oct) return String.fromCodePoint(Number.parseInt(oct, 8));\n      return celSimpleEscapes[ch!] ?? ch!;\n    }\n  );\n\nexport function evalCELLiteralValue(literal: CELStringLiteral): string;\nexport function evalCELLiteralValue(literal: CELBooleanLiteral): boolean;\nexport function evalCELLiteralValue(literal: CELNumericLiteral): number | null;\nexport function evalCELLiteralValue(literal: CELBytesLiteral): null;\nexport function evalCELLiteralValue(literal: CELNullLiteral): null;\nexport function evalCELLiteralValue(literal: CELLiteral): string | boolean | number | null;\nexport function evalCELLiteralValue(literal: CELLiteral) {\n  switch (literal.type) {\n    case 'StringLiteral': {\n      const [, raw, , body] = /^([rR]?)('''|\"\"\"|'|\")([\\S\\s]*)\\2$/.exec(literal.value)!;\n      return raw ? body : unescapeCELString(body);\n    }\n    case 'BooleanLiteral': {\n      return literal.value;\n    }\n    case 'NullLiteral':\n    case 'BytesLiteral': {\n      return null;\n    }\n    default:\n      return literal.value;\n  }\n}\n\nexport const celNormalizeCombinator = (c: '&&' | '||'): DefaultCombinatorName =>\n  c === '||' ? 'or' : 'and';\n\nexport const celNormalizeOperator = (op: CELRelop, flip?: boolean): DefaultOperatorName => {\n  if (flip) {\n    if (op === '<') return '>';\n    if (op === '<=') return '>=';\n    if (op === '>') return '<';\n    if (op === '>=') return '<=';\n  }\n  if (op === '==') return '=';\n  return op;\n};\n\nexport const celGenerateFlatAndOrList = (\n  expr: CELConditionalAnd | CELConditionalOr\n): (DefaultCombinatorName | CELExpression)[] => {\n  const combinator = celNormalizeCombinator(expr.type === 'ConditionalAnd' ? '&&' : '||');\n  const { left, right } = expr;\n  if (isCELConditionalAnd(left) || isCELConditionalOr(left)) {\n    return [...celGenerateFlatAndOrList(left), combinator, right];\n  }\n  return [left, combinator, right];\n};\n\nexport const celGenerateMixedAndOrList = (\n  expr: CELConditionalAnd | CELConditionalOr\n): (DefaultCombinatorName | CELExpression | ('and' | CELExpression)[])[] => {\n  const arr = celGenerateFlatAndOrList(expr);\n  const returnArray: (DefaultCombinatorName | CELExpression | ('and' | CELExpression)[])[] = [];\n  let startIndex = 0;\n  for (let i = 0; i < arr.length; i += 2) {\n    if (arr[i + 1] === 'and') {\n      startIndex = i;\n      let j = 1;\n      while (arr[startIndex + j] === 'and') {\n        i += 2;\n        j += 2;\n      }\n      const tempAndArray = arr.slice(startIndex, i + 1) as ('and' | CELExpression)[];\n      returnArray.push(tempAndArray);\n      i -= 2;\n    } else if (arr[i + 1] === 'or') {\n      if (i === 0 || i === arr.length - 3) {\n        if (i === 0 || arr[i - 1] === 'or') {\n          returnArray.push(arr[i]);\n        }\n        returnArray.push(arr[i + 1]);\n        if (i === arr.length - 3) {\n          returnArray.push(arr[i + 2]);\n        }\n      } else {\n        if (arr[i - 1] === 'and') {\n          returnArray.push(arr[i + 1]);\n        } else {\n          returnArray.push(arr[i], arr[i + 1]);\n        }\n      }\n    }\n  }\n  if (returnArray.length === 1 && Array.isArray(returnArray[0])) {\n    // If length is 1, then the only element is an AND array so just return that\n    return returnArray[0];\n  }\n  return returnArray;\n};\n\nconst isPrimitiveArrayUsage = (expr: CELExpression, alias: string | null): boolean => {\n  // v8 ignore next\n  if (!alias) return false;\n\n  // Check if alias is used alone (e.g., \"score > 90\" where \"score\" is the alias)\n  if (isCELIdentifier(expr) && expr.value === alias) {\n    return true;\n  }\n\n  // Check if alias is used with primitive operators (contains, startsWith, endsWith)\n  if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) {\n    return true;\n  }\n\n  // Recursively check relations for primitive usage and conditional expressions\n  if (isCELRelation(expr) || isCELConditionalAnd(expr) || isCELConditionalOr(expr)) {\n    return isPrimitiveArrayUsage(expr.left, alias) || isPrimitiveArrayUsage(expr.right, alias);\n  }\n\n  // v8 ignore next\n  if (isCELExpressionGroup(expr) || isCELNegation(expr)) {\n    return isPrimitiveArrayUsage(expr.value, alias);\n  }\n\n  return false;\n};\n\nconst transformAliasInExpressionInternal = (\n  expr: CELExpression,\n  alias: string | null,\n  isPrimitive: boolean\n): CELExpression => {\n  // v8 ignore next\n  if (!alias) return expr;\n\n  // If it's an identifier that matches the alias\n  if (isCELIdentifier(expr) && expr.value === alias) {\n    return { type: 'Identifier', value: '' } as CELIdentifier;\n  }\n\n  // If it's a member expression starting with the alias, remove the alias part\n  if (isCELMember(expr) && expr.left && isCELIdentifier(expr.left) && expr.left.value === alias) {\n    // For object arrays: \"alias.property\" becomes \"property\"\n    // For primitive arrays: this shouldn't happen as we should have caught it above\n    if (expr.right && isCELIdentifier(expr.right) && !isPrimitive) {\n      // If this is a method call (has a list), preserve the Member structure\n      if (expr.list) {\n        return {\n          type: 'Member',\n          left: { type: 'Identifier', value: '' },\n          right: expr.right,\n          list: expr.list,\n        } as CELMember;\n      }\n      return expr.right;\n    }\n  }\n\n  // Handle CEL like expressions (e.g., \"alias.contains('test')\")\n  if (isCELLikeExpression(expr) && isCELIdentifier(expr.left) && expr.left.value === alias) {\n    // Transform \"alias.contains('test')\" to just \"contains('test')\" with empty field\n    // Keep it as a Member type but replace the left side with empty identifier\n    return {\n      type: 'Member',\n      left: { type: 'Identifier', value: '' },\n      right: expr.right,\n      list: expr.list,\n    } as CELMember;\n  }\n\n  // Handle negated like expressions\n  if (\n    isCELNegatedLikeExpression(expr) &&\n    expr.left &&\n    isCELNegatedIdentifier(expr.left) &&\n    expr.left.value.value === alias\n  ) {\n    return {\n      type: 'Member',\n      left: {\n        type: 'Negation',\n        negations: expr.left.negations,\n        value: { type: 'Identifier', value: '' },\n      },\n      right: expr.right,\n      list: expr.list,\n    } as CELMember;\n  }\n\n  // If it's a member chain like \"alias.prop1.prop2\", transform to \"prop1.prop2\"\n  if (isCELMember(expr) && expr.left && expr.right) {\n    const transformedLeft = transformAliasInExpressionInternal(expr.left, alias, isPrimitive);\n    // v8 ignore else\n    if (transformedLeft !== expr.left) {\n      return {\n        type: 'Member',\n        left: transformedLeft as CELPrimary | CELMember,\n        right: expr.right,\n        list: expr.list,\n        value: expr.value,\n      } as CELMember;\n    }\n  }\n\n  // For other expression types, recursively transform child expressions\n  if (isCELRelation(expr)) {\n    return {\n      type: 'Relation',\n      left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),\n      right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive),\n      operator: expr.operator,\n    } as CELRelation;\n  }\n\n  if (isCELConditionalAnd(expr)) {\n    return {\n      type: 'ConditionalAnd',\n      left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),\n      right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive),\n    } as CELConditionalAnd;\n  }\n\n  if (isCELConditionalOr(expr)) {\n    return {\n      type: 'ConditionalOr',\n      left: transformAliasInExpressionInternal(expr.left, alias, isPrimitive),\n      right: transformAliasInExpressionInternal(expr.right, alias, isPrimitive),\n    } as CELConditionalOr;\n  }\n\n  if (isCELExpressionGroup(expr)) {\n    return {\n      type: 'ExpressionGroup',\n      value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive),\n    } as CELExpressionGroup;\n  }\n\n  if (isCELNegation(expr)) {\n    return {\n      type: 'Negation',\n      negations: expr.negations,\n      value: transformAliasInExpressionInternal(expr.value, alias, isPrimitive) as CELPrimary,\n    } as CELNegation;\n  }\n\n  return expr;\n};\n\nexport const transformAliasInExpression = (\n  expr: CELExpression,\n  alias: string | null\n): CELExpression => {\n  // v8 ignore next\n  if (!alias) return expr;\n\n  const isPrimitive = isPrimitiveArrayUsage(expr, alias);\n  return transformAliasInExpressionInternal(expr, alias, isPrimitive);\n};\n\n/** A CEL arithmetic infix node (`Addition`/`Subtraction`/`Multiplication`/`Division`/`Modulo`). */\nexport const isCELMathOperation = (expr: CELExpression): boolean =>\n  expr.type === 'Addition' ||\n  expr.type === 'Subtraction' ||\n  expr.type === 'Multiplication' ||\n  expr.type === 'Division' ||\n  expr.type === 'Modulo';\n\n/**\n * Whether a relation operand should be routed to `getExpression`: an arithmetic infix node, a\n * `FunctionCall`, or a `ConditionalExpr` (`min`/`max` template) — optionally wrapped in one or\n * more `ExpressionGroup`s. Bare identifiers, chains, and literals are not expression operands\n * (they retain their normal handling).\n */\nexport const isCELExpressionOperand = (expr: CELExpression): boolean => {\n  const inner = isCELExpressionGroup(expr) ? expr.value : expr;\n  if (isCELExpressionGroup(inner)) return isCELExpressionOperand(inner);\n  return (\n    isCELMathOperation(inner) || inner.type === 'FunctionCall' || inner.type === 'ConditionalExpr'\n  );\n};\n"],"mappings":";AAgDA,MAAa,wBAAwB,SACnC,KAAK,SAAS;AAChB,MAAa,uBAAuB,SAClC,KAAK,SAAS;AAChB,MAAa,sBAAsB,SACjC,KAAK,SAAS;AAChB,MAAa,sBAAsB,SACjC,KAAK,SAAS;AAChB,MAAa,gBAAgB,SAC3B,oBAAoB,IAAI,KACxB,mBAAmB,IAAI,KACvB,oBAAoB,IAAI,KACxB,iBAAiB,IAAI,KACrB,kBAAkB,IAAI;AACxB,MAAa,uBAAuB,SAClC,kBAAkB,IAAI,KAAK,oBAAoB,IAAI,KAAK,4BAA4B,IAAI;AAC1F,MAAa,iBAAiB,SAA6C,KAAK,SAAS;AACzF,MAAa,aAAa,SAAyC,KAAK,SAAS;AACjF,MAAa,YAAY,SAAwC,KAAK,SAAS;AAC/E,MAAa,mBAAmB,SAC9B,KAAK,SAAS;AAChB,MAAa,iBAAiB,SAA6C,KAAK,SAAS;AACzF,MAAa,eAAe,SAA2C,KAAK,SAAS;;AAGrF,MAAa,iBAAiB,SAA6C,KAAK,SAAS;A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