"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _reactNativeSplashScreen = _interopRequireDefault(require("react-native-splash-screen"));
var _reactNativeToastMessage = _interopRequireDefault(require("react-native-toast-message"));
var _native = require("@react-navigation/native");
var _reactNativeDeviceInfo = require("react-native-device-info");
var _reactNativeOrientationLocker = _interopRequireDefault(require("react-native-orientation-locker"));
var _animatedComponents = require("./animated-components");
var _ErrorModal = _interopRequireDefault(require("./components/modals/ErrorModal"));
var _NetInfo = _interopRequireDefault(require("./components/network/NetInfo"));
var _ToastConfig = _interopRequireDefault(require("./components/toast/ToastConfig"));
var _constants = require("./constants");
var _containerApi = require("./container-api");
var _animatedComponents2 = require("./contexts/animated-components");
var _auth = require("./contexts/auth");
var _navigation = _interopRequireDefault(require("./contexts/navigation"));
var _network = require("./contexts/network");
var _store = require("./contexts/store");
var _theme = require("./contexts/theme");
var _tourProvider = require("./contexts/tour/tour-provider");
var _localization = require("./localization");
var _RootStack = _interopRequireDefault(require("./navigators/RootStack"));
var _theme2 = require("./theme");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const createApp = container => {
  const AppComponent = () => {
    const navigationRef = (0, _native.useNavigationContainerRef)();
    (0, _react.useEffect)(() => {
      (0, _localization.initStoredLanguage)().then();
    }, []);
    (0, _react.useEffect)(() => {
      // Hide the native splash / loading screen so that our
      // RN version can be displayed.
      _reactNativeSplashScreen.default.hide();
    }, []);
    if (!(0, _reactNativeDeviceInfo.isTablet)()) {
      _reactNativeOrientationLocker.default.lockToPortrait();
    }
    return /*#__PURE__*/_react.default.createElement(_containerApi.ContainerProvider, {
      value: container
    }, /*#__PURE__*/_react.default.createElement(_store.StoreProvider, null, /*#__PURE__*/_react.default.createElement(_theme.ThemeProvider, {
      themes: _theme2.themes,
      defaultThemeName: _theme2.bifoldTheme.themeName
    }, /*#__PURE__*/_react.default.createElement(_navigation.default, {
      navigationRef: navigationRef
    }, /*#__PURE__*/_react.default.createElement(_animatedComponents2.AnimatedComponentsProvider, {
      value: _animatedComponents.animatedComponents
    }, /*#__PURE__*/_react.default.createElement(_auth.AuthProvider, null, /*#__PURE__*/_react.default.createElement(_network.NetworkProvider, null, /*#__PURE__*/_react.default.createElement(_reactNative.StatusBar, {
      hidden: false,
      barStyle: "light-content",
      backgroundColor: _theme2.bifoldTheme.ColorPallet.brand.primary,
      translucent: false
    }), /*#__PURE__*/_react.default.createElement(_NetInfo.default, null), /*#__PURE__*/_react.default.createElement(_ErrorModal.default, null), /*#__PURE__*/_react.default.createElement(_tourProvider.TourProvider, {
      tours: _constants.tours,
      overlayColor: 'gray',
      overlayOpacity: 0.7
    }, /*#__PURE__*/_react.default.createElement(_RootStack.default, null)), /*#__PURE__*/_react.default.createElement(_reactNativeToastMessage.default, {
      topOffset: 15,
      config: _ToastConfig.default
    }))))))));
  };
  return AppComponent;
};
var _default = exports.default = createApp;
//# sourceMappingURL=App.js.map