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/booking/components/TabProduct/selectProductItem/index.tsx
var selectProductItem_exports = {};
__export(selectProductItem_exports, {
  default: () => selectProductItem_default
});
module.exports = __toCommonJS(selectProductItem_exports);
var import_react = __toESM(require("react"));
var import_utils = require("@pisell/utils");
var import_classnames = __toESM(require("classnames"));
var import_browserSelect = __toESM(require("../../browserSelect"));
var import_collapsibleList = __toESM(require("../../collapsibleList"));
var import_utils2 = require("../../collapsibleList/utils");
var import_index = require("./index.less");
var SelectProductItem = ({
  item,
  onClick,
  onChangeQuantity,
  amountSymbol,
  style,
  className,
  disabled
}) => {
  var _a, _b, _c, _d;
  const list = (0, import_utils.createArray)(100, (d, i) => {
    let item2 = {
      label: i,
      value: i
    };
    if (i === 0) {
      item2.label = import_utils.locales.getText("pisell2.text.remove");
    }
    return item2;
  });
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style,
      className: (0, import_classnames.default)("server-select-product", className),
      onClick: () => {
        onClick == null ? void 0 : onClick(item);
      }
    },
    item.cover ? /* @__PURE__ */ import_react.default.createElement(
      "img",
      {
        src: import_utils.image.ali(item.cover, 100),
        className: "server-select-product-cover"
      }
    ) : /* @__PURE__ */ import_react.default.createElement("div", null),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-subtitle" }, item.subtitle || ""), (((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) || []).length ? /* @__PURE__ */ import_react.default.createElement(
      import_collapsibleList.default,
      {
        style: { width: "100%" },
        list: ((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.bundle) || [],
        renderItem: (item2) => (0, import_utils2.renderBundles)(item2, amountSymbol)
      }
    ) : null, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "server-select-product-quantity",
        onClick: (e) => {
          e.preventDefault();
          e.stopPropagation();
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_browserSelect.default,
        {
          options: list,
          value: item._extend.quantity,
          onChange: onChangeQuantity,
          style: { minWidth: 50 },
          disabled
        }
      ),
      /* @__PURE__ */ import_react.default.createElement("div", { className: "server-select-product-total" }, item._extend.origin_total !== item._extend.total && /* @__PURE__ */ import_react.default.createElement("span", { className: "server-select-product-origin-total" }, (0, import_utils.formatAmount)(
        item._extend.origin_total * item._extend.quantity,
        2,
        amountSymbol
      )), (0, import_utils.formatAmount)(
        item._extend.total * item._extend.quantity,
        2,
        amountSymbol
      ))
    ))
  );
};
var selectProductItem_default = SelectProductItem;
