import c from "./index-parsePhoneNumberWithError_.js";
import i from "./index-ParseError.js";
import { isSupportedCountry as p } from "./index-metadata.js";
function u(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var n = Object.getOwnPropertySymbols(e);
    r && (n = n.filter(function(o) {
      return Object.getOwnPropertyDescriptor(e, o).enumerable;
    })), t.push.apply(t, n);
  }
  return t;
}
function f(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = arguments[r] != null ? arguments[r] : {};
    r % 2 ? u(Object(t), !0).forEach(function(n) {
      a(e, n, t[n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : u(Object(t)).forEach(function(n) {
      Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
    });
  }
  return e;
}
function a(e, r, t) {
  return r in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;
}
function y(e, r, t) {
  r && r.defaultCountry && !p(r.defaultCountry, t) && (r = f(f({}, r), {}, {
    defaultCountry: void 0
  }));
  try {
    return c(e, r, t);
  } catch (n) {
    if (!(n instanceof i)) throw n;
  }
}
export {
  y as default
};
