"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getHotels = void 0;
const getHotels = function () {
  let dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  let id = arguments.length > 1 ? arguments[1] : undefined;
  if (!id) return;
  let hotels;
  for (const _ref of dataSource) {
    var _ref$ids = _ref.ids;
    const ids = _ref$ids === void 0 ? [] : _ref$ids;
    const tagId = _ref.tagId;
    var _ref$tags = _ref.tags;
    const tags = _ref$tags === void 0 ? [] : _ref$tags;
    if ((!tagId || tagId !== id) && tags.length > 0) {
      var _hotels;
      hotels = getHotels(tags, id);
      if (((_hotels = hotels) === null || _hotels === void 0 ? void 0 : _hotels.length) > 0) break;
    } else if (tagId === id) {
      hotels = ids;
      break;
    }
  }
  return hotels;
};
exports.getHotels = getHotels;
//# sourceMappingURL=getHotels.js.map