import { jsx as t, jsxs as f } from "react/jsx-runtime";
import { useState as u, useEffect as m } from "react";
import { useParams as d, useLocation as g, Navigate as s, Outlet as h } from "react-router";
import { getComponentByNameIgnoreCase as v } from "../embeddable/index.js";
import { IntlProvider as C } from "react-intl";
import { AppContextProvider as w, SettingProvider as I, SettingsConsumer as E } from "@devgateway/wp-react-lib";
import { Provider as L } from "react-redux";
import "semantic-ui-react";
import "../utils/AppMedia.js";
import "./Footer.js";
import "./Header.js";
import { CustomizerWrapper as P } from "./Customizer.js";
import { Config as y } from "../conf/index.js";
import * as b from "../translations/en.json.js";
import * as x from "../translations/fr.json.js";
import * as N from "../translations/af.json.js";
import * as O from "../translations/am.json.js";
import { updateIntl as j } from "../lib/react-intl-redux/index.js";
import "immutable";
import { store as e } from "../redux/store.js";
import "./Favicon.js";
import "clsx";
import "../utils/semanticUtils.js";
import "./SearchControl.js";
import "./ClassicHeader.js";
import "./FloatingMenuHeader.js";
const r = {
  en: b,
  fr: x,
  am: O,
  af: N
}, Z = () => {
  const a = d(), p = g(), i = y.DEFAULT_LOCALE, [A, l] = u(!1), o = a.lan, c = p.pathname;
  return m(() => {
    l(!0), process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), typeof window < "u" && window.setTimeout(() => {
      if (window.location.hash) {
        const n = document.getElementById(window.location.hash.substring(1));
        n && n.scrollIntoView({ behavior: "auto", block: "start" });
      }
    }, 2e3);
  }, []), m(() => {
    e.dispatch(j({ locale: o, formats: {}, messages: r[o ?? "en"] }));
  }, [o]), o ? Object.keys(r).includes(o) ? /* @__PURE__ */ t(L, { store: e, children: /* @__PURE__ */ t(C, { locale: o, messages: r[o], children: /* @__PURE__ */ t(w, { getComponent: v, store: e, locale: o, children: /* @__PURE__ */ t(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(E, { children: [
    /* @__PURE__ */ t(P, {}),
    /* @__PURE__ */ t(h, {})
  ] }) }) }) }, o) }) : /* @__PURE__ */ t(s, { to: `/${i}${c}`, replace: !0 }) : /* @__PURE__ */ t(s, { to: i, replace: !0 });
};
export {
  Z as default
};
