import { isNormalProductByDurationSchedule, isBookingProduct } from "../../../components/booking/info/service2/utils";
import { getIsNoSpecAndPackage } from "../../../components/booking/info2/utilsByBooking";
/**
 * 资源编辑抽屉是否展示「编辑商品」按钮。
 */
export function canShowBookingEditProductButton(options) {
  var cacheItem = options.cacheItem,
    bookingState = options.bookingState,
    hasOpenProductDetail = options.hasOpenProductDetail;
  if (!cacheItem || bookingState.channelDisabledEdit) {
    return false;
  }
  if (getIsNoSpecAndPackage(cacheItem)) {
    return false;
  }
  if (isBookingProduct(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.extension_type)) {
    return hasOpenProductDetail;
  }
  if (isNormalProductByDurationSchedule(cacheItem)) {
    return true;
  }
  return hasOpenProductDetail;
}