"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const React = require("react");
const classNames = require("../../_util/classNames.js");
const pictureItem = require("./pictureItem.js");
const textItem = require("./textItem.js");
const index = require("../../ConfigProvider/index.js");
const is = require("../../_util/is.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
const CSSTransition = require("../../../../../../../react-transition-group@4.4.5_biqbaboplfbrettd7655fr4n2y/node_modules/react-transition-group/esm/CSSTransition.js");
const TransitionGroup = require("../../../../../../../react-transition-group@4.4.5_biqbaboplfbrettd7655fr4n2y/node_modules/react-transition-group/esm/TransitionGroup.js");
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
var __rest = globalThis && globalThis.__rest || function(s, e) {
  var t = {};
  for (var p in s)
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
      t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
};
var FileList = function(props) {
  var _a;
  var _b = React.useContext(index.ConfigContext), locale = _b.locale, rtl = _b.rtl;
  var listType = props.listType, fileList = props.fileList, renderUploadList = props.renderUploadList, renderUploadItem = props.renderUploadItem, prefixCls = props.prefixCls, rest = __rest(props, ["listType", "fileList", "renderUploadList", "renderUploadItem", "prefixCls"]);
  if (is.isFunction(renderUploadList)) {
    return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
      className: prefixCls + "-list",
      children: renderUploadList(fileList, rest)
    });
  }
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(TransitionGroup, {
    className: classNames(prefixCls + "-list", prefixCls + "-list-type-" + listType, (_a = {}, _a[prefixCls + "-list-rtl"] = rtl, _a)),
    children: fileList.map(function(file) {
      var originNode = listType === "picture-card" ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
        className: prefixCls + "-list-item " + prefixCls + "-list-item-" + file.status,
        children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(pictureItem, {
          ...__assign({}, props, {
            file
          })
        })
      }) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(textItem, {
        ...__assign({}, props, {
          file,
          locale
        })
      });
      if (is.isFunction(renderUploadItem)) {
        originNode = renderUploadItem(originNode, file, fileList);
      }
      return listType === "picture-card" ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(CSSTransition, {
        timeout: {
          enter: 200,
          exit: 400
        },
        classNames: prefixCls + "-slide-inline",
        onEntered: function(e) {
          e.style.width = "";
        },
        onExit: function(e) {
          e.style.width = e.scrollWidth + "px";
        },
        onExiting: function(e) {
          e.style.width = 0;
        },
        onExited: function(e) {
          e.style.width = 0;
        },
        children: originNode
      }, file.uid) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(CSSTransition, {
        timeout: {
          enter: 200,
          exit: 400
        },
        classNames: prefixCls + "-slide-up",
        onExit: function(e) {
          e.style.height = e.scrollHeight + "px";
        },
        onExiting: function(e) {
          e.style.height = 0;
        },
        onExited: function(e) {
          e.style.height = 0;
        },
        children: originNode
      }, file.uid);
    })
  });
};
FileList.defaultProps = {
  listType: "text"
};
FileList.displayName = "FileList";
const UploadList = FileList;
exports.FileList = FileList;
exports.default = UploadList;
//# sourceMappingURL=index.js.map
