import { jsx as c } from "react/jsx-runtime";
import { createContext as f, useContext as d, useEffect as s } from "react";
import { appConsole as m } from "../utils/appConsole.js";
import { useLocalization as p } from "../utils/hooks/useLocalization.js";
const r = f({
  localeMessages: {}
}), C = () => {
  const e = d(r);
  return typeof e.localeMessages > "u" && m.error("Please use this hooks inside children component of RPProvider"), e;
}, P = ({
  children: e,
  locale: o = "en_US",
  localization: t
}) => {
  const {
    setLocale: n,
    localeMessages: i,
    addLocalization: a
  } = p(o);
  return s(() => {
    o && n(o);
  }, [o]), s(() => {
    t && a(t);
  }, [t]), /* @__PURE__ */ c(
    r.Provider,
    {
      value: {
        localeMessages: i
      },
      children: e
    }
  );
};
export {
  r as LocalizationContext,
  P as LocalizationProvider,
  C as useLocalizationContext
};
