const d = (o) => typeof o == "string", A = () => {
  let o, e;
  const t = new Promise((i, s) => {
    o = i, e = s;
  });
  return t.resolve = o, t.reject = e, t;
}, ie = (o) => o == null ? "" : "" + o, Le = (o, e, t) => {
  o.forEach((i) => {
    e[i] && (t[i] = e[i]);
  });
}, we = /###/g, ne = (o) => o && o.indexOf("###") > -1 ? o.replace(we, ".") : o, re = (o) => !o || d(o), U = (o, e, t) => {
  const i = d(e) ? e.split(".") : e;
  let s = 0;
  for (; s < i.length - 1; ) {
    if (re(o)) return {};
    const n = ne(i[s]);
    !o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++s;
  }
  return re(o) ? {} : {
    obj: o,
    k: ne(i[s])
  };
}, ae = (o, e, t) => {
  const {
    obj: i,
    k: s
  } = U(o, e, Object);
  if (i !== void 0 || e.length === 1) {
    i[s] = t;
    return;
  }
  let n = e[e.length - 1], r = e.slice(0, e.length - 1), a = U(o, r, Object);
  for (; a.obj === void 0 && r.length; )
    n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), a = U(o, r, Object), a?.obj && typeof a.obj[`${a.k}.${n}`] < "u" && (a.obj = void 0);
  a.obj[`${a.k}.${n}`] = t;
}, ve = (o, e, t, i) => {
  const {
    obj: s,
    k: n
  } = U(o, e, Object);
  s[n] = s[n] || [], s[n].push(t);
}, J = (o, e) => {
  const {
    obj: t,
    k: i
  } = U(o, e);
  if (t && Object.prototype.hasOwnProperty.call(t, i))
    return t[i];
}, Pe = (o, e, t) => {
  const i = J(o, t);
  return i !== void 0 ? i : J(e, t);
}, me = (o, e, t) => {
  for (const i in e)
    i !== "__proto__" && i !== "constructor" && (i in o ? d(o[i]) || o[i] instanceof String || d(e[i]) || e[i] instanceof String ? t && (o[i] = e[i]) : me(o[i], e[i], t) : o[i] = e[i]);
  return o;
}, F = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
var Ce = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;",
  "/": "&#x2F;"
};
const Re = (o) => d(o) ? o.replace(/[&<>"'\/]/g, (e) => Ce[e]) : o;
class $e {
  constructor(e) {
    this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
  }
  getRegExp(e) {
    const t = this.regExpMap.get(e);
    if (t !== void 0)
      return t;
    const i = new RegExp(e);
    return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, i), this.regExpQueue.push(e), i;
  }
}
const Ne = [" ", ",", "?", "!", ";"], ke = new $e(20), je = (o, e, t) => {
  e = e || "", t = t || "";
  const i = Ne.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
  if (i.length === 0) return !0;
  const s = ke.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
  let n = !s.test(o);
  if (!n) {
    const r = o.indexOf(t);
    r > 0 && !s.test(o.substring(0, r)) && (n = !0);
  }
  return n;
}, X = (o, e, t = ".") => {
  if (!o) return;
  if (o[e])
    return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
  const i = e.split(t);
  let s = o;
  for (let n = 0; n < i.length; ) {
    if (!s || typeof s != "object")
      return;
    let r, a = "";
    for (let l = n; l < i.length; ++l)
      if (l !== n && (a += t), a += i[l], r = s[a], r !== void 0) {
        if (["string", "number", "boolean"].indexOf(typeof r) > -1 && l < i.length - 1)
          continue;
        n += l - n + 1;
        break;
      }
    s = r;
  }
  return s;
}, M = (o) => o?.replace(/_/g, "-"), Ee = {
  type: "logger",
  log(o) {
    this.output("log", o);
  },
  warn(o) {
    this.output("warn", o);
  },
  error(o) {
    this.output("error", o);
  },
  output(o, e) {
    console?.[o]?.apply?.(console, e);
  }
};
class _ {
  constructor(e, t = {}) {
    this.init(e, t);
  }
  init(e, t = {}) {
    this.prefix = t.prefix || "i18next:", this.logger = e || Ee, this.options = t, this.debug = t.debug;
  }
  log(...e) {
    return this.forward(e, "log", "", !0);
  }
  warn(...e) {
    return this.forward(e, "warn", "", !0);
  }
  error(...e) {
    return this.forward(e, "error", "");
  }
  deprecate(...e) {
    return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
  }
  forward(e, t, i, s) {
    return s && !this.debug ? null : (d(e[0]) && (e[0] = `${i}${this.prefix} ${e[0]}`), this.logger[t](e));
  }
  create(e) {
    return new _(this.logger, {
      prefix: `${this.prefix}:${e}:`,
      ...this.options
    });
  }
  clone(e) {
    return e = e || this.options, e.prefix = e.prefix || this.prefix, new _(this.logger, e);
  }
}
var R = new _();
class Y {
  constructor() {
    this.observers = {};
  }
  on(e, t) {
    return e.split(" ").forEach((i) => {
      this.observers[i] || (this.observers[i] = /* @__PURE__ */ new Map());
      const s = this.observers[i].get(t) || 0;
      this.observers[i].set(t, s + 1);
    }), this;
  }
  off(e, t) {
    if (this.observers[e]) {
      if (!t) {
        delete this.observers[e];
        return;
      }
      this.observers[e].delete(t);
    }
  }
  emit(e, ...t) {
    this.observers[e] && Array.from(this.observers[e].entries()).forEach(([s, n]) => {
      for (let r = 0; r < n; r++)
        s(...t);
    }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([s, n]) => {
      for (let r = 0; r < n; r++)
        s.apply(s, [e, ...t]);
    });
  }
}
class oe extends Y {
  constructor(e, t = {
    ns: ["translation"],
    defaultNS: "translation"
  }) {
    super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
  }
  addNamespaces(e) {
    this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
  }
  removeNamespaces(e) {
    const t = this.options.ns.indexOf(e);
    t > -1 && this.options.ns.splice(t, 1);
  }
  getResource(e, t, i, s = {}) {
    const n = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, r = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
    let a;
    e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], i && (Array.isArray(i) ? a.push(...i) : d(i) && n ? a.push(...i.split(n)) : a.push(i)));
    const l = J(this.data, a);
    return !l && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), l || !r || !d(i) ? l : X(this.data?.[e]?.[t], i, n);
  }
  addResource(e, t, i, s, n = {
    silent: !1
  }) {
    const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
    let a = [e, t];
    i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), ae(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
  }
  addResources(e, t, i, s = {
    silent: !1
  }) {
    for (const n in i)
      (d(i[n]) || Array.isArray(i[n])) && this.addResource(e, t, n, i[n], {
        silent: !0
      });
    s.silent || this.emit("added", e, t, i);
  }
  addResourceBundle(e, t, i, s, n, r = {
    silent: !1,
    skipCopy: !1
  }) {
    let a = [e, t];
    e.indexOf(".") > -1 && (a = e.split("."), s = i, i = t, t = a[1]), this.addNamespaces(t);
    let l = J(this.data, a) || {};
    r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? me(l, i, n) : l = {
      ...l,
      ...i
    }, ae(this.data, a, l), r.silent || this.emit("added", e, t, i);
  }
  removeResourceBundle(e, t) {
    this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
  }
  hasResourceBundle(e, t) {
    return this.getResource(e, t) !== void 0;
  }
  getResourceBundle(e, t) {
    return t || (t = this.options.defaultNS), this.getResource(e, t);
  }
  getDataByLanguage(e) {
    return this.data[e];
  }
  hasLanguageSomeTranslations(e) {
    const t = this.getDataByLanguage(e);
    return !!(t && Object.keys(t) || []).find((s) => t[s] && Object.keys(t[s]).length > 0);
  }
  toJSON() {
    return this.data;
  }
}
var xe = {
  processors: {},
  addPostProcessor(o) {
    this.processors[o.name] = o;
  },
  handle(o, e, t, i, s) {
    return o.forEach((n) => {
      e = this.processors[n]?.process(e, t, i, s) ?? e;
    }), e;
  }
};
const ye = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
function Fe() {
  const o = [], e = /* @__PURE__ */ Object.create(null);
  let t;
  return e.get = (i, s) => (t?.revoke?.(), s === ye ? o : (o.push(s), t = Proxy.revocable(i, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
}
function D(o, e) {
  const {
    [ye]: t
  } = o(Fe()), i = e?.keySeparator ?? ".", s = e?.nsSeparator ?? ":";
  if (t.length > 1 && s) {
    const n = e?.ns, r = Array.isArray(n) ? n : null;
    if (r && r.length > 1 && r.slice(1).includes(t[0]))
      return `${t[0]}${s}${t.slice(1).join(i)}`;
  }
  return t.join(i);
}
const le = {}, Q = (o) => !d(o) && typeof o != "boolean" && typeof o != "number";
class W extends Y {
  constructor(e, t = {}) {
    super(), Le(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = R.create("translator");
  }
  changeLanguage(e) {
    e && (this.language = e);
  }
  exists(e, t = {
    interpolation: {}
  }) {
    const i = {
      ...t
    };
    if (e == null) return !1;
    const s = this.resolve(e, i);
    if (s?.res === void 0) return !1;
    const n = Q(s.res);
    return !(i.returnObjects === !1 && n);
  }
  extractFromKey(e, t) {
    let i = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
    i === void 0 && (i = ":");
    const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
    let n = t.ns || this.options.defaultNS || [];
    const r = i && e.indexOf(i) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !je(e, i, s);
    if (r && !a) {
      const l = e.match(this.interpolator.nestingRegexp);
      if (l && l.length > 0)
        return {
          key: e,
          namespaces: d(n) ? [n] : n
        };
      const u = e.split(i);
      (i !== s || i === s && this.options.ns.indexOf(u[0]) > -1) && (n = u.shift()), e = u.join(s);
    }
    return {
      key: e,
      namespaces: d(n) ? [n] : n
    };
  }
  translate(e, t, i) {
    let s = typeof t == "object" ? {
      ...t
    } : t;
    if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof s == "object" && (s = {
      ...s
    }), s || (s = {}), e == null) return "";
    typeof e == "function" && (e = D(e, {
      ...this.options,
      ...s
    })), Array.isArray(e) || (e = [String(e)]), e = e.map((S) => typeof S == "function" ? D(S, {
      ...this.options,
      ...s
    }) : String(S));
    const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
      key: a,
      namespaces: l
    } = this.extractFromKey(e[e.length - 1], s), u = l[l.length - 1];
    let c = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
    c === void 0 && (c = ":");
    const f = s.lng || this.language, p = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
    if (f?.toLowerCase() === "cimode")
      return p ? n ? {
        res: `${u}${c}${a}`,
        usedKey: a,
        exactUsedKey: a,
        usedLng: f,
        usedNS: u,
        usedParams: this.getUsedParamsDetails(s)
      } : `${u}${c}${a}` : n ? {
        res: a,
        usedKey: a,
        exactUsedKey: a,
        usedLng: f,
        usedNS: u,
        usedParams: this.getUsedParamsDetails(s)
      } : a;
    const g = this.resolve(e, s);
    let h = g?.res;
    const m = g?.usedKey || a, y = g?.exactUsedKey || a, w = ["[object Number]", "[object Function]", "[object RegExp]"], x = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, j = !this.i18nFormat || this.i18nFormat.handleAsObject, L = s.count !== void 0 && !d(s.count), N = W.hasDefaultValue(s), T = L ? this.pluralResolver.getSuffix(f, s.count, s) : "", I = s.ordinal && L ? this.pluralResolver.getSuffix(f, s.count, {
      ordinal: !1
    }) : "", q = L && !s.ordinal && s.count === 0, k = q && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${T}`] || s[`defaultValue${I}`] || s.defaultValue;
    let P = h;
    j && !h && N && (P = k);
    const Oe = Q(P), be = Object.prototype.toString.apply(P);
    if (j && P && Oe && w.indexOf(be) < 0 && !(d(x) && Array.isArray(P))) {
      if (!s.returnObjects && !this.options.returnObjects) {
        this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
        const S = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, P, {
          ...s,
          ns: l
        }) : `key '${a} (${this.language})' returned an object instead of string.`;
        return n ? (g.res = S, g.usedParams = this.getUsedParamsDetails(s), g) : S;
      }
      if (r) {
        const S = Array.isArray(P), v = S ? [] : {}, ee = S ? y : m;
        for (const C in P)
          if (Object.prototype.hasOwnProperty.call(P, C)) {
            const $ = `${ee}${r}${C}`;
            N && !h ? v[C] = this.translate($, {
              ...s,
              defaultValue: Q(k) ? k[C] : void 0,
              joinArrays: !1,
              ns: l
            }) : v[C] = this.translate($, {
              ...s,
              joinArrays: !1,
              ns: l
            }), v[C] === $ && (v[C] = P[C]);
          }
        h = v;
      }
    } else if (j && d(x) && Array.isArray(h))
      h = h.join(x), h && (h = this.extendTranslation(h, e, s, i));
    else {
      let S = !1, v = !1;
      !this.isValidLookup(h) && N && (S = !0, h = k), this.isValidLookup(h) || (v = !0, h = a);
      const C = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && v ? void 0 : h, $ = N && k !== h && this.options.updateMissing;
      if (v || S || $) {
        if (this.logger.log($ ? "updateKey" : "missingKey", f, u, a, $ ? k : h), r) {
          const b = this.resolve(a, {
            ...s,
            keySeparator: !1
          });
          b && b.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
        }
        let V = [];
        const z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
        if (this.options.saveMissingTo === "fallback" && z && z[0])
          for (let b = 0; b < z.length; b++)
            V.push(z[b]);
        else this.options.saveMissingTo === "all" ? V = this.languageUtils.toResolveHierarchy(s.lng || this.language) : V.push(s.lng || this.language);
        const te = (b, E, K) => {
          const se = N && K !== h ? K : C;
          this.options.missingKeyHandler ? this.options.missingKeyHandler(b, u, E, se, $, s) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(b, u, E, se, $, s), this.emit("missingKey", b, u, E, h);
        };
        this.options.saveMissing && (this.options.saveMissingPlurals && L ? V.forEach((b) => {
          const E = this.pluralResolver.getSuffixes(b, s);
          q && s[`defaultValue${this.options.pluralSeparator}zero`] && E.indexOf(`${this.options.pluralSeparator}zero`) < 0 && E.push(`${this.options.pluralSeparator}zero`), E.forEach((K) => {
            te([b], a + K, s[`defaultValue${K}`] || k);
          });
        }) : te(V, a, k));
      }
      h = this.extendTranslation(h, e, s, g, i), v && h === a && this.options.appendNamespaceToMissingKey && (h = `${u}${c}${a}`), (v || S) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${c}${a}` : a, S ? h : void 0, s));
    }
    return n ? (g.res = h, g.usedParams = this.getUsedParamsDetails(s), g) : h;
  }
  extendTranslation(e, t, i, s, n) {
    if (this.i18nFormat?.parse)
      e = this.i18nFormat.parse(e, {
        ...this.options.interpolation.defaultVariables,
        ...i
      }, i.lng || this.language || s.usedLng, s.usedNS, s.usedKey, {
        resolved: s
      });
    else if (!i.skipInterpolation) {
      i.interpolation && this.interpolator.init({
        ...i,
        interpolation: {
          ...this.options.interpolation,
          ...i.interpolation
        }
      });
      const l = d(e) && (i?.interpolation?.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
      let u;
      if (l) {
        const f = e.match(this.interpolator.nestingRegexp);
        u = f && f.length;
      }
      let c = i.replace && !d(i.replace) ? i.replace : i;
      if (this.options.interpolation.defaultVariables && (c = {
        ...this.options.interpolation.defaultVariables,
        ...c
      }), e = this.interpolator.interpolate(e, c, i.lng || this.language || s.usedLng, i), l) {
        const f = e.match(this.interpolator.nestingRegexp), p = f && f.length;
        u < p && (i.nest = !1);
      }
      !i.lng && s && s.res && (i.lng = this.language || s.usedLng), i.nest !== !1 && (e = this.interpolator.nest(e, (...f) => n?.[0] === f[0] && !i.context ? (this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`), null) : this.translate(...f, t), i)), i.interpolation && this.interpolator.reset();
    }
    const r = i.postProcess || this.options.postProcess, a = d(r) ? [r] : r;
    return e != null && a?.length && i.applyPostProcessor !== !1 && (e = xe.handle(a, e, t, this.options && this.options.postProcessPassResolved ? {
      i18nResolved: {
        ...s,
        usedParams: this.getUsedParamsDetails(i)
      },
      ...i
    } : i, this)), e;
  }
  resolve(e, t = {}) {
    let i, s, n, r, a;
    return d(e) && (e = [e]), Array.isArray(e) && (e = e.map((l) => typeof l == "function" ? D(l, {
      ...this.options,
      ...t
    }) : l)), e.forEach((l) => {
      if (this.isValidLookup(i)) return;
      const u = this.extractFromKey(l, t), c = u.key;
      s = c;
      let f = u.namespaces;
      this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
      const p = t.count !== void 0 && !d(t.count), g = p && !t.ordinal && t.count === 0, h = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
      f.forEach((y) => {
        this.isValidLookup(i) || (a = y, !le[`${m[0]}-${y}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (le[`${m[0]}-${y}`] = !0, this.logger.warn(`key "${s}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((w) => {
          if (this.isValidLookup(i)) return;
          r = w;
          const x = [c];
          if (this.i18nFormat?.addLookupKeys)
            this.i18nFormat.addLookupKeys(x, c, w, y, t);
          else {
            let L;
            p && (L = this.pluralResolver.getSuffix(w, t.count, t));
            const N = `${this.options.pluralSeparator}zero`, T = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
            if (p && (t.ordinal && L.indexOf(T) === 0 && x.push(c + L.replace(T, this.options.pluralSeparator)), x.push(c + L), g && x.push(c + N)), h) {
              const I = `${c}${this.options.contextSeparator || "_"}${t.context}`;
              x.push(I), p && (t.ordinal && L.indexOf(T) === 0 && x.push(I + L.replace(T, this.options.pluralSeparator)), x.push(I + L), g && x.push(I + N));
            }
          }
          let j;
          for (; j = x.pop(); )
            this.isValidLookup(i) || (n = j, i = this.getResource(w, y, j, t));
        }));
      });
    }), {
      res: i,
      usedKey: s,
      exactUsedKey: n,
      usedLng: r,
      usedNS: a
    };
  }
  isValidLookup(e) {
    return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
  }
  getResource(e, t, i, s = {}) {
    return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, i, s) : this.resourceStore.getResource(e, t, i, s);
  }
  getUsedParamsDetails(e = {}) {
    const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], i = e.replace && !d(e.replace);
    let s = i ? e.replace : e;
    if (i && typeof e.count < "u" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = {
      ...this.options.interpolation.defaultVariables,
      ...s
    }), !i) {
      s = {
        ...s
      };
      for (const n of t)
        delete s[n];
    }
    return s;
  }
  static hasDefaultValue(e) {
    const t = "defaultValue";
    for (const i in e)
      if (Object.prototype.hasOwnProperty.call(e, i) && t === i.substring(0, t.length) && e[i] !== void 0)
        return !0;
    return !1;
  }
}
class ue {
  constructor(e) {
    this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = R.create("languageUtils");
  }
  getScriptPartFromCode(e) {
    if (e = M(e), !e || e.indexOf("-") < 0) return null;
    const t = e.split("-");
    return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
  }
  getLanguagePartFromCode(e) {
    if (e = M(e), !e || e.indexOf("-") < 0) return e;
    const t = e.split("-");
    return this.formatLanguageCode(t[0]);
  }
  formatLanguageCode(e) {
    if (d(e) && e.indexOf("-") > -1) {
      let t;
      try {
        t = Intl.getCanonicalLocales(e)[0];
      } catch {
      }
      return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
    }
    return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
  }
  isSupportedCode(e) {
    return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
  }
  getBestMatchFromCodes(e) {
    if (!e) return null;
    let t;
    return e.forEach((i) => {
      if (t) return;
      const s = this.formatLanguageCode(i);
      (!this.options.supportedLngs || this.isSupportedCode(s)) && (t = s);
    }), !t && this.options.supportedLngs && e.forEach((i) => {
      if (t) return;
      const s = this.getScriptPartFromCode(i);
      if (this.isSupportedCode(s)) return t = s;
      const n = this.getLanguagePartFromCode(i);
      if (this.isSupportedCode(n)) return t = n;
      t = this.options.supportedLngs.find((r) => {
        if (r === n) return r;
        if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
          return r;
      });
    }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
  }
  getFallbackCodes(e, t) {
    if (!e) return [];
    if (typeof e == "function" && (e = e(t)), d(e) && (e = [e]), Array.isArray(e)) return e;
    if (!t) return e.default || [];
    let i = e[t];
    return i || (i = e[this.getScriptPartFromCode(t)]), i || (i = e[this.formatLanguageCode(t)]), i || (i = e[this.getLanguagePartFromCode(t)]), i || (i = e.default), i || [];
  }
  toResolveHierarchy(e, t) {
    const i = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), s = [], n = (r) => {
      r && (this.isSupportedCode(r) ? s.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
    };
    return d(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : d(e) && n(this.formatLanguageCode(e)), i.forEach((r) => {
      s.indexOf(r) < 0 && n(this.formatLanguageCode(r));
    }), s;
  }
}
const fe = {
  zero: 0,
  one: 1,
  two: 2,
  few: 3,
  many: 4,
  other: 5
}, ce = {
  select: (o) => o === 1 ? "one" : "other",
  resolvedOptions: () => ({
    pluralCategories: ["one", "other"]
  })
};
class Te {
  constructor(e, t = {}) {
    this.languageUtils = e, this.options = t, this.logger = R.create("pluralResolver"), this.pluralRulesCache = {};
  }
  clearCache() {
    this.pluralRulesCache = {};
  }
  getRule(e, t = {}) {
    const i = M(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
      cleanedCode: i,
      type: s
    });
    if (n in this.pluralRulesCache)
      return this.pluralRulesCache[n];
    let r;
    try {
      r = new Intl.PluralRules(i, {
        type: s
      });
    } catch {
      if (typeof Intl > "u")
        return this.logger.error("No Intl support, please use an Intl polyfill!"), ce;
      if (!e.match(/-|_/)) return ce;
      const l = this.languageUtils.getLanguagePartFromCode(e);
      r = this.getRule(l, t);
    }
    return this.pluralRulesCache[n] = r, r;
  }
  needsPlural(e, t = {}) {
    let i = this.getRule(e, t);
    return i || (i = this.getRule("dev", t)), i?.resolvedOptions().pluralCategories.length > 1;
  }
  getPluralFormsOfKey(e, t, i = {}) {
    return this.getSuffixes(e, i).map((s) => `${t}${s}`);
  }
  getSuffixes(e, t = {}) {
    let i = this.getRule(e, t);
    return i || (i = this.getRule("dev", t)), i ? i.resolvedOptions().pluralCategories.sort((s, n) => fe[s] - fe[n]).map((s) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${s}`) : [];
  }
  getSuffix(e, t, i = {}) {
    const s = this.getRule(e, i);
    return s ? `${this.options.prepend}${i.ordinal ? `ordinal${this.options.prepend}` : ""}${s.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, i));
  }
}
const he = (o, e, t, i = ".", s = !0) => {
  let n = Pe(o, e, t);
  return !n && s && d(t) && (n = X(o, t, i), n === void 0 && (n = X(e, t, i))), n;
}, G = (o) => o.replace(/\$/g, "$$$$");
class de {
  constructor(e = {}) {
    this.logger = R.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
  }
  init(e = {}) {
    e.interpolation || (e.interpolation = {
      escapeValue: !0
    });
    const {
      escape: t,
      escapeValue: i,
      useRawValueToEscape: s,
      prefix: n,
      prefixEscaped: r,
      suffix: a,
      suffixEscaped: l,
      formatSeparator: u,
      unescapeSuffix: c,
      unescapePrefix: f,
      nestingPrefix: p,
      nestingPrefixEscaped: g,
      nestingSuffix: h,
      nestingSuffixEscaped: m,
      nestingOptionsSeparator: y,
      maxReplaces: w,
      alwaysFormat: x
    } = e.interpolation;
    this.escape = t !== void 0 ? t : Re, this.escapeValue = i !== void 0 ? i : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = n ? F(n) : r || "{{", this.suffix = a ? F(a) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = c ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : c || "", this.nestingPrefix = p ? F(p) : g || F("$t("), this.nestingSuffix = h ? F(h) : m || F(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = w || 1e3, this.alwaysFormat = x !== void 0 ? x : !1, this.resetRegExp();
  }
  reset() {
    this.options && this.init(this.options);
  }
  resetRegExp() {
    const e = (t, i) => t?.source === i ? (t.lastIndex = 0, t) : new RegExp(i, "g");
    this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
  }
  interpolate(e, t, i, s) {
    let n, r, a;
    const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (g) => {
      if (g.indexOf(this.formatSeparator) < 0) {
        const w = he(t, l, g, this.options.keySeparator, this.options.ignoreJSONStructure);
        return this.alwaysFormat ? this.format(w, void 0, i, {
          ...s,
          ...t,
          interpolationkey: g
        }) : w;
      }
      const h = g.split(this.formatSeparator), m = h.shift().trim(), y = h.join(this.formatSeparator).trim();
      return this.format(he(t, l, m, this.options.keySeparator, this.options.ignoreJSONStructure), y, i, {
        ...s,
        ...t,
        interpolationkey: m
      });
    };
    this.resetRegExp();
    const c = s?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = s?.interpolation?.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
    return [{
      regex: this.regexpUnescape,
      safeValue: (g) => G(g)
    }, {
      regex: this.regexp,
      safeValue: (g) => this.escapeValue ? G(this.escape(g)) : G(g)
    }].forEach((g) => {
      for (a = 0; n = g.regex.exec(e); ) {
        const h = n[1].trim();
        if (r = u(h), r === void 0)
          if (typeof c == "function") {
            const y = c(e, n, s);
            r = d(y) ? y : "";
          } else if (s && Object.prototype.hasOwnProperty.call(s, h))
            r = "";
          else if (f) {
            r = n[0];
            continue;
          } else
            this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`), r = "";
        else !d(r) && !this.useRawValueToEscape && (r = ie(r));
        const m = g.safeValue(r);
        if (e = e.replace(n[0], m), f ? (g.regex.lastIndex += r.length, g.regex.lastIndex -= n[0].length) : g.regex.lastIndex = 0, a++, a >= this.maxReplaces)
          break;
      }
    }), e;
  }
  nest(e, t, i = {}) {
    let s, n, r;
    const a = (l, u) => {
      const c = this.nestingOptionsSeparator;
      if (l.indexOf(c) < 0) return l;
      const f = l.split(new RegExp(`${F(c)}[ ]*{`));
      let p = `{${f[1]}`;
      l = f[0], p = this.interpolate(p, r);
      const g = p.match(/'/g), h = p.match(/"/g);
      ((g?.length ?? 0) % 2 === 0 && !h || (h?.length ?? 0) % 2 !== 0) && (p = p.replace(/'/g, '"'));
      try {
        r = JSON.parse(p), u && (r = {
          ...u,
          ...r
        });
      } catch (m) {
        return this.logger.warn(`failed parsing options string in nesting for key ${l}`, m), `${l}${c}${p}`;
      }
      return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, l;
    };
    for (; s = this.nestingRegexp.exec(e); ) {
      let l = [];
      r = {
        ...i
      }, r = r.replace && !d(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
      const u = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
      if (u !== -1 && (l = s[1].slice(u).split(this.formatSeparator).map((c) => c.trim()).filter(Boolean), s[1] = s[1].slice(0, u)), n = t(a.call(this, s[1].trim(), r), r), n && s[0] === e && !d(n)) return n;
      d(n) || (n = ie(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((c, f) => this.format(c, f, i.lng, {
        ...i,
        interpolationkey: s[1].trim()
      }), n.trim())), e = e.replace(s[0], n), this.regexp.lastIndex = 0;
    }
    return e;
  }
}
const Ie = (o) => {
  let e = o.toLowerCase().trim();
  const t = {};
  if (o.indexOf("(") > -1) {
    const i = o.split("(");
    e = i[0].toLowerCase().trim();
    const s = i[1].substring(0, i[1].length - 1);
    e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((r) => {
      if (r) {
        const [a, ...l] = r.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), c = a.trim();
        t[c] || (t[c] = u), u === "false" && (t[c] = !1), u === "true" && (t[c] = !0), isNaN(u) || (t[c] = parseInt(u, 10));
      }
    });
  }
  return {
    formatName: e,
    formatOptions: t
  };
}, pe = (o) => {
  const e = {};
  return (t, i, s) => {
    let n = s;
    s && s.interpolationkey && s.formatParams && s.formatParams[s.interpolationkey] && s[s.interpolationkey] && (n = {
      ...n,
      [s.interpolationkey]: void 0
    });
    const r = i + JSON.stringify(n);
    let a = e[r];
    return a || (a = o(M(i), s), e[r] = a), a(t);
  };
}, De = (o) => (e, t, i) => o(M(t), i)(e);
class Ve {
  constructor(e = {}) {
    this.logger = R.create("formatter"), this.options = e, this.init(e);
  }
  init(e, t = {
    interpolation: {}
  }) {
    this.formatSeparator = t.interpolation.formatSeparator || ",";
    const i = t.cacheInBuiltFormats ? pe : De;
    this.formats = {
      number: i((s, n) => {
        const r = new Intl.NumberFormat(s, {
          ...n
        });
        return (a) => r.format(a);
      }),
      currency: i((s, n) => {
        const r = new Intl.NumberFormat(s, {
          ...n,
          style: "currency"
        });
        return (a) => r.format(a);
      }),
      datetime: i((s, n) => {
        const r = new Intl.DateTimeFormat(s, {
          ...n
        });
        return (a) => r.format(a);
      }),
      relativetime: i((s, n) => {
        const r = new Intl.RelativeTimeFormat(s, {
          ...n
        });
        return (a) => r.format(a, n.range || "day");
      }),
      list: i((s, n) => {
        const r = new Intl.ListFormat(s, {
          ...n
        });
        return (a) => r.format(a);
      })
    };
  }
  add(e, t) {
    this.formats[e.toLowerCase().trim()] = t;
  }
  addCached(e, t) {
    this.formats[e.toLowerCase().trim()] = pe(t);
  }
  format(e, t, i, s = {}) {
    const n = t.split(this.formatSeparator);
    if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((a) => a.indexOf(")") > -1)) {
      const a = n.findIndex((l) => l.indexOf(")") > -1);
      n[0] = [n[0], ...n.splice(1, a)].join(this.formatSeparator);
    }
    return n.reduce((a, l) => {
      const {
        formatName: u,
        formatOptions: c
      } = Ie(l);
      if (this.formats[u]) {
        let f = a;
        try {
          const p = s?.formatParams?.[s.interpolationkey] || {}, g = p.locale || p.lng || s.locale || s.lng || i;
          f = this.formats[u](a, g, {
            ...c,
            ...s,
            ...p
          });
        } catch (p) {
          this.logger.warn(p);
        }
        return f;
      } else
        this.logger.warn(`there was no format function for ${u}`);
      return a;
    }, e);
  }
}
const Ke = (o, e) => {
  o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
};
class Ae extends Y {
  constructor(e, t, i, s = {}) {
    super(), this.backend = e, this.store = t, this.services = i, this.languageUtils = i.languageUtils, this.options = s, this.logger = R.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = s.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = s.maxRetries >= 0 ? s.maxRetries : 5, this.retryTimeout = s.retryTimeout >= 1 ? s.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(i, s.backend, s);
  }
  queueLoad(e, t, i, s) {
    const n = {}, r = {}, a = {}, l = {};
    return e.forEach((u) => {
      let c = !0;
      t.forEach((f) => {
        const p = `${u}|${f}`;
        !i.reload && this.store.hasResourceBundle(u, f) ? this.state[p] = 2 : this.state[p] < 0 || (this.state[p] === 1 ? r[p] === void 0 && (r[p] = !0) : (this.state[p] = 1, c = !1, r[p] === void 0 && (r[p] = !0), n[p] === void 0 && (n[p] = !0), l[f] === void 0 && (l[f] = !0)));
      }), c || (a[u] = !0);
    }), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
      pending: r,
      pendingCount: Object.keys(r).length,
      loaded: {},
      errors: [],
      callback: s
    }), {
      toLoad: Object.keys(n),
      pending: Object.keys(r),
      toLoadLanguages: Object.keys(a),
      toLoadNamespaces: Object.keys(l)
    };
  }
  loaded(e, t, i) {
    const s = e.split("|"), n = s[0], r = s[1];
    t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
      skipCopy: !0
    }), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
    const a = {};
    this.queue.forEach((l) => {
      ve(l.loaded, [n], r), Ke(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
        a[u] || (a[u] = {});
        const c = l.loaded[u];
        c.length && c.forEach((f) => {
          a[u][f] === void 0 && (a[u][f] = !0);
        });
      }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
    }), this.emit("loaded", a), this.queue = this.queue.filter((l) => !l.done);
  }
  read(e, t, i, s = 0, n = this.retryTimeout, r) {
    if (!e.length) return r(null, {});
    if (this.readingCalls >= this.maxParallelReads) {
      this.waitingReads.push({
        lng: e,
        ns: t,
        fcName: i,
        tried: s,
        wait: n,
        callback: r
      });
      return;
    }
    this.readingCalls++;
    const a = (u, c) => {
      if (this.readingCalls--, this.waitingReads.length > 0) {
        const f = this.waitingReads.shift();
        this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
      }
      if (u && c && s < this.maxRetries) {
        setTimeout(() => {
          this.read.call(this, e, t, i, s + 1, n * 2, r);
        }, n);
        return;
      }
      r(u, c);
    }, l = this.backend[i].bind(this.backend);
    if (l.length === 2) {
      try {
        const u = l(e, t);
        u && typeof u.then == "function" ? u.then((c) => a(null, c)).catch(a) : a(null, u);
      } catch (u) {
        a(u);
      }
      return;
    }
    return l(e, t, a);
  }
  prepareLoading(e, t, i = {}, s) {
    if (!this.backend)
      return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
    d(e) && (e = this.languageUtils.toResolveHierarchy(e)), d(t) && (t = [t]);
    const n = this.queueLoad(e, t, i, s);
    if (!n.toLoad.length)
      return n.pending.length || s(), null;
    n.toLoad.forEach((r) => {
      this.loadOne(r);
    });
  }
  load(e, t, i) {
    this.prepareLoading(e, t, {}, i);
  }
  reload(e, t, i) {
    this.prepareLoading(e, t, {
      reload: !0
    }, i);
  }
  loadOne(e, t = "") {
    const i = e.split("|"), s = i[0], n = i[1];
    this.read(s, n, "read", void 0, void 0, (r, a) => {
      r && this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`, r), !r && a && this.logger.log(`${t}loaded namespace ${n} for language ${s}`, a), this.loaded(e, r, a);
    });
  }
  saveMissing(e, t, i, s, n, r = {}, a = () => {
  }) {
    if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
      this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
      return;
    }
    if (!(i == null || i === "")) {
      if (this.backend?.create) {
        const l = {
          ...r,
          isUpdate: n
        }, u = this.backend.create.bind(this.backend);
        if (u.length < 6)
          try {
            let c;
            u.length === 5 ? c = u(e, t, i, s, l) : c = u(e, t, i, s), c && typeof c.then == "function" ? c.then((f) => a(null, f)).catch(a) : a(null, c);
          } catch (c) {
            a(c);
          }
        else
          u(e, t, i, s, a, l);
      }
      !e || !e[0] || this.store.addResource(e[0], t, i, s);
    }
  }
}
const Z = () => ({
  debug: !1,
  initAsync: !0,
  ns: ["translation"],
  defaultNS: ["translation"],
  fallbackLng: ["dev"],
  fallbackNS: !1,
  supportedLngs: !1,
  nonExplicitSupportedLngs: !1,
  load: "all",
  preload: !1,
  simplifyPluralSuffix: !0,
  keySeparator: ".",
  nsSeparator: ":",
  pluralSeparator: "_",
  contextSeparator: "_",
  partialBundledLanguages: !1,
  saveMissing: !1,
  updateMissing: !1,
  saveMissingTo: "fallback",
  saveMissingPlurals: !0,
  missingKeyHandler: !1,
  missingInterpolationHandler: !1,
  postProcess: !1,
  postProcessPassResolved: !1,
  returnNull: !1,
  returnEmptyString: !0,
  returnObjects: !1,
  joinArrays: !1,
  returnedObjectHandler: !1,
  parseMissingKeyHandler: !1,
  appendNamespaceToMissingKey: !1,
  appendNamespaceToCIMode: !1,
  overloadTranslationOptionHandler: (o) => {
    let e = {};
    if (typeof o[1] == "object" && (e = o[1]), d(o[1]) && (e.defaultValue = o[1]), d(o[2]) && (e.tDescription = o[2]), typeof o[2] == "object" || typeof o[3] == "object") {
      const t = o[3] || o[2];
      Object.keys(t).forEach((i) => {
        e[i] = t[i];
      });
    }
    return e;
  },
  interpolation: {
    escapeValue: !0,
    format: (o) => o,
    prefix: "{{",
    suffix: "}}",
    formatSeparator: ",",
    unescapePrefix: "-",
    nestingPrefix: "$t(",
    nestingSuffix: ")",
    nestingOptionsSeparator: ",",
    maxReplaces: 1e3,
    skipOnVariables: !0
  },
  cacheInBuiltFormats: !0
}), ge = (o) => (d(o.ns) && (o.ns = [o.ns]), d(o.fallbackLng) && (o.fallbackLng = [o.fallbackLng]), d(o.fallbackNS) && (o.fallbackNS = [o.fallbackNS]), o.supportedLngs?.indexOf?.("cimode") < 0 && (o.supportedLngs = o.supportedLngs.concat(["cimode"])), typeof o.initImmediate == "boolean" && (o.initAsync = o.initImmediate), o), B = () => {
}, Ue = (o) => {
  Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach((t) => {
    typeof o[t] == "function" && (o[t] = o[t].bind(o));
  });
}, Se = "__i18next_supportNoticeShown", He = () => !!(typeof globalThis < "u" && globalThis[Se] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env && process.env.NODE_ENV === "production"), Me = () => {
  typeof globalThis < "u" && (globalThis[Se] = !0);
}, ze = (o) => !!(o?.modules?.backend?.name?.indexOf("Locize") > 0 || o?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || o?.options?.backend?.backends && o.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || o?.options?.backend?.projectId || o?.options?.backend?.backendOptions && o.options.backend.backendOptions.some((e) => e?.projectId));
class H extends Y {
  constructor(e = {}, t) {
    if (super(), this.options = ge(e), this.services = {}, this.logger = R, this.modules = {
      external: []
    }, Ue(this), t && !this.isInitialized && !e.isClone) {
      if (!this.options.initAsync)
        return this.init(e, t), this;
      setTimeout(() => {
        this.init(e, t);
      }, 0);
    }
  }
  init(e = {}, t) {
    this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (d(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
    const i = Z();
    this.options = {
      ...i,
      ...this.options,
      ...ge(e)
    }, this.options.interpolation = {
      ...i.interpolation,
      ...this.options.interpolation
    }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = i.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !ze(this) && !He() && (typeof console < "u" && typeof console.info < "u" && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Me());
    const s = (u) => u ? typeof u == "function" ? new u() : u : null;
    if (!this.options.isClone) {
      this.modules.logger ? R.init(s(this.modules.logger), this.options) : R.init(null, this.options);
      let u;
      this.modules.formatter ? u = this.modules.formatter : u = Ve;
      const c = new ue(this.options);
      this.store = new oe(this.options.resources, this.options);
      const f = this.services;
      f.logger = R, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new Te(c, {
        prepend: this.options.pluralSeparator,
        simplifyPluralSuffix: this.options.simplifyPluralSuffix
      }), this.options.interpolation.format && this.options.interpolation.format !== i.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), u && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (f.formatter = s(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new de(this.options), f.utils = {
        hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
      }, f.backendConnector = new Ae(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (g, ...h) => {
        this.emit(g, ...h);
      }), this.modules.languageDetector && (f.languageDetector = s(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = s(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new W(this.services, this.options), this.translator.on("*", (g, ...h) => {
        this.emit(g, ...h);
      }), this.modules.external.forEach((g) => {
        g.init && g.init(this);
      });
    }
    if (this.format = this.options.interpolation.format, t || (t = B), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
      const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
      u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
    }
    !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((u) => {
      this[u] = (...c) => this.store[u](...c);
    }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
      this[u] = (...c) => (this.store[u](...c), this);
    });
    const a = A(), l = () => {
      const u = (c, f) => {
        this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), a.resolve(f), t(c, f);
      };
      if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
      this.changeLanguage(this.options.lng, u);
    };
    return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), a;
  }
  loadResources(e, t = B) {
    let i = t;
    const s = d(e) ? e : this.language;
    if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
      if (s?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return i();
      const n = [], r = (a) => {
        if (!a || a === "cimode") return;
        this.services.languageUtils.toResolveHierarchy(a).forEach((u) => {
          u !== "cimode" && n.indexOf(u) < 0 && n.push(u);
        });
      };
      s ? r(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => r(l)), this.options.preload?.forEach?.((a) => r(a)), this.services.backendConnector.load(n, this.options.ns, (a) => {
        !a && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(a);
      });
    } else
      i(null);
  }
  reloadResources(e, t, i) {
    const s = A();
    return typeof e == "function" && (i = e, e = void 0), typeof t == "function" && (i = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), i || (i = B), this.services.backendConnector.reload(e, t, (n) => {
      s.resolve(), i(n);
    }), s;
  }
  use(e) {
    if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
    if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
    return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && xe.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
  }
  setResolvedLanguage(e) {
    if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
      for (let t = 0; t < this.languages.length; t++) {
        const i = this.languages[t];
        if (!(["cimode", "dev"].indexOf(i) > -1) && this.store.hasLanguageSomeTranslations(i)) {
          this.resolvedLanguage = i;
          break;
        }
      }
      !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
    }
  }
  changeLanguage(e, t) {
    this.isLanguageChangingTo = e;
    const i = A();
    this.emit("languageChanging", e);
    const s = (a) => {
      this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
    }, n = (a, l) => {
      l ? this.isLanguageChangingTo === e && (s(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, i.resolve((...u) => this.t(...u)), t && t(a, (...u) => this.t(...u));
    }, r = (a) => {
      !e && !a && this.services.languageDetector && (a = []);
      const l = d(a) ? a : a && a[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(d(a) ? [a] : a);
      u && (this.language || s(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (c) => {
        n(c, u);
      });
    };
    return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), i;
  }
  getFixedT(e, t, i) {
    const s = (n, r, ...a) => {
      let l;
      typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : l = {
        ...r
      }, l.lng = l.lng || s.lng, l.lngs = l.lngs || s.lngs, l.ns = l.ns || s.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || i || s.keyPrefix);
      const u = {
        ...this.options,
        ...l
      };
      typeof l.keyPrefix == "function" && (l.keyPrefix = D(l.keyPrefix, u));
      const c = this.options.keySeparator || ".";
      let f;
      return l.keyPrefix && Array.isArray(n) ? f = n.map((p) => (typeof p == "function" && (p = D(p, u)), `${l.keyPrefix}${c}${p}`)) : (typeof n == "function" && (n = D(n, u)), f = l.keyPrefix ? `${l.keyPrefix}${c}${n}` : n), this.t(f, l);
    };
    return d(e) ? s.lng = e : s.lngs = e, s.ns = t, s.keyPrefix = i, s;
  }
  t(...e) {
    return this.translator?.translate(...e);
  }
  exists(...e) {
    return this.translator?.exists(...e);
  }
  setDefaultNamespace(e) {
    this.options.defaultNS = e;
  }
  hasLoadedNamespace(e, t = {}) {
    if (!this.isInitialized)
      return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
    if (!this.languages || !this.languages.length)
      return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
    const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
    if (i.toLowerCase() === "cimode") return !0;
    const r = (a, l) => {
      const u = this.services.backendConnector.state[`${a}|${l}`];
      return u === -1 || u === 0 || u === 2;
    };
    if (t.precheck) {
      const a = t.precheck(this, r);
      if (a !== void 0) return a;
    }
    return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
  }
  loadNamespaces(e, t) {
    const i = A();
    return this.options.ns ? (d(e) && (e = [e]), e.forEach((s) => {
      this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
    }), this.loadResources((s) => {
      i.resolve(), t && t(s);
    }), i) : (t && t(), Promise.resolve());
  }
  loadLanguages(e, t) {
    const i = A();
    d(e) && (e = [e]);
    const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
    return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
      i.resolve(), t && t(r);
    }), i) : (t && t(), Promise.resolve());
  }
  dir(e) {
    if (e || (e = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
    try {
      const s = new Intl.Locale(e);
      if (s && s.getTextInfo) {
        const n = s.getTextInfo();
        if (n && n.direction) return n.direction;
      }
    } catch {
    }
    const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], i = this.services?.languageUtils || new ue(Z());
    return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
  }
  static createInstance(e = {}, t) {
    const i = new H(e, t);
    return i.createInstance = H.createInstance, i;
  }
  cloneInstance(e = {}, t = B) {
    const i = e.forkResourceStore;
    i && delete e.forkResourceStore;
    const s = {
      ...this.options,
      ...e,
      isClone: !0
    }, n = new H(s);
    if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
      n[a] = this[a];
    }), n.services = {
      ...this.services
    }, n.services.utils = {
      hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
    }, i) {
      const a = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
        ...this.store.data[u]
      }, l[u] = Object.keys(l[u]).reduce((c, f) => (c[f] = {
        ...l[u][f]
      }, c), l[u]), l), {});
      n.store = new oe(a, s), n.services.resourceStore = n.store;
    }
    if (e.interpolation) {
      const l = {
        ...Z().interpolation,
        ...this.options.interpolation,
        ...e.interpolation
      }, u = {
        ...s,
        interpolation: l
      };
      n.services.interpolator = new de(u);
    }
    return n.translator = new W(n.services, s), n.translator.on("*", (a, ...l) => {
      n.emit(a, ...l);
    }), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
      hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
    }, n;
  }
  toJSON() {
    return {
      options: this.options,
      store: this.store,
      language: this.language,
      languages: this.languages,
      resolvedLanguage: this.resolvedLanguage
    };
  }
}
const O = H.createInstance();
O.createInstance;
O.dir;
O.init;
O.loadResources;
O.reloadResources;
O.use;
O.changeLanguage;
O.getFixedT;
O.t;
O.exists;
O.setDefaultNamespace;
O.hasLoadedNamespace;
O.loadNamespaces;
O.loadLanguages;
export {
  O as default,
  D as keyFromSelector
};
