"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _components = require("@wordpress/components");
var _i18n = require("@wordpress/i18n");
var _mediaPreview = require("./media-preview");
var _lockUnlock = require("../../../lock-unlock");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const {
  CompositeV2: Composite,
  useCompositeStoreV2: useCompositeStore
} = (0, _lockUnlock.unlock)(_components.privateApis);
function MediaList({
  mediaList,
  category,
  onClick,
  label = (0, _i18n.__)('Media List')
}) {
  const compositeStore = useCompositeStore();
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Composite, {
    store: compositeStore,
    role: "listbox",
    className: "block-editor-inserter__media-list",
    "aria-label": label,
    children: mediaList.map((media, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_mediaPreview.MediaPreview, {
      media: media,
      category: category,
      onClick: onClick
    }, media.id || media.sourceId || index))
  });
}
var _default = exports.default = MediaList;
//# sourceMappingURL=media-list.js.map