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/view/BookingCalendarWeekView.tsx
var BookingCalendarWeekView_exports = {};
__export(BookingCalendarWeekView_exports, {
  BookingCalendarWeekView: () => BookingCalendarWeekView
});
module.exports = __toCommonJS(BookingCalendarWeekView_exports);
var import_react = __toESM(require("react"));
var import_bookingCalendarDateUtils = require("../utils/bookingCalendarDateUtils");
var import_bookingCalendarConstants = require("../const/bookingCalendarConstants");
var import_calendarI18n = require("../calendarI18n");
var import_BookingCalendarStyle = require("../utils/BookingCalendarStyle");
var import_bookingCalendarViewShared = require("../bookingCalendarViewShared");
var import_BookingCalendarGroupRowHeader = require("./BookingCalendarGroupRowHeader");
var import_bookingCalendarAxis = require("../utils/bookingCalendarAxis");
var WEEK_VIEW_OVERLAY_CELL_PAD = 4;
var WEEK_VIEW_OVERLAY_LANE_GAP = 4;
function BookingCalendarWeekView({
  calendarProps,
  isLight,
  weekDays,
  bookings,
  courts,
  hourSlots,
  slotStepHours,
  visibleCourts,
  visibleCourtRows,
  isBusinessHour,
  goToDayFromCell,
  handleGridDropMove,
  openBookingDetail,
  setDraggingItem,
  setCollapsedGroups,
  setOverflowListModal,
  tickFillMode
}) {
  const props = calendarProps;
  const todayKey = (0, import_bookingCalendarDateUtils.fmtDate)(/* @__PURE__ */ new Date());
  const weekDayColMinPx = 150;
  const weekGridMinWidthPx = import_bookingCalendarConstants.frozenColWidth + weekDays.length * weekDayColMinPx;
  const weekDateSet = (0, import_react.useMemo)(() => {
    const s = /* @__PURE__ */ new Set();
    for (const d of weekDays) s.add((0, import_bookingCalendarDateUtils.fmtDate)(d));
    return s;
  }, [weekDays]);
  const dateKeyToCol = (0, import_react.useMemo)(() => {
    const m = /* @__PURE__ */ new Map();
    weekDays.forEach((d, i) => m.set((0, import_bookingCalendarDateUtils.fmtDate)(d), i));
    return m;
  }, [weekDays]);
  const weekFirstKey = (0, import_react.useMemo)(
    () => weekDays[0] ? (0, import_bookingCalendarDateUtils.fmtDate)(weekDays[0]) : "",
    [weekDays]
  );
  const weekLastKey = (0, import_react.useMemo)(
    () => weekDays.length > 0 ? (0, import_bookingCalendarDateUtils.fmtDate)(weekDays[weekDays.length - 1]) : "",
    [weekDays]
  );
  const bookingsByCourt = (0, import_react.useMemo)(() => {
    const m = /* @__PURE__ */ new Map();
    if (!weekFirstKey || !weekLastKey) return m;
    for (const b of bookings) {
      if (!(b == null ? void 0 : b.courtId)) continue;
      if (!(0, import_bookingCalendarDateUtils.bookingIntersectsDateWindow)(b, weekFirstKey, weekLastKey)) continue;
      const cid = String(b.courtId);
      const arr = m.get(cid);
      if (arr) arr.push(b);
      else m.set(cid, [b]);
    }
    return m;
  }, [bookings, weekFirstKey, weekLastKey]);
  const courtRowMetrics = (0, import_react.useMemo)(() => {
    const m = /* @__PURE__ */ new Map();
    for (const [cid, items] of bookingsByCourt) {
      const { lanes, laneCount } = (0, import_bookingCalendarDateUtils.assignLanesByInterval)(items, "day");
      const entries = [];
      const overflowByDate = /* @__PURE__ */ new Map();
      const seenIds = /* @__PURE__ */ new Set();
      for (const it of items) {
        const idKey = String(it.id);
        if (seenIds.has(idKey)) continue;
        seenIds.add(idKey);
        const lane = lanes.get(idKey);
        if (lane === void 0) continue;
        entries.push({ item: it, lane });
        if (lane < import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE) continue;
        const startStr = String(it.date);
        const endStr = String(it.endDate ?? it.date);
        const startDate = /* @__PURE__ */ new Date(`${startStr}T00:00:00`);
        const endDate = /* @__PURE__ */ new Date(`${endStr}T00:00:00`);
        const cur = new Date(startDate);
        while (cur.getTime() <= endDate.getTime()) {
          const k = (0, import_bookingCalendarDateUtils.fmtDate)(cur);
          if (weekDateSet.has(k)) {
            const arr = overflowByDate.get(k);
            if (arr) arr.push(it);
            else overflowByDate.set(k, [it]);
          }
          cur.setDate(cur.getDate() + 1);
        }
      }
      m.set(cid, { entries, laneCount, overflowByDate });
    }
    return m;
  }, [bookingsByCourt, weekDateSet]);
  const courtRowHeightPx = (0, import_react.useMemo)(() => {
    const padY = import_bookingCalendarConstants.RESOURCE_VIEW_CELL_PADDING_Y_PX;
    const cardH = import_bookingCalendarConstants.RESOURCE_VIEW_BOOKING_CARD_EST_PX;
    const gap = WEEK_VIEW_OVERLAY_LANE_GAP;
    const moreH = import_bookingCalendarConstants.RESOURCE_VIEW_MORE_TILE_MIN_PX;
    const m = /* @__PURE__ */ new Map();
    courtRowMetrics.forEach((metric, cid) => {
      const visibleLanes = Math.min(metric.laneCount, import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE);
      const hasOverflow = metric.laneCount > import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE;
      if (visibleLanes === 0) {
        m.set(cid, import_bookingCalendarConstants.dayRowHeight);
        return;
      }
      let content = visibleLanes * cardH + (visibleLanes - 1) * gap;
      if (hasOverflow) content += gap + moreH;
      m.set(cid, Math.max(import_bookingCalendarConstants.dayRowHeight, padY + content));
    });
    return m;
  }, [courtRowMetrics]);
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      key: `week-${(0, import_bookingCalendarDateUtils.fmtDate)(weekDays[0])}`,
      className: "flex min-h-0 flex-1 flex-col"
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "relative flex min-h-0 min-w-0 flex-1 flex-col" }, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "theme-panel pisell-scroll-hidden min-h-0 min-w-0 max-h-none flex-1 overflow-auto touch-pan-x touch-pan-y select-none",
        style: { overscrollBehavior: "none" }
      },
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: "grid",
          style: {
            minWidth: weekGridMinWidthPx,
            gridTemplateColumns: `${import_bookingCalendarConstants.frozenColWidth}px repeat(${weekDays.length}, minmax(${weekDayColMinPx}px, 1fr))`
          }
        },
        /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            className: "grid sticky top-0 z-50",
            style: {
              gridColumn: "1 / -1",
              gridTemplateColumns: `${import_bookingCalendarConstants.frozenColWidth}px repeat(${weekDays.length}, minmax(${weekDayColMinPx}px, 1fr))`,
              isolation: "isolate"
            }
          },
          /* @__PURE__ */ import_react.default.createElement(
            "div",
            {
              className: `sticky left-0 z-30 flex w-[132px] min-w-[132px] max-w-[132px] items-center px-2.5 py-3 font-semibold border-b shadow-[8px_0_16px_rgba(0,0,0,0.08)] ${isLight ? "theme-sticky theme-border theme-text" : "bg-[#241d40] border-zinc-800"}`
            },
            (0, import_calendarI18n.tCal)("pisell2.recordBoard.calendar.week.headerCourtDate")
          ),
          weekDays.map((day, i) => {
            const key = (0, import_bookingCalendarDateUtils.fmtDate)(day);
            const isToday = key === todayKey;
            const dayItems = bookings.filter(
              (b) => (0, import_bookingCalendarDateUtils.getBookingSegmentForDate)(b, key) != null
            );
            const fullyBooked = courts.every(
              (court) => hourSlots.filter(isBusinessHour).every(
                (h) => (0, import_bookingCalendarDateUtils.dayOccupancy)(
                  court.id,
                  key,
                  bookings,
                  hourSlots,
                  slotStepHours
                )[h]
              )
            );
            return /* @__PURE__ */ import_react.default.createElement(
              "div",
              {
                key,
                className: `relative z-20 border-b border-l px-1.5 py-2 text-center shadow-[0_8px_16px_rgba(0,0,0,0.06)] ${isLight ? "theme-border theme-text" : "border-zinc-800"} ${isToday ? isLight ? "bg-gradient-to-b from-violet-50 to-white" : "bg-gradient-to-b from-violet-950 to-[#1a1a22]" : isLight ? "theme-panel-soft" : "bg-[#1a1a22]"}`
              },
              /* @__PURE__ */ import_react.default.createElement(
                "div",
                {
                  className: `text-sm leading-tight ${isLight ? "theme-text-faint" : "text-zinc-400"}`
                },
                (0, import_calendarI18n.tCal)(import_calendarI18n.CALENDAR_WEEKDAY_IDS[i])
              ),
              /* @__PURE__ */ import_react.default.createElement("div", { className: "mt-0.5 flex justify-center" }, /* @__PURE__ */ import_react.default.createElement(
                "span",
                {
                  className: "grid h-10 w-10 place-items-center text-3xl font-semibold leading-none",
                  "aria-label": isToday ? "Today" : void 0
                },
                day.getDate()
              ))
            );
          })
        ),
        visibleCourtRows.map((row) => {
          if (row.kind === "group") {
            return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: row.id }, /* @__PURE__ */ import_react.default.createElement(
              import_BookingCalendarGroupRowHeader.BookingCalendarGroupRowHeader,
              {
                isLight,
                view: "week",
                row: {
                  id: row.id,
                  label: row.label,
                  count: row.count,
                  collapsed: row.collapsed
                },
                renderResourceCell: props.renderResourceCell,
                setCollapsedGroups
              }
            ), weekDays.map((day) => {
              const key = (0, import_bookingCalendarDateUtils.fmtDate)(day);
              const groupCourts = visibleCourts.filter(
                (court) => court.type === row.label
              );
              const noRatioCell = groupCourts.length === 0;
              const total = groupCourts.length;
              let remaining = 0;
              let ratio = 0;
              if (!noRatioCell) {
                const busyCount = groupCourts.filter((court) => {
                  const summary = (0, import_bookingCalendarDateUtils.courtDaySummary)(
                    court.id,
                    key,
                    bookings,
                    hourSlots,
                    slotStepHours
                  );
                  return summary.items.length > 0;
                }).length;
                remaining = total - busyCount;
                ratio = total > 0 ? remaining / total : 0;
              }
              return /* @__PURE__ */ import_react.default.createElement(
                "div",
                {
                  key: `${row.id}-${key}`,
                  style: { minHeight: import_bookingCalendarConstants.dayRowHeight },
                  className: `flex h-full items-center justify-center border-b border-l px-1.5 py-1 text-center text-sm font-medium ${isLight ? "theme-border" : "border-zinc-800"} ${noRatioCell ? isLight ? "bg-slate-100 theme-text-faint" : "bg-zinc-800/80 text-zinc-500" : isLight ? "theme-panel-soft" : "bg-[#151a2f] text-zinc-300"}`
                },
                noRatioCell ? /* @__PURE__ */ import_react.default.createElement("div", { className: "text-xs opacity-60" }, "—") : /* @__PURE__ */ import_react.default.createElement(
                  "div",
                  {
                    className: `text-xs font-semibold leading-none ${(0, import_bookingCalendarViewShared.getRemainingToneClass)(
                      ratio,
                      isLight
                    )}`
                  },
                  (0, import_calendarI18n.tCal)(
                    "pisell2.recordBoard.calendar.day.freeRatio",
                    {
                      remaining,
                      total
                    }
                  )
                )
              );
            }));
          }
          return /* @__PURE__ */ import_react.default.createElement(
            CourtWeekRow,
            {
              key: row.id,
              row,
              isLight,
              weekDays,
              weekDayColMinPx,
              bookings,
              hourSlots,
              slotStepHours,
              metric: courtRowMetrics.get(String(row.id)),
              rowHeight: courtRowHeightPx.get(String(row.id)) ?? import_bookingCalendarConstants.dayRowHeight,
              dateKeyToCol,
              renderResourceCell: props.renderResourceCell,
              renderMonthWeekBooking: props.renderMonthWeekBooking,
              goToDayFromCell,
              handleGridDropMove,
              openBookingDetail,
              setDraggingItem,
              setOverflowListModal,
              tickFillMode
            }
          );
        })
      )
    ))
  );
}
function CourtWeekRow({
  row,
  isLight,
  weekDays,
  weekDayColMinPx,
  bookings,
  hourSlots,
  slotStepHours,
  metric,
  rowHeight,
  dateKeyToCol,
  renderResourceCell,
  renderMonthWeekBooking,
  goToDayFromCell,
  handleGridDropMove,
  openBookingDetail,
  setDraggingItem,
  setOverflowListModal,
  tickFillMode
}) {
  const lastColIdx = weekDays.length - 1;
  const firstKey = lastColIdx >= 0 ? (0, import_bookingCalendarDateUtils.fmtDate)(weekDays[0]) : "";
  const lastKey = lastColIdx >= 0 ? (0, import_bookingCalendarDateUtils.fmtDate)(weekDays[lastColIdx]) : "";
  const pills = (0, import_react.useMemo)(() => {
    if (!metric) return [];
    const out = [];
    for (const entry of metric.entries) {
      const it = entry.item;
      if (entry.lane >= import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE) continue;
      const startStr = String(it.date);
      const endStr = String(it.endDate ?? it.date);
      const rawStartCol = dateKeyToCol.get(startStr);
      const rawEndCol = dateKeyToCol.get(endStr);
      let startCol = rawStartCol ?? -1;
      let endCol = rawEndCol ?? -1;
      const clippedLeft = rawStartCol === void 0 && firstKey !== "" && startStr < firstKey;
      const clippedRight = rawEndCol === void 0 && lastKey !== "" && endStr > lastKey;
      if (rawStartCol === void 0) startCol = clippedLeft ? 0 : -1;
      if (rawEndCol === void 0) endCol = clippedRight ? lastColIdx : -1;
      if (startCol < 0 || endCol < 0 || endCol < startCol) continue;
      out.push({
        key: `${row.id}	${it.id}`,
        item: it,
        lane: entry.lane,
        startCol,
        endCol,
        clippedLeft,
        clippedRight,
        crossDay: (0, import_bookingCalendarDateUtils.isCrossDayBooking)(it)
      });
    }
    return out;
  }, [metric, dateKeyToCol, firstKey, lastKey, lastColIdx, row.id]);
  const moreTiles = (0, import_react.useMemo)(() => {
    if (!metric || metric.laneCount <= import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE) return [];
    const out = [];
    weekDays.forEach((day, ci) => {
      const dk = (0, import_bookingCalendarDateUtils.fmtDate)(day);
      const overflowItems = metric.overflowByDate.get(dk);
      if (!overflowItems || overflowItems.length === 0) return;
      const allHits = bookings.filter(
        (b) => String(b.courtId) === String(row.id) && (0, import_bookingCalendarDateUtils.getBookingSegmentForDate)(b, dk) != null
      );
      out.push({
        key: `${row.id}	${dk}	more`,
        colIdx: ci,
        dateKey: dk,
        moreItems: overflowItems,
        moreCount: overflowItems.length,
        allItems: allHits
      });
    });
    return out;
  }, [metric, weekDays, bookings, row.id]);
  const padY = WEEK_VIEW_OVERLAY_CELL_PAD;
  const cardH = import_bookingCalendarConstants.RESOURCE_VIEW_BOOKING_CARD_EST_PX;
  const gap = WEEK_VIEW_OVERLAY_LANE_GAP;
  const visibleLanes = Math.min((metric == null ? void 0 : metric.laneCount) ?? 0, import_bookingCalendarConstants.WEEK_VIEW_MAX_LANE);
  const dayGridMin = (hourSlots == null ? void 0 : hourSlots[0]) ?? 0;
  const dayGridSpan = ((hourSlots == null ? void 0 : hourSlots.length) ?? 24) * (slotStepHours || 1);
  const pctAxis = {
    originUnit: 0,
    scalePerUnit: 100 / weekDays.length,
    // 每列百分比
    tickUnit: 1,
    minSize: 0
  };
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      style: {
        gridColumn: "1 / -1",
        position: "relative",
        minHeight: rowHeight
      }
    },
    /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        style: {
          display: "grid",
          gridTemplateColumns: `${import_bookingCalendarConstants.frozenColWidth}px repeat(${weekDays.length}, minmax(${weekDayColMinPx}px, 1fr))`,
          minHeight: rowHeight
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: `sticky left-0 z-30 flex h-full min-h-0 w-[132px] min-w-[132px] max-w-[132px] items-center border-b px-2.5 py-1.5 shadow-[8px_0_16px_rgba(0,0,0,0.06)] ${isLight ? "theme-sticky theme-border" : "border-zinc-800 bg-[#1a1a22]"}`,
          style: { minHeight: rowHeight }
        },
        renderResourceCell ? renderResourceCell({
          view: "week",
          row: { kind: "court", id: row.id, name: row.name, type: row.type },
          isLight
        }) : /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-rb-cal-week-resource-name min-w-0 w-full font-semibold text-[16px] leading-tight" }, row.name)
      ),
      weekDays.map((day) => {
        const key = (0, import_bookingCalendarDateUtils.fmtDate)(day);
        const summary = (0, import_bookingCalendarDateUtils.courtDaySummary)(
          row.id,
          key,
          bookings,
          hourSlots,
          slotStepHours
        );
        const isEmpty = summary.items.length === 0;
        return /* @__PURE__ */ import_react.default.createElement(
          "button",
          {
            key: `${row.id}-${key}`,
            onClick: () => goToDayFromCell(day, row.id, `week-${row.id}-${key}`),
            onDragOver: (e) => e.preventDefault(),
            onDrop: (e) => {
              e.preventDefault();
              handleGridDropMove(key, row.id);
            },
            style: { minHeight: rowHeight },
            className: `relative flex h-full flex-col justify-start border-b border-l p-1 text-left align-top transition outline-none ${isLight ? "theme-border" : "border-zinc-700"} ${summary.fullyBooked ? isLight ? "bg-slate-100 theme-text-faint" : "bg-zinc-800 text-zinc-500" : summary.hasBlock ? isLight ? "bg-red-50 border-red-200" : "bg-red-950/30 border-red-800/40" : summary.occupiedHours.length > 0 ? isLight ? "bg-violet-50" : "bg-[#1c1630]" : isLight ? "theme-grid-cell" : "bg-zinc-900"}`
          },
          summary.fullyBooked ? /* @__PURE__ */ import_react.default.createElement(
            "div",
            {
              className: "min-h-[28px] w-full rounded-lg bg-zinc-700/70",
              "aria-hidden": true
            }
          ) : isEmpty ? /* @__PURE__ */ import_react.default.createElement(
            "div",
            {
              className: `${import_bookingCalendarConstants.CALENDAR_EMPTY_DASHED_SLOT_CLASSNAME} text-center ${isLight ? "border-[#d8d0eb] text-[#8f86a9]" : "border-zinc-700 text-zinc-500"}`,
              "aria-hidden": true
            }
          ) : null
        );
      })
    ),
    /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        "aria-hidden": true,
        style: {
          position: "absolute",
          top: 0,
          bottom: 0,
          left: import_bookingCalendarConstants.frozenColWidth,
          right: 0,
          pointerEvents: "none"
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          style: {
            position: "relative",
            width: "100%",
            height: "100%"
          }
        },
        pills.map((p) => {
          const startHourVal = Number.isFinite(Number(p.item.startHour)) ? Number(p.item.startHour) : dayGridMin;
          const endHourVal = Number.isFinite(Number(p.item.endHour)) ? Number(p.item.endHour) : dayGridMin;
          const startUnit = tickFillMode === "snap" ? p.startCol : (0, import_bookingCalendarAxis.dayGridUnit)(p.startCol, startHourVal, dayGridMin, dayGridSpan);
          const endUnit = tickFillMode === "snap" ? p.endCol + 1 : (0, import_bookingCalendarAxis.dayGridUnit)(p.endCol, endHourVal, dayGridMin, dayGridSpan);
          const sp = (0, import_bookingCalendarAxis.mapAxisSpan)(pctAxis, startUnit, endUnit, tickFillMode);
          const radiusClass = p.crossDay ? `${p.clippedLeft ? "rounded-l-none" : "rounded-l-lg"} ${p.clippedRight ? "rounded-r-none" : "rounded-r-lg"}` : "rounded-lg";
          const layoutClassName = `flex flex-col justify-center px-2.5 py-1.5 text-xs text-left w-full h-full ${radiusClass} ${(0, import_BookingCalendarStyle.getGridBookingRowStateClasses)(p.item)}`;
          return /* @__PURE__ */ import_react.default.createElement(
            "div",
            {
              key: p.key,
              style: {
                position: "absolute",
                left: `calc(${sp.offset}% + ${padY}px)`,
                width: `calc(${sp.size}% - ${padY * 2}px)`,
                top: padY + p.lane * (cardH + gap),
                height: cardH,
                pointerEvents: "auto"
              },
              onDragOver: (e) => e.preventDefault(),
              onDrop: (e) => {
                e.preventDefault();
                handleGridDropMove(p.item.date, String(row.id));
              }
            },
            renderMonthWeekBooking ? /* @__PURE__ */ import_react.default.createElement("div", { className: "relative h-full w-full min-h-0" }, renderMonthWeekBooking({
              item: p.item,
              dateKey: p.item.date,
              view: "week",
              isLight,
              layoutClassName,
              onOpenDetail: openBookingDetail,
              onDragStart: (it) => setDraggingItem(it),
              // 跨日 booking 暂不支持拖拽改约
              draggable: !p.crossDay
            }), /* @__PURE__ */ import_react.default.createElement(
              import_bookingCalendarViewShared.CalendarGridBookingClipMarkers,
              {
                clippedLeft: p.clippedLeft,
                clippedRight: p.clippedRight
              }
            )) : /* @__PURE__ */ import_react.default.createElement(
              "button",
              {
                type: "button",
                onClick: (e) => {
                  e.stopPropagation();
                  openBookingDetail(p.item);
                },
                className: `relative ${layoutClassName}`
              },
              p.clippedLeft && /* @__PURE__ */ import_react.default.createElement(
                "span",
                {
                  "aria-hidden": true,
                  className: "absolute left-0.5 top-1/2 -translate-y-1/2 text-[10px] leading-none opacity-80"
                },
                "◀"
              ),
              p.clippedRight && /* @__PURE__ */ import_react.default.createElement(
                "span",
                {
                  "aria-hidden": true,
                  className: "absolute right-0.5 top-1/2 -translate-y-1/2 text-[10px] leading-none opacity-80"
                },
                "▶"
              ),
              /* @__PURE__ */ import_react.default.createElement("div", { className: "truncate" }, p.item.name),
              /* @__PURE__ */ import_react.default.createElement("div", { className: "mt-1 opacity-80 truncate" }, p.crossDay ? `${(0, import_bookingCalendarDateUtils.formatShortMonthDay)(p.item.date)} ${(0, import_bookingCalendarDateUtils.formatHourLabel)(
                p.item.startHour
              )} - ${(0, import_bookingCalendarDateUtils.formatShortMonthDay)(
                p.item.endDate ?? p.item.date
              )} ${(0, import_bookingCalendarDateUtils.formatHourLabel)(p.item.endHour)}` : `${(0, import_bookingCalendarDateUtils.formatHourLabel)(p.item.startHour)} - ${(0, import_bookingCalendarDateUtils.formatHourLabel)(
                p.item.endHour
              )}`)
            )
          );
        }),
        moreTiles.map((t) => /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            key: t.key,
            style: {
              position: "absolute",
              left: `calc(${t.colIdx * (100 / weekDays.length)}% + ${padY}px)`,
              width: `calc(${100 / weekDays.length}% - ${padY * 2}px)`,
              top: padY + visibleLanes * (cardH + gap),
              pointerEvents: "auto"
            }
          },
          /* @__PURE__ */ import_react.default.createElement(
            "button",
            {
              type: "button",
              onClick: (e) => {
                e.stopPropagation();
                setOverflowListModal(
                  (prev) => prev && prev.scope === row.id && prev.date === t.dateKey ? null : {
                    scope: row.id,
                    date: t.dateKey,
                    title: (0, import_calendarI18n.tCal)(
                      "pisell2.recordBoard.calendar.overflow.listTitleAllBookings",
                      { date: t.dateKey }
                    ),
                    items: t.allItems
                  }
                );
              },
              style: { minHeight: import_bookingCalendarConstants.RESOURCE_VIEW_MORE_TILE_MIN_PX },
              className: "flex w-full items-center justify-center rounded-xl bg-violet-700/90 px-2.5 py-1 text-xs font-semibold text-white"
            },
            "+",
            t.moreCount
          )
        ))
      )
    )
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BookingCalendarWeekView
});
