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/eventBooking/components/resourceDisplay/index.tsx
var resourceDisplay_exports = {};
__export(resourceDisplay_exports, {
  default: () => resourceDisplay_default
});
module.exports = __toCommonJS(resourceDisplay_exports);
var import_react = __toESM(require("react"));
var import_materials = require("@pisell/materials");
var import_classnames = __toESM(require("classnames"));
var import_image = __toESM(require("../../assets/image.svg"));
var import_calendar_heart = __toESM(require("../../assets/calendar-heart.svg"));
var import_compass = __toESM(require("../../assets/compass.svg"));
var import_phone = __toESM(require("../../assets/phone.svg"));
var import_mock = require("../../mock");
var import_index = require("./index.less");
var PisellResourceCard = ({
  dataSource,
  mode = "normal",
  showImage = true,
  showTitle = true,
  showSubtitle = true,
  showLocation = true,
  showContact = true,
  direction = "horizontal",
  shape = "circle",
  size = "xxl",
  useTextAvatar = false,
  className,
  style,
  onClick,
  ...rest
}) => {
  const { resource_display } = import_mock.mock;
  const { image, title, subtitle, location, contact } = dataSource || resource_display;
  const renderAvatar = () => {
    if (!showImage) return null;
    return /* @__PURE__ */ import_react.default.createElement(
      import_materials.PisellAvatar,
      {
        src: image || void 0,
        shape,
        size,
        useTextAvatar: !image,
        children: (rest == null ? void 0 : rest.children) || /* @__PURE__ */ import_react.default.createElement(import_materials.Image, { src: import_image.default, preview: false }),
        className: (0, import_classnames.default)({
          "pisell-resource-card-campus-avatar": mode === "campus",
          "pisell-resource-card-empty-avatar": !image
        })
      }
    );
  };
  const campusLists = () => {
    let lists = [];
    if (showTitle && title) {
      lists.push({ key: "title", value: title, icon: import_calendar_heart.default });
    }
    if (showLocation && location) {
      lists.push({ key: "location", value: location, icon: import_compass.default });
    }
    if (showContact && contact) {
      lists.push({ key: "contact", value: contact, icon: import_phone.default });
    }
    return lists;
  };
  const renderContent = () => {
    if (mode !== "campus") {
      return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, showTitle && title && /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText, { className: "pisell-resource-card-name" }, title), showSubtitle && subtitle && /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText, { className: "pisell-resource-card-subtitle" }, subtitle));
    }
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-resource-card-campus-wrap" }, campusLists().map(({ key, value, icon }) => {
      return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-resource-card-campus-item", key }, /* @__PURE__ */ import_react.default.createElement(import_materials.Image, { src: icon, preview: false }), /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText, null, value));
    }));
  };
  return /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellCard,
    {
      className: (0, import_classnames.default)(
        "pisell-resource-card",
        `pisell-resource-card-${direction}`,
        className
      ),
      style,
      onClick,
      ...rest
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-resource-card-content" }, renderAvatar(), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-resource-card-info" }, renderContent()))
  );
};
var resourceDisplay_default = PisellResourceCard;
