"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getSuperProps = void 0;
var _Core = require("../Core.constants");
const _excluded = ["features"];
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
const getSuperProps = function () {
  var _tracking$compareTrac;
  let {
    store = {},
    engineVersion
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  const {
      config = {},
      components = {},
      club = {},
      finder: {
        place: {
          id: [placeHotelId] = [],
          isHotel
        } = {}
      } = {},
      hotel: {
        features = {}
      } = {},
      id,
      type,
      urlParams = {},
      variant
    } = store,
    hotel = _objectWithoutProperties(store.hotel, _excluded);
  const {
    tracking = {}
  } = config;
  const hotelId = isHotel ? placeHotelId : hotel.id;
  const {
    country = {},
    name,
    showMiraiTwin
  } = features[hotel.id] || {};
  const {
    name: chainName
  } = features[id] || {};
  const props = {
    active_experiments: {
      '002_checkout_cart_transparency': variant
    },
    chain_id: type === _Core.TYPE.CHAIN ? "".concat(id) : 'independent',
    chain_name: type === _Core.TYPE.CHAIN ? chainName : undefined,
    engine_version: engineVersion,
    feature_3d: showMiraiTwin,
    feature_loyalty: !!(club !== null && club !== void 0 && club.active),
    feature_price_comp: !!(tracking !== null && tracking !== void 0 && (_tracking$compareTrac = tracking.compareTracking) !== null && _tracking$compareTrac !== void 0 && _tracking$compareTrac.length),
    feature_sarai: !!components.chat,
    hotel_country: country.en,
    hotel_id: hotelId,
    hotel_name: name,
    is_internal_user: urlParams.internalUser === 'true'
  };
  return Object.fromEntries(Object.entries(props).filter(_ref => {
    let [, value] = _ref;
    return value !== undefined && value !== '';
  }));
};
exports.getSuperProps = getSuperProps;
//# sourceMappingURL=getSuperProps.js.map