function c(t) {
  "@babel/helpers - typeof";
  return c = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
    return typeof r;
  } : function(r) {
    return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
  }, c(t);
}
function y(t, r) {
  var e = Object.keys(t);
  if (Object.getOwnPropertySymbols) {
    var n = Object.getOwnPropertySymbols(t);
    r && (n = n.filter(function(o) {
      return Object.getOwnPropertyDescriptor(t, o).enumerable;
    })), e.push.apply(e, n);
  }
  return e;
}
function s(t) {
  for (var r = 1; r < arguments.length; r++) {
    var e = arguments[r] != null ? arguments[r] : {};
    r % 2 ? y(Object(e), !0).forEach(function(n) {
      b(t, n, e[n]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : y(Object(e)).forEach(function(n) {
      Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
    });
  }
  return t;
}
function b(t, r, e) {
  return r in t ? Object.defineProperty(t, r, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = e, t;
}
function m(t, r) {
  return _(t) || O(t, r) || g(t, r) || d();
}
function d() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function g(t, r) {
  if (t) {
    if (typeof t == "string") return p(t, r);
    var e = Object.prototype.toString.call(t).slice(8, -1);
    if (e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set") return Array.from(t);
    if (e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)) return p(t, r);
  }
}
function p(t, r) {
  (r == null || r > t.length) && (r = t.length);
  for (var e = 0, n = new Array(r); e < r; e++)
    n[e] = t[e];
  return n;
}
function O(t, r) {
  var e = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
  if (e != null) {
    var n = [], o = !0, i = !1, u, f;
    try {
      for (e = e.call(t); !(o = (u = e.next()).done) && (n.push(u.value), !(r && n.length === r)); o = !0)
        ;
    } catch (a) {
      i = !0, f = a;
    } finally {
      try {
        !o && e.return != null && e.return();
      } finally {
        if (i) throw f;
      }
    }
    return n;
  }
}
function _(t) {
  if (Array.isArray(t)) return t;
}
function h(t) {
  var r = Array.prototype.slice.call(t), e = m(r, 4), n = e[0], o = e[1], i = e[2], u = e[3], f, a, l;
  if (typeof n == "string")
    f = n;
  else throw new TypeError("A text for parsing must be a string.");
  if (!o || typeof o == "string")
    u ? (a = i, l = u) : (a = void 0, l = i), o && (a = s({
      defaultCountry: o
    }, a));
  else if (v(o))
    i ? (a = o, l = i) : l = o;
  else throw new Error("Invalid second argument: ".concat(o));
  return {
    text: f,
    options: a,
    metadata: l
  };
}
var v = function(r) {
  return c(r) === "object";
};
export {
  h as default
};
