"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createCountryIconComponent = createCountryIconComponent;
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _InternationalIcon = _interopRequireDefault(require("./InternationalIcon"));

var _Flag = _interopRequireDefault(require("./Flag"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function createCountryIconComponent(_ref) {
  var flags = _ref.flags,
      flagUrl = _ref.flagUrl,
      FlagComponent = _ref.flagComponent,
      InternationalIcon = _ref.internationalIcon;
  return function CountryIcon(_ref2) {
    var country = _ref2.country,
        label = _ref2.label;
    return _react["default"].createElement("div", {
      className: (0, _classnames["default"])('PhoneInputCountryIcon', {
        'PhoneInputCountryIcon--border': country
      })
    }, country ? _react["default"].createElement(FlagComponent, {
      country: country,
      countryName: label,
      flags: flags,
      flagUrl: flagUrl
    }) : _react["default"].createElement(InternationalIcon, {
      title: label
    }));
  };
}

var _default = createCountryIconComponent({
  // Must be equal to `defaultProps.flagUrl` in `./PhoneInputWithCountry.js`.
  flagUrl: 'https://catamphetamine.github.io/react-phone-number-input/flags/3x2/{0}.svg',
  flagComponent: _Flag["default"],
  internationalIcon: _InternationalIcon["default"]
});

exports["default"] = _default;
//# sourceMappingURL=CountryIcon.js.map