import { useContext, useMemo } from "react";
import { L as LanguageContext } from "./languageContext-BIMozZxS.esm.js";
const createFallbackLanguage = () => ({
  code: "en",
  label: "English",
  direction: "ltr"
});
const fallbackContextValue = {
  languages: [createFallbackLanguage()],
  currentLanguage: createFallbackLanguage(),
  isLoading: false,
  error: null,
  isFallbackActive: true,
  changeLanguage: (langCode) => {
    console.warn(`useLanguage: changeLanguage called but LanguageProvider is not available. Language code: ${langCode}`);
  },
  fetchLanguages: async () => {
    console.warn("useLanguage: fetchLanguages called but LanguageProvider is not available.");
  },
  direction: "ltr",
  isRtl: false,
  isLtr: true
};
const useLanguage = () => {
  const context = useContext(LanguageContext);
  if (context === void 0) {
    if (process.env.NODE_ENV !== "production") {
      console.warn(
        "useLanguage: LanguageProvider is not available. Using fallback values. To enable full language functionality, wrap your app with <ERPUIProvider> or <LanguageProvider>."
      );
    }
    return fallbackContextValue;
  }
  const computedValues = useMemo(() => {
    var _a;
    const direction = ((_a = context.currentLanguage) == null ? void 0 : _a.direction) || "ltr";
    const isRtl = direction === "rtl";
    const isLtr = direction === "ltr";
    return { direction, isRtl, isLtr };
  }, [context.currentLanguage]);
  return {
    ...context,
    ...computedValues
  };
};
export {
  useLanguage as u
};
//# sourceMappingURL=useLangauge-BaiyBPxd.esm.js.map
