import React from "react";
import { Button } from "antd";
import { Icon } from "@pisell/materials";
//#region src/plus/saasDevice/appPeripheral/components/shared/ModelPickerGrid.tsx
const ModelPickerGrid = ({ groups, classNamePrefix, separator = "__", groupTitleClassName, translation, onSelect, getFallbackGroupTitle, renderMeta, useButton = true }) => /* @__PURE__ */ React.createElement("div", { className: `${classNamePrefix}${separator}model-groups` }, groups.map(([typeCode, items]) => {
	var _items$;
	const type = (_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.type;
	return /* @__PURE__ */ React.createElement("div", {
		key: typeCode || "default",
		className: `${classNamePrefix}${separator}model-group`
	}, /* @__PURE__ */ React.createElement("div", { className: groupTitleClassName || `${classNamePrefix}${separator}model-group-title` }, (type === null || type === void 0 ? void 0 : type.icon) ? /* @__PURE__ */ React.createElement(Icon, { type: type.icon }) : null, /* @__PURE__ */ React.createElement("span", null, translation(type === null || type === void 0 ? void 0 : type.name) || (getFallbackGroupTitle === null || getFallbackGroupTitle === void 0 ? void 0 : getFallbackGroupTitle(typeCode)) || typeCode)), /* @__PURE__ */ React.createElement("div", { className: `${classNamePrefix}${separator}model-grid` }, items.map((model) => {
		const content = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: `${classNamePrefix}${separator}model-name` }, translation(model.name) || model.code), renderMeta === null || renderMeta === void 0 ? void 0 : renderMeta(model));
		return useButton ? /* @__PURE__ */ React.createElement(Button, {
			key: model.code,
			className: `${classNamePrefix}${separator}model-card`,
			onClick: () => onSelect(model)
		}, content) : /* @__PURE__ */ React.createElement("div", {
			key: model.code,
			role: "button",
			tabIndex: 0,
			className: `${classNamePrefix}${separator}model-card`,
			onClick: () => onSelect(model)
		}, content);
	})));
}));
//#endregion
export { ModelPickerGrid as default };
