"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.CairoTestApp = CairoTestApp;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireWildcard(require("react"));
var _components = require("../components");
var _designSystem = require("@wix/design-system");
var _react2 = require("@wix/bex-core/react");
var _react3 = require("@wix/fe-essentials/react");
var _EntityPage = require("../components/EntityPage");
var _CollectionPageNew = require("../components/CollectionPageNew");
var _PageWrapper = require("../components/PageWrapper/PageWrapper");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/test-utils/CairoTestApp.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const CairoTestAppRouter = /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./CairoTestAppRouter'))).then(module => ({
  default: module.CairoTestAppRouter
})));
function CairoTestApp({
  children,
  driver,
  page,
  scrollElement,
  entityPageState,
  collectionPageState,
  routerParams,
  collectionPageHeaderProps
}) {
  let child = children;
  switch (page) {
    case 'wsr':
      child = /*#__PURE__*/_react.default.createElement(_designSystem.Page, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 53,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Page.Header, {
        title: "Page Title",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 54,
          columnNumber: 11
        }
      }), /*#__PURE__*/_react.default.createElement(_designSystem.Page.Content, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 55,
          columnNumber: 11
        }
      }, children));
      break;
    case 'entity':
      child = /*#__PURE__*/_react.default.createElement(_designSystem.Page, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 61,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Page.Content, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 62,
          columnNumber: 11
        }
      }, children));
      break;
    case 'none':
      child = /*#__PURE__*/_react.default.createElement("div", {
        ref: scrollElement,
        "data-hook": "custom-scroll-container",
        style: {
          height: '200px',
          overflow: 'auto'
        },
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 68,
          columnNumber: 9
        }
      }, child);
      break;
    case 'entity-page':
      if (!entityPageState) {
        throw new Error('Page state was not initialized');
      }
      child = /*#__PURE__*/_react.default.createElement(_EntityPage.EntityPage, {
        state: entityPageState,
        dataHook: page,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 82,
          columnNumber: 9
        }
      }, children);
      break;
    case 'collection-page':
      if (!collectionPageState) {
        throw new Error('Page state was not initialized');
      }
      child = /*#__PURE__*/_react.default.createElement(_CollectionPageNew.CollectionPage, {
        dataHook: page,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 92,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_CollectionPageNew.CollectionPage.Header, (0, _extends2.default)({
        title: {
          text: collectionPageState.pageTitle || 'Title',
          hideTotal: collectionPageState.hideHeaderTotal
        }
      }, collectionPageHeaderProps, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 93,
          columnNumber: 11
        }
      })), /*#__PURE__*/_react.default.createElement(_CollectionPageNew.CollectionPage.Content, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 100,
          columnNumber: 11
        }
      }, children));
      break;
    case 'router':
      if (!routerParams) {
        throw new Error('Router params were not initialized');
      }
      child = /*#__PURE__*/_react.default.createElement(_react.Suspense, {
        fallback: /*#__PURE__*/_react.default.createElement("div", {
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 110,
            columnNumber: 29
          }
        }, "Loading router..."),
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 110,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(CairoTestAppRouter, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 111,
          columnNumber: 11
        }
      }, children));
      break;
    default:
      child = /*#__PURE__*/_react.default.createElement(_PageWrapper.PageWrapper, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 117,
          columnNumber: 9
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Page, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 118,
          columnNumber: 11
        }
      }, /*#__PURE__*/_react.default.createElement(_designSystem.Page.Content, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 119,
          columnNumber: 13
        }
      }, children)));
      break;
  }
  return /*#__PURE__*/_react.default.createElement(_react3.EssentialsProvider, {
    essentials: driver.testContext,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 127,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.WixStyleReactEnvironmentProvider, {
    locale: driver.testContext.environment.language,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 128,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_components.WixPatternsTestProvider, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 131,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_react2.WixPatternsContainerProvider, {
    value: driver.container,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 132,
      columnNumber: 11
    }
  }, child))));
}
//# sourceMappingURL=CairoTestApp.js.map