{"version":3,"file":"node.cjs","names":["createVitePressRouterAdapter","createNodeI18n","require_adapter","require_vitepress_locales","_i18n_micro_node","createI18n","defaultLocale","options","locales","item","adapter"],"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":"A,6LAqBA,SAAgBK,EAAW,EAAsC,CAC/D,IAAMC,EAAgBC,EAAQ,eAAiBA,EAAQ,OACjDC,GAAWD,EAAQ,SAAS,OAASA,EAAQ,QAAU,CAACA,EAAQ,MAAM,EAAA,CAAG,IAAK,GAAU,OAAOE,GAAS,SAAW,CAAE,KAAMA,CAAK,EAAIA,CAAK,EACzIC,EAAUV,EAAAA,EAA6B,CAC3C,UACA,gBACA,gBAAiBO,EAAQ,gBACzB,KAAMA,EAAQ,IAChB,CAAC,EAED,OAAA,EAAON,EAAAA,WAAAA,CAAeM,CAAO,CAAC,CAAC,OAAO,CACpC,aAAcG,EAAQ,aACtB,iBAAkBA,EAAQ,iBAC1B,kBAAmBA,EAAQ,kBAC3B,qBAAsBA,EAAQ,qBAC9B,kBAAmBA,EAAQ,iBAC7B,CAAC,CACH,C"}