import IconFont from "../../../../iconfont/index.js";
import { PREFIX } from "../../index.js";
import React from "react";
import { locales } from "@pisell/utils";
import "./index.less";
//#region src/components/productCard/cartSkuCard/components/holders/index.tsx
const holderIconMap = {
	"form": "pisell2-file-05",
	"minors": "pisell2-user-check-01",
	"waiver": "pisell2-file-lock-03"
};
const Holders = (props) => {
	const { dataSource = {} } = props;
	const { holders, holder_id } = dataSource;
	if (!holder_id || (holder_id === null || holder_id === void 0 ? void 0 : holder_id.length) === 0) {
		if (dataSource.isFormSubject) return /* @__PURE__ */ React.createElement("div", { className: "holder-item unassigned" }, dataSource.holderMaxCount > 1 ? /* @__PURE__ */ React.createElement("span", null, dataSource.holderMaxCount, "/", dataSource.holderMaxCount, " ") : null, /* @__PURE__ */ React.createElement("span", { className: "holder-label" }, locales.getText("pisell2.cart.sku-card.unassigned")));
		return null;
	}
	const renderHolder = (id) => {
		if (!id) return null;
		const holder = holders.find((item) => item.id === id);
		return /* @__PURE__ */ React.createElement("div", {
			className: "holder-item",
			key: id
		}, /* @__PURE__ */ React.createElement(IconFont, {
			className: "holder-icon",
			type: holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || "minors"]
		}), /* @__PURE__ */ React.createElement("span", { className: "holder-label" }, (holder === null || holder === void 0 ? void 0 : holder.label) || id));
	};
	return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__holders` }, Array.isArray(holder_id) ? holder_id === null || holder_id === void 0 ? void 0 : holder_id.map((id) => {
		return renderHolder(id);
	}) : renderHolder(holder_id));
};
//#endregion
export { Holders as default };
