var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/salesSdk/utils/shouldPromptHolderOnAddCart.ts
var shouldPromptHolderOnAddCart_exports = {};
__export(shouldPromptHolderOnAddCart_exports, {
  isHolderRequiredOnAddCart: () => isHolderRequiredOnAddCart,
  shouldPromptHolderOnAddCart: () => shouldPromptHolderOnAddCart
});
module.exports = __toCommonJS(shouldPromptHolderOnAddCart_exports);
var import_utils = require("../../../components/booking/utils");
var import_utils2 = require("../../../components/booking/info/service2/utils");
function shouldPromptHolderOnAddCart(input) {
  var _a, _b, _c;
  const { cacheItem, bookingConfig, customerId, skipForPromotion } = input;
  if (skipForPromotion) return false;
  const basic = (_b = (_a = bookingConfig == null ? void 0 : bookingConfig.config) == null ? void 0 : _a.basic) == null ? void 0 : _b.appointment_subject;
  if ((basic == null ? void 0 : basic.type) !== "form") return false;
  if ((basic == null ? void 0 : basic.show_hold_on_add_cart) === 0) return false;
  if ((0, import_utils.isWalkIn)(customerId ?? void 0)) return false;
  if ((0, import_utils2.isNormalProductByDurationSchedule)(cacheItem)) return false;
  const holderId = (_c = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _c.holder_id;
  if (Array.isArray(holderId) && holderId.length > 0) return false;
  if (holderId !== void 0 && holderId !== null && holderId !== "" && !Array.isArray(holderId)) {
    return false;
  }
  return true;
}
function isHolderRequiredOnAddCart(bookingConfig) {
  var _a, _b;
  return ((_b = (_a = bookingConfig == null ? void 0 : bookingConfig.config) == null ? void 0 : _a.basic) == null ? void 0 : _b.subject_require) === "require";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  isHolderRequiredOnAddCart,
  shouldPromptHolderOnAddCart
});
