{"version":3,"file":"aiSdk.mjs","names":["generateTextFn"],"sources":["../../src/aiSdk.ts"],"sourcesContent":["import type { AlibabaProvider, createAlibaba } from '@ai-sdk/alibaba';\nimport type {\n  AmazonBedrockProvider,\n  createAmazonBedrock,\n} from '@ai-sdk/amazon-bedrock';\nimport type { AnthropicProvider, createAnthropic } from '@ai-sdk/anthropic';\nimport type { createDeepSeek, DeepSeekProvider } from '@ai-sdk/deepseek';\nimport type { createFireworks, FireworksProvider } from '@ai-sdk/fireworks';\nimport type {\n  createGoogleGenerativeAI,\n  GoogleGenerativeAIProvider,\n} from '@ai-sdk/google';\nimport type {\n  createVertex,\n  GoogleVertexProvider as VertexProvider,\n} from '@ai-sdk/google-vertex';\nimport type { createGroq, GroqProvider } from '@ai-sdk/groq';\nimport type {\n  createHuggingFace,\n  HuggingFaceProvider,\n} from '@ai-sdk/huggingface';\nimport type { createMistral, MistralProvider } from '@ai-sdk/mistral';\nimport type { createOpenAI, OpenAIProvider } from '@ai-sdk/openai';\nimport type {\n  createOpenAICompatible,\n  OpenAICompatibleProvider,\n} from '@ai-sdk/openai-compatible';\nimport type { createTogetherAI, TogetherAIProvider } from '@ai-sdk/togetherai';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, logger, x } from '@intlayer/config/logger';\nimport { AiProviders } from '@intlayer/types/config';\nimport type {\n  createOpenRouter,\n  OpenRouterProvider,\n} from '@openrouter/ai-sdk-provider';\nimport type {\n  AssistantModelMessage,\n  generateText,\n  SystemModelMessage,\n  ToolModelMessage,\n  UserModelMessage,\n} from 'ai';\nimport { generateText as generateTextFn } from 'ai';\n\nconst DEFAULT_PROVIDER = AiProviders.ANTHROPIC;\nconst DEFAULT_MODEL = 'claude-haiku-4-5';\nconst DEFAULT_API_KEY = process.env.ANTHROPIC_API_KEY;\n\nexport { AiProviders as AIProvider };\n\ntype AnthropicModel = Parameters<AnthropicProvider>[0];\ntype DeepSeekModel = Parameters<DeepSeekProvider>[0];\ntype MistralModel = Parameters<MistralProvider>[0];\ntype OpenAIModel = Parameters<OpenAIProvider>[0];\ntype OpenRouterModel = Parameters<OpenRouterProvider>[0];\ntype GoogleModel = Parameters<GoogleGenerativeAIProvider>[0];\ntype VertexModel = Parameters<VertexProvider>[0];\ntype AlibabaModel = Parameters<AlibabaProvider>[0];\ntype AmazonBedrockModel = Parameters<AmazonBedrockProvider>[0];\ntype FireworksModel = Parameters<FireworksProvider>[0];\ntype GroqModel = Parameters<GroqProvider>[0];\ntype HuggingFaceModel = Parameters<HuggingFaceProvider>[0];\ntype TogetherAIModel = Parameters<TogetherAIProvider>[0];\ntype LMStudioModel = Parameters<OpenAICompatibleProvider>[0];\n\nexport type OpenAIProviderOptions = Parameters<typeof createOpenAI>[0];\nexport type AnthropicProviderOptions = Parameters<typeof createAnthropic>[0];\nexport type MistralProviderOptions = Parameters<typeof createMistral>[0];\nexport type DeepSeekProviderOptions = Parameters<typeof createDeepSeek>[0];\nexport type GoogleProviderOptions = Parameters<\n  typeof createGoogleGenerativeAI\n>[0];\nexport type VertexProviderOptions = Parameters<typeof createVertex>[0];\nexport type OpenRouterProviderOptions = Parameters<typeof createOpenRouter>[0];\nexport type AlibabaProviderOptions = Parameters<typeof createAlibaba>[0];\nexport type FireworksProviderOptions = Parameters<typeof createFireworks>[0];\nexport type GroqProviderOptions = Parameters<typeof createGroq>[0];\nexport type HuggingFaceProviderOptions = Parameters<\n  typeof createHuggingFace\n>[0];\nexport type AmazonBedrockProviderOptions = Parameters<\n  typeof createAmazonBedrock\n>[0];\nexport type TogetherAIProviderOptions = Parameters<typeof createTogetherAI>[0];\nexport type LMStudioProviderOptions = Parameters<\n  typeof createOpenAICompatible\n>[0];\n\nexport type SystemMessage =\n  | string\n  | SystemModelMessage\n  | SystemModelMessage[]\n  | undefined;\n\nexport type Messages = (\n  | UserModelMessage\n  | AssistantModelMessage\n  | ToolModelMessage\n)[];\n\n/**\n * Supported AI models\n */\nexport type Model =\n  | AnthropicModel\n  | DeepSeekModel\n  | MistralModel\n  | OpenAIModel\n  | OpenRouterModel\n  | GoogleModel\n  | VertexModel\n  | AlibabaModel\n  | AmazonBedrockModel\n  | FireworksModel\n  | GroqModel\n  | HuggingFaceModel\n  | TogetherAIModel\n  | LMStudioModel\n  | (string & {});\n\n/**\n * Supported AI SDK providers\n */\n\nexport type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'none';\n\n/**\n * Common options for all AI providers\n */\ntype CommonAIOptions = {\n  model?: Model;\n  temperature?: number;\n  baseURL?: string;\n  apiKey?: string;\n  applicationContext?: string;\n  dataSerialization?: 'json' | 'toon';\n};\n\nexport type AIOptions = (\n  | ({\n      provider: AiProviders.OPENAI | `${AiProviders.OPENAI}`;\n    } & OpenAIProviderOptions)\n  | ({\n      provider: AiProviders.ANTHROPIC | `${AiProviders.ANTHROPIC}`;\n    } & AnthropicProviderOptions)\n  | ({\n      provider: AiProviders.MISTRAL | `${AiProviders.MISTRAL}`;\n    } & MistralProviderOptions)\n  | ({\n      provider: AiProviders.DEEPSEEK | `${AiProviders.DEEPSEEK}`;\n    } & DeepSeekProviderOptions)\n  | ({\n      provider: AiProviders.GEMINI | `${AiProviders.GEMINI}`;\n    } & GoogleProviderOptions)\n  | ({\n      provider:\n        | AiProviders.GOOGLEGENERATIVEAI\n        | `${AiProviders.GOOGLEGENERATIVEAI}`;\n    } & GoogleProviderOptions)\n  | ({\n      provider: AiProviders.OLLAMA | `${AiProviders.OLLAMA}`;\n    } & OpenAIProviderOptions)\n  | ({\n      provider: AiProviders.OPENROUTER | `${AiProviders.OPENROUTER}`;\n    } & OpenRouterProviderOptions)\n  | ({\n      provider: AiProviders.ALIBABA | `${AiProviders.ALIBABA}`;\n    } & AlibabaProviderOptions)\n  | ({\n      provider: AiProviders.FIREWORKS | `${AiProviders.FIREWORKS}`;\n    } & FireworksProviderOptions)\n  | ({\n      provider: AiProviders.GROQ | `${AiProviders.GROQ}`;\n    } & GroqProviderOptions)\n  | ({\n      provider: AiProviders.HUGGINGFACE | `${AiProviders.HUGGINGFACE}`;\n    } & HuggingFaceProviderOptions)\n  | ({\n      provider: AiProviders.BEDROCK | `${AiProviders.BEDROCK}`;\n    } & AmazonBedrockProviderOptions)\n  | ({\n      provider: AiProviders.GOOGLEVERTEX | `${AiProviders.GOOGLEVERTEX}`;\n    } & VertexProviderOptions)\n  | ({\n      provider: AiProviders.TOGETHERAI | `${AiProviders.TOGETHERAI}`;\n    } & TogetherAIProviderOptions)\n  | ({\n      provider: AiProviders.LMSTUDIO | `${AiProviders.LMSTUDIO}`;\n    } & LMStudioProviderOptions)\n  | ({ provider?: undefined } & OpenAIProviderOptions)\n) &\n  CommonAIOptions;\n\n// Define the structure of messages used in chat completions\nexport type ChatCompletionRequestMessage = {\n  role: 'system' | 'user' | 'assistant'; // The role of the message sender\n  content: string; // The text content of the message\n  timestamp?: Date; // The timestamp of the message\n};\n\ntype AccessType = 'apiKey' | 'registered_user' | 'premium_user' | 'public';\n\nconst isMaskedKey = (key?: string): boolean => !!key?.includes('*');\n\nconst getAPIKey = (\n  accessType: AccessType[],\n  aiOptions?: AIOptions,\n  isAuthenticated: boolean = false\n) => {\n  const apiKey =\n    aiOptions?.apiKey && !isMaskedKey(aiOptions.apiKey)\n      ? aiOptions.apiKey\n      : undefined;\n\n  if (accessType.includes('public')) {\n    return apiKey ?? DEFAULT_API_KEY;\n  }\n\n  if (accessType.includes('apiKey') && apiKey) {\n    return apiKey;\n  }\n\n  if (accessType.includes('registered_user') && isAuthenticated) {\n    return apiKey ?? DEFAULT_API_KEY;\n  }\n\n  // TODO: Implement premium user access\n  if (accessType.includes('premium_user') && isAuthenticated) {\n    return apiKey ?? DEFAULT_API_KEY;\n  }\n\n  return undefined;\n};\n\nconst getModelName = (\n  provider: AiProviders,\n  isUserProvidedKey: boolean,\n  userModel?: Model\n): Model => {\n  // If the user provides their own API key, allow custom model selection\n  if (\n    isUserProvidedKey ||\n    provider === AiProviders.OLLAMA ||\n    provider === AiProviders.LMSTUDIO\n  ) {\n    if (userModel) {\n      return userModel;\n    }\n\n    // No custom model specified — fall back to the default\n    return DEFAULT_MODEL;\n  }\n\n  // Using backend's default API key — always use the default model,\n  // ignore any custom model the user may have passed\n  return DEFAULT_MODEL;\n};\n\nconst getLanguageModel = async (\n  aiOptions: AIOptions,\n  apiKey: string | undefined\n) => {\n  const loadModule = async <T>(packageName: string): Promise<T> => {\n    try {\n      return (await import(packageName)) as T;\n    } catch {\n      logger(\n        `${x} The package \"${colorize(packageName, ANSIColors.GREEN)}\" is required to use this AI provider. Please install it using: ${colorize(`npm install ${packageName}`, ANSIColors.GREY_DARK)}`,\n        {\n          level: 'error',\n        }\n      );\n      process.exit();\n    }\n  };\n\n  const provider = aiOptions.provider ?? AiProviders.OPENAI;\n  const selectedModel = getModelName(\n    provider as AiProviders,\n    !!aiOptions.apiKey, // true only when the user explicitly provided their own key\n    aiOptions.model\n  );\n\n  const baseURL = aiOptions.baseURL;\n\n  switch (provider) {\n    case AiProviders.OPENAI: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createOpenAI } =\n        await loadModule<typeof import('@ai-sdk/openai')>('@ai-sdk/openai');\n\n      return createOpenAI({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel);\n    }\n\n    case AiProviders.ANTHROPIC: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createAnthropic } =\n        await loadModule<typeof import('@ai-sdk/anthropic')>(\n          '@ai-sdk/anthropic'\n        );\n\n      return createAnthropic({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel);\n    }\n\n    case AiProviders.MISTRAL: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createMistral } =\n        await loadModule<typeof import('@ai-sdk/mistral')>('@ai-sdk/mistral');\n\n      return createMistral({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel);\n    }\n\n    case AiProviders.DEEPSEEK: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createDeepSeek } =\n        await loadModule<typeof import('@ai-sdk/deepseek')>('@ai-sdk/deepseek');\n\n      return createDeepSeek({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel);\n    }\n\n    case AiProviders.GEMINI: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createGoogleGenerativeAI } =\n        await loadModule<typeof import('@ai-sdk/google')>('@ai-sdk/google');\n\n      return createGoogleGenerativeAI({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel);\n    }\n\n    case AiProviders.GOOGLEVERTEX: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createVertex } = await loadModule<\n        typeof import('@ai-sdk/google-vertex')\n      >('@ai-sdk/google-vertex');\n\n      return createVertex({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel as string);\n    }\n\n    case AiProviders.GOOGLEGENERATIVEAI: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createGoogleGenerativeAI } =\n        await loadModule<typeof import('@ai-sdk/google')>('@ai-sdk/google');\n\n      return createGoogleGenerativeAI({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      })(selectedModel as string);\n    }\n\n    case AiProviders.OLLAMA: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createOpenAI } =\n        await loadModule<typeof import('@ai-sdk/openai')>('@ai-sdk/openai');\n\n      // Ollama compatible mode:\n      const ollama = createOpenAI({\n        baseURL: baseURL ?? 'http://localhost:11434/v1',\n        apiKey: apiKey ?? 'ollama', // Required but unused by Ollama\n        ...otherOptions,\n      });\n\n      return ollama.chat(selectedModel);\n    }\n\n    case AiProviders.OPENROUTER: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createOpenRouter } = await loadModule<\n        typeof import('@openrouter/ai-sdk-provider')\n      >('@openrouter/ai-sdk-provider');\n\n      const openrouter = createOpenRouter({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return openrouter(selectedModel as string);\n    }\n\n    case AiProviders.ALIBABA: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createAlibaba } =\n        await loadModule<typeof import('@ai-sdk/alibaba')>('@ai-sdk/alibaba');\n\n      const alibaba = createAlibaba({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return alibaba(selectedModel as string);\n    }\n\n    case AiProviders.FIREWORKS: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createFireworks } =\n        await loadModule<typeof import('@ai-sdk/fireworks')>(\n          '@ai-sdk/fireworks'\n        );\n\n      const fireworks = createFireworks({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return fireworks(selectedModel as string);\n    }\n\n    case AiProviders.GROQ: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createGroq } =\n        await loadModule<typeof import('@ai-sdk/groq')>('@ai-sdk/groq');\n\n      const groq = createGroq({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return groq(selectedModel as string);\n    }\n\n    case AiProviders.HUGGINGFACE: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createHuggingFace } = await loadModule<\n        typeof import('@ai-sdk/huggingface')\n      >('@ai-sdk/huggingface');\n\n      const huggingface = createHuggingFace({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return huggingface(selectedModel as string);\n    }\n\n    case AiProviders.BEDROCK: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createAmazonBedrock } = await loadModule<\n        typeof import('@ai-sdk/amazon-bedrock')\n      >('@ai-sdk/amazon-bedrock');\n\n      const bedrock = createAmazonBedrock({\n        accessKeyId: apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return bedrock(selectedModel as string);\n    }\n\n    case AiProviders.TOGETHERAI: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createTogetherAI } =\n        await loadModule<typeof import('@ai-sdk/togetherai')>(\n          '@ai-sdk/togetherai'\n        );\n\n      const togetherai = createTogetherAI({\n        apiKey,\n        baseURL,\n        ...otherOptions,\n      });\n\n      return togetherai(selectedModel as string);\n    }\n\n    case AiProviders.LMSTUDIO: {\n      const {\n        provider,\n        model,\n        temperature,\n        applicationContext,\n        dataSerialization,\n        apiKey: _apiKey,\n        baseURL: _baseURL,\n        ...otherOptions\n      } = aiOptions as any;\n\n      const { createOpenAICompatible } = await loadModule<\n        typeof import('@ai-sdk/openai-compatible')\n      >('@ai-sdk/openai-compatible');\n\n      const lmstudio = createOpenAICompatible({\n        name: 'lmstudio',\n        baseURL: baseURL ?? 'http://localhost:1234/v1',\n        ...otherOptions,\n      });\n\n      return lmstudio(selectedModel as string);\n    }\n\n    default: {\n      throw new Error(`Provider ${provider} not supported`);\n    }\n  }\n};\n\nexport type AIConfig = Omit<Parameters<typeof generateText>[0], 'prompt'> & {\n  reasoningEffort?: ReasoningEffort;\n  textVerbosity?: 'low' | 'medium' | 'high';\n  dataSerialization?: 'json' | 'toon';\n};\n\nexport type AIConfigOptions = {\n  userOptions?: AIOptions;\n  projectOptions?: AIOptions;\n  defaultOptions?: AIOptions;\n  accessType?: AccessType[];\n};\n\n/**\n * Sends a minimal request to verify that the configured AI provider credentials\n * are valid and reachable before starting any bulk operation.\n *\n * @returns true if access is confirmed, false otherwise\n */\nexport const checkAISDKAccess = async (\n  aiConfig: AIConfig\n): Promise<{ hasAIAccess: boolean; error?: string }> => {\n  try {\n    await generateTextFn({\n      ...aiConfig,\n      messages: [\n        {\n          role: 'user',\n          content: 'ping',\n        },\n      ],\n      maxOutputTokens: 20,\n    });\n    return { hasAIAccess: true };\n  } catch (error) {\n    return { hasAIAccess: false, error: (error as Error).message };\n  }\n};\n\n/**\n * Get AI model configuration based on the selected provider and options\n * This function handles the configuration for different AI providers\n *\n * @param options Configuration options including provider, API keys, models and temperature\n * @returns Configured AI model ready to use with generateText\n */\nexport const getAIConfig = async (\n  options: AIConfigOptions,\n  isAuthenticated: boolean = false\n): Promise<AIConfig> => {\n  const {\n    userOptions,\n    projectOptions,\n    defaultOptions,\n    accessType = ['registered_user'],\n  } = options;\n\n  const mergeWithoutUndefined = (...sources: (AIOptions | undefined)[]) => {\n    const result: Record<string, unknown> = { provider: DEFAULT_PROVIDER };\n    for (const source of sources) {\n      if (!source) continue;\n      for (const [key, value] of Object.entries(source)) {\n        if (value === undefined) continue;\n        if (key === 'apiKey' && isMaskedKey(value as string)) continue;\n        result[key] = value;\n      }\n    }\n    return result;\n  };\n\n  const aiOptions = mergeWithoutUndefined(\n    defaultOptions,\n    projectOptions,\n    userOptions\n  ) as AIOptions;\n\n  const apiKey = getAPIKey(accessType, aiOptions, isAuthenticated);\n\n  // Check if API key is provided\n  if (\n    !apiKey &&\n    aiOptions.provider !== AiProviders.OLLAMA &&\n    aiOptions.provider !== AiProviders.LMSTUDIO\n  ) {\n    throw new Error(`API key for ${aiOptions.provider} is missing`);\n  }\n\n  const languageModel = await getLanguageModel(aiOptions, apiKey);\n\n  return {\n    model: languageModel,\n    temperature: aiOptions.temperature,\n    dataSerialization: aiOptions.dataSerialization,\n  };\n};\n"],"mappings":";;;;;;AA4CA,MAAM,mBAAmB,YAAY;AACrC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,QAAQ,IAAI;AA4JpC,MAAM,eAAe,QAA0B,CAAC,CAAC,KAAK,SAAS,IAAI;AAEnE,MAAM,aACJ,YACA,WACA,kBAA2B,UACxB;CACH,MAAM,SACJ,WAAW,UAAU,CAAC,YAAY,UAAU,OAAO,GAC/C,UAAU,SACV;AAEN,KAAI,WAAW,SAAS,SAAS,CAC/B,QAAO,UAAU;AAGnB,KAAI,WAAW,SAAS,SAAS,IAAI,OACnC,QAAO;AAGT,KAAI,WAAW,SAAS,kBAAkB,IAAI,gBAC5C,QAAO,UAAU;AAInB,KAAI,WAAW,SAAS,eAAe,IAAI,gBACzC,QAAO,UAAU;;AAMrB,MAAM,gBACJ,UACA,mBACA,cACU;AAEV,KACE,qBACA,aAAa,YAAY,UACzB,aAAa,YAAY,UACzB;AACA,MAAI,UACF,QAAO;A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