{"ast":null,"code":"function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Trans, useTranslation, withTranslation } from 'react-i18next';\nimport { appWithTranslation, withInternals } from './hocs';\nimport { Link } from './components';\nimport { consoleMessage } from './utils';\nimport { createConfig } from './config/create-config';\nimport createI18NextClient from './create-i18next-client';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport { wrapRouter } from './router';\nexport { withTranslation } from 'react-i18next';\nexport default class NextI18Next {\n  constructor(userConfig) {\n    _defineProperty(this, \"Trans\", void 0);\n\n    _defineProperty(this, \"Link\", void 0);\n\n    _defineProperty(this, \"Router\", void 0);\n\n    _defineProperty(this, \"i18n\", void 0);\n\n    _defineProperty(this, \"initPromise\", void 0);\n\n    _defineProperty(this, \"config\", void 0);\n\n    _defineProperty(this, \"useTranslation\", void 0);\n\n    _defineProperty(this, \"withTranslation\", void 0);\n\n    _defineProperty(this, \"appWithTranslation\", void 0);\n\n    _defineProperty(this, \"consoleMessage\", void 0);\n\n    _defineProperty(this, \"withNamespaces\", void 0);\n\n    this.config = createConfig(userConfig);\n    this.consoleMessage = consoleMessage.bind(this);\n    /* Validation */\n\n    if (this.config.otherLanguages.length <= 0) {\n      throw new Error('To properly initialise a next-i18next instance you must provide one or more locale codes in config.otherLanguages.');\n    }\n\n    this.withNamespaces = () => {\n      throw new Error('next-i18next has upgraded to react-i18next v10 - please rename withNamespaces to withTranslation.');\n    };\n\n    const {\n      i18n,\n      initPromise\n    } = createI18NextClient(this.config);\n    this.i18n = i18n;\n    this.initPromise = initPromise || Promise.resolve();\n    this.appWithTranslation = appWithTranslation.bind(this);\n\n    this.withTranslation = (namespace, options) => Component => hoistNonReactStatics(withTranslation(namespace, options)(Component), Component);\n\n    const nextI18NextInternals = {\n      config: this.config,\n      i18n: this.i18n\n    };\n    this.Link = withInternals(Link, nextI18NextInternals);\n    this.Router = wrapRouter(nextI18NextInternals);\n    /* Directly export `react-i18next` methods */\n\n    this.Trans = Trans;\n    this.useTranslation = useTranslation;\n  }\n\n}","map":null,"metadata":{},"sourceType":"module"}