"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _Sidebar = _interopRequireDefault(require("../components/Sidebar"));

var _sidebarHandlers = _interopRequireDefault(require("./sidebarHandlers"));

var _reactRedux = require("react-redux");

/*
 * Copyright (C) 2018 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */
function propsFromState(state) {
  var ui = state.ui,
      contextType = state.contextType,
      contextId = state.contextId,
      files = state.files,
      images = state.images,
      folders = state.folders,
      rootFolderId = state.rootFolderId,
      flickr = state.flickr,
      upload = state.upload,
      session = state.session,
      newPageLinkExpanded = state.newPageLinkExpanded;
  var collections = {};

  for (var key in state.collections) {
    var collection = state.collections[key];
    collections[key] = {
      links: collection.links,
      lastError: collection.error,
      isLoading: !!collection.loading,
      hasMore: !!collection.bookmark
    };
  }

  return Object.assign({}, {
    contextType: contextType,
    contextId: contextId,
    collections: collections,
    files: files,
    images: images,
    folders: folders,
    rootFolderId: rootFolderId,
    flickr: flickr,
    upload: upload,
    session: session,
    newPageLinkExpanded: newPageLinkExpanded
  }, ui);
}

var _default = (0, _reactRedux.connect)(propsFromState, _sidebarHandlers.default)(_Sidebar.default);

exports.default = _default;