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/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.tsx
var SelectDate_exports = {};
__export(SelectDate_exports, {
  default: () => SelectDate_default
});
module.exports = __toCommonJS(SelectDate_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_dayjs = __toESM(require("dayjs"));
var import_materials = require("@pisell/materials");
var import_Status = __toESM(require("../CalendarDate/Status"));
var import_CalenDateWeek = __toESM(require("../CalendarDate/CalenDateWeek"));
var import_CalendarDate = __toESM(require("../CalendarDate"));
var import_mock = require("../../../../mock");
var import_OpenCard = __toESM(require("../../../OpenCard"));
var import_index = require("./index.less");
var SelectDate = ({
  currentDate,
  detail,
  currentDateChange,
  setSurplusDisabledChange,
  cutTime,
  setCutTime,
  showCalendarPopup
}, ref) => {
  const [dateLimitData, setDateLimitData] = (0, import_react.useState)(
    import_mock.mock.availability_calendar.limitData
  );
  const calendarDateRef = (0, import_react.useRef)(null);
  (0, import_react.useImperativeHandle)(ref, () => {
    return {};
  });
  const getLimitData = (start_date, end_date) => {
    const _list = [];
    const start = (0, import_dayjs.default)(start_date);
    const end = (0, import_dayjs.default)(end_date);
    while (start.isBefore(end)) {
      _list.push(start.format("YYYY-MM-DD"));
      start.add(1, "days");
    }
    console.log("dateLimitData", dateLimitData);
    console.log("_list", _list);
    const haveAllData = _list.find((item) => !dateLimitData[item]);
    if (haveAllData) {
    }
  };
  const extraHeader = () => {
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        onClick: (e) => {
          var _a;
          e.stopPropagation();
          (_a = calendarDateRef == null ? void 0 : calendarDateRef.current) == null ? void 0 : _a.open(currentDate, detail == null ? void 0 : detail.id);
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_materials.Iconfont,
        {
          type: "pisell2-calendar",
          className: (0, import_classnames.default)("calendar-icon")
        }
      )
    );
  };
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
    import_OpenCard.default,
    {
      title: "Select a date",
      initOpen: true,
      showArrow: false,
      isClick: false,
      extra: showCalendarPopup ? extraHeader() : null
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_CalenDateWeek.default,
      {
        currentDate,
        productId: detail == null ? void 0 : detail.id,
        cutTime,
        dateLimitData
      }
    ),
    /* @__PURE__ */ import_react.default.createElement(import_Status.default, null)
  ), /* @__PURE__ */ import_react.default.createElement(
    import_CalendarDate.default,
    {
      ref: calendarDateRef,
      cutTime,
      dateLimitData
    }
  ));
};
var SelectDate_default = (0, import_react.forwardRef)(SelectDate);
