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/pisellRecordBoard/shellFrame/Calendar/modal/MoveConfirmModal.tsx
var MoveConfirmModal_exports = {};
__export(MoveConfirmModal_exports, {
  MoveConfirmModal: () => MoveConfirmModal
});
module.exports = __toCommonJS(MoveConfirmModal_exports);
var import_react = __toESM(require("react"));
var import_bookingCalendarDateUtils = require("../utils/bookingCalendarDateUtils");
var import_calendarI18n = require("../calendarI18n");
function MoveConfirmModal({
  moveConfirm,
  moveDraft,
  setMoveDraft,
  panelRef,
  isLight,
  courts,
  visibleCourts,
  hourSlots,
  isBusinessHour,
  firstTimelineHour,
  endTimelineExclusive,
  onConfirm,
  onClose
}) {
  var _a, _b, _c, _d, _e;
  if (!moveConfirm) return null;
  const detail = (0, import_bookingCalendarDateUtils.getBookingDetailData)(moveConfirm.item, courts);
  const currentCustomer = {
    name: ((_a = detail.customer) == null ? void 0 : _a.name) || detail.headerSummary.customerName,
    phone: ((_b = detail.customer) == null ? void 0 : _b.phone) || "",
    email: ((_c = detail.customer) == null ? void 0 : _c.email) || ""
  };
  const originalCourtName = ((_d = courts.find((c) => c.id === moveConfirm.item.courtId)) == null ? void 0 : _d.name) || detail.headerSummary.resourceLabel || (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.courtFallback");
  const nextCourtName = ((_e = courts.find(
    (c) => c.id === ((moveDraft == null ? void 0 : moveDraft.targetCourtId) || moveConfirm.targetCourtId)
  )) == null ? void 0 : _e.name) || (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.courtFallback");
  const originalDate = moveConfirm.item.date;
  const originalStart = (0, import_bookingCalendarDateUtils.formatHourLabel)(moveConfirm.item.startHour);
  const originalEnd = (0, import_bookingCalendarDateUtils.formatHourLabel)(moveConfirm.item.endHour);
  const nextDate = (moveDraft == null ? void 0 : moveDraft.targetDate) || moveConfirm.targetDate;
  const nextStartHour = (moveDraft == null ? void 0 : moveDraft.targetHour) ?? moveConfirm.targetHour;
  const duration = moveConfirm.item.endHour - moveConfirm.item.startHour;
  const nextEndHour = nextStartHour + duration;
  const changed = originalDate !== nextDate || moveConfirm.item.courtId !== ((moveDraft == null ? void 0 : moveDraft.targetCourtId) || moveConfirm.targetCourtId) || moveConfirm.item.startHour !== nextStartHour;
  const isDragScenario = moveConfirm.item.date !== moveConfirm.targetDate || moveConfirm.item.startHour !== moveConfirm.targetHour || moveConfirm.item.courtId !== moveConfirm.targetCourtId;
  const slotDisabledLabel = (hour) => (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.slotDisabled", {
    time: (0, import_bookingCalendarDateUtils.formatHourLabel)(hour)
  });
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "fixed inset-0 z-[72] bg-black/45 backdrop-blur-sm flex items-center justify-center p-4" }, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      ref: panelRef,
      className: `w-full max-w-[980px] rounded-3xl border p-6 shadow-2xl ${isLight ? "theme-panel theme-border soft-shadow" : "border-zinc-700 bg-[#121217]"}`
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "text-[22px] font-semibold" }, (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.title")),
    /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `mt-2 text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.subtitle")
    ),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "mt-5 space-y-4" }, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `rounded-3xl border p-5 ${isLight ? "theme-panel-alt theme-border" : "border-zinc-700 bg-[#171820]"}`
      },
      /* @__PURE__ */ import_react.default.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `text-xs uppercase tracking-[0.14em] ${isLight ? "theme-text-muted" : "text-zinc-500"}`
        },
        (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.customer")
      ), /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `mt-3 text-[20px] font-semibold ${isLight ? "theme-text" : "text-white"}`
        },
        currentCustomer.name
      ), /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `mt-2 text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
        },
        currentCustomer.phone || (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.noPhone")
      ), /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `mt-1 text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
        },
        currentCustomer.email || (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.noEmail")
      ))
    ), /* @__PURE__ */ import_react.default.createElement("div", { className: "grid min-w-0 gap-4 md:grid-cols-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ import_react.default.createElement(
      "label",
      {
        className: `mb-2 block text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.court")
    ), /* @__PURE__ */ import_react.default.createElement(
      "select",
      {
        value: (moveDraft == null ? void 0 : moveDraft.targetCourtId) || moveConfirm.targetCourtId,
        onChange: (e) => setMoveDraft((prev) => ({
          ...prev || {},
          targetCourtId: e.target.value
        })),
        className: `min-w-0 w-full rounded-2xl px-4 py-4 outline-none ${isLight ? "theme-input theme-text" : "border border-zinc-700 bg-[#171820] text-white"}`
      },
      visibleCourts.map((court) => /* @__PURE__ */ import_react.default.createElement("option", { key: court.id, value: court.id }, court.name))
    )), /* @__PURE__ */ import_react.default.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ import_react.default.createElement(
      "label",
      {
        className: `mb-2 block text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.newDate")
    ), /* @__PURE__ */ import_react.default.createElement(
      "input",
      {
        type: "date",
        value: (moveDraft == null ? void 0 : moveDraft.targetDate) || moveConfirm.targetDate,
        onChange: (e) => setMoveDraft((prev) => ({
          ...prev || {},
          targetDate: e.target.value
        })),
        className: `min-w-0 w-full rounded-2xl py-4 pl-4 pr-11 outline-none [color-scheme:dark] [&::-webkit-calendar-picker-indicator]:ml-auto [&::-webkit-calendar-picker-indicator]:mr-1 ${isLight ? "theme-input theme-text [color-scheme:light]" : "border border-zinc-700 bg-[#171820] text-white"}`
      }
    ))), /* @__PURE__ */ import_react.default.createElement("div", { className: "grid min-w-0 gap-4 md:grid-cols-2" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ import_react.default.createElement(
      "label",
      {
        className: `mb-2 block text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.newStartTime")
    ), /* @__PURE__ */ import_react.default.createElement(
      "select",
      {
        value: nextStartHour,
        onChange: (e) => setMoveDraft((prev) => ({
          ...prev || {},
          targetHour: Number(e.target.value)
        })),
        className: `min-w-0 w-full rounded-2xl px-4 py-4 outline-none ${isLight ? "theme-input theme-text" : "border border-zinc-700 bg-[#171820] text-white"}`
      },
      hourSlots.filter(isBusinessHour).map((hour) => {
        const disabled = hour + duration > endTimelineExclusive;
        return /* @__PURE__ */ import_react.default.createElement("option", { key: hour, value: hour, disabled }, disabled ? slotDisabledLabel(hour) : (0, import_bookingCalendarDateUtils.formatHourLabel)(hour));
      })
    )), /* @__PURE__ */ import_react.default.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ import_react.default.createElement(
      "label",
      {
        className: `mb-2 block text-sm ${isLight ? "theme-text-muted" : "text-zinc-400"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.newEndTime")
    ), /* @__PURE__ */ import_react.default.createElement(
      "select",
      {
        value: nextEndHour,
        onChange: (e) => {
          const nextEnd = Number(e.target.value);
          setMoveDraft((prev) => ({
            ...prev || {},
            targetHour: nextEnd - duration
          }));
        },
        className: `min-w-0 w-full rounded-2xl px-4 py-4 outline-none ${isLight ? "theme-input theme-text" : "border border-zinc-700 bg-[#171820] text-white"}`
      },
      hourSlots.filter(isBusinessHour).map((hour) => {
        const startHour = hour - duration;
        const disabled = startHour < firstTimelineHour;
        return /* @__PURE__ */ import_react.default.createElement("option", { key: `end-${hour}`, value: hour, disabled }, disabled ? slotDisabledLabel(hour) : (0, import_bookingCalendarDateUtils.formatHourLabel)(hour));
      })
    ))), changed && /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `rounded-3xl border p-5 ${isLight ? "theme-panel-alt theme-border" : "border-zinc-700 bg-[#171820]"}`
      },
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `text-xs uppercase tracking-[0.14em] ${isLight ? "theme-text-muted" : "text-zinc-500"}`
        },
        (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.previousInfo")
      ),
      /* @__PURE__ */ import_react.default.createElement("div", { className: "mt-3 grid gap-3 md:grid-cols-2" }, /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `rounded-2xl p-4 ${isLight ? "theme-panel" : "bg-[#101117]"}`
        },
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `text-xs ${isLight ? "theme-text-muted" : "text-zinc-500"}`
          },
          (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.original")
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-2 text-sm ${isLight ? "theme-text-soft" : "text-zinc-300"}`
          },
          originalCourtName
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-1 text-sm ${isLight ? "theme-text-soft" : "text-zinc-300"}`
          },
          originalDate
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-1 text-sm ${isLight ? "theme-text-soft" : "text-zinc-300"}`
          },
          originalStart,
          " - ",
          originalEnd
        )
      ), /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `rounded-2xl p-4 ${isLight ? "theme-brand-surface border border-[var(--brand-light)]" : "bg-violet-600/10 border border-violet-500/30"}`
        },
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `text-xs ${isLight ? "theme-brand-text" : "text-violet-300"}`
          },
          isDragScenario ? (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.dropTarget") : (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.updated")
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-2 text-sm ${isLight ? "theme-text" : "text-white"}`
          },
          nextCourtName
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-1 text-sm ${isLight ? "theme-text" : "text-white"}`
          },
          nextDate
        ),
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: `mt-1 text-sm ${isLight ? "theme-text" : "text-white"}`
          },
          (0, import_bookingCalendarDateUtils.formatHourLabel)(nextStartHour),
          " -",
          " ",
          (0, import_bookingCalendarDateUtils.formatHourLabel)(nextEndHour)
        )
      ))
    )),
    /* @__PURE__ */ import_react.default.createElement("div", { className: "mt-6 flex justify-end gap-3" }, /* @__PURE__ */ import_react.default.createElement(
      "button",
      {
        type: "button",
        onClick: onClose,
        className: `rounded-2xl px-5 py-3 ${isLight ? "btn-neutral" : "border border-zinc-700 text-zinc-300"}`
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.common.cancel")
    ), /* @__PURE__ */ import_react.default.createElement(
      "button",
      {
        type: "button",
        onClick: onConfirm,
        className: "rounded-2xl bg-violet-600 px-6 py-3 font-semibold text-white"
      },
      (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.move.confirm")
    ))
  ));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  MoveConfirmModal
});
