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/pisellReservation/floorMap/floorMapHostCheckout.ts
var floorMapHostCheckout_exports = {};
__export(floorMapHostCheckout_exports, {
  resolveFloorMapHostCheckoutRecord: () => resolveFloorMapHostCheckoutRecord
});
module.exports = __toCommonJS(floorMapHostCheckout_exports);
var import_reservationConstants = require("../reservationConstants");
function resolveFloorMapHostCheckoutRecord(event, sourceBookings) {
  var _a;
  if (!(sourceBookings == null ? void 0 : sourceBookings.length)) return void 0;
  const root = event.target;
  if (!root) return sourceBookings[0];
  const el = root.closest(import_reservationConstants.PISELL_FLOOR_CHECKOUT_BOOKING_SELECTOR);
  const key = (_a = el == null ? void 0 : el.getAttribute("data-pisell-floor-checkout-booking")) == null ? void 0 : _a.trim();
  if (key) {
    const hit = sourceBookings.find((r) => {
      const rid = r.id;
      const bid = r.booking_id;
      return String(rid ?? "") === key || String(bid ?? "") === key;
    });
    if (hit && typeof hit === "object") return hit;
  }
  const first = sourceBookings[0];
  return first && typeof first === "object" ? first : void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  resolveFloorMapHostCheckoutRecord
});
