"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageConstructorProvider = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const constants_1 = require("../../components/constants.js");
const analyticsContext_1 = require("../../context/analyticsContext/index.js");
const editorStoreContext_1 = require("../../context/editorStoreContext/index.js");
const FormsContext_1 = require("../../context/formsContext/FormsContext.js");
const imageContext_1 = require("../../context/imageContext/index.js");
const localeContext_1 = require("../../context/localeContext/index.js");
const locationContext_1 = require("../../context/locationContext/index.js");
const mapsContext_1 = require("../../context/mapsContext/mapsContext.js");
const mobileContext_1 = require("../../context/mobileContext/index.js");
const projectSettingsContext_1 = require("../../context/projectSettingsContext/index.js");
const ssrContext_1 = require("../../context/ssrContext/index.js");
const theme_1 = require("../../context/theme/index.js");
const PageConstructorProvider = (props) => {
    const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, forms = FormsContext_1.DEFAULT_FORMS_CONTEXT_VALUE, } = props;
    /* eslint-disable react/jsx-key */
    const context = [
        (0, jsx_runtime_1.jsx)(theme_1.ThemeContext.Provider, { value: { theme } }),
        (0, jsx_runtime_1.jsx)(projectSettingsContext_1.ProjectSettingsContext.Provider, { value: projectSettings }),
        (0, jsx_runtime_1.jsx)(localeContext_1.LocaleContext.Provider, { value: locale }),
        (0, jsx_runtime_1.jsx)(imageContext_1.ImageContext.Provider, { value: image }),
        (0, jsx_runtime_1.jsx)(locationContext_1.LocationContext.Provider, { value: location }),
        (0, jsx_runtime_1.jsx)(mobileContext_1.MobileContext.Provider, { value: Boolean(isMobile) }),
        (0, jsx_runtime_1.jsx)(mapsContext_1.MapsContext.Provider, { value: mapsContext }),
        (0, jsx_runtime_1.jsx)(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
        (0, jsx_runtime_1.jsx)(FormsContext_1.FormsContext.Provider, { value: forms }),
        (0, jsx_runtime_1.jsx)(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
        (0, jsx_runtime_1.jsx)(editorStoreContext_1.PCEditorStoreProvider, {}),
    ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
    /* eslint-enable react/jsx-key */
    return (0, jsx_runtime_1.jsx)(React.Fragment, { children: context });
};
exports.PageConstructorProvider = PageConstructorProvider;
//# sourceMappingURL=Provider.js.map
