{"version":3,"file":"odx-angular-localization.mjs","sources":["../../../../libs/angular/localization/src/lib/localization-locales.ts","../../../../libs/angular/localization/src/lib/localization.config.ts","../../../../libs/angular/localization/src/lib/localization.logger.ts","../../../../libs/angular/localization/src/lib/localization.service.ts","../../../../libs/angular/localization/src/lib/models/localization-feature.ts","../../../../libs/angular/localization/src/lib/features/with-angular-locale.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-header.ts","../../../../libs/angular/localization/src/lib/features/with-http-language-query-param.ts","../../../../libs/angular/localization/src/lib/loaders/browser-language-loader.ts","../../../../libs/angular/localization/src/odx-angular-localization.ts"],"sourcesContent":["import localeDe from '@angular/common/locales/de';\nimport localeEn from '@angular/common/locales/en';\nimport localeEnGb from '@angular/common/locales/en-GB';\nimport localeEs from '@angular/common/locales/es';\nimport localeFr from '@angular/common/locales/fr';\nimport localeFrCa from '@angular/common/locales/fr-CA';\n\n// Order determines DEFAULT_AVAILABLE_LANGUAGES — the first entry is the default language.\nconst LOCALE_DATA_BY_ID = new Map<string, unknown>([\n  ['en-us', localeEn],\n  ['en-gb', localeEnGb],\n  ['en', localeEn],\n  ['de-de', localeDe],\n  ['de', localeDe],\n  ['es-es', localeEs],\n  ['es', localeEs],\n  ['fr-fr', localeFr],\n  ['fr-ca', localeFrCa],\n  ['fr', localeFr],\n]);\n\nexport const DEFAULT_AVAILABLE_LANGUAGES = [...LOCALE_DATA_BY_ID.keys()].map(\n  (key) => new Intl.Locale(key).baseName,\n);\n\nexport function resolveAngularLocaleData(localeId: string): unknown | undefined {\n  try {\n    const locale = new Intl.Locale(localeId);\n    return LOCALE_DATA_BY_ID.get(locale.baseName.toLowerCase()) ?? LOCALE_DATA_BY_ID.get(locale.language.toLowerCase());\n  } catch {\n    return undefined;\n  }\n}\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\nimport { createConfigTokens } from '@odx/angular/utils';\nimport { withAngularLocale } from './features/with-angular-locale';\nimport { DEFAULT_AVAILABLE_LANGUAGES } from './localization-locales';\nimport { LocalizationService } from './localization.service';\nimport { LanguageLoaderFn, LocalizationFeature } from './models';\n\n/**\n * Defines the structure for the localization configuration used throughout the application.\n * It allows specifying available languages, and includes an optional loader\n * function for dynamically determining the active language.\n *\n * @property {LanguageLoaderFn} [activeLanguageLoader] Optional function for loading the\n * active language dynamically, useful for scenarios where the application's language\n * needs to be determined based on user settings, browser settings, or external data.\n * @property {boolean} [angularLocale=false] Enables Angular locale integration (`LOCALE_ID`\n * and locale data registration) based on the resolved active language.\n * @property {string[]} availableLanguages An array of language codes representing the\n * languages available in the application.\n */\nexport interface LocalizationConfig {\n  activeLanguageLoader?: LanguageLoaderFn;\n  angularLocale?: boolean;\n  availableLanguages: string[];\n}\n\n/**\n * Utilizes `createConfigTokens` to generate configuration tokens and related utilities for the\n * localization settings within the application. It defines a structured and type-safe approach\n * for managing localization configurations, such as available languages, and potentially\n * a dynamic loader for the active language. The generated tokens and utilities facilitate accessing\n * and providing these configurations throughout the application.\n *\n * @const {InjectionToken<LocalizationConfig>} LocalizationConfig - An InjectionToken for accessing\n * the localization configuration within Angular's dependency injection framework. Use this token to inject\n * localization configurations into services, components, or other tokens.\n *\n * @const {LocalizationConfig} LocalizationDefaultConfig - The default configuration values for localization,\n * based on the provided settings. Includes the default available languages.\n *\n * @const {Function} injectLocalizationConfig - A utility function that returns the injected value of\n * `LocalizationConfig` token. Use this function to access the current localization configuration in\n * a type-safe manner.\n *\n * @const {Function} provideLocalizationConfig - A utility function to provide the `LocalizationConfig` token\n * with specific values. Use this function to configure and override default localization settings within\n * an Angular module or component.\n *\n * @example\n * ```ts\n * // Providing localization settings in an Angular module\n * @NgModule({\n *   providers: [\n *     provideLocalizationConfig({\n *       availableLanguages: ['en', 'es', 'fr'],\n *     })\n *   ]\n * })\n * export class AppModule { }\n *\n * // Injecting and using the localization configuration in a service\n * @Injectable({ providedIn: 'root' })\n * export class MyLocalizationService {\n *   constructor(@Inject(LocalizationConfig) private config: LocalizationConfig) {\n *     console.log('Available languages:', config.availableLanguages);\n *   }\n * }\n * ```\n */\nexport const { LocalizationConfig, LocalizationDefaultConfig, injectLocalizationConfig, provideLocalizationConfig } = createConfigTokens(\n  'Localization',\n  '@odx/angular/internal/translate',\n  {\n    angularLocale: false,\n    availableLanguages: DEFAULT_AVAILABLE_LANGUAGES,\n  } as LocalizationConfig,\n);\n\n/**\n * Sets up the localization configuration for the application and initializes the localization\n * system with the provided configuration and features. This function is typically called\n * within the main module or a core module of the application to ensure localization settings\n * are available and active as early as possible.\n *\n * @param {Partial<LocalizationConfig>} config The localization configuration settings, including\n * available languages and optionally, a custom loader for the active language.\n * @param {...LocalizationFeature[]} features Additional localization features or configurations\n * to be registered as part of the application's environment providers.\n * @returns {EnvironmentProviders} A collection of providers for setting up the application's\n * localization environment, to be used with Angular's environment-specific injector configuration.\n * @example\n * ```ts\n * // Example of providing localization settings in an Angular module\n * @NgModule({\n *   imports: [...],\n *   providers: [\n *     provideLocalization({\n *       availableLanguages: ['en', 'es', 'fr'],\n *       activeLanguageLoader: () => fetch('/api/user/language').then(res => res.text()),\n *     }),\n *   ],\n * })\n * export class AppModule {}\n * ```\n */\nexport function provideLocalization(config: Partial<LocalizationConfig>, ...features: LocalizationFeature[]): EnvironmentProviders {\n  const localeFeatures = config.angularLocale ? [withAngularLocale()] : [];\n  // Base initializer is only needed when withAngularLocale is not present,\n  // since withAngularLocale's own initializer already calls loadActiveLanguage().\n  const baseInitializers = localeFeatures.length === 0 ? [provideAppInitializer(() => inject(LocalizationService).loadActiveLanguage())] : [];\n\n  return makeEnvironmentProviders([\n    provideLocalizationConfig(config),\n    ...baseInitializers,\n    ...localeFeatures,\n    ...features,\n  ]);\n}\n","import { Logger } from '@odx/angular/internal';\n\nexport default new Logger('@odx/angular/localization');\n","import { Injectable, Injector, inject, runInInjectionContext } from '@angular/core';\nimport { BehaviorSubject, Observable, distinctUntilChanged, firstValueFrom, from, isObservable, map, of, shareReplay } from 'rxjs';\nimport { injectLocalizationConfig } from './localization.config';\nimport logger from './localization.logger';\n\n@Injectable({ providedIn: 'root' })\nexport class LocalizationService {\n  private readonly localizationConfig = injectLocalizationConfig();\n  private readonly injector = inject(Injector);\n  private readonly initialLoadedLanguage = this.localizationConfig.activeLanguageLoader?.();\n  private readonly localeState$ = new BehaviorSubject<Intl.Locale>(new Intl.Locale(this.localizationConfig.availableLanguages[0]));\n  private loadActiveLanguagePromise?: Promise<void>;\n\n  /**\n   * Represents an observable stream of the active language in the localization service.\n   * The active language is determined by the locale state.\n   *\n   * @emits {string} The active language.\n   */\n  public readonly activeLanguage$ = this.localeState$.pipe(\n    map((x) => x.baseName),\n    distinctUntilChanged(),\n    shareReplay({ bufferSize: 1, refCount: true }),\n  );\n\n  /**\n   * Gets the list of available languages for localization.\n   *\n   * @type {string[]} The list of available languages.\n   */\n  public readonly availableLanguages = this.localizationConfig.availableLanguages;\n\n  /**\n   * Default language derived from the first entry in the available languages list.\n   *\n   * @type {string}\n   */\n  public readonly defaultLanguage = this.availableLanguages[0];\n\n  constructor() {\n    if (typeof this.initialLoadedLanguage === 'string') {\n      this.setActiveLanguage(this.initialLoadedLanguage);\n    }\n  }\n\n  /**\n   * Retrieves the currently active language.\n   *\n   * @returns {string} Full locale name e.g. 'en-US' or just 'en' if no region info is attached.\n   */\n  public getActiveLanguage(): string {\n    return this.localeState$.getValue().baseName;\n  }\n\n  /**\n   * Retrieves the active language subtag.\n   *\n   * @returns {string} The two-digit language subtag, e.g. 'en', 'fr'.\n   */\n  public getActiveLanguageSubtag(): string {\n    return this.localeState$.getValue().language;\n  }\n\n  /**\n   * Sets the active language based on the provided language code. If the language is not\n   * recognized, it logs an error and does not change the active language.\n   *\n   * @param {string} language The language code to set as the active language.\n   */\n  public setActiveLanguage(language: string): void {\n    try {\n      const locale = new Intl.Locale(language);\n      if (this.availableLanguages.includes(locale.baseName)) {\n        this.localeState$.next(locale);\n      } else if (this.availableLanguages.includes(locale.language)) {\n        this.localeState$.next(new Intl.Locale(locale.language));\n      } else {\n        throw new Error(`Unrecognizable language '${language}'. Make sure it's a part of availableLanguages inside LocalizationService config.`);\n      }\n    } catch (error) {\n      logger.error(error);\n    }\n  }\n\n  /**\n   * Loads the active language for the localization service.\n   * This method runs in an injection context and sets the active language based on the result of the active language loader.\n   * If the active language loader fails, the default language is set as the active language.\n   *\n   * @returns {Promise<void>} A promise that resolves when the active language is loaded and set.\n   */\n  public async loadActiveLanguage(): Promise<void> {\n    if (!this.loadActiveLanguagePromise) {\n      this.loadActiveLanguagePromise = runInInjectionContext(this.injector, async () => {\n        const activeLanguageLoader$ = this.createActiveLanguageLoader$();\n        const activeLanguage = await firstValueFrom(activeLanguageLoader$).catch(() => null);\n        this.setActiveLanguage(activeLanguage ?? this.defaultLanguage);\n      });\n    }\n\n    return this.loadActiveLanguagePromise;\n  }\n\n  private createActiveLanguageLoader$(): Observable<string | undefined> {\n    const language = this.initialLoadedLanguage ?? this.localizationConfig.activeLanguageLoader?.();\n    if (isObservable(language)) {\n      return language;\n    }\n    if (language instanceof Promise) {\n      return from(language);\n    }\n    return of(language);\n  }\n}\n\n","import { EnvironmentProviders, Provider } from '@angular/core';\n\nexport type LocalizationFeature = EnvironmentProviders & { ɵodxBrand: '@odx/angular/localization::LocalizationFeature' };\n\n/**\n * @internal\n * Creates a feature provider for the localization module.\n *\n * @param {Provider[] | EnvironmentProviders} provider - The providers to be used for the localization feature.\n * @returns {LocalizationFeature} The localization feature provider.\n */\nexport function makeLocalizationFeature(provider: Provider[] | EnvironmentProviders): LocalizationFeature {\n  return provider as never as LocalizationFeature;\n}\n","import { registerLocaleData } from '@angular/common';\nimport { LOCALE_ID, inject, isDevMode, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\nimport { resolveAngularLocaleData } from '../localization-locales';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nasync function registerAngularLocale(localeId: string, registeredLocales: Set<string>): Promise<void> {\n  const locale = new Intl.Locale(localeId);\n  const localeKey = locale.baseName.toLowerCase();\n\n  if (registeredLocales.has(localeKey)) {\n    return;\n  }\n\n  const localeData = resolveAngularLocaleData(localeKey);\n  if (!localeData) {\n    if (isDevMode()) {\n      console.warn(\n        `[withAngularLocale] No built-in locale data found for \"${locale.baseName}\". ` +\n          `Register locale data manually using registerLocaleData() before bootstrapping.`,\n      );\n    }\n    return;\n  }\n\n  registerLocaleData(localeData, locale.baseName);\n  registeredLocales.add(localeKey);\n}\n\n/**\n * @internal\n *\n * Provides Angular locale integration by synchronizing `LOCALE_ID` with the active\n * localization language and registering locale data for built-in Angular pipes.\n *\n * Use `angularLocale: true` in `provideLocalization` config instead of calling this directly.\n */\nexport function withAngularLocale(): LocalizationFeature {\n  const registeredLocales = new Set<string>();\n\n  return makeLocalizationFeature(\n    makeEnvironmentProviders([\n      provideAppInitializer(async () => {\n        const localizationService = inject(LocalizationService);\n        const preLoadLanguage = localizationService.getActiveLanguage();\n        await localizationService.loadActiveLanguage();\n        const resolvedLanguage = localizationService.getActiveLanguage();\n\n        if (isDevMode() && preLoadLanguage !== resolvedLanguage) {\n          console.warn(\n            `[withAngularLocale] Active language resolved asynchronously: ` +\n              `initial value was \"${preLoadLanguage}\", loaded value is \"${resolvedLanguage}\". ` +\n              `Any LOCALE_ID consumer initialized before this APP_INITIALIZER completed will use \"${preLoadLanguage}\". ` +\n              `Use a synchronous activeLanguageLoader (e.g. browserLanguageLoader) for predictable LOCALE_ID behavior.`,\n          );\n        }\n\n        await registerAngularLocale(resolvedLanguage, registeredLocales);\n      }),\n      {\n        provide: LOCALE_ID,\n        useFactory: () => inject(LocalizationService).getActiveLanguage(),\n      },\n    ]),\n  );\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_HEADER = 'Accept-Language';\n\n/**\n * Configuration object for the HTTP language header interceptor. It specifies which URLs\n * the interceptor should apply to and allows customizing the name of the header used to transmit\n * the current language setting.\n *\n * @property {Array<string | RegExp>} allowedUrls - An array of strings or RegExp patterns\n * indicating the URLs to which the language header should be added.\n * @property {string} [headerName=HTTP_LANGUAGE_HEADER] - Optional. The name of the HTTP header\n * through which the current language setting will be transmitted. Defaults to 'Accept-Language'.\n */\nexport interface HttpLanguageHeaderInterceptorConfig {\n  allowedUrls: Array<string | RegExp>;\n  headerName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that adds a language header to outgoing HTTP requests,\n * but only for URLs matching the provided criteria. This allows the server to respond with\n * resources localized in the user's current language.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the interceptor,\n * including the list of allowed URLs and optionally a custom header name.\n * @returns {HttpInterceptorFn} An Angular HTTP interceptor function that conditionally adds\n * the current language as an HTTP header based on the request URL.\n *\n * @example\n * ```ts\n * // Use in HTTP client module setup\n * import { HttpClientModule } from '@angular/common/http';\n * import { httpLanguageHeaderInterceptor, HTTP_LANGUAGE_HEADER } from '@odx/angular/localization';\n *\n * @NgModule({\n *   imports: [HttpClientModule],\n *   providers: [\n *     provideHttpClient(withInterceptors([\n *       httpLanguageHeaderInterceptor({ allowedUrls: ['/api'], headerName: HTTP_LANGUAGE_HEADER })\n *     ]))\n *   ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function httpLanguageHeaderInterceptor({ allowedUrls, headerName }: HttpLanguageHeaderInterceptorConfig): HttpInterceptorFn {\n  return (req, next) => {\n    const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n    for (const allowedUrl of allowedUrls) {\n      if (!matchUrl(req.url, allowedUrl)) continue;\n      return language$.pipe(switchMap((language) => next(req.clone({ setHeaders: { [headerName ?? HTTP_LANGUAGE_HEADER]: language } }))));\n    }\n    return next(req);\n  };\n}\n\n/**\n * Provides a localization feature that automatically adds a language header to HTTP requests\n * for specified URLs, using the current active language. This function simplifies setting up\n * the HTTP language header interceptor by wrapping it into a LocalizationFeature, making it easy\n * to integrate with the application's localization infrastructure.\n *\n * @param {HttpLanguageHeaderInterceptorConfig} config - The configuration for the language header\n * interceptor, specifying which URLs should include the language header and optionally defining a\n * custom header name.\n * @returns {LocalizationFeature} A localization feature object that can be used to configure\n * the application's localization settings to include automatic language header addition for HTTP requests.\n *\n * @example\n * ```ts\n * // Example usage with the localization provider\n * import { provideLocalization, LocalizationModule, withHttpLanguageHeader } from '@odx/angular/localization';\n *\n * @NgModule({\n *   imports: [LocalizationModule],\n *   providers: [\n *     provideLocalization({}, withHttpLanguageHeader({ allowedUrls: ['/api'] }))\n *   ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageHeader(config: HttpLanguageHeaderInterceptorConfig): LocalizationFeature {\n  const providers = provideHttpClient(withInterceptors([httpLanguageHeaderInterceptor(config)]));\n\n  return makeLocalizationFeature(providers);\n}\n","import { HttpInterceptorFn, provideHttpClient, withInterceptors } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport { matchUrl } from '@odx/angular/utils';\nimport { switchMap, take } from 'rxjs';\nimport { LocalizationService } from '../localization.service';\nimport { LocalizationFeature, makeLocalizationFeature } from '../models';\n\nexport const HTTP_LANGUAGE_QUERY = 'language';\n\n/**\n * Defines the configuration options for the HTTP interceptor that appends the current\n * language setting as a query parameter to outgoing requests. This configuration specifies\n * which requests should have the language parameter appended based on their URLs.\n *\n * @property {Array<string | RegExp>} allowedUrls - URLs (or patterns matching URLs) to which\n * the language query parameter should be appended.\n * @property {string} [queryParamName=HTTP_LANGUAGE_QUERY] - The name of the query parameter\n * used to transmit the current language. Defaults to 'language'.\n */\nexport interface HttpLanguageQueryParamInterceptorConfig {\n  allowedUrls: Array<string | RegExp>;\n  queryParamName?: string;\n}\n\n/**\n * Creates an HTTP interceptor function that appends the current language as a query parameter\n * to outgoing HTTP requests that match specified URLs. This interceptor enables dynamic content\n * localization by informing the backend of the user's preferred language.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for the interceptor,\n * including allowed URLs and an optional custom name for the query parameter.\n * @returns {HttpInterceptorFn} The interceptor function ready to be applied to the HTTP client.\n *\n * @example\n * ```ts\n * // Applying the interceptor in an Angular module\n * import { HttpClientModule } from '@angular/common/http';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n *   imports: [HttpClientModule],\n *   providers: [\n *     provideHttpClient(withInterceptors([\n *       withHttpLanguageQueryParam({ allowedUrls: ['/api/resources'] })\n *     ]))\n *   ]\n * })\n * export class ApiModule {}\n * ```\n */\nexport function withHttpLanguageQueryParamInterceptor({ allowedUrls, queryParamName }: HttpLanguageQueryParamInterceptorConfig): HttpInterceptorFn {\n  return (req, next) => {\n    const language$ = inject(LocalizationService).activeLanguage$.pipe(take(1));\n    for (const allowedUrl of allowedUrls) {\n      if (!matchUrl(req.url, allowedUrl)) continue;\n      return language$.pipe(switchMap((language) => next(req.clone({ setParams: { [queryParamName ?? HTTP_LANGUAGE_QUERY]: language } }))));\n    }\n    return next(req);\n  };\n}\n\n/**\n * Registers the HTTP interceptor that appends the current language as a query parameter to\n * outgoing requests for configured URLs as a localization feature. This utility function\n * simplifies the setup by bundling the interceptor into a feature that can be easily integrated\n * with localization configurations.\n *\n * @param {HttpLanguageQueryParamInterceptorConfig} config - Configuration for appending the\n * language query parameter, including allowed URLs and an optional parameter name.\n * @returns {LocalizationFeature} A localization feature encapsulating the interceptor, ready\n * for integration with the application's localization setup.\n *\n * @example\n * ```ts\n * // Integrating the localization feature in an Angular module\n * import { provideLocalization } from '@angular/core';\n * import { withHttpLanguageQueryParam } from '@odx/angular/localization';\n *\n * @NgModule({\n *   providers: [\n *     provideLocalization({}, withHttpLanguageQueryParam({ allowedUrls: ['/api'] }))\n *   ]\n * })\n * export class AppModule {}\n * ```\n */\nexport function withHttpLanguageQueryParam(config: HttpLanguageQueryParamInterceptorConfig): LocalizationFeature {\n  const providers = provideHttpClient(withInterceptors([withHttpLanguageQueryParamInterceptor(config)]));\n\n  return makeLocalizationFeature(providers);\n}\n","import { inject } from '@angular/core';\nimport { WindowRef } from '@odx/angular';\nimport { LanguageLoaderFn } from '../models';\n\n/**\n * Loads the browser's current language setting using the `WindowRef` service.\n * This function is intended to be used as a dynamic language loader within a localization configuration,\n * allowing applications to automatically adapt to the user's preferred language as specified in browser settings.\n *\n * The `WindowRef` service abstracts window-related operations, making it easier to interact with global\n * browser properties and methods in a testable and platform-agnostic way. This function makes use of\n * `WindowRef` to access the navigator's language setting in a safe and Angular-friendly manner.\n *\n * @returns {string} The language code (e.g., 'en', 'fr') of the browser's currently configured language.\n * This value can then be used to set the active language in a localization configuration.\n *\n * @example\n * ```ts\n * import { provideLocalization, browserLanguageLoader } from '@odx/angular/localization';\n *\n * provideLocalization({\n *   activeLanguageLoader: browserLanguageLoader,\n *   availableLanguages: ['en', 'es', 'fr'],\n * });\n * ```\n */\nexport const browserLanguageLoader: LanguageLoaderFn = (): string => {\n  return inject(WindowRef).getLanguage();\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA;AACA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAkB;IACjD,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnB,CAAC,OAAO,EAAE,UAAU,CAAC;IACrB,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChB,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnB,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChB,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnB,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChB,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnB,CAAC,OAAO,EAAE,UAAU,CAAC;IACrB,CAAC,IAAI,EAAE,QAAQ,CAAC;AACjB,CAAA,CAAC;AAEK,MAAM,2BAA2B,GAAG,CAAC,GAAG,iBAAiB,CAA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