import React from 'react';
import { T as TYPE_TO_MINI_ICON } from './index-cbe3a76a.js';
import { L as LCSubtypes } from './index-28917993.js';

const TYPE_TO_COLOR = {
  course: "bg-emerald-50",
  achievement: "bg-spice-50",
  skill: "bg-indigo-50"
};
const TYPE_TO_TEXT_COLOR = {
  course: "text-emerald-700",
  achievement: "text-spice-500",
  skill: "text-indigo-600"
};
const JobListingBubble = ({
  count = 0,
  type = LCSubtypes.skill,
  className
}) => {
  const imgSrc = TYPE_TO_MINI_ICON[type];
  const bgColor = TYPE_TO_COLOR[type];
  const textColor = TYPE_TO_TEXT_COLOR[type];
  if (count === 0) return /* @__PURE__ */ React.createElement(React.Fragment, null);
  return /* @__PURE__ */ React.createElement(
    "div",
    {
      className: `job-card-stat-bubble px-[10px] px-[5px] flex-nowrap rounded-[30px] flex ${bgColor} min-w-[48px] min-w-[90px] h-[30px] justify-center items-center ${className}`
    },
    /* @__PURE__ */ React.createElement("img", { src: imgSrc, className: "mr-[3px]" }),
    /* @__PURE__ */ React.createElement("span", { className: `flex items-center text-sm ${textColor} font-bold` }, count)
  );
};
const JobListCard = ({
  company,
  className = "job-listing-card",
  title,
  compensation,
  location,
  locationRequirement,
  timeRequirement,
  qualificationDisplay,
  percentQualifiedDisplay,
  postDateDisplay,
  customButtonComponent,
  imgThumb,
  isBookmarked,
  onBookmark,
  onClick
}) => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
  const courseReqCount = (_a = qualificationDisplay == null ? void 0 : qualificationDisplay.courses) == null ? void 0 : _a.totalRequiredCount;
  const achievementsReqCount = (_b = qualificationDisplay == null ? void 0 : qualificationDisplay.achievements) == null ? void 0 : _b.totalRequiredCount;
  const skillsReqCount = (_c = qualificationDisplay == null ? void 0 : qualificationDisplay.skills) == null ? void 0 : _c.totalRequiredCount;
  const courseCountDisplay = courseReqCount && `${(_e = (_d = qualificationDisplay == null ? void 0 : qualificationDisplay.courses) == null ? void 0 : _d.fulfilledCount) != null ? _e : 0}/${(_g = (_f = qualificationDisplay == null ? void 0 : qualificationDisplay.courses) == null ? void 0 : _f.totalRequiredCount) != null ? _g : 0}`;
  const achievementsCountDisplay = achievementsReqCount && `${(_i = (_h = qualificationDisplay == null ? void 0 : qualificationDisplay.achievements) == null ? void 0 : _h.fulfilledCount) != null ? _i : 0}/${(_k = (_j = qualificationDisplay == null ? void 0 : qualificationDisplay.achievements) == null ? void 0 : _j.totalRequiredCount) != null ? _k : 0}`;
  const skillsCountDisplay = skillsReqCount && `${(_m = (_l = qualificationDisplay == null ? void 0 : qualificationDisplay.skills) == null ? void 0 : _l.fulfilledCount) != null ? _m : 0}/${(_o = (_n = qualificationDisplay == null ? void 0 : qualificationDisplay.skills) == null ? void 0 : _n.totalRequiredCount) != null ? _o : 0}`;
  const qualifiedText = percentQualifiedDisplay ? `${percentQualifiedDisplay}% Qualified - Apply` : "Apply";
  let topText = "";
  if (!compensation && timeRequirement) topText = timeRequirement;
  if (!timeRequirement && compensation) topText = compensation;
  if (timeRequirement && compensation) topText = `${compensation} \u2022 ${timeRequirement}`;
  let locationText = "";
  if (!location && locationRequirement) locationText = locationRequirement;
  if (!locationRequirement && location) locationText = location;
  if (locationRequirement && location) locationText = `${locationRequirement} \u2022 ${location}`;
  const defaultButton = /* @__PURE__ */ React.createElement(
    "button",
    {
      type: "button",
      onClick,
      className: "mt-[10px] bg-cyan-700 py-[15px] px-[2px] rounded-[40px] text-grayscale-50 text-[17px] font-bold"
    },
    qualifiedText
  );
  const buttonComponent = customButtonComponent ? customButtonComponent : defaultButton;
  return /* @__PURE__ */ React.createElement(
    "div",
    {
      className: `flex flex-col justify-between shadow-[0_0_8px_0px_rgba(0,0,0,0.2)] relative $ py-[10px] px-[15px] max-w-[400px] min-h-[260px] rounded-[20px] ${className}`
    },
    /* @__PURE__ */ React.createElement("div", { className: "job-listing-top flex" }, /* @__PURE__ */ React.createElement("div", { className: "flex text-grayscale-500 text-xs uppercase w-full line-clamp-1" }, topText)),
    /* @__PURE__ */ React.createElement("p", { className: "text-grayscale-500 text-xs line-clamp-1 flex-shrink-0" }, " ", postDateDisplay),
    /* @__PURE__ */ React.createElement("div", { className: "job-listing-center flex mt-[5px]" }, imgThumb && /* @__PURE__ */ React.createElement(
      "img",
      {
        className: "object-cover w-[80px] flex-shrink-0 items-center justify-center rounded-[15px] mr-[10px]",
        src: imgThumb
      }
    ), /* @__PURE__ */ React.createElement("div", { className: "job-listing-description flex flex-col" }, /* @__PURE__ */ React.createElement("h4", { className: "text-lg font-bold line-clamp-2" }, title), /* @__PURE__ */ React.createElement("p", { className: "text-sm line-clamp-1" }, company), /* @__PURE__ */ React.createElement("span", { className: "text-sm line-clamp-1" }, locationText))),
    /* @__PURE__ */ React.createElement("div", { className: "job-listing-qualifications mt-[10px]" }, /* @__PURE__ */ React.createElement("div", { className: "course-card-counts-container flex items-center flex-wrap" }, /* @__PURE__ */ React.createElement(
      JobListingBubble,
      {
        type: LCSubtypes.course,
        count: courseCountDisplay,
        className: "mr-[5px] min-w-[100px]"
      }
    ), /* @__PURE__ */ React.createElement(
      JobListingBubble,
      {
        type: LCSubtypes.achievement,
        count: achievementsCountDisplay,
        className: "mr-[5px] min-w-[100px]"
      }
    ), /* @__PURE__ */ React.createElement(
      JobListingBubble,
      {
        type: LCSubtypes.skill,
        count: skillsCountDisplay,
        className: "mr-[0px min-w-[100px]]"
      }
    ))),
    buttonComponent
  );
};

export { JobListingBubble as J, JobListCard as a };
//# sourceMappingURL=JobListCard-e8b4ab33.js.map
