import { g as Le } from "./_commonjsHelpers-2ufMB8rV.js";
function S(n) {
  this._maxSize = n, this.clear();
}
S.prototype.clear = function() {
  this._size = 0, this._values = /* @__PURE__ */ Object.create(null);
};
S.prototype.get = function(n) {
  return this._values[n];
};
S.prototype.set = function(n, e) {
  return this._size >= this._maxSize && this.clear(), n in this._values || this._size++, this._values[n] = e;
};
var qe = /[^.^\]^[]+|(?=\[\]|\.\.)/g, $e = /^\d+$/, Ze = /^\d/, Ye = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, Ge = /^\s*(['"]?)(.*?)(\1)\s*$/, ee = 512, ve = new S(ee), we = new S(ee), _e = new S(ee), k = {
  Cache: S,
  split: K,
  normalizePath: X,
  setter: function(n) {
    var e = X(n);
    return we.get(n) || we.set(n, function(r, s) {
      for (var i = 0, u = e.length, a = r; i < u - 1; ) {
        var l = e[i];
        if (l === "__proto__" || l === "constructor" || l === "prototype")
          return r;
        a = a[e[i++]];
      }
      a[e[i]] = s;
    });
  },
  getter: function(n, e) {
    var t = X(n);
    return _e.get(n) || _e.set(n, function(s) {
      for (var i = 0, u = t.length; i < u; )
        if (s != null || !e)
          s = s[t[i++]];
        else
          return;
      return s;
    });
  },
  join: function(n) {
    return n.reduce(function(e, t) {
      return e + (te(t) || $e.test(t) ? "[" + t + "]" : (e ? "." : "") + t);
    }, "");
  },
  forEach: function(n, e, t) {
    Xe(Array.isArray(n) ? n : K(n), e, t);
  }
};
function X(n) {
  return ve.get(n) || ve.set(
    n,
    K(n).map(function(e) {
      return e.replace(Ge, "$2");
    })
  );
}
function K(n) {
  return n.match(qe) || [""];
}
function Xe(n, e, t) {
  var r = n.length, s, i, u, a;
  for (i = 0; i < r; i++)
    s = n[i], s && (Be(s) && (s = '"' + s + '"'), a = te(s), u = !a && /^\d+$/.test(s), e.call(t, s, a, u, i, n));
}
function te(n) {
  return typeof n == "string" && n && ["'", '"'].indexOf(n.charAt(0)) !== -1;
}
function He(n) {
  return n.match(Ze) && !n.match($e);
}
function Ke(n) {
  return Ye.test(n);
}
function Be(n) {
  return !te(n) && (He(n) || Ke(n));
}
const Je = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g, L = (n) => n.match(Je) || [], q = (n) => n[0].toUpperCase() + n.slice(1), re = (n, e) => L(n).join(e).toLowerCase(), Oe = (n) => L(n).reduce(
  (e, t) => `${e}${e ? t[0].toUpperCase() + t.slice(1).toLowerCase() : t.toLowerCase()}`,
  ""
), Qe = (n) => q(Oe(n)), We = (n) => re(n, "_"), et = (n) => re(n, "-"), tt = (n) => q(re(n, " ")), rt = (n) => L(n).map(q).join(" ");
var H = {
  words: L,
  upperFirst: q,
  camelCase: Oe,
  pascalCase: Qe,
  snakeCase: We,
  kebabCase: et,
  sentenceCase: tt,
  titleCase: rt
}, ne = { exports: {} };
ne.exports = function(n) {
  return ke(nt(n), n);
};
ne.exports.array = ke;
function ke(n, e) {
  var t = n.length, r = new Array(t), s = {}, i = t, u = st(e), a = it(n);
  for (e.forEach(function(o) {
    if (!a.has(o[0]) || !a.has(o[1]))
      throw new Error("Unknown node. There is an unknown node in the supplied edges.");
  }); i--; )
    s[i] || l(n[i], i, /* @__PURE__ */ new Set());
  return r;
  function l(o, f, c) {
    if (c.has(o)) {
      var h;
      try {
        h = ", node was:" + JSON.stringify(o);
      } catch {
        h = "";
      }
      throw new Error("Cyclic dependency" + h);
    }
    if (!a.has(o))
      throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(o));
    if (!s[f]) {
      s[f] = !0;
      var d = u.get(o) || /* @__PURE__ */ new Set();
      if (d = Array.from(d), f = d.length) {
        c.add(o);
        do {
          var x = d[--f];
          l(x, a.get(x), c);
        } while (f);
        c.delete(o);
      }
      r[--t] = o;
    }
  }
}
function nt(n) {
  for (var e = /* @__PURE__ */ new Set(), t = 0, r = n.length; t < r; t++) {
    var s = n[t];
    e.add(s[0]), e.add(s[1]);
  }
  return Array.from(e);
}
function st(n) {
  for (var e = /* @__PURE__ */ new Map(), t = 0, r = n.length; t < r; t++) {
    var s = n[t];
    e.has(s[0]) || e.set(s[0], /* @__PURE__ */ new Set()), e.has(s[1]) || e.set(s[1], /* @__PURE__ */ new Set()), e.get(s[0]).add(s[1]);
  }
  return e;
}
function it(n) {
  for (var e = /* @__PURE__ */ new Map(), t = 0, r = n.length; t < r; t++)
    e.set(n[t], t);
  return e;
}
var ut = ne.exports;
const at = /* @__PURE__ */ Le(ut), lt = Object.prototype.toString, ot = Error.prototype.toString, ct = RegExp.prototype.toString, ft = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", ht = /^Symbol\((.*)\)(.*)$/;
function dt(n) {
  return n != +n ? "NaN" : n === 0 && 1 / n < 0 ? "-0" : "" + n;
}
function Te(n, e = !1) {
  if (n == null || n === !0 || n === !1)
    return "" + n;
  const t = typeof n;
  if (t === "number")
    return dt(n);
  if (t === "string")
    return e ? `"${n}"` : n;
  if (t === "function")
    return "[Function " + (n.name || "anonymous") + "]";
  if (t === "symbol")
    return ft.call(n).replace(ht, "Symbol($1)");
  const r = lt.call(n).slice(8, -1);
  return r === "Date" ? isNaN(n.getTime()) ? "" + n : n.toISOString(n) : r === "Error" || n instanceof Error ? "[" + ot.call(n) + "]" : r === "RegExp" ? ct.call(n) : null;
}
function _(n, e) {
  let t = Te(n, e);
  return t !== null ? t : JSON.stringify(n, function(r, s) {
    let i = Te(this[r], e);
    return i !== null ? i : s;
  }, 2);
}
function Se(n) {
  return n == null ? [] : [].concat(n);
}
let Ae, pt = /\$\{\s*(\w+)\s*\}/g;
Ae = Symbol.toStringTag;
class y extends Error {
  static formatError(e, t) {
    const r = t.label || t.path || "this";
    return r !== t.path && (t = Object.assign({}, t, {
      path: r
    })), typeof e == "string" ? e.replace(pt, (s, i) => _(t[i])) : typeof e == "function" ? e(t) : e;
  }
  static isError(e) {
    return e && e.name === "ValidationError";
  }
  constructor(e, t, r, s, i) {
    super(), this.value = void 0, this.path = void 0, this.type = void 0, this.errors = void 0, this.params = void 0, this.inner = void 0, this[Ae] = "Error", this.name = "ValidationError", this.value = t, this.path = r, this.type = s, this.errors = [], this.inner = [], Se(e).forEach((u) => {
      if (y.isError(u)) {
        this.errors.push(...u.errors);
        const a = u.inner.length ? u.inner : [u];
        this.inner.push(...a);
      } else
        this.errors.push(u);
    }), this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0], !i && Error.captureStackTrace && Error.captureStackTrace(this, y);
  }
}
let w = {
  default: "${path} is invalid",
  required: "${path} is a required field",
  defined: "${path} must be defined",
  notNull: "${path} cannot be null",
  oneOf: "${path} must be one of the following values: ${values}",
  notOneOf: "${path} must not be one of the following values: ${values}",
  notType: ({
    path: n,
    type: e,
    value: t,
    originalValue: r
  }) => {
    const s = r != null && r !== t ? ` (cast from the value \`${_(r, !0)}\`).` : ".";
    return e !== "mixed" ? `${n} must be a \`${e}\` type, but the final value was: \`${_(t, !0)}\`` + s : `${n} must match the configured type. The validated value was: \`${_(t, !0)}\`` + s;
  }
}, g = {
  length: "${path} must be exactly ${length} characters",
  min: "${path} must be at least ${min} characters",
  max: "${path} must be at most ${max} characters",
  matches: '${path} must match the following: "${regex}"',
  email: "${path} must be a valid email",
  url: "${path} must be a valid URL",
  uuid: "${path} must be a valid UUID",
  trim: "${path} must be a trimmed string",
  lowercase: "${path} must be a lowercase string",
  uppercase: "${path} must be a upper case string"
}, E = {
  min: "${path} must be greater than or equal to ${min}",
  max: "${path} must be less than or equal to ${max}",
  lessThan: "${path} must be less than ${less}",
  moreThan: "${path} must be greater than ${more}",
  positive: "${path} must be a positive number",
  negative: "${path} must be a negative number",
  integer: "${path} must be an integer"
}, B = {
  min: "${path} field must be later than ${min}",
  max: "${path} field must be at earlier than ${max}"
}, J = {
  isValue: "${path} field must be ${value}"
}, Q = {
  noUnknown: "${path} field has unspecified keys: ${unknown}"
}, R = {
  min: "${path} field must have at least ${min} items",
  max: "${path} field must have less than or equal to ${max} items",
  length: "${path} must have ${length} items"
}, De = {
  notType: (n) => {
    const {
      path: e,
      value: t,
      spec: r
    } = n, s = r.types.length;
    if (Array.isArray(t)) {
      if (t.length < s)
        return `${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${_(t, !0)}\``;
      if (t.length > s)
        return `${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${_(t, !0)}\``;
    }
    return y.formatError(w.notType, n);
  }
};
var je = Object.assign(/* @__PURE__ */ Object.create(null), {
  mixed: w,
  string: g,
  number: E,
  date: B,
  object: Q,
  array: R,
  boolean: J,
  tuple: De
});
const A = (n) => n && n.__isYupSchema__;
class I {
  static fromOptions(e, t) {
    if (!t.then && !t.otherwise)
      throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
    let {
      is: r,
      then: s,
      otherwise: i
    } = t, u = typeof r == "function" ? r : (...a) => a.every((l) => l === r);
    return new I(e, (a, l) => {
      var o;
      let f = u(...a) ? s : i;
      return (o = f == null ? void 0 : f(l)) != null ? o : l;
    });
  }
  constructor(e, t) {
    this.fn = void 0, this.refs = e, this.refs = e, this.fn = t;
  }
  resolve(e, t) {
    let r = this.refs.map((i) => (
      // TODO: ? operator here?
      i.getValue(t == null ? void 0 : t.value, t == null ? void 0 : t.parent, t == null ? void 0 : t.context)
    )), s = this.fn(r, e, t);
    if (s === void 0 || // @ts-ignore this can be base
    s === e)
      return e;
    if (!A(s))
      throw new TypeError("conditions must return a schema object");
    return s.resolve(t);
  }
}
const M = {
  context: "$",
  value: "."
};
function mt(n, e) {
  return new $(n, e);
}
class $ {
  constructor(e, t = {}) {
    if (this.key = void 0, this.isContext = void 0, this.isValue = void 0, this.isSibling = void 0, this.path = void 0, this.getter = void 0, this.map = void 0, typeof e != "string")
      throw new TypeError("ref must be a string, got: " + e);
    if (this.key = e.trim(), e === "")
      throw new TypeError("ref must be a non-empty string");
    this.isContext = this.key[0] === M.context, this.isValue = this.key[0] === M.value, this.isSibling = !this.isContext && !this.isValue;
    let r = this.isContext ? M.context : this.isValue ? M.value : "";
    this.path = this.key.slice(r.length), this.getter = this.path && k.getter(this.path, !0), this.map = t.map;
  }
  getValue(e, t, r) {
    let s = this.isContext ? r : this.isValue ? e : t;
    return this.getter && (s = this.getter(s || {})), this.map && (s = this.map(s)), s;
  }
  /**
   *
   * @param {*} value
   * @param {Object} options
   * @param {Object=} options.context
   * @param {Object=} options.parent
   */
  cast(e, t) {
    return this.getValue(e, t == null ? void 0 : t.parent, t == null ? void 0 : t.context);
  }
  resolve() {
    return this;
  }
  describe() {
    return {
      type: "ref",
      key: this.key
    };
  }
  toString() {
    return `Ref(${this.key})`;
  }
  static isRef(e) {
    return e && e.__isYupRef;
  }
}
$.prototype.__isYupRef = !0;
const v = (n) => n == null;
function j(n) {
  function e({
    value: t,
    path: r = "",
    options: s,
    originalValue: i,
    schema: u
  }, a, l) {
    const {
      name: o,
      test: f,
      params: c,
      message: h,
      skipAbsent: d
    } = n;
    let {
      parent: x,
      context: b,
      abortEarly: F = u.spec.abortEarly,
      disableStackTrace: z = u.spec.disableStackTrace
    } = s;
    function O(p) {
      return $.isRef(p) ? p.getValue(t, x, b) : p;
    }
    function pe(p = {}) {
      var be;
      const D = Object.assign({
        value: t,
        originalValue: i,
        label: u.spec.label,
        path: p.path || r,
        spec: u.spec
      }, c, p.params);
      for (const ge of Object.keys(D))
        D[ge] = O(D[ge]);
      const xe = new y(y.formatError(p.message || h, D), t, D.path, p.type || o, (be = p.disableStackTrace) != null ? be : z);
      return xe.params = D, xe;
    }
    const Z = F ? a : l;
    let Y = {
      path: r,
      parent: x,
      type: o,
      from: s.from,
      createError: pe,
      resolve: O,
      options: s,
      originalValue: i,
      schema: u
    };
    const G = (p) => {
      y.isError(p) ? Z(p) : p ? l(null) : Z(pe());
    }, me = (p) => {
      y.isError(p) ? Z(p) : a(p);
    };
    if (d && v(t))
      return G(!0);
    let V;
    try {
      var ye;
      if (V = f.call(Y, t, Y), typeof ((ye = V) == null ? void 0 : ye.then) == "function") {
        if (s.sync)
          throw new Error(`Validation test of type: "${Y.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
        return Promise.resolve(V).then(G, me);
      }
    } catch (p) {
      me(p);
      return;
    }
    G(V);
  }
  return e.OPTIONS = n, e;
}
function se(n, e, t, r = t) {
  let s, i, u;
  return e ? (k.forEach(e, (a, l, o) => {
    let f = l ? a.slice(1, a.length - 1) : a;
    n = n.resolve({
      context: r,
      parent: s,
      value: t
    });
    let c = n.type === "tuple", h = o ? parseInt(f, 10) : 0;
    if (n.innerType || c) {
      if (c && !o)
        throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${u}" must contain an index to the tuple element, e.g. "${u}[0]"`);
      if (t && h >= t.length)
        throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);
      s = t, t = t && t[h], n = c ? n.spec.types[h] : n.innerType;
    }
    if (!o) {
      if (!n.fields || !n.fields[f])
        throw new Error(`The schema does not contain the path: ${e}. (failed at: ${u} which is a type: "${n.type}")`);
      s = t, t = t && t[f], n = n.fields[f];
    }
    i = f, u = l ? "[" + a + "]" : "." + a;
  }), {
    schema: n,
    parent: s,
    parentPath: i
  }) : {
    parent: s,
    parentPath: e,
    schema: n
  };
}
function yt(n, e, t, r) {
  return se(n, e, t, r).schema;
}
class U extends Set {
  describe() {
    const e = [];
    for (const t of this.values())
      e.push($.isRef(t) ? t.describe() : t);
    return e;
  }
  resolveAll(e) {
    let t = [];
    for (const r of this.values())
      t.push(e(r));
    return t;
  }
  clone() {
    return new U(this.values());
  }
  merge(e, t) {
    const r = this.clone();
    return e.forEach((s) => r.add(s)), t.forEach((s) => r.delete(s)), r;
  }
}
function C(n, e = /* @__PURE__ */ new Map()) {
  if (A(n) || !n || typeof n != "object")
    return n;
  if (e.has(n))
    return e.get(n);
  let t;
  if (n instanceof Date)
    t = new Date(n.getTime()), e.set(n, t);
  else if (n instanceof RegExp)
    t = new RegExp(n), e.set(n, t);
  else if (Array.isArray(n)) {
    t = new Array(n.length), e.set(n, t);
    for (let r = 0; r < n.length; r++)
      t[r] = C(n[r], e);
  } else if (n instanceof Map) {
    t = /* @__PURE__ */ new Map(), e.set(n, t);
    for (const [r, s] of n.entries())
      t.set(r, C(s, e));
  } else if (n instanceof Set) {
    t = /* @__PURE__ */ new Set(), e.set(n, t);
    for (const r of n)
      t.add(C(r, e));
  } else if (n instanceof Object) {
    t = {}, e.set(n, t);
    for (const [r, s] of Object.entries(n))
      t[r] = C(s, e);
  } else
    throw Error(`Unable to clone ${n}`);
  return t;
}
class m {
  constructor(e) {
    this.type = void 0, this.deps = [], this.tests = void 0, this.transforms = void 0, this.conditions = [], this._mutate = void 0, this.internalTests = {}, this._whitelist = new U(), this._blacklist = new U(), this.exclusiveTests = /* @__PURE__ */ Object.create(null), this._typeCheck = void 0, this.spec = void 0, this.tests = [], this.transforms = [], this.withMutation(() => {
      this.typeError(w.notType);
    }), this.type = e.type, this._typeCheck = e.check, this.spec = Object.assign({
      strip: !1,
      strict: !1,
      abortEarly: !0,
      recursive: !0,
      disableStackTrace: !1,
      nullable: !1,
      optional: !0,
      coerce: !0
    }, e == null ? void 0 : e.spec), this.withMutation((t) => {
      t.nonNullable();
    });
  }
  // TODO: remove
  get _type() {
    return this.type;
  }
  clone(e) {
    if (this._mutate)
      return e && Object.assign(this.spec, e), this;
    const t = Object.create(Object.getPrototypeOf(this));
    return t.type = this.type, t._typeCheck = this._typeCheck, t._whitelist = this._whitelist.clone(), t._blacklist = this._blacklist.clone(), t.internalTests = Object.assign({}, this.internalTests), t.exclusiveTests = Object.assign({}, this.exclusiveTests), t.deps = [...this.deps], t.conditions = [...this.conditions], t.tests = [...this.tests], t.transforms = [...this.transforms], t.spec = C(Object.assign({}, this.spec, e)), t;
  }
  label(e) {
    let t = this.clone();
    return t.spec.label = e, t;
  }
  meta(...e) {
    if (e.length === 0)
      return this.spec.meta;
    let t = this.clone();
    return t.spec.meta = Object.assign(t.spec.meta || {}, e[0]), t;
  }
  withMutation(e) {
    let t = this._mutate;
    this._mutate = !0;
    let r = e(this);
    return this._mutate = t, r;
  }
  concat(e) {
    if (!e || e === this)
      return this;
    if (e.type !== this.type && this.type !== "mixed")
      throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);
    let t = this, r = e.clone();
    const s = Object.assign({}, t.spec, r.spec);
    return r.spec = s, r.internalTests = Object.assign({}, t.internalTests, r.internalTests), r._whitelist = t._whitelist.merge(e._whitelist, e._blacklist), r._blacklist = t._blacklist.merge(e._blacklist, e._whitelist), r.tests = t.tests, r.exclusiveTests = t.exclusiveTests, r.withMutation((i) => {
      e.tests.forEach((u) => {
        i.test(u.OPTIONS);
      });
    }), r.transforms = [...t.transforms, ...r.transforms], r;
  }
  isType(e) {
    return e == null ? !!(this.spec.nullable && e === null || this.spec.optional && e === void 0) : this._typeCheck(e);
  }
  resolve(e) {
    let t = this;
    if (t.conditions.length) {
      let r = t.conditions;
      t = t.clone(), t.conditions = [], t = r.reduce((s, i) => i.resolve(s, e), t), t = t.resolve(e);
    }
    return t;
  }
  resolveOptions(e) {
    var t, r, s, i;
    return Object.assign({}, e, {
      from: e.from || [],
      strict: (t = e.strict) != null ? t : this.spec.strict,
      abortEarly: (r = e.abortEarly) != null ? r : this.spec.abortEarly,
      recursive: (s = e.recursive) != null ? s : this.spec.recursive,
      disableStackTrace: (i = e.disableStackTrace) != null ? i : this.spec.disableStackTrace
    });
  }
  /**
   * Run the configured transform pipeline over an input value.
   */
  cast(e, t = {}) {
    let r = this.resolve(Object.assign({
      value: e
    }, t)), s = t.assert === "ignore-optionality", i = r._cast(e, t);
    if (t.assert !== !1 && !r.isType(i)) {
      if (s && v(i))
        return i;
      let u = _(e), a = _(i);
      throw new TypeError(`The value of ${t.path || "field"} could not be cast to a value that satisfies the schema type: "${r.type}". 

attempted value: ${u} 
` + (a !== u ? `result of cast: ${a}` : ""));
    }
    return i;
  }
  _cast(e, t) {
    let r = e === void 0 ? e : this.transforms.reduce((s, i) => i.call(this, s, e, this), e);
    return r === void 0 && (r = this.getDefault(t)), r;
  }
  _validate(e, t = {}, r, s) {
    let {
      path: i,
      originalValue: u = e,
      strict: a = this.spec.strict
    } = t, l = e;
    a || (l = this._cast(l, Object.assign({
      assert: !1
    }, t)));
    let o = [];
    for (let f of Object.values(this.internalTests))
      f && o.push(f);
    this.runTests({
      path: i,
      value: l,
      originalValue: u,
      options: t,
      tests: o
    }, r, (f) => {
      if (f.length)
        return s(f, l);
      this.runTests({
        path: i,
        value: l,
        originalValue: u,
        options: t,
        tests: this.tests
      }, r, s);
    });
  }
  /**
   * Executes a set of validations, either schema, produced Tests or a nested
   * schema validate result.
   */
  runTests(e, t, r) {
    let s = !1, {
      tests: i,
      value: u,
      originalValue: a,
      path: l,
      options: o
    } = e, f = (b) => {
      s || (s = !0, t(b, u));
    }, c = (b) => {
      s || (s = !0, r(b, u));
    }, h = i.length, d = [];
    if (!h)
      return c([]);
    let x = {
      value: u,
      originalValue: a,
      path: l,
      options: o,
      schema: this
    };
    for (let b = 0; b < i.length; b++) {
      const F = i[b];
      F(x, f, function(O) {
        O && (Array.isArray(O) ? d.push(...O) : d.push(O)), --h <= 0 && c(d);
      });
    }
  }
  asNestedTest({
    key: e,
    index: t,
    parent: r,
    parentPath: s,
    originalParent: i,
    options: u
  }) {
    const a = e ?? t;
    if (a == null)
      throw TypeError("Must include `key` or `index` for nested validations");
    const l = typeof a == "number";
    let o = r[a];
    const f = Object.assign({}, u, {
      // Nested validations fields are always strict:
      //    1. parent isn't strict so the casting will also have cast inner values
      //    2. parent is strict in which case the nested values weren't cast either
      strict: !0,
      parent: r,
      value: o,
      originalValue: i[a],
      // FIXME: tests depend on `index` being passed around deeply,
      //   we should not let the options.key/index bleed through
      key: void 0,
      // index: undefined,
      [l ? "index" : "key"]: a,
      path: l || a.includes(".") ? `${s || ""}[${o ? a : `"${a}"`}]` : (s ? `${s}.` : "") + e
    });
    return (c, h, d) => this.resolve(f)._validate(o, f, h, d);
  }
  validate(e, t) {
    var r;
    let s = this.resolve(Object.assign({}, t, {
      value: e
    })), i = (r = t == null ? void 0 : t.disableStackTrace) != null ? r : s.spec.disableStackTrace;
    return new Promise((u, a) => s._validate(e, t, (l, o) => {
      y.isError(l) && (l.value = o), a(l);
    }, (l, o) => {
      l.length ? a(new y(l, o, void 0, void 0, i)) : u(o);
    }));
  }
  validateSync(e, t) {
    var r;
    let s = this.resolve(Object.assign({}, t, {
      value: e
    })), i, u = (r = t == null ? void 0 : t.disableStackTrace) != null ? r : s.spec.disableStackTrace;
    return s._validate(e, Object.assign({}, t, {
      sync: !0
    }), (a, l) => {
      throw y.isError(a) && (a.value = l), a;
    }, (a, l) => {
      if (a.length)
        throw new y(a, e, void 0, void 0, u);
      i = l;
    }), i;
  }
  isValid(e, t) {
    return this.validate(e, t).then(() => !0, (r) => {
      if (y.isError(r))
        return !1;
      throw r;
    });
  }
  isValidSync(e, t) {
    try {
      return this.validateSync(e, t), !0;
    } catch (r) {
      if (y.isError(r))
        return !1;
      throw r;
    }
  }
  _getDefault(e) {
    let t = this.spec.default;
    return t == null ? t : typeof t == "function" ? t.call(this, e) : C(t);
  }
  getDefault(e) {
    return this.resolve(e || {})._getDefault(e);
  }
  default(e) {
    return arguments.length === 0 ? this._getDefault() : this.clone({
      default: e
    });
  }
  strict(e = !0) {
    return this.clone({
      strict: e
    });
  }
  nullability(e, t) {
    const r = this.clone({
      nullable: e
    });
    return r.internalTests.nullable = j({
      message: t,
      name: "nullable",
      test(s) {
        return s === null ? this.schema.spec.nullable : !0;
      }
    }), r;
  }
  optionality(e, t) {
    const r = this.clone({
      optional: e
    });
    return r.internalTests.optionality = j({
      message: t,
      name: "optionality",
      test(s) {
        return s === void 0 ? this.schema.spec.optional : !0;
      }
    }), r;
  }
  optional() {
    return this.optionality(!0);
  }
  defined(e = w.defined) {
    return this.optionality(!1, e);
  }
  nullable() {
    return this.nullability(!0);
  }
  nonNullable(e = w.notNull) {
    return this.nullability(!1, e);
  }
  required(e = w.required) {
    return this.clone().withMutation((t) => t.nonNullable(e).defined(e));
  }
  notRequired() {
    return this.clone().withMutation((e) => e.nullable().optional());
  }
  transform(e) {
    let t = this.clone();
    return t.transforms.push(e), t;
  }
  /**
   * Adds a test function to the schema's queue of tests.
   * tests can be exclusive or non-exclusive.
   *
   * - exclusive tests, will replace any existing tests of the same name.
   * - non-exclusive: can be stacked
   *
   * If a non-exclusive test is added to a schema with an exclusive test of the same name
   * the exclusive test is removed and further tests of the same name will be stacked.
   *
   * If an exclusive test is added to a schema with non-exclusive tests of the same name
   * the previous tests are removed and further tests of the same name will replace each other.
   */
  test(...e) {
    let t;
    if (e.length === 1 ? typeof e[0] == "function" ? t = {
      test: e[0]
    } : t = e[0] : e.length === 2 ? t = {
      name: e[0],
      test: e[1]
    } : t = {
      name: e[0],
      message: e[1],
      test: e[2]
    }, t.message === void 0 && (t.message = w.default), typeof t.test != "function")
      throw new TypeError("`test` is a required parameters");
    let r = this.clone(), s = j(t), i = t.exclusive || t.name && r.exclusiveTests[t.name] === !0;
    if (t.exclusive && !t.name)
      throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
    return t.name && (r.exclusiveTests[t.name] = !!t.exclusive), r.tests = r.tests.filter((u) => !(u.OPTIONS.name === t.name && (i || u.OPTIONS.test === s.OPTIONS.test))), r.tests.push(s), r;
  }
  when(e, t) {
    !Array.isArray(e) && typeof e != "string" && (t = e, e = ".");
    let r = this.clone(), s = Se(e).map((i) => new $(i));
    return s.forEach((i) => {
      i.isSibling && r.deps.push(i.key);
    }), r.conditions.push(typeof t == "function" ? new I(s, t) : I.fromOptions(s, t)), r;
  }
  typeError(e) {
    let t = this.clone();
    return t.internalTests.typeError = j({
      message: e,
      name: "typeError",
      skipAbsent: !0,
      test(r) {
        return this.schema._typeCheck(r) ? !0 : this.createError({
          params: {
            type: this.schema.type
          }
        });
      }
    }), t;
  }
  oneOf(e, t = w.oneOf) {
    let r = this.clone();
    return e.forEach((s) => {
      r._whitelist.add(s), r._blacklist.delete(s);
    }), r.internalTests.whiteList = j({
      message: t,
      name: "oneOf",
      skipAbsent: !0,
      test(s) {
        let i = this.schema._whitelist, u = i.resolveAll(this.resolve);
        return u.includes(s) ? !0 : this.createError({
          params: {
            values: Array.from(i).join(", "),
            resolved: u
          }
        });
      }
    }), r;
  }
  notOneOf(e, t = w.notOneOf) {
    let r = this.clone();
    return e.forEach((s) => {
      r._blacklist.add(s), r._whitelist.delete(s);
    }), r.internalTests.blacklist = j({
      message: t,
      name: "notOneOf",
      test(s) {
        let i = this.schema._blacklist, u = i.resolveAll(this.resolve);
        return u.includes(s) ? this.createError({
          params: {
            values: Array.from(i).join(", "),
            resolved: u
          }
        }) : !0;
      }
    }), r;
  }
  strip(e = !0) {
    let t = this.clone();
    return t.spec.strip = e, t;
  }
  /**
   * Return a serialized description of the schema including validations, flags, types etc.
   *
   * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
   */
  describe(e) {
    const t = (e ? this.resolve(e) : this).clone(), {
      label: r,
      meta: s,
      optional: i,
      nullable: u
    } = t.spec;
    return {
      meta: s,
      label: r,
      optional: i,
      nullable: u,
      default: t.getDefault(e),
      type: t.type,
      oneOf: t._whitelist.describe(),
      notOneOf: t._blacklist.describe(),
      tests: t.tests.map((l) => ({
        name: l.OPTIONS.name,
        params: l.OPTIONS.params
      })).filter((l, o, f) => f.findIndex((c) => c.name === l.name) === o)
    };
  }
}
m.prototype.__isYupSchema__ = !0;
for (const n of ["validate", "validateSync"])
  m.prototype[`${n}At`] = function(e, t, r = {}) {
    const {
      parent: s,
      parentPath: i,
      schema: u
    } = se(this, e, t, r.context);
    return u[n](s && s[i], Object.assign({}, r, {
      parent: s,
      path: e
    }));
  };
