{"version":3,"file":"node.mjs","names":["createNodeI18n","createVitePressRouterAdapter","createI18n$1","createI18n","defaultLocale","options","locales","item","adapter","buildVitePressLocales","loadRootTranslations","loadTranslations"],"sources":["../src/runtime/node-create.ts"],"sourcesContent":["import type { Locale } from '@i18n-micro/types'\nimport { createI18n as createNodeI18n, type I18n, type I18nOptions } from '@i18n-micro/node'\nimport { createVitePressRouterAdapter, type PathMethods } from '../router/adapter'\n\nexport type { I18nOptions, LoadedTranslations } from '@i18n-micro/node'\nexport { loadTranslations, loadRootTranslations } from '@i18n-micro/node'\nexport type { PathMethods }\n\nexport interface CreateI18nOptions extends I18nOptions {\n  /** Locales for path helpers (`localizePath`, …). Defaults to `[{ code: locale }]`. */\n  locales?: Locale[] | string[]\n  defaultLocale?: string\n  localeKeyToCode?: Record<string, string>\n  base?: string\n}\n\nexport type NodeI18n = I18n & PathMethods\n\n/**\n * Node `createI18n` (`@i18n-micro/node`) + VitePress path methods from the router adapter.\n */\nexport function createI18n(options: CreateI18nOptions): NodeI18n {\n  const defaultLocale = options.defaultLocale || options.locale\n  const locales = (options.locales?.length ? options.locales : [options.locale]).map((item) => (typeof item === 'string' ? { code: item } : item))\n  const adapter = createVitePressRouterAdapter({\n    locales,\n    defaultLocale,\n    localeKeyToCode: options.localeKeyToCode,\n    base: options.base,\n  })\n\n  return createNodeI18n(options).extend({\n    localizePath: adapter.localizePath,\n    switchLocalePath: adapter.switchLocalePath,\n    getLocaleFromPath: adapter.getLocaleFromPath,\n    removeLocaleFromPath: adapter.removeLocaleFromPath,\n    routeNameFromPath: adapter.routeNameFromPath,\n  })\n}\n"],"mappings":";;;;AAqBA,SAAgBG,EAAW,GAAsC;CAC/D,IAAMC,IAAgBC,EAAQ,iBAAiBA,EAAQ,QACjDC,KAAWD,EAAQ,SAAS,SAASA,EAAQ,UAAU,CAACA,EAAQ,MAAM,EAAA,CAAG,KAAK,MAAU,OAAOE,KAAS,WAAW,EAAE,MAAMA,EAAK,IAAIA,CAAK,GACzIC,IAAUP,EAA6B;EAC3C;EACA;EACA,iBAAiBI,EAAQ;EACzB,MAAMA,EAAQ;CAChB,CAAC;CAED,OAAOL,EAAeK,CAAO,CAAC,CAAC,OAAO;EACpC,cAAcG,EAAQ;EACtB,kBAAkBA,EAAQ;EAC1B,mBAAmBA,EAAQ;EAC3B,sBAAsBA,EAAQ;EAC9B,mBAAmBA,EAAQ;CAC7B,CAAC;AACH"}