var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellShellFrame/PisellShellFrame.tsx
var PisellShellFrame_exports = {};
__export(PisellShellFrame_exports, {
  PisellShellFrame: () => PisellShellFrame,
  default: () => PisellShellFrame_default
});
module.exports = __toCommonJS(PisellShellFrame_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_locales = require("../../locales");
var import_PisellShellFrame = require("./PisellShellFrame.less");
var defaultConfig = {
  showTitle: false,
  showToolbar: false,
  showStatistic: false,
  statisticCollapsible: false,
  scroll: false,
  showBatchActionBar: false,
  showStatusArea: false
};
var PisellShellFrame = (props) => {
  const {
    className,
    style,
    config: configProp,
    title,
    subtitle,
    titleExtra,
    toolbar,
    statisticList,
    children,
    batchActionBar,
    statusArea
  } = props;
  const config = { ...defaultConfig, ...configProp };
  const [statisticCollapsed, setStatisticCollapsed] = (0, import_react.useState)(false);
  const hasTitle = config.showTitle && (title != null || subtitle != null || titleExtra != null);
  const hasToolbar = config.showToolbar && toolbar != null;
  const hasStatistic = config.showStatistic && statisticList != null;
  const hasBatchBar = config.showBatchActionBar && batchActionBar != null;
  const hasStatus = config.showStatusArea && statusArea != null;
  const scrollConfig = config.scroll;
  const useScroll = scrollConfig === true || typeof scrollConfig === "object" && scrollConfig != null;
  const scrollOpts = typeof scrollConfig === "object" && scrollConfig != null ? scrollConfig : null;
  const scrollStyle = scrollOpts == null ? void 0 : scrollOpts.style;
  const scrollClassName = scrollOpts == null ? void 0 : scrollOpts.className;
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: `pisell-shell-frame ${className ?? ""}`.trim(),
      style,
      "data-shell-frame": true
    },
    /* @__PURE__ */ import_react.default.createElement("header", { className: "pisell-shell-frame-header" }, hasTitle && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-title" }, /* @__PURE__ */ import_react.default.createElement("span", null, title != null && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-shell-frame-title-main" }, title), subtitle != null && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-shell-frame-title-sub" }, subtitle)), titleExtra != null && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-title-extra" }, titleExtra)), hasToolbar && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-toolbar" }, toolbar), hasStatistic && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-statistic" }, config.statisticCollapsible ? /* @__PURE__ */ import_react.default.createElement(
      import_antd.Collapse,
      {
        ghost: true,
        activeKey: statisticCollapsed ? [] : ["statistic"],
        onChange: (keys) => setStatisticCollapsed(keys.length === 0),
        items: [
          {
            key: "statistic",
            label: /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-shell-frame-statistic-collapse-header" }, statisticCollapsed ? (0, import_locales.getText)("shell-frame-statistic-expand") : (0, import_locales.getText)("shell-frame-statistic-collapse")),
            children: statisticList
          }
        ]
      }
    ) : statisticList)),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-body" }, useScroll ? /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `pisell-shell-frame-scroll ${scrollClassName ?? ""}`.trim(),
        style: scrollStyle
      },
      children
    ) : children),
    (hasBatchBar || hasStatus) && /* @__PURE__ */ import_react.default.createElement("footer", { className: "pisell-shell-frame-footer" }, hasBatchBar && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-batch-bar" }, batchActionBar), hasStatus && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-shell-frame-status" }, statusArea))
  );
};
PisellShellFrame.displayName = "PisellShellFrame";
var PisellShellFrame_default = PisellShellFrame;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  PisellShellFrame
});