for (const n of ["equals", "is"])
  m.prototype[n] = m.prototype.oneOf;
for (const n of ["not", "nope"])
  m.prototype[n] = m.prototype.notOneOf;
const bt = () => !0;
function Ce(n) {
  return new ie(n);
}
class ie extends m {
  constructor(e) {
    super(typeof e == "function" ? {
      type: "mixed",
      check: e
    } : Object.assign({
      type: "mixed",
      check: bt
    }, e));
  }
}
Ce.prototype = ie.prototype;
function W() {
  return new ue();
}
class ue extends m {
  constructor() {
    super({
      type: "boolean",
      check(e) {
        return e instanceof Boolean && (e = e.valueOf()), typeof e == "boolean";
      }
    }), this.withMutation(() => {
      this.transform((e, t, r) => {
        if (r.spec.coerce && !r.isType(e)) {
          if (/^(true|1)$/i.test(String(e)))
            return !0;
          if (/^(false|0)$/i.test(String(e)))
            return !1;
        }
        return e;
      });
    });
  }
  isTrue(e = J.isValue) {
    return this.test({
      message: e,
      name: "is-value",
      exclusive: !0,
      params: {
        value: "true"
      },
      test(t) {
        return v(t) || t === !0;
      }
    });
  }
  isFalse(e = J.isValue) {
    return this.test({
      message: e,
      name: "is-value",
      exclusive: !0,
      params: {
        value: "false"
      },
      test(t) {
        return v(t) || t === !1;
      }
    });
  }
  default(e) {
    return super.default(e);
  }
  defined(e) {
    return super.defined(e);
  }
  optional() {
    return super.optional();
  }
  required(e) {
    return super.required(e);
  }
  notRequired() {
    return super.notRequired();
  }
  nullable() {
    return super.nullable();
  }
  nonNullable(e) {
    return super.nonNullable(e);
  }
  strip(e) {
    return super.strip(e);
  }
}
W.prototype = ue.prototype;
let xt = (
  // eslint-disable-next-line
  /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
), gt = (
  // eslint-disable-next-line
  /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
), vt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, wt = (n) => v(n) || n === n.trim(), _t = {}.toString();
function Ne() {
  return new ae();
}
class ae extends m {
  constructor() {
    super({
      type: "string",
      check(e) {
        return e instanceof String && (e = e.valueOf()), typeof e == "string";
      }
    }), this.withMutation(() => {
      this.transform((e, t, r) => {
        if (!r.spec.coerce || r.isType(e) || Array.isArray(e))
          return e;
        const s = e != null && e.toString ? e.toString() : e;
        return s === _t ? e : s;
      });
    });
  }
  required(e) {
    return super.required(e).withMutation((t) => t.test({
      message: e || w.required,
      name: "required",
      skipAbsent: !0,
      test: (r) => !!r.length
    }));
  }
  notRequired() {
    return super.notRequired().withMutation((e) => (e.tests = e.tests.filter((t) => t.OPTIONS.name !== "required"), e));
  }
  length(e, t = g.length) {
    return this.test({
      message: t,
      name: "length",
      exclusive: !0,
      params: {
        length: e
      },
      skipAbsent: !0,
      test(r) {
        return r.length === this.resolve(e);
      }
    });
  }
  min(e, t = g.min) {
    return this.test({
      message: t,
      name: "min",
      exclusive: !0,
      params: {
        min: e
      },
      skipAbsent: !0,
      test(r) {
        return r.length >= this.resolve(e);
      }
    });
  }
  max(e, t = g.max) {
    return this.test({
      name: "max",
      exclusive: !0,
      message: t,
      params: {
        max: e
      },
      skipAbsent: !0,
      test(r) {
        return r.length <= this.resolve(e);
      }
    });
  }
  matches(e, t) {
    let r = !1, s, i;
    return t && (typeof t == "object" ? {
      excludeEmptyString: r = !1,
      message: s,
      name: i
    } = t : s = t), this.test({
      name: i || "matches",
      message: s || g.matches,
      params: {
        regex: e
      },
      skipAbsent: !0,
      test: (u) => u === "" && r || u.search(e) !== -1
    });
  }
  email(e = g.email) {
    return this.matches(xt, {
      name: "email",
      message: e,
      excludeEmptyString: !0
    });
  }
  url(e = g.url) {
    return this.matches(gt, {
      name: "url",
      message: e,
      excludeEmptyString: !0
    });
  }
  uuid(e = g.uuid) {
    return this.matches(vt, {
      name: "uuid",
      message: e,
      excludeEmptyString: !1
    });
  }
  //-- transforms --
  ensure() {
    return this.default("").transform((e) => e === null ? "" : e);
  }
  trim(e = g.trim) {
    return this.transform((t) => t != null ? t.trim() : t).test({
      message: e,
      name: "trim",
      test: wt
    });
  }
  lowercase(e = g.lowercase) {
    return this.transform((t) => v(t) ? t : t.toLowerCase()).test({
      message: e,
      name: "string_case",
      exclusive: !0,
      skipAbsent: !0,
      test: (t) => v(t) || t === t.toLowerCase()
    });
  }
  uppercase(e = g.uppercase) {
    return this.transform((t) => v(t) ? t : t.toUpperCase()).test({
      message: e,
      name: "string_case",
      exclusive: !0,
      skipAbsent: !0,
      test: (t) => v(t) || t === t.toUpperCase()
    });
  }
}
Ne.prototype = ae.prototype;
let Tt = (n) => n != +n;
function ze() {
  return new le();
}
class le extends m {
  constructor() {
    super({
      type: "number",
      check(e) {
        return e instanceof Number && (e = e.valueOf()), typeof e == "number" && !Tt(e);
      }
    }), this.withMutation(() => {
      this.transform((e, t, r) => {
        if (!r.spec.coerce)
          return e;
        let s = e;
        if (typeof s == "string") {
          if (s = s.replace(/\s/g, ""), s === "")
            return NaN;
          s = +s;
        }
        return r.isType(s) || s === null ? s : parseFloat(s);
      });
    });
  }
  min(e, t = E.min) {
    return this.test({
      message: t,
      name: "min",
      exclusive: !0,
      params: {
        min: e
      },
      skipAbsent: !0,
      test(r) {
        return r >= this.resolve(e);
      }
    });
  }
  max(e, t = E.max) {
    return this.test({
      message: t,
      name: "max",
      exclusive: !0,
      params: {
        max: e
      },
      skipAbsent: !0,
      test(r) {
        return r <= this.resolve(e);
      }
    });
  }
  lessThan(e, t = E.lessThan) {
    return this.test({
      message: t,
      name: "max",
      exclusive: !0,
      params: {
        less: e
      },
      skipAbsent: !0,
      test(r) {
        return r < this.resolve(e);
      }
    });
  }
  moreThan(e, t = E.moreThan) {
    return this.test({
      message: t,
      name: "min",
      exclusive: !0,
      params: {
        more: e
      },
      skipAbsent: !0,
      test(r) {
        return r > this.resolve(e);
      }
    });
  }
  positive(e = E.positive) {
    return this.moreThan(0, e);
  }
  negative(e = E.negative) {
    return this.lessThan(0, e);
  }
  integer(e = E.integer) {
    return this.test({
      name: "integer",
      message: e,
      skipAbsent: !0,
      test: (t) => Number.isInteger(t)
    });
  }
  truncate() {
    return this.transform((e) => v(e) ? e : e | 0);
  }
  round(e) {
    var t;
    let r = ["ceil", "floor", "round", "trunc"];
    if (e = ((t = e) == null ? void 0 : t.toLowerCase()) || "round", e === "trunc")
      return this.truncate();
    if (r.indexOf(e.toLowerCase()) === -1)
      throw new TypeError("Only valid options for round() are: " + r.join(", "));
    return this.transform((s) => v(s) ? s : Math[e](s));
  }
}
ze.prototype = le.prototype;
const Ft = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
function T(n, e = 0) {
  return Number(n) || e;
}
function Et(n) {
  const e = Ft.exec(n);
  if (!e)
    return Date.parse ? Date.parse(n) : Number.NaN;
  const t = {
    year: T(e[1]),
    month: T(e[2], 1) - 1,
    day: T(e[3], 1),
    hour: T(e[4]),
    minute: T(e[5]),
    second: T(e[6]),
    millisecond: e[7] ? (
      // allow arbitrary sub-second precision beyond milliseconds
      T(e[7].substring(0, 3))
    ) : 0,
    z: e[8] || void 0,
    plusMinus: e[9] || void 0,
    hourOffset: T(e[10]),
    minuteOffset: T(e[11])
  };
  if (t.z === void 0 && t.plusMinus === void 0)
    return new Date(t.year, t.month, t.day, t.hour, t.minute, t.second, t.millisecond).valueOf();
  let r = 0;
  return t.z !== "Z" && t.plusMinus !== void 0 && (r = t.hourOffset * 60 + t.minuteOffset, t.plusMinus === "+" && (r = 0 - r)), Date.UTC(t.year, t.month, t.day, t.hour, t.minute + r, t.second, t.millisecond);
}
let Ve = /* @__PURE__ */ new Date(""), $t = (n) => Object.prototype.toString.call(n) === "[object Date]";
function oe() {
  return new N();
}
class N extends m {
  constructor() {
    super({
      type: "date",
      check(e) {
        return $t(e) && !isNaN(e.getTime());
      }
    }), this.withMutation(() => {
      this.transform((e, t, r) => !r.spec.coerce || r.isType(e) || e === null ? e : (e = Et(e), isNaN(e) ? N.INVALID_DATE : new Date(e)));
    });
  }
  prepareParam(e, t) {
    let r;
    if ($.isRef(e))
      r = e;
    else {
      let s = this.cast(e);
      if (!this._typeCheck(s))
        throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);
      r = s;
    }
    return r;
  }
  min(e, t = B.min) {
    let r = this.prepareParam(e, "min");
    return this.test({
      message: t,
      name: "min",
      exclusive: !0,
      params: {
        min: e
      },
      skipAbsent: !0,
      test(s) {
        return s >= this.resolve(r);
      }
    });
  }
  max(e, t = B.max) {
    let r = this.prepareParam(e, "max");
    return this.test({
      message: t,
      name: "max",
      exclusive: !0,
      params: {
        max: e
      },
      skipAbsent: !0,
      test(s) {
        return s <= this.resolve(r);
      }
    });
  }
}
N.INVALID_DATE = Ve;
oe.prototype = N.prototype;
oe.INVALID_DATE = Ve;
function Ot(n, e = []) {
  let t = [], r = /* @__PURE__ */ new Set(), s = new Set(e.map(([u, a]) => `${u}-${a}`));
  function i(u, a) {
    let l = k.split(u)[0];
    r.add(l), s.has(`${a}-${l}`) || t.push([a, l]);
  }
  for (const u of Object.keys(n)) {
    let a = n[u];
    r.add(u), $.isRef(a) && a.isSibling ? i(a.path, u) : A(a) && "deps" in a && a.deps.forEach((l) => i(l, u));
  }
  return at.array(Array.from(r), t).reverse();
}
function Fe(n, e) {
  let t = 1 / 0;
  return n.some((r, s) => {
    var i;
    if ((i = e.path) != null && i.includes(r))
      return t = s, !0;
  }), t;
}
function Me(n) {
  return (e, t) => Fe(n, e) - Fe(n, t);
}
const Re = (n, e, t) => {
  if (typeof n != "string")
    return n;
  let r = n;
  try {
    r = JSON.parse(n);
  } catch {
  }
  return t.isType(r) ? r : n;
};
function P(n) {
  if ("fields" in n) {
    const e = {};
    for (const [t, r] of Object.entries(n.fields))
      e[t] = P(r);
    return n.setFields(e);
  }
  if (n.type === "array") {
    const e = n.optional();
    return e.innerType && (e.innerType = P(e.innerType)), e;
  }
  return n.type === "tuple" ? n.optional().clone({
    types: n.spec.types.map(P)
  }) : "optional" in n ? n.optional() : n;
}
const kt = (n, e) => {
  const t = [...k.normalizePath(e)];
  if (t.length === 1)
    return t[0] in n;
  let r = t.pop(), s = k.getter(k.join(t), !0)(n);
  return !!(s && r in s);
};
let Ee = (n) => Object.prototype.toString.call(n) === "[object Object]";
function St(n, e) {
  let t = Object.keys(n.fields);
  return Object.keys(e).filter((r) => t.indexOf(r) === -1);
}
const At = Me([]);
function Pe(n) {
  return new ce(n);
}
class ce extends m {
  constructor(e) {
    super({
      type: "object",
      check(t) {
        return Ee(t) || typeof t == "function";
      }
    }), this.fields = /* @__PURE__ */ Object.create(null), this._sortErrors = At, this._nodes = [], this._excludedEdges = [], this.withMutation(() => {
      e && this.shape(e);
    });
  }
  _cast(e, t = {}) {
    var r;
    let s = super._cast(e, t);
    if (s === void 0)
      return this.getDefault(t);
    if (!this._typeCheck(s))
      return s;
    let i = this.fields, u = (r = t.stripUnknown) != null ? r : this.spec.noUnknown, a = [].concat(this._nodes, Object.keys(s).filter((c) => !this._nodes.includes(c))), l = {}, o = Object.assign({}, t, {
      parent: l,
      __validating: t.__validating || !1
    }), f = !1;
    for (const c of a) {
      let h = i[c], d = c in s;
      if (h) {
        let x, b = s[c];
        o.path = (t.path ? `${t.path}.` : "") + c, h = h.resolve({
          value: b,
          context: t.context,
          parent: l
        });
        let F = h instanceof m ? h.spec : void 0, z = F == null ? void 0 : F.strict;
        if (F != null && F.strip) {
          f = f || c in s;
          continue;
        }
        x = !t.__validating || !z ? (
          // TODO: use _cast, this is double resolving
          h.cast(s[c], o)
        ) : s[c], x !== void 0 && (l[c] = x);
      } else
        d && !u && (l[c] = s[c]);
      (d !== c in l || l[c] !== s[c]) && (f = !0);
    }
    return f ? l : s;
  }
  _validate(e, t = {}, r, s) {
    let {
      from: i = [],
      originalValue: u = e,
      recursive: a = this.spec.recursive
    } = t;
    t.from = [{
      schema: this,
      value: u
    }, ...i], t.__validating = !0, t.originalValue = u, super._validate(e, t, r, (l, o) => {
      if (!a || !Ee(o)) {
        s(l, o);
        return;
      }
      u = u || o;
      let f = [];
      for (let c of this._nodes) {
        let h = this.fields[c];
        !h || $.isRef(h) || f.push(h.asNestedTest({
          options: t,
          key: c,
          parent: o,
          parentPath: t.path,
          originalParent: u
        }));
      }
      this.runTests({
        tests: f,
        value: o,
        originalValue: u,
        options: t
      }, r, (c) => {
        s(c.sort(this._sortErrors).concat(l), o);
      });
    });
  }
  clone(e) {
    const t = super.clone(e);
    return t.fields = Object.assign({}, this.fields), t._nodes = this._nodes, t._excludedEdges = this._excludedEdges, t._sortErrors = this._sortErrors, t;
  }
  concat(e) {
    let t = super.concat(e), r = t.fields;
    for (let [s, i] of Object.entries(this.fields)) {
      const u = r[s];
      r[s] = u === void 0 ? i : u;
    }
    return t.withMutation((s) => (
      // XXX: excludes here is wrong
      s.setFields(r, [...this._excludedEdges, ...e._excludedEdges])
    ));
  }
  _getDefault(e) {
    if ("default" in this.spec)
      return super._getDefault(e);
    if (!this._nodes.length)
      return;
    let t = {};
    return this._nodes.forEach((r) => {
      var s;
      const i = this.fields[r];
      let u = e;
      (s = u) != null && s.value && (u = Object.assign({}, u, {
        parent: u.value,
        value: u.value[r]
      })), t[r] = i && "getDefault" in i ? i.getDefault(u) : void 0;
    }), t;
  }
  setFields(e, t) {
    let r = this.clone();
    return r.fields = e, r._nodes = Ot(e, t), r._sortErrors = Me(Object.keys(e)), t && (r._excludedEdges = t), r;
  }
  shape(e, t = []) {
    return this.clone().withMutation((r) => {
      let s = r._excludedEdges;
      return t.length && (Array.isArray(t[0]) || (t = [t]), s = [...r._excludedEdges, ...t]), r.setFields(Object.assign(r.fields, e), s);
    });
  }
  partial() {
    const e = {};
    for (const [t, r] of Object.entries(this.fields))
      e[t] = "optional" in r && r.optional instanceof Function ? r.optional() : r;
    return this.setFields(e);
  }
  deepPartial() {
    return P(this);
  }
  pick(e) {
    const t = {};
    for (const r of e)
      this.fields[r] && (t[r] = this.fields[r]);
    return this.setFields(t, this._excludedEdges.filter(([r, s]) => e.includes(r) && e.includes(s)));
  }
  omit(e) {
    const t = [];
    for (const r of Object.keys(this.fields))
      e.includes(r) || t.push(r);
    return this.pick(t);
  }
  from(e, t, r) {
    let s = k.getter(e, !0);
    return this.transform((i) => {
      if (!i)
        return i;
      let u = i;
      return kt(i, e) && (u = Object.assign({}, i), r || delete u[e], u[t] = s(i)), u;
    });
  }
  /** Parse an input JSON string to an object */
  json() {
    return this.transform(Re);
  }
  noUnknown(e = !0, t = Q.noUnknown) {
    typeof e != "boolean" && (t = e, e = !0);
    let r = this.test({
      name: "noUnknown",
      exclusive: !0,
      message: t,
      test(s) {
        if (s == null)
          return !0;
        const i = St(this.schema, s);
        return !e || i.length === 0 || this.createError({
          params: {
            unknown: i.join(", ")
          }
        });
      }
    });
    return r.spec.noUnknown = e, r;
  }
  unknown(e = !0, t = Q.noUnknown) {
    return this.noUnknown(!e, t);
  }
  transformKeys(e) {
    return this.transform((t) => {
      if (!t)
        return t;
      const r = {};
      for (const s of Object.keys(t))
        r[e(s)] = t[s];
      return r;
    });
  }
  camelCase() {
    return this.transformKeys(H.camelCase);
  }
  snakeCase() {
    return this.transformKeys(H.snakeCase);
  }
  constantCase() {
    return this.transformKeys((e) => H.snakeCase(e).toUpperCase());
  }
  describe(e) {
    const t = (e ? this.resolve(e) : this).clone(), r = super.describe(e);
    r.fields = {};
    for (const [i, u] of Object.entries(t.fields)) {
      var s;
      let a = e;
      (s = a) != null && s.value && (a = Object.assign({}, a, {
        parent: a.value,
        value: a.value[i]
      })), r.fields[i] = u.describe(a);
    }
    return r;
  }
}
Pe.prototype = ce.prototype;
function Ie(n) {
  return new fe(n);
}
class fe extends m {
  constructor(e) {
    super({
      type: "array",
      spec: {
        types: e
      },
      check(t) {
        return Array.isArray(t);
      }
    }), this.innerType = void 0, this.innerType = e;
  }
  _cast(e, t) {
    const r = super._cast(e, t);
    if (!this._typeCheck(r) || !this.innerType)
      return r;
    let s = !1;
    const i = r.map((u, a) => {
      const l = this.innerType.cast(u, Object.assign({}, t, {
        path: `${t.path || ""}[${a}]`
      }));
      return l !== u && (s = !0), l;
    });
    return s ? i : r;
  }
  _validate(e, t = {}, r, s) {
    var i;
    let u = this.innerType, a = (i = t.recursive) != null ? i : this.spec.recursive;
    t.originalValue != null && t.originalValue, super._validate(e, t, r, (l, o) => {
      var f;
      if (!a || !u || !this._typeCheck(o)) {
        s(l, o);
        return;
      }
      let c = new Array(o.length);
      for (let d = 0; d < o.length; d++) {
        var h;
        c[d] = u.asNestedTest({
          options: t,
          index: d,
          parent: o,
          parentPath: t.path,
          originalParent: (h = t.originalValue) != null ? h : e
        });
      }
      this.runTests({
        value: o,
        tests: c,
        originalValue: (f = t.originalValue) != null ? f : e,
        options: t
      }, r, (d) => s(d.concat(l), o));
    });
  }
  clone(e) {
    const t = super.clone(e);
    return t.innerType = this.innerType, t;
  }
  /** Parse an input JSON string to an object */
  json() {
    return this.transform(Re);
  }
  concat(e) {
    let t = super.concat(e);
    return t.innerType = this.innerType, e.innerType && (t.innerType = t.innerType ? (
      // @ts-expect-error Lazy doesn't have concat and will break
      t.innerType.concat(e.innerType)
    ) : e.innerType), t;
  }
  of(e) {
    let t = this.clone();
    if (!A(e))
      throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + _(e));
    return t.innerType = e, t.spec = Object.assign({}, t.spec, {
      types: e
    }), t;
  }
  length(e, t = R.length) {
    return this.test({
      message: t,
      name: "length",
      exclusive: !0,
      params: {
        length: e
      },
      skipAbsent: !0,
      test(r) {
        return r.length === this.resolve(e);
      }
    });
  }
  min(e, t) {
    return t = t || R.min, this.test({
      message: t,
      name: "min",
      exclusive: !0,
      params: {
        min: e
      },
      skipAbsent: !0,
      // FIXME(ts): Array<typeof T>
      test(r) {
        return r.length >= this.resolve(e);
      }
    });
  }
  max(e, t) {
    return t = t || R.max, this.test({
      message: t,
      name: "max",
      exclusive: !0,
      params: {
        max: e
      },
      skipAbsent: !0,
      test(r) {
        return r.length <= this.resolve(e);
      }
    });
  }
  ensure() {
    return this.default(() => []).transform((e, t) => this._typeCheck(e) ? e : t == null ? [] : [].concat(t));
  }
  compact(e) {
    let t = e ? (r, s, i) => !e(r, s, i) : (r) => !!r;
    return this.transform((r) => r != null ? r.filter(t) : r);
  }
  describe(e) {
    const t = (e ? this.resolve(e) : this).clone(), r = super.describe(e);
    if (t.innerType) {
      var s;
      let i = e;
      (s = i) != null && s.value && (i = Object.assign({}, i, {
        parent: i.value,
        value: i.value[0]
      })), r.innerType = t.innerType.describe(i);
    }
    return r;
  }
}
Ie.prototype = fe.prototype;
function Ue(n) {
  return new he(n);
}
class he extends m {
  constructor(e) {
    super({
      type: "tuple",
      spec: {
        types: e
      },
      check(t) {
        const r = this.spec.types;
        return Array.isArray(t) && t.length === r.length;
      }
    }), this.withMutation(() => {
      this.typeError(De.notType);
    });
  }
  _cast(e, t) {
    const {
      types: r
    } = this.spec, s = super._cast(e, t);
    if (!this._typeCheck(s))
      return s;
    let i = !1;
    const u = r.map((a, l) => {
      const o = a.cast(s[l], Object.assign({}, t, {
        path: `${t.path || ""}[${l}]`
      }));
      return o !== s[l] && (i = !0), o;
    });
    return i ? u : s;
  }
  _validate(e, t = {}, r, s) {
    let i = this.spec.types;
    super._validate(e, t, r, (u, a) => {
      var l;
      if (!this._typeCheck(a)) {
        s(u, a);
        return;
      }
      let o = [];
      for (let [c, h] of i.entries()) {
        var f;
        o[c] = h.asNestedTest({
          options: t,
          index: c,
          parent: a,
          parentPath: t.path,
          originalParent: (f = t.originalValue) != null ? f : e
        });
      }
      this.runTests({
        value: a,
        tests: o,
        originalValue: (l = t.originalValue) != null ? l : e,
        options: t
      }, r, (c) => s(c.concat(u), a));
    });
  }
  describe(e) {
    const t = (e ? this.resolve(e) : this).clone(), r = super.describe(e);
    return r.innerType = t.spec.types.map((s, i) => {
      var u;
      let a = e;
      return (u = a) != null && u.value && (a = Object.assign({}, a, {
        parent: a.value,
        value: a.value[i]
      })), s.describe(a);
    }), r;
  }
}
Ue.prototype = he.prototype;
function Dt(n) {
  return new de(n);
}
class de {
  constructor(e) {
    this.type = "lazy", this.__isYupSchema__ = !0, this.spec = void 0, this._resolve = (t, r = {}) => {
      let s = this.builder(t, r);
      if (!A(s))
        throw new TypeError("lazy() functions must return a valid schema");
      return this.spec.optional && (s = s.optional()), s.resolve(r);
    }, this.builder = e, this.spec = {
      meta: void 0,
      optional: !1
    };
  }
  clone(e) {
    const t = new de(this.builder);
    return t.spec = Object.assign({}, this.spec, e), t;
  }
  optionality(e) {
    return this.clone({
      optional: e
    });
  }
  optional() {
    return this.optionality(!0);
  }
  resolve(e) {
    return this._resolve(e.value, e);
  }
  cast(e, t) {
    return this._resolve(e, t).cast(e, t);
  }
  asNestedTest(e) {
    let {
      key: t,
      index: r,
      parent: s,
      options: i
    } = e, u = s[r ?? t];
    return this._resolve(u, Object.assign({}, i, {
      value: u,
      parent: s
    })).asNestedTest(e);
  }
  validate(e, t) {
    return this._resolve(e, t).validate(e, t);
  }
  validateSync(e, t) {
    return this._resolve(e, t).validateSync(e, t);
  }
  validateAt(e, t, r) {
    return this._resolve(t, r).validateAt(e, t, r);
  }
  validateSyncAt(e, t, r) {
    return this._resolve(t, r).validateSyncAt(e, t, r);
  }
  isValid(e, t) {
    return this._resolve(e, t).isValid(e, t);
  }
  isValidSync(e, t) {
    return this._resolve(e, t).isValidSync(e, t);
  }
  describe(e) {
    return e ? this.resolve(e).describe(e) : {
      type: "lazy",
      meta: this.spec.meta,
      label: void 0
    };
  }
  meta(...e) {
    if (e.length === 0)
      return this.spec.meta;
    let t = this.clone();
    return t.spec.meta = Object.assign(t.spec.meta || {}, e[0]), t;
  }
}
function jt(n) {
  Object.keys(n).forEach((e) => {
    Object.keys(n[e]).forEach((t) => {
      je[e][t] = n[e][t];
    });
  });
}
function Ct(n, e, t) {
  if (!n || !A(n.prototype))
    throw new TypeError("You must provide a yup schema constructor function");
  if (typeof e != "string")
    throw new TypeError("A Method name must be provided");
  if (typeof t != "function")
    throw new TypeError("Method function must be provided");
  n.prototype[e] = t;
}
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ArraySchema: fe,
  BooleanSchema: ue,
  DateSchema: N,
  MixedSchema: ie,
  NumberSchema: le,
  ObjectSchema: ce,
  Schema: m,
  StringSchema: ae,
  TupleSchema: he,
  ValidationError: y,
  addMethod: Ct,
  array: Ie,
  bool: W,
  boolean: W,
  date: oe,
  defaultLocale: je,
  getIn: se,
  isSchema: A,
  lazy: Dt,
  mixed: Ce,
  number: ze,
  object: Pe,
  printValue: _,
  reach: yt,
  ref: mt,
  setLocale: jt,
  string: Ne,
  tuple: Ue
}, Symbol.toStringTag, { value: "Module" }));
export {
  Ct as a,
  Pe as b,
  Ce as c,
  Ne as d,
  Vt as y
};
