'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { DndContext, pointerWithin } from '@dnd-kit/core';
import { ModalContainer, ModalProvider } from '@faceless-ui/modal';
import { ScrollInfoProvider } from '@faceless-ui/scroll-info';
import React from 'react';
import { CloseModalOnRouteChange } from '../../elements/CloseModalOnRouteChange/index.js';
import { LoadingOverlayProvider } from '../../elements/LoadingOverlay/index.js';
import { NavProvider } from '../../elements/Nav/context.js';
import { StayLoggedInModal } from '../../elements/StayLoggedIn/index.js';
import { StepNavProvider } from '../../elements/StepNav/index.js';
import { ClickOutsideProvider } from '../../providers/ClickOutside/index.js';
import { WindowInfoProvider } from '../../providers/WindowInfo/index.js';
import { AuthProvider } from '../Auth/index.js';
import { ClientFunctionProvider } from '../ClientFunction/index.js';
import { ConfigProvider } from '../Config/index.js';
import { DocumentEventsProvider } from '../DocumentEvents/index.js';
import { LocaleProvider } from '../Locale/index.js';
import { ParamsProvider } from '../Params/index.js';
import { PreferencesProvider } from '../Preferences/index.js';
import { RouteCache } from '../RouteCache/index.js';
import { RouteTransitionProvider } from '../RouteTransition/index.js';
import { SearchParamsProvider } from '../SearchParams/index.js';
import { ServerFunctionsProvider } from '../ServerFunctions/index.js';
import { ThemeProvider } from '../Theme/index.js';
import { ToastContainer } from '../ToastContainer/index.js';
import { TranslationProvider } from '../Translation/index.js';
import { UploadHandlersProvider } from '../UploadHandlers/index.js';
export const RootProvider = ({ children, config, dateFNSKey, fallbackLang, isNavOpen, languageCode, languageOptions, locale, permissions, serverFunction, switchLanguageServerAction, theme, translations, user })=>{
    const dndContextID = React.useId();
    return /*#__PURE__*/ _jsxDEV(ClickOutsideProvider, {
        children: [
            /*#__PURE__*/ _jsxDEV(ServerFunctionsProvider, {
                serverFunction: serverFunction,
                children: /*#__PURE__*/ _jsxDEV(RouteTransitionProvider, {
                    children: /*#__PURE__*/ _jsxDEV(RouteCache, {
                        cachingEnabled: process.env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH === 'true',
                        children: /*#__PURE__*/ _jsxDEV(ConfigProvider, {
                            config: config,
                            children: /*#__PURE__*/ _jsxDEV(ClientFunctionProvider, {
                                children: /*#__PURE__*/ _jsxDEV(TranslationProvider, {
                                    dateFNSKey: dateFNSKey,
                                    fallbackLang: fallbackLang,
                                    language: languageCode,
                                    languageOptions: languageOptions,
                                    switchLanguageServerAction: switchLanguageServerAction,
                                    translations: translations,
                                    children: /*#__PURE__*/ _jsxDEV(WindowInfoProvider, {
                                        breakpoints: {
                                            l: '(max-width: 1440px)',
                                            m: '(max-width: 1024px)',
                                            s: '(max-width: 768px)',
                                            xs: '(max-width: 400px)'
                                        },
                                        children: /*#__PURE__*/ _jsxDEV(ScrollInfoProvider, {
                                            children: /*#__PURE__*/ _jsxDEV(SearchParamsProvider, {
                                                children: /*#__PURE__*/ _jsxDEV(ModalProvider, {
                                                    classPrefix: "payload",
                                                    transTime: 0,
                                                    zIndex: "var(--z-modal)",
                                                    children: [
                                                        /*#__PURE__*/ _jsxDEV(CloseModalOnRouteChange, {}, void 0, false, {
                                                            fileName: "src/providers/Root/index.tsx",
                                                            lineNumber: 105,
                                                            columnNumber: 27
                                                        }, this),
                                                        /*#__PURE__*/ _jsxDEV(AuthProvider, {
                                                            permissions: permissions,
                                                            user: user,
                                                            children: [
                                                                /*#__PURE__*/ _jsxDEV(PreferencesProvider, {
                                                                    children: /*#__PURE__*/ _jsxDEV(ThemeProvider, {
                                                                        theme: theme,
                                                                        children: /*#__PURE__*/ _jsxDEV(ParamsProvider, {
                                                                            children: /*#__PURE__*/ _jsxDEV(LocaleProvider, {
                                                                                locale: locale,
                                                                                children: /*#__PURE__*/ _jsxDEV(StepNavProvider, {
                                                                                    children: /*#__PURE__*/ _jsxDEV(LoadingOverlayProvider, {
                                                                                        children: /*#__PURE__*/ _jsxDEV(DocumentEventsProvider, {
                                                                                            children: /*#__PURE__*/ _jsxDEV(NavProvider, {
                                                                                                initialIsOpen: isNavOpen,
                                                                                                children: /*#__PURE__*/ _jsxDEV(UploadHandlersProvider, {
                                                                                                    children: /*#__PURE__*/ _jsxDEV(DndContext, {
                                                                                                        collisionDetection: pointerWithin,
                                                                                                        id: dndContextID,
                                                                                                        children: children
                                                                                                    }, void 0, false, {
                                                                                                        fileName: "src/providers/Root/index.tsx",
                                                                                                        lineNumber: 116,
                                                                                                        columnNumber: 47
                                                                                                    }, this)
                                                                                                }, void 0, false, {
                                                                                                    fileName: "src/providers/Root/index.tsx",
                                                                                                    lineNumber: 115,
                                                                                                    columnNumber: 45
                                                                                                }, this)
                                                                                            }, void 0, false, {
                                                                                                fileName: "src/providers/Root/index.tsx",
                                                                                                lineNumber: 114,
                                                                                                columnNumber: 43
                                                                                            }, this)
                                                                                        }, void 0, false, {
                                                                                            fileName: "src/providers/Root/index.tsx",
                                                                                            lineNumber: 113,
                                                                                            columnNumber: 41
                                                                                        }, this)
                                                                                    }, void 0, false, {
                                                                                        fileName: "src/providers/Root/index.tsx",
                                                                                        lineNumber: 112,
                                                                                        columnNumber: 39
                                                                                    }, this)
                                                                                }, void 0, false, {
                                                                                    fileName: "src/providers/Root/index.tsx",
                                                                                    lineNumber: 111,
                                                                                    columnNumber: 37
                                                                                }, this)
                                                                            }, void 0, false, {
                                                                                fileName: "src/providers/Root/index.tsx",
                                                                                lineNumber: 110,
                                                                                columnNumber: 35
                                                                            }, this)
                                                                        }, void 0, false, {
                                                                            fileName: "src/providers/Root/index.tsx",
                                                                            lineNumber: 109,
                                                                            columnNumber: 33
                                                                        }, this)
                                                                    }, void 0, false, {
                                                                        fileName: "src/providers/Root/index.tsx",
                                                                        lineNumber: 108,
                                                                        columnNumber: 31
                                                                    }, this)
                                                                }, void 0, false, {
                                                                    fileName: "src/providers/Root/index.tsx",
                                                                    lineNumber: 107,
                                                                    columnNumber: 29
                                                                }, this),
                                                                /*#__PURE__*/ _jsxDEV(ModalContainer, {}, void 0, false, {
                                                                    fileName: "src/providers/Root/index.tsx",
                                                                    lineNumber: 131,
                                                                    columnNumber: 29
                                                                }, this),
                                                                /*#__PURE__*/ _jsxDEV(StayLoggedInModal, {}, void 0, false, {
                                                                    fileName: "src/providers/Root/index.tsx",
                                                                    lineNumber: 132,
                                                                    columnNumber: 29
                                                                }, this)
                                                            ]
                                                        }, void 0, true, {
                                                            fileName: "src/providers/Root/index.tsx",
                                                            lineNumber: 106,
                                                            columnNumber: 27
                                                        }, this)
                                                    ]
                                                }, void 0, true, {
                                                    fileName: "src/providers/Root/index.tsx",
                                                    lineNumber: 104,
                                                    columnNumber: 25
                                                }, this)
                                            }, void 0, false, {
                                                fileName: "src/providers/Root/index.tsx",
                                                lineNumber: 103,
                                                columnNumber: 23
                                            }, this)
                                        }, void 0, false, {
                                            fileName: "src/providers/Root/index.tsx",
                                            lineNumber: 102,
                                            columnNumber: 21
                                        }, this)
                                    }, void 0, false, {
                                        fileName: "src/providers/Root/index.tsx",
                                        lineNumber: 94,
                                        columnNumber: 19
                                    }, this)
                                }, void 0, false, {
                                    fileName: "src/providers/Root/index.tsx",
                                    lineNumber: 86,
                                    columnNumber: 17
                                }, this)
                            }, void 0, false, {
                                fileName: "src/providers/Root/index.tsx",
                                lineNumber: 85,
                                columnNumber: 15
                            }, this)
                        }, void 0, false, {
                            fileName: "src/providers/Root/index.tsx",
                            lineNumber: 84,
                            columnNumber: 13
                        }, this)
                    }, void 0, false, {
                        fileName: "src/providers/Root/index.tsx",
                        lineNumber: 81,
                        columnNumber: 11
                    }, this)
                }, void 0, false, {
                    fileName: "src/providers/Root/index.tsx",
                    lineNumber: 80,
                    columnNumber: 9
                }, this)
            }, void 0, false, {
                fileName: "src/providers/Root/index.tsx",
                lineNumber: 79,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV(ToastContainer, {
                config: config
            }, void 0, false, {
                fileName: "src/providers/Root/index.tsx",
                lineNumber: 144,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/providers/Root/index.tsx",
        lineNumber: 78,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map