"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.GridFolders = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireWildcard(require("react"));
var _ToolbarCollectionContentAutoSizer = require("../ToolbarCollectionContentAutoSizer");
var _mobxReactLite = require("mobx-react-lite");
var _useGridBaseSyncProps = require("./useGridBaseSyncProps");
var _getToolbarCollectionFeaturesInitializers = require("../../state/getToolbarCollectionFeaturesInitializers");
var _GridFoldersSectionsGroup = require("./GridFoldersSectionsGroup");
var _CollectionCard = require("../CollectionCard");
var _ToolbarCollection = require("../ToolbarCollection");
var _GridFoldersPlaceholderStates = require("./GridFoldersPlaceholderStates");
var _minimalRequiredWdsRuntimeCheck = require("../../minimalRequiredWdsRuntimeCheck");
var _useToolbarCollectionSyncProps = require("../ToolbarCollection/useToolbarCollectionSyncProps");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/Grid/GridFolders.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); }
function _GridFolders(props) {
  const {
    state,
    exportModal,
    dataHook,
    cardProps,
    emptyState,
    noResultsState,
    renderError,
    errorState = renderError && ((err, {
      isOnline,
      retry
    }) => renderError == null ? void 0 : renderError({
      err,
      isOnline,
      retry
    }))
  } = props;
  const {
    toolbar
  } = state;
  if (process.env.NODE_ENV !== 'production') {
    // https://github.com/wix-private/wix-design-systems/pull/13091/files#diff-0befb17e7fa12b244a3efce19b067187b39d3a96d4f7e62a59f4f0fd876dc37cR102
    (0, _minimalRequiredWdsRuntimeCheck.minimalRequiredWdsRuntimeCheck)({
      required: '^1.89.0',
      requiredBy: 'WixPatterns/GridFolders'
    });
  }
  (0, _useToolbarCollectionSyncProps.useToolbarCollectionSyncProps)({
    ...props,
    state: state.toolbar,
    isUsingDragAndDrop: false,
    isUsingBulkActionsToolbar: false,
    isUsingHorizontalScroll: false,
    isUsingFolders: true,
    isUsingTableVirtualization: false
  });
  (0, _useGridBaseSyncProps.useGridBaseSyncProps)({
    ...props,
    state: state.items
  });
  (0, _useGridBaseSyncProps.useGridBaseSyncProps)({
    ...props,
    renderAddItem: props.renderFolderAddItem,
    state: state.folders
  });
  (0, _react.useEffect)(() => state.init({
    featuresInitializers: (0, _getToolbarCollectionFeaturesInitializers.getToolbarCollectionFeaturesInitializers)(props)
  }), []);
  return /*#__PURE__*/_react.default.createElement(_CollectionCard.CollectionCard, (0, _extends2.default)({
    errorState: false,
    state: toolbar,
    dataHook: dataHook
  }, cardProps, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 132,
      columnNumber: 5
    }
  }), /*#__PURE__*/_react.default.createElement(_ToolbarCollection.ToolbarCollection, (0, _extends2.default)({}, props, {
    state: toolbar,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 138,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_GridFoldersPlaceholderStates.GridFoldersPlaceholderStates, {
    state: state,
    emptyState: emptyState,
    noResultsState: noResultsState,
    errorState: errorState,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 139,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_ToolbarCollectionContentAutoSizer.ToolbarCollectionContentAutoSizer, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 145,
      columnNumber: 11
    }
  }, /*#__PURE__*/_react.default.createElement(_GridFoldersSectionsGroup.GridFoldersSectionsGroup, (0, _extends2.default)({}, props, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 146,
      columnNumber: 13
    }
  }))))), exportModal ?? toolbar.featuredComponents.exportModal.value);
}
const GridFolders = exports.GridFolders = (0, _mobxReactLite.observer)(_GridFolders);
//# sourceMappingURL=GridFolders.js.map