var g;
(function(s) {
  s.assertEqual = (a) => {
  };
  function e(a) {
  }
  s.assertIs = e;
  function t(a) {
    throw new Error();
  }
  s.assertNever = t, s.arrayToEnum = (a) => {
    const n = {};
    for (const i of a)
      n[i] = i;
    return n;
  }, s.getValidEnumValues = (a) => {
    const n = s.objectKeys(a).filter((d) => typeof a[a[d]] != "number"), i = {};
    for (const d of n)
      i[d] = a[d];
    return s.objectValues(i);
  }, s.objectValues = (a) => s.objectKeys(a).map(function(n) {
    return a[n];
  }), s.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
    const n = [];
    for (const i in a)
      Object.prototype.hasOwnProperty.call(a, i) && n.push(i);
    return n;
  }, s.find = (a, n) => {
    for (const i of a)
      if (n(i))
        return i;
  }, s.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
  function r(a, n = " | ") {
    return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(n);
  }
  s.joinValues = r, s.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n;
})(g || (g = {}));
var te;
(function(s) {
  s.mergeShapes = (e, t) => ({
    ...e,
    ...t
    // second overwrites first
  });
})(te || (te = {}));
const u = g.arrayToEnum([
  "string",
  "nan",
  "number",
  "integer",
  "float",
  "boolean",
  "date",
  "bigint",
  "symbol",
  "function",
  "undefined",
  "null",
  "array",
  "object",
  "unknown",
  "promise",
  "void",
  "never",
  "map",
  "set"
]), O = (s) => {
  switch (typeof s) {
    case "undefined":
      return u.undefined;
    case "string":
      return u.string;
    case "number":
      return Number.isNaN(s) ? u.nan : u.number;
    case "boolean":
      return u.boolean;
    case "function":
      return u.function;
    case "bigint":
      return u.bigint;
    case "symbol":
      return u.symbol;
    case "object":
      return Array.isArray(s) ? u.array : s === null ? u.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? u.promise : typeof Map < "u" && s instanceof Map ? u.map : typeof Set < "u" && s instanceof Set ? u.set : typeof Date < "u" && s instanceof Date ? u.date : u.object;
    default:
      return u.unknown;
  }
}, o = g.arrayToEnum([
  "invalid_type",
  "invalid_literal",
  "custom",
  "invalid_union",
  "invalid_union_discriminator",
  "invalid_enum_value",
  "unrecognized_keys",
  "invalid_arguments",
  "invalid_return_type",
  "invalid_date",
  "invalid_string",
  "too_small",
  "too_big",
  "invalid_intersection_types",
  "not_multiple_of",
  "not_finite"
]);
class T extends Error {
  get errors() {
    return this.issues;
  }
  constructor(e) {
    super(), this.issues = [], this.addIssue = (r) => {
      this.issues = [...this.issues, r];
    }, this.addIssues = (r = []) => {
      this.issues = [...this.issues, ...r];
    };
    const t = new.target.prototype;
    Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
  }
  format(e) {
    const t = e || function(n) {
      return n.message;
    }, r = { _errors: [] }, a = (n) => {
      for (const i of n.issues)
        if (i.code === "invalid_union")
          i.unionErrors.map(a);
        else if (i.code === "invalid_return_type")
          a(i.returnTypeError);
        else if (i.code === "invalid_arguments")
          a(i.argumentsError);
        else if (i.path.length === 0)
          r._errors.push(t(i));
        else {
          let d = r, f = 0;
          for (; f < i.path.length; ) {
            const h = i.path[f];
            f === i.path.length - 1 ? (d[h] = d[h] || { _errors: [] }, d[h]._errors.push(t(i))) : d[h] = d[h] || { _errors: [] }, d = d[h], f++;
          }
        }
    };
    return a(this), r;
  }
  static assert(e) {
    if (!(e instanceof T))
      throw new Error(`Not a ZodError: ${e}`);
  }
  toString() {
    return this.message;
  }
  get message() {
    return JSON.stringify(this.issues, g.jsonStringifyReplacer, 2);
  }
  get isEmpty() {
    return this.issues.length === 0;
  }
  flatten(e = (t) => t.message) {
    const t = {}, r = [];
    for (const a of this.issues)
      a.path.length > 0 ? (t[a.path[0]] = t[a.path[0]] || [], t[a.path[0]].push(e(a))) : r.push(e(a));
    return { formErrors: r, fieldErrors: t };
  }
  get formErrors() {
    return this.flatten();
  }
}
T.create = (s) => new T(s);
const q = (s, e) => {
  let t;
  switch (s.code) {
    case o.invalid_type:
      s.received === u.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
      break;
    case o.invalid_literal:
      t = `Invalid literal value, expected ${JSON.stringify(s.expected, g.jsonStringifyReplacer)}`;
      break;
    case o.unrecognized_keys:
      t = `Unrecognized key(s) in object: ${g.joinValues(s.keys, ", ")}`;
      break;
    case o.invalid_union:
      t = "Invalid input";
      break;
    case o.invalid_union_discriminator:
      t = `Invalid discriminator value. Expected ${g.joinValues(s.options)}`;
      break;
    case o.invalid_enum_value:
      t = `Invalid enum value. Expected ${g.joinValues(s.options)}, received '${s.received}'`;
      break;
    case o.invalid_arguments:
      t = "Invalid function arguments";
      break;
    case o.invalid_return_type:
      t = "Invalid function return type";
      break;
    case o.invalid_date:
      t = "Invalid date";
      break;
    case o.invalid_string:
      typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : g.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
      break;
    case o.too_small:
      s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
      break;
    case o.too_big:
      s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
      break;
    case o.custom:
      t = "Invalid input";
      break;
    case o.invalid_intersection_types:
      t = "Intersection results could not be merged";
      break;
    case o.not_multiple_of:
      t = `Number must be a multiple of ${s.multipleOf}`;
      break;
    case o.not_finite:
      t = "Number must be finite";
      break;
    default:
      t = e.defaultError, g.assertNever(s);
  }
  return { message: t };
};
let xe = q;
function ke() {
  return xe;
}
const be = (s) => {
  const { data: e, path: t, errorMaps: r, issueData: a } = s, n = [...t, ...a.path || []], i = {
    ...a,
    path: n
  };
  if (a.message !== void 0)
    return {
      ...a,
      path: n,
      message: a.message
    };
  let d = "";
  const f = r.filter((h) => !!h).slice().reverse();
  for (const h of f)
    d = h(i, { data: e, defaultError: d }).message;
  return {
    ...a,
    path: n,
    message: d
  };
};
function c(s, e) {
  const t = ke(), r = be({
    issueData: e,
    data: s.data,
    path: s.path,
    errorMaps: [
      s.common.contextualErrorMap,
      // contextual error map is first priority
      s.schemaErrorMap,
      // then schema-bound map if available
      t,
      // then global override map
      t === q ? void 0 : q
      // then global default map
    ].filter((a) => !!a)
  });
  s.common.issues.push(r);
}
class k {
  constructor() {
    this.value = "valid";
  }
  dirty() {
    this.value === "valid" && (this.value = "dirty");
  }
  abort() {
    this.value !== "aborted" && (this.value = "aborted");
  }
  static mergeArray(e, t) {
    const r = [];
    for (const a of t) {
      if (a.status === "aborted")
        return m;
      a.status === "dirty" && e.dirty(), r.push(a.value);
    }
    return { status: e.value, value: r };
  }
  static async mergeObjectAsync(e, t) {
    const r = [];
    for (const a of t) {
      const n = await a.key, i = await a.value;
      r.push({
        key: n,
        value: i
      });
    }
    return k.mergeObjectSync(e, r);
  }
  static mergeObjectSync(e, t) {
    const r = {};
    for (const a of t) {
      const { key: n, value: i } = a;
      if (n.status === "aborted" || i.status === "aborted")
        return m;
      n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (r[n.value] = i.value);
    }
    return { status: e.value, value: r };
  }
}
const m = Object.freeze({
  status: "aborted"
}), P = (s) => ({ status: "dirty", value: s }), b = (s) => ({ status: "valid", value: s }), se = (s) => s.status === "aborted", re = (s) => s.status === "dirty", R = (s) => s.status === "valid", U = (s) => typeof Promise < "u" && s instanceof Promise;
var l;
(function(s) {
  s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
})(l || (l = {}));
class S {
  constructor(e, t, r, a) {
    this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = a;
  }
  get path() {
    return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
  }
}
const ae = (s, e) => {
  if (R(e))
    return { success: !0, data: e.value };
  if (!s.common.issues.length)
    throw new Error("Validation failed but no issues detected.");
  return {
    success: !1,
    get error() {
      if (this._error)
        return this._error;
      const t = new T(s.common.issues);
      return this._error = t, this._error;
    }
  };
};
function _(s) {
  if (!s)
    return {};
  const { errorMap: e, invalid_type_error: t, required_error: r, description: a } = s;
  if (e && (t || r))
    throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
  return e ? { errorMap: e, description: a } : { errorMap: (i, d) => {
    const { message: f } = s;
    return i.code === "invalid_enum_value" ? { message: f ?? d.defaultError } : typeof d.data > "u" ? { message: f ?? r ?? d.defaultError } : i.code !== "invalid_type" ? { message: d.defaultError } : { message: f ?? t ?? d.defaultError };
  }, description: a };
}
class y {
  get description() {
    return this._def.description;
  }
  _getType(e) {
    return O(e.data);
  }
  _getOrReturnCtx(e, t) {
    return t || {
      common: e.parent.common,
      data: e.data,
      parsedType: O(e.data),
      schemaErrorMap: this._def.errorMap,
      path: e.path,
      parent: e.parent
    };
  }
  _processInputParams(e) {
    return {
      status: new k(),
      ctx: {
        common: e.parent.common,
        data: e.data,
        parsedType: O(e.data),
        schemaErrorMap: this._def.errorMap,
        path: e.path,
        parent: e.parent
      }
    };
  }
  _parseSync(e) {
    const t = this._parse(e);
    if (U(t))
      throw new Error("Synchronous parse encountered promise.");
    return t;
  }
  _parseAsync(e) {
    const t = this._parse(e);
    return Promise.resolve(t);
  }
  parse(e, t) {
    const r = this.safeParse(e, t);
    if (r.success)
      return r.data;
    throw r.error;
  }
  safeParse(e, t) {
    const r = {
      common: {
        issues: [],
        async: (t == null ? void 0 : t.async) ?? !1,
        contextualErrorMap: t == null ? void 0 : t.errorMap
      },
      path: (t == null ? void 0 : t.path) || [],
      schemaErrorMap: this._def.errorMap,
      parent: null,
      data: e,
      parsedType: O(e)
    }, a = this._parseSync({ data: e, path: r.path, parent: r });
    return ae(r, a);
  }
  "~validate"(e) {
    var r, a;
    const t = {
      common: {
        issues: [],
        async: !!this["~standard"].async
      },
      path: [],
      schemaErrorMap: this._def.errorMap,
      parent: null,
      data: e,
      parsedType: O(e)
    };
    if (!this["~standard"].async)
      try {
        const n = this._parseSync({ data: e, path: [], parent: t });
        return R(n) ? {
          value: n.value
        } : {
          issues: t.common.issues
        };
      } catch (n) {
        (a = (r = n == null ? void 0 : n.message) == null ? void 0 : r.toLowerCase()) != null && a.includes("encountered") && (this["~standard"].async = !0), t.common = {
          issues: [],
          async: !0
        };
      }
    return this._parseAsync({ data: e, path: [], parent: t }).then((n) => R(n) ? {
      value: n.value
    } : {
      issues: t.common.issues
    });
  }
  async parseAsync(e, t) {
    const r = await this.safeParseAsync(e, t);
    if (r.success)
      return r.data;
    throw r.error;
  }
  async safeParseAsync(e, t) {
    const r = {
      common: {
        issues: [],
        contextualErrorMap: t == null ? void 0 : t.errorMap,
        async: !0
      },
      path: (t == null ? void 0 : t.path) || [],
      schemaErrorMap: this._def.errorMap,
      parent: null,
      data: e,
      parsedType: O(e)
    }, a = this._parse({ data: e, path: r.path, parent: r }), n = await (U(a) ? a : Promise.resolve(a));
    return ae(r, n);
  }
  refine(e, t) {
    const r = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
    return this._refinement((a, n) => {
      const i = e(a), d = () => n.addIssue({
        code: o.custom,
        ...r(a)
      });
      return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? !0 : (d(), !1)) : i ? !0 : (d(), !1);
    });
  }
  refinement(e, t) {
    return this._refinement((r, a) => e(r) ? !0 : (a.addIssue(typeof t == "function" ? t(r, a) : t), !1));
  }
  _refinement(e) {
    return new M({
      schema: this,
      typeName: p.ZodEffects,
      effect: { type: "refinement", refinement: e }
    });
  }
  superRefine(e) {
    return this._refinement(e);
  }
  constructor(e) {
    this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
      version: 1,
      vendor: "zod",
      validate: (t) => this["~validate"](t)
    };
  }
  optional() {
    return N.create(this, this._def);
  }
  nullable() {
    return D.create(this, this._def);
  }
  nullish() {
    return this.nullable().optional();
  }
  array() {
    return w.create(this);
  }
  promise() {
    return G.create(this, this._def);
  }
  or(e) {
    return J.create([this, e], this._def);
  }
  and(e) {
    return H.create(this, e, this._def);
  }
  transform(e) {
    return new M({
      ..._(this._def),
      schema: this,
      typeName: p.ZodEffects,
      effect: { type: "transform", transform: e }
    });
  }
  default(e) {
    const t = typeof e == "function" ? e : () => e;
    return new Q({
      ..._(this._def),
      innerType: this,
      defaultValue: t,
      typeName: p.ZodDefault
    });
  }
  brand() {
    return new We({
      typeName: p.ZodBranded,
      type: this,
      ..._(this._def)
    });
  }
  catch(e) {
    const t = typeof e == "function" ? e : () => e;
    return new X({
      ..._(this._def),
      innerType: this,
      catchValue: t,
      typeName: p.ZodCatch
    });
  }
  describe(e) {
    const t = this.constructor;
    return new t({
      ...this._def,
      description: e
    });
  }
  pipe(e) {
    return ee.create(this, e);
  }
  readonly() {
    return K.create(this);
  }
  isOptional() {
    return this.safeParse(void 0).success;
  }
  isNullable() {
    return this.safeParse(null).success;
  }
}
const we = /^c[^\s-]{8,}$/i, Ce = /^[0-9a-z]+$/, Te = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Oe = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Se = /^[a-z0-9_-]{21}$/i, Ne = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ae = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ze = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Re = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
let W;
const Ie = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, je = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ee = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, $e = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ve = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Me = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, _e = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Le = new RegExp(`^${_e}$`);
function ye(s) {
  let e = "[0-5]\\d";
  s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`);
  const t = s.precision ? "+" : "?";
  return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
}
function Pe(s) {
  return new RegExp(`^${ye(s)}$`);
}
function ze(s) {
  let e = `${_e}T${ye(s)}`;
  const t = [];
  return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
}
function De(s, e) {
  return !!((e === "v4" || !e) && Ie.test(s) || (e === "v6" || !e) && Ee.test(s));
}
function Ue(s, e) {
  if (!Ne.test(s))
    return !1;
  try {
    const [t] = s.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(r));
    return !(typeof a != "object" || a === null || "typ" in a && (a == null ? void 0 : a.typ) !== "JWT" || !a.alg || e && a.alg !== e);
  } catch {
    return !1;
  }
}
function Be(s, e) {
  return !!((e === "v4" || !e) && je.test(s) || (e === "v6" || !e) && $e.test(s));
}
class C extends y {
  _parse(e) {
    if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
      const n = this._getOrReturnCtx(e);
      return c(n, {
        code: o.invalid_type,
        expected: u.string,
        received: n.parsedType
      }), m;
    }
    const r = new k();
    let a;
    for (const n of this._def.checks)
      if (n.kind === "min")
        e.data.length < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
          code: o.too_small,
          minimum: n.value,
          type: "string",
          inclusive: !0,
          exact: !1,
          message: n.message
        }), r.dirty());
      else if (n.kind === "max")
        e.data.length > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
          code: o.too_big,
          maximum: n.value,
          type: "string",
          inclusive: !0,
          exact: !1,
          message: n.message
        }), r.dirty());
      else if (n.kind === "length") {
        const i = e.data.length > n.value, d = e.data.length < n.value;
        (i || d) && (a = this._getOrReturnCtx(e, a), i ? c(a, {
          code: o.too_big,
          maximum: n.value,
          type: "string",
          inclusive: !0,
          exact: !0,
          message: n.message
        }) : d && c(a, {
          code: o.too_small,
          minimum: n.value,
          type: "string",
          inclusive: !0,
          exact: !0,
          message: n.message
        }), r.dirty());
      } else if (n.kind === "email")
        Ze.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "email",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "emoji")
        W || (W = new RegExp(Re, "u")), W.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "emoji",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "uuid")
        Oe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "uuid",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "nanoid")
        Se.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "nanoid",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "cuid")
        we.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "cuid",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "cuid2")
        Ce.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "cuid2",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "ulid")
        Te.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
          validation: "ulid",
          code: o.invalid_string,
          message: n.message
        }), r.dirty());
      else if (n.kind === "url")
        try {
          new URL(e.data);
        } catch {
          a = this._getOrReturnCtx(e, a), c(a, {
            validation: "url",
            code: o.invalid_string,
            message: n.message
          }), r.dirty();
        }
      else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "regex",
        code: o.invalid_string,
        message: n.message
      }), r.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: { includes: n.value, position: n.position },
        message: n.message
      }), r.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: { startsWith: n.value },
        message: n.message
      }), r.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: { endsWith: n.value },
        message: n.message
      }), r.dirty()) : n.kind === "datetime" ? ze(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: "datetime",
        message: n.message
      }), r.dirty()) : n.kind === "date" ? Le.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: "date",
        message: n.message
      }), r.dirty()) : n.kind === "time" ? Pe(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.invalid_string,
        validation: "time",
        message: n.message
      }), r.dirty()) : n.kind === "duration" ? Ae.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "duration",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : n.kind === "ip" ? De(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "ip",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : n.kind === "jwt" ? Ue(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "jwt",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : n.kind === "cidr" ? Be(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "cidr",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : n.kind === "base64" ? Ve.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "base64",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : n.kind === "base64url" ? Me.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
        validation: "base64url",
        code: o.invalid_string,
        message: n.message
      }), r.dirty()) : g.assertNever(n);
    return { status: r.value, value: e.data };
  }
  _regex(e, t, r) {
    return this.refinement((a) => e.test(a), {
      validation: t,
      code: o.invalid_string,
      ...l.errToObj(r)
    });
  }
  _addCheck(e) {
    return new C({
      ...this._def,
      checks: [...this._def.checks, e]
    });
  }
  email(e) {
    return this._addCheck({ kind: "email", ...l.errToObj(e) });
  }
  url(e) {
    return this._addCheck({ kind: "url", ...l.errToObj(e) });
  }
  emoji(e) {
    return this._addCheck({ kind: "emoji", ...l.errToObj(e) });
  }
  uuid(e) {
    return this._addCheck({ kind: "uuid", ...l.errToObj(e) });
  }
  nanoid(e) {
    return this._addCheck({ kind: "nanoid", ...l.errToObj(e) });
  }
  cuid(e) {
    return this._addCheck({ kind: "cuid", ...l.errToObj(e) });
  }
  cuid2(e) {
    return this._addCheck({ kind: "cuid2", ...l.errToObj(e) });
  }
  ulid(e) {
    return this._addCheck({ kind: "ulid", ...l.errToObj(e) });
  }
  base64(e) {
    return this._addCheck({ kind: "base64", ...l.errToObj(e) });
  }
  base64url(e) {
    return this._addCheck({
      kind: "base64url",
      ...l.errToObj(e)
    });
  }
  jwt(e) {
    return this._addCheck({ kind: "jwt", ...l.errToObj(e) });
  }
  ip(e) {
    return this._addCheck({ kind: "ip", ...l.errToObj(e) });
  }
  cidr(e) {
    return this._addCheck({ kind: "cidr", ...l.errToObj(e) });
  }
  datetime(e) {
    return typeof e == "string" ? this._addCheck({
      kind: "datetime",
      precision: null,
      offset: !1,
      local: !1,
      message: e
    }) : this._addCheck({
      kind: "datetime",
      precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
      offset: (e == null ? void 0 : e.offset) ?? !1,
      local: (e == null ? void 0 : e.local) ?? !1,
      ...l.errToObj(e == null ? void 0 : e.message)
    });
  }
  date(e) {
    return this._addCheck({ kind: "date", message: e });
  }
  time(e) {
    return typeof e == "string" ? this._addCheck({
      kind: "time",
      precision: null,
      message: e
    }) : this._addCheck({
      kind: "time",
      precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
      ...l.errToObj(e == null ? void 0 : e.message)
    });
  }
  duration(e) {
    return this._addCheck({ kind: "duration", ...l.errToObj(e) });
  }
  regex(e, t) {
    return this._addCheck({
      kind: "regex",
      regex: e,
      ...l.errToObj(t)
    });
  }
  includes(e, t) {
    return this._addCheck({
      kind: "includes",
      value: e,
      position: t == null ? void 0 : t.position,
      ...l.errToObj(t == null ? void 0 : t.message)
    });
  }
  startsWith(e, t) {
    return this._addCheck({
      kind: "startsWith",
      value: e,
      ...l.errToObj(t)
    });
  }
  endsWith(e, t) {
    return this._addCheck({
      kind: "endsWith",
      value: e,
      ...l.errToObj(t)
    });
  }
  min(e, t) {
    return this._addCheck({
      kind: "min",
      value: e,
      ...l.errToObj(t)
    });
  }
  max(e, t) {
    return this._addCheck({
      kind: "max",
      value: e,
      ...l.errToObj(t)
    });
  }
  length(e, t) {
    return this._addCheck({
      kind: "length",
      value: e,
      ...l.errToObj(t)
    });
  }
  /**
   * Equivalent to `.min(1)`
   */
  nonempty(e) {
    return this.min(1, l.errToObj(e));
  }
  trim() {
    return new C({
      ...this._def,
      checks: [...this._def.checks, { kind: "trim" }]
    });
  }
  toLowerCase() {
    return new C({
      ...this._def,
      checks: [...this._def.checks, { kind: "toLowerCase" }]
    });
  }
  toUpperCase() {
    return new C({
      ...this._def,
      checks: [...this._def.checks, { kind: "toUpperCase" }]
    });
  }
  get isDatetime() {
    return !!this._def.checks.find((e) => e.kind === "datetime");
  }
  get isDate() {
    return !!this._def.checks.find((e) => e.kind === "date");
  }
  get isTime() {
    return !!this._def.checks.find((e) => e.kind === "time");
  }
  get isDuration() {
    return !!this._def.checks.find((e) => e.kind === "duration");
  }
  get isEmail() {
    return !!this._def.checks.find((e) => e.kind === "email");
  }
  get isURL() {
    return !!this._def.checks.find((e) => e.kind === "url");
  }
  get isEmoji() {
    return !!this._def.checks.find((e) => e.kind === "emoji");
  }
  get isUUID() {
    return !!this._def.checks.find((e) => e.kind === "uuid");
  }
  get isNANOID() {
    return !!this._def.checks.find((e) => e.kind === "nanoid");
  }
  get isCUID() {
    return !!this._def.checks.find((e) => e.kind === "cuid");
  }
  get isCUID2() {
    return !!this._def.checks.find((e) => e.kind === "cuid2");
  }
  get isULID() {
    return !!this._def.checks.find((e) => e.kind === "ulid");
  }
  get isIP() {
    return !!this._def.checks.find((e) => e.kind === "ip");
  }
  get isCIDR() {
    return !!this._def.checks.find((e) => e.kind === "cidr");
  }
  get isBase64() {
    return !!this._def.checks.find((e) => e.kind === "base64");
  }
  get isBase64url() {
    return !!this._def.checks.find((e) => e.kind === "base64url");
  }
  get minLength() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "min" && (e === null || t.value > e) && (e = t.value);
    return e;
  }
  get maxLength() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "max" && (e === null || t.value < e) && (e = t.value);
    return e;
  }
}
C.create = (s) => new C({
  checks: [],
  typeName: p.ZodString,
  coerce: (s == null ? void 0 : s.coerce) ?? !1,
  ..._(s)
});
function Fe(s, e) {
  const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, a = t > r ? t : r, n = Number.parseInt(s.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
  return n % i / 10 ** a;
}
class I extends y {
  constructor() {
    super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
  }
  _parse(e) {
    if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== u.number) {
      const n = this._getOrReturnCtx(e);
      return c(n, {
        code: o.invalid_type,
        expected: u.number,
        received: n.parsedType
      }), m;
    }
    let r;
    const a = new k();
    for (const n of this._def.checks)
      n.kind === "int" ? g.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.invalid_type,
        expected: "integer",
        received: "float",
        message: n.message
      }), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.too_small,
        minimum: n.value,
        type: "number",
        inclusive: n.inclusive,
        exact: !1,
        message: n.message
      }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.too_big,
        maximum: n.value,
        type: "number",
        inclusive: n.inclusive,
        exact: !1,
        message: n.message
      }), a.dirty()) : n.kind === "multipleOf" ? Fe(e.data, n.value) !== 0 && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.not_multiple_of,
        multipleOf: n.value,
        message: n.message
      }), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.not_finite,
        message: n.message
      }), a.dirty()) : g.assertNever(n);
    return { status: a.value, value: e.data };
  }
  gte(e, t) {
    return this.setLimit("min", e, !0, l.toString(t));
  }
  gt(e, t) {
    return this.setLimit("min", e, !1, l.toString(t));
  }
  lte(e, t) {
    return this.setLimit("max", e, !0, l.toString(t));
  }
  lt(e, t) {
    return this.setLimit("max", e, !1, l.toString(t));
  }
  setLimit(e, t, r, a) {
    return new I({
      ...this._def,
      checks: [
        ...this._def.checks,
        {
          kind: e,
          value: t,
          inclusive: r,
          message: l.toString(a)
        }
      ]
    });
  }
  _addCheck(e) {
    return new I({
      ...this._def,
      checks: [...this._def.checks, e]
    });
  }
  int(e) {
    return this._addCheck({
      kind: "int",
      message: l.toString(e)
    });
  }
  positive(e) {
    return this._addCheck({
      kind: "min",
      value: 0,
      inclusive: !1,
      message: l.toString(e)
    });
  }
  negative(e) {
    return this._addCheck({
      kind: "max",
      value: 0,
      inclusive: !1,
      message: l.toString(e)
    });
  }
  nonpositive(e) {
    return this._addCheck({
      kind: "max",
      value: 0,
      inclusive: !0,
      message: l.toString(e)
    });
  }
  nonnegative(e) {
    return this._addCheck({
      kind: "min",
      value: 0,
      inclusive: !0,
      message: l.toString(e)
    });
  }
  multipleOf(e, t) {
    return this._addCheck({
      kind: "multipleOf",
      value: e,
      message: l.toString(t)
    });
  }
  finite(e) {
    return this._addCheck({
      kind: "finite",
      message: l.toString(e)
    });
  }
  safe(e) {
    return this._addCheck({
      kind: "min",
      inclusive: !0,
      value: Number.MIN_SAFE_INTEGER,
      message: l.toString(e)
    })._addCheck({
      kind: "max",
      inclusive: !0,
      value: Number.MAX_SAFE_INTEGER,
      message: l.toString(e)
    });
  }
  get minValue() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "min" && (e === null || t.value > e) && (e = t.value);
    return e;
  }
  get maxValue() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "max" && (e === null || t.value < e) && (e = t.value);
    return e;
  }
  get isInt() {
    return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && g.isInteger(e.value));
  }
  get isFinite() {
    let e = null, t = null;
    for (const r of this._def.checks) {
      if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
        return !0;
      r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
    }
    return Number.isFinite(t) && Number.isFinite(e);
  }
}
I.create = (s) => new I({
  checks: [],
  typeName: p.ZodNumber,
  coerce: (s == null ? void 0 : s.coerce) || !1,
  ..._(s)
});
class j extends y {
  constructor() {
    super(...arguments), this.min = this.gte, this.max = this.lte;
  }
  _parse(e) {
    if (this._def.coerce)
      try {
        e.data = BigInt(e.data);
      } catch {
        return this._getInvalidInput(e);
      }
    if (this._getType(e) !== u.bigint)
      return this._getInvalidInput(e);
    let r;
    const a = new k();
    for (const n of this._def.checks)
      n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.too_small,
        type: "bigint",
        minimum: n.value,
        inclusive: n.inclusive,
        message: n.message
      }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.too_big,
        type: "bigint",
        maximum: n.value,
        inclusive: n.inclusive,
        message: n.message
      }), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), c(r, {
        code: o.not_multiple_of,
        multipleOf: n.value,
        message: n.message
      }), a.dirty()) : g.assertNever(n);
    return { status: a.value, value: e.data };
  }
  _getInvalidInput(e) {
    const t = this._getOrReturnCtx(e);
    return c(t, {
      code: o.invalid_type,
      expected: u.bigint,
      received: t.parsedType
    }), m;
  }
  gte(e, t) {
    return this.setLimit("min", e, !0, l.toString(t));
  }
  gt(e, t) {
    return this.setLimit("min", e, !1, l.toString(t));
  }
  lte(e, t) {
    return this.setLimit("max", e, !0, l.toString(t));
  }
  lt(e, t) {
    return this.setLimit("max", e, !1, l.toString(t));
  }
  setLimit(e, t, r, a) {
    return new j({
      ...this._def,
      checks: [
        ...this._def.checks,
        {
          kind: e,
          value: t,
          inclusive: r,
          message: l.toString(a)
        }
      ]
    });
  }
  _addCheck(e) {
    return new j({
      ...this._def,
      checks: [...this._def.checks, e]
    });
  }
  positive(e) {
    return this._addCheck({
      kind: "min",
      value: BigInt(0),
      inclusive: !1,
      message: l.toString(e)
    });
  }
  negative(e) {
    return this._addCheck({
      kind: "max",
      value: BigInt(0),
      inclusive: !1,
      message: l.toString(e)
    });
  }
  nonpositive(e) {
    return this._addCheck({
      kind: "max",
      value: BigInt(0),
      inclusive: !0,
      message: l.toString(e)
    });
  }
  nonnegative(e) {
    return this._addCheck({
      kind: "min",
      value: BigInt(0),
      inclusive: !0,
      message: l.toString(e)
    });
  }
  multipleOf(e, t) {
    return this._addCheck({
      kind: "multipleOf",
      value: e,
      message: l.toString(t)
    });
  }
  get minValue() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "min" && (e === null || t.value > e) && (e = t.value);
    return e;
  }
  get maxValue() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "max" && (e === null || t.value < e) && (e = t.value);
    return e;
  }
}
j.create = (s) => new j({
  checks: [],
  typeName: p.ZodBigInt,
  coerce: (s == null ? void 0 : s.coerce) ?? !1,
  ..._(s)
});
class B extends y {
  _parse(e) {
    if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.boolean,
        received: r.parsedType
      }), m;
    }
    return b(e.data);
  }
}
B.create = (s) => new B({
  typeName: p.ZodBoolean,
  coerce: (s == null ? void 0 : s.coerce) || !1,
  ..._(s)
});
class E extends y {
  _parse(e) {
    if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
      const n = this._getOrReturnCtx(e);
      return c(n, {
        code: o.invalid_type,
        expected: u.date,
        received: n.parsedType
      }), m;
    }
    if (Number.isNaN(e.data.getTime())) {
      const n = this._getOrReturnCtx(e);
      return c(n, {
        code: o.invalid_date
      }), m;
    }
    const r = new k();
    let a;
    for (const n of this._def.checks)
      n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.too_small,
        message: n.message,
        inclusive: !0,
        exact: !1,
        minimum: n.value,
        type: "date"
      }), r.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
        code: o.too_big,
        message: n.message,
        inclusive: !0,
        exact: !1,
        maximum: n.value,
        type: "date"
      }), r.dirty()) : g.assertNever(n);
    return {
      status: r.value,
      value: new Date(e.data.getTime())
    };
  }
  _addCheck(e) {
    return new E({
      ...this._def,
      checks: [...this._def.checks, e]
    });
  }
  min(e, t) {
    return this._addCheck({
      kind: "min",
      value: e.getTime(),
      message: l.toString(t)
    });
  }
  max(e, t) {
    return this._addCheck({
      kind: "max",
      value: e.getTime(),
      message: l.toString(t)
    });
  }
  get minDate() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "min" && (e === null || t.value > e) && (e = t.value);
    return e != null ? new Date(e) : null;
  }
  get maxDate() {
    let e = null;
    for (const t of this._def.checks)
      t.kind === "max" && (e === null || t.value < e) && (e = t.value);
    return e != null ? new Date(e) : null;
  }
}
E.create = (s) => new E({
  checks: [],
  coerce: (s == null ? void 0 : s.coerce) || !1,
  typeName: p.ZodDate,
  ..._(s)
});
class ne extends y {
  _parse(e) {
    if (this._getType(e) !== u.symbol) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.symbol,
        received: r.parsedType
      }), m;
    }
    return b(e.data);
  }
}
ne.create = (s) => new ne({
  typeName: p.ZodSymbol,
  ..._(s)
});
class ie extends y {
  _parse(e) {
    if (this._getType(e) !== u.undefined) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.undefined,
        received: r.parsedType
      }), m;
    }
    return b(e.data);
  }
}
ie.create = (s) => new ie({
  typeName: p.ZodUndefined,
  ..._(s)
});
class de extends y {
  _parse(e) {
    if (this._getType(e) !== u.null) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.null,
        received: r.parsedType
      }), m;
    }
    return b(e.data);
  }
}
de.create = (s) => new de({
  typeName: p.ZodNull,
  ..._(s)
});
class F extends y {
  constructor() {
    super(...arguments), this._any = !0;
  }
  _parse(e) {
    return b(e.data);
  }
}
F.create = (s) => new F({
  typeName: p.ZodAny,
  ..._(s)
});
class oe extends y {
  constructor() {
    super(...arguments), this._unknown = !0;
  }
  _parse(e) {
    return b(e.data);
  }
}
oe.create = (s) => new oe({
  typeName: p.ZodUnknown,
  ..._(s)
});
class A extends y {
  _parse(e) {
    const t = this._getOrReturnCtx(e);
    return c(t, {
      code: o.invalid_type,
      expected: u.never,
      received: t.parsedType
    }), m;
  }
}
A.create = (s) => new A({
  typeName: p.ZodNever,
  ..._(s)
});
class ce extends y {
  _parse(e) {
    if (this._getType(e) !== u.undefined) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.void,
        received: r.parsedType
      }), m;
    }
    return b(e.data);
  }
}
ce.create = (s) => new ce({
  typeName: p.ZodVoid,
  ..._(s)
});
class w extends y {
  _parse(e) {
    const { ctx: t, status: r } = this._processInputParams(e), a = this._def;
    if (t.parsedType !== u.array)
      return c(t, {
        code: o.invalid_type,
        expected: u.array,
        received: t.parsedType
      }), m;
    if (a.exactLength !== null) {
      const i = t.data.length > a.exactLength.value, d = t.data.length < a.exactLength.value;
      (i || d) && (c(t, {
        code: i ? o.too_big : o.too_small,
        minimum: d ? a.exactLength.value : void 0,
        maximum: i ? a.exactLength.value : void 0,
        type: "array",
        inclusive: !0,
        exact: !0,
        message: a.exactLength.message
      }), r.dirty());
    }
    if (a.minLength !== null && t.data.length < a.minLength.value && (c(t, {
      code: o.too_small,
      minimum: a.minLength.value,
      type: "array",
      inclusive: !0,
      exact: !1,
      message: a.minLength.message
    }), r.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (c(t, {
      code: o.too_big,
      maximum: a.maxLength.value,
      type: "array",
      inclusive: !0,
      exact: !1,
      message: a.maxLength.message
    }), r.dirty()), t.common.async)
      return Promise.all([...t.data].map((i, d) => a.type._parseAsync(new S(t, i, t.path, d)))).then((i) => k.mergeArray(r, i));
    const n = [...t.data].map((i, d) => a.type._parseSync(new S(t, i, t.path, d)));
    return k.mergeArray(r, n);
  }
  get element() {
    return this._def.type;
  }
  min(e, t) {
    return new w({
      ...this._def,
      minLength: { value: e, message: l.toString(t) }
    });
  }
  max(e, t) {
    return new w({
      ...this._def,
      maxLength: { value: e, message: l.toString(t) }
    });
  }
  length(e, t) {
    return new w({
      ...this._def,
      exactLength: { value: e, message: l.toString(t) }
    });
  }
  nonempty(e) {
    return this.min(1, e);
  }
}
w.create = (s, e) => new w({
  type: s,
  minLength: null,
  maxLength: null,
  exactLength: null,
  typeName: p.ZodArray,
  ..._(e)
});
function Z(s) {
  if (s instanceof x) {
    const e = {};
    for (const t in s.shape) {
      const r = s.shape[t];
      e[t] = N.create(Z(r));
    }
    return new x({
      ...s._def,
      shape: () => e
    });
  } else return s instanceof w ? new w({
    ...s._def,
    type: Z(s.element)
  }) : s instanceof N ? N.create(Z(s.unwrap())) : s instanceof D ? D.create(Z(s.unwrap())) : s instanceof $ ? $.create(s.items.map((e) => Z(e))) : s;
}
class x extends y {
  constructor() {
    super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
  }
  _getCached() {
    if (this._cached !== null)
      return this._cached;
    const e = this._def.shape(), t = g.objectKeys(e);
    return this._cached = { shape: e, keys: t }, this._cached;
  }
  _parse(e) {
    if (this._getType(e) !== u.object) {
      const h = this._getOrReturnCtx(e);
      return c(h, {
        code: o.invalid_type,
        expected: u.object,
        received: h.parsedType
      }), m;
    }
    const { status: r, ctx: a } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), d = [];
    if (!(this._def.catchall instanceof A && this._def.unknownKeys === "strip"))
      for (const h in a.data)
        i.includes(h) || d.push(h);
    const f = [];
    for (const h of i) {
      const v = n[h], L = a.data[h];
      f.push({
        key: { status: "valid", value: h },
        value: v._parse(new S(a, L, a.path, h)),
        alwaysSet: h in a.data
      });
    }
    if (this._def.catchall instanceof A) {
      const h = this._def.unknownKeys;
      if (h === "passthrough")
        for (const v of d)
          f.push({
            key: { status: "valid", value: v },
            value: { status: "valid", value: a.data[v] }
          });
      else if (h === "strict")
        d.length > 0 && (c(a, {
          code: o.unrecognized_keys,
          keys: d
        }), r.dirty());
      else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
    } else {
      const h = this._def.catchall;
      for (const v of d) {
        const L = a.data[v];
        f.push({
          key: { status: "valid", value: v },
          value: h._parse(
            new S(a, L, a.path, v)
            //, ctx.child(key), value, getParsedType(value)
          ),
          alwaysSet: v in a.data
        });
      }
    }
    return a.common.async ? Promise.resolve().then(async () => {
      const h = [];
      for (const v of f) {
        const L = await v.key, ve = await v.value;
        h.push({
          key: L,
          value: ve,
          alwaysSet: v.alwaysSet
        });
      }
      return h;
    }).then((h) => k.mergeObjectSync(r, h)) : k.mergeObjectSync(r, f);
  }
  get shape() {
    return this._def.shape();
  }
  strict(e) {
    return new x({
      ...this._def,
      unknownKeys: "strict",
      ...e !== void 0 ? {
        errorMap: (t, r) => {
          var n, i;
          const a = ((i = (n = this._def).errorMap) == null ? void 0 : i.call(n, t, r).message) ?? r.defaultError;
          return t.code === "unrecognized_keys" ? {
            message: l.errToObj(e).message ?? a
          } : {
            message: a
          };
        }
      } : {}
    });
  }
  strip() {
    return new x({
      ...this._def,
      unknownKeys: "strip"
    });
  }
  passthrough() {
    return new x({
      ...this._def,
      unknownKeys: "passthrough"
    });
  }
  // const AugmentFactory =
  //   <Def extends ZodObjectDef>(def: Def) =>
  //   <Augmentation extends ZodRawShape>(
  //     augmentation: Augmentation
  //   ): ZodObject<
  //     extendShape<ReturnType<Def["shape"]>, Augmentation>,
  //     Def["unknownKeys"],
  //     Def["catchall"]
  //   > => {
  //     return new ZodObject({
  //       ...def,
  //       shape: () => ({
  //         ...def.shape(),
  //         ...augmentation,
  //       }),
  //     }) as any;
  //   };
  extend(e) {
    return new x({
      ...this._def,
      shape: () => ({
        ...this._def.shape(),
        ...e
      })
    });
  }
  /**
   * Prior to zod@1.0.12 there was a bug in the
   * inferred type of merged objects. Please
   * upgrade if you are experiencing issues.
   */
  merge(e) {
    return new x({
      unknownKeys: e._def.unknownKeys,
      catchall: e._def.catchall,
      shape: () => ({
        ...this._def.shape(),
        ...e._def.shape()
      }),
      typeName: p.ZodObject
    });
  }
  // merge<
  //   Incoming extends AnyZodObject,
  //   Augmentation extends Incoming["shape"],
  //   NewOutput extends {
  //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
  //       ? Augmentation[k]["_output"]
  //       : k extends keyof Output
  //       ? Output[k]
  //       : never;
  //   },
  //   NewInput extends {
  //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
  //       ? Augmentation[k]["_input"]
  //       : k extends keyof Input
  //       ? Input[k]
  //       : never;
  //   }
  // >(
  //   merging: Incoming
  // ): ZodObject<
  //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
  //   Incoming["_def"]["unknownKeys"],
  //   Incoming["_def"]["catchall"],
  //   NewOutput,
  //   NewInput
  // > {
  //   const merged: any = new ZodObject({
  //     unknownKeys: merging._def.unknownKeys,
  //     catchall: merging._def.catchall,
  //     shape: () =>
  //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
  //     typeName: ZodFirstPartyTypeKind.ZodObject,
  //   }) as any;
  //   return merged;
  // }
  setKey(e, t) {
    return this.augment({ [e]: t });
  }
  // merge<Incoming extends AnyZodObject>(
  //   merging: Incoming
  // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
  // ZodObject<
  //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
  //   Incoming["_def"]["unknownKeys"],
  //   Incoming["_def"]["catchall"]
  // > {
  //   // const mergedShape = objectUtil.mergeShapes(
  //   //   this._def.shape(),
  //   //   merging._def.shape()
  //   // );
  //   const merged: any = new ZodObject({
  //     unknownKeys: merging._def.unknownKeys,
  //     catchall: merging._def.catchall,
  //     shape: () =>
  //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
  //     typeName: ZodFirstPartyTypeKind.ZodObject,
  //   }) as any;
  //   return merged;
  // }
  catchall(e) {
    return new x({
      ...this._def,
      catchall: e
    });
  }
  pick(e) {
    const t = {};
    for (const r of g.objectKeys(e))
      e[r] && this.shape[r] && (t[r] = this.shape[r]);
    return new x({
      ...this._def,
      shape: () => t
    });
  }
  omit(e) {
    const t = {};
    for (const r of g.objectKeys(this.shape))
      e[r] || (t[r] = this.shape[r]);
    return new x({
      ...this._def,
      shape: () => t
    });
  }
  /**
   * @deprecated
   */
  deepPartial() {
    return Z(this);
  }
  partial(e) {
    const t = {};
    for (const r of g.objectKeys(this.shape)) {
      const a = this.shape[r];
      e && !e[r] ? t[r] = a : t[r] = a.optional();
    }
    return new x({
      ...this._def,
      shape: () => t
    });
  }
  required(e) {
    const t = {};
    for (const r of g.objectKeys(this.shape))
      if (e && !e[r])
        t[r] = this.shape[r];
      else {
        let n = this.shape[r];
        for (; n instanceof N; )
          n = n._def.innerType;
        t[r] = n;
      }
    return new x({
      ...this._def,
      shape: () => t
    });
  }
  keyof() {
    return ge(g.objectKeys(this.shape));
  }
}
x.create = (s, e) => new x({
  shape: () => s,
  unknownKeys: "strip",
  catchall: A.create(),
  typeName: p.ZodObject,
  ..._(e)
});
x.strictCreate = (s, e) => new x({
  shape: () => s,
  unknownKeys: "strict",
  catchall: A.create(),
  typeName: p.ZodObject,
  ..._(e)
});
x.lazycreate = (s, e) => new x({
  shape: s,
  unknownKeys: "strip",
  catchall: A.create(),
  typeName: p.ZodObject,
  ..._(e)
});
class J extends y {
  _parse(e) {
    const { ctx: t } = this._processInputParams(e), r = this._def.options;
    function a(n) {
      for (const d of n)
        if (d.result.status === "valid")
          return d.result;
      for (const d of n)
        if (d.result.status === "dirty")
          return t.common.issues.push(...d.ctx.common.issues), d.result;
      const i = n.map((d) => new T(d.ctx.common.issues));
      return c(t, {
        code: o.invalid_union,
        unionErrors: i
      }), m;
    }
    if (t.common.async)
      return Promise.all(r.map(async (n) => {
        const i = {
          ...t,
          common: {
            ...t.common,
            issues: []
          },
          parent: null
        };
        return {
          result: await n._parseAsync({
            data: t.data,
            path: t.path,
            parent: i
          }),
          ctx: i
        };
      })).then(a);
    {
      let n;
      const i = [];
      for (const f of r) {
        const h = {
          ...t,
          common: {
            ...t.common,
            issues: []
          },
          parent: null
        }, v = f._parseSync({
          data: t.data,
          path: t.path,
          parent: h
        });
        if (v.status === "valid")
          return v;
        v.status === "dirty" && !n && (n = { result: v, ctx: h }), h.common.issues.length && i.push(h.common.issues);
      }
      if (n)
        return t.common.issues.push(...n.ctx.common.issues), n.result;
      const d = i.map((f) => new T(f));
      return c(t, {
        code: o.invalid_union,
        unionErrors: d
      }), m;
    }
  }
  get options() {
    return this._def.options;
  }
}
J.create = (s, e) => new J({
  options: s,
  typeName: p.ZodUnion,
  ..._(e)
});
function Y(s, e) {
  const t = O(s), r = O(e);
  if (s === e)
    return { valid: !0, data: s };
  if (t === u.object && r === u.object) {
    const a = g.objectKeys(e), n = g.objectKeys(s).filter((d) => a.indexOf(d) !== -1), i = { ...s, ...e };
    for (const d of n) {
      const f = Y(s[d], e[d]);
      if (!f.valid)
        return { valid: !1 };
      i[d] = f.data;
    }
    return { valid: !0, data: i };
  } else if (t === u.array && r === u.array) {
    if (s.length !== e.length)
      return { valid: !1 };
    const a = [];
    for (let n = 0; n < s.length; n++) {
      const i = s[n], d = e[n], f = Y(i, d);
      if (!f.valid)
        return { valid: !1 };
      a.push(f.data);
    }
    return { valid: !0, data: a };
  } else return t === u.date && r === u.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
}
class H extends y {
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e), a = (n, i) => {
      if (se(n) || se(i))
        return m;
      const d = Y(n.value, i.value);
      return d.valid ? ((re(n) || re(i)) && t.dirty(), { status: t.value, value: d.data }) : (c(r, {
        code: o.invalid_intersection_types
      }), m);
    };
    return r.common.async ? Promise.all([
      this._def.left._parseAsync({
        data: r.data,
        path: r.path,
        parent: r
      }),
      this._def.right._parseAsync({
        data: r.data,
        path: r.path,
        parent: r
      })
    ]).then(([n, i]) => a(n, i)) : a(this._def.left._parseSync({
      data: r.data,
      path: r.path,
      parent: r
    }), this._def.right._parseSync({
      data: r.data,
      path: r.path,
      parent: r
    }));
  }
}
H.create = (s, e, t) => new H({
  left: s,
  right: e,
  typeName: p.ZodIntersection,
  ..._(t)
});
class $ extends y {
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== u.array)
      return c(r, {
        code: o.invalid_type,
        expected: u.array,
        received: r.parsedType
      }), m;
    if (r.data.length < this._def.items.length)
      return c(r, {
        code: o.too_small,
        minimum: this._def.items.length,
        inclusive: !0,
        exact: !1,
        type: "array"
      }), m;
    !this._def.rest && r.data.length > this._def.items.length && (c(r, {
      code: o.too_big,
      maximum: this._def.items.length,
      inclusive: !0,
      exact: !1,
      type: "array"
    }), t.dirty());
    const n = [...r.data].map((i, d) => {
      const f = this._def.items[d] || this._def.rest;
      return f ? f._parse(new S(r, i, r.path, d)) : null;
    }).filter((i) => !!i);
    return r.common.async ? Promise.all(n).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, n);
  }
  get items() {
    return this._def.items;
  }
  rest(e) {
    return new $({
      ...this._def,
      rest: e
    });
  }
}
$.create = (s, e) => {
  if (!Array.isArray(s))
    throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
  return new $({
    items: s,
    typeName: p.ZodTuple,
    rest: null,
    ..._(e)
  });
};
class ue extends y {
  get keySchema() {
    return this._def.keyType;
  }
  get valueSchema() {
    return this._def.valueType;
  }
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== u.map)
      return c(r, {
        code: o.invalid_type,
        expected: u.map,
        received: r.parsedType
      }), m;
    const a = this._def.keyType, n = this._def.valueType, i = [...r.data.entries()].map(([d, f], h) => ({
      key: a._parse(new S(r, d, r.path, [h, "key"])),
      value: n._parse(new S(r, f, r.path, [h, "value"]))
    }));
    if (r.common.async) {
      const d = /* @__PURE__ */ new Map();
      return Promise.resolve().then(async () => {
        for (const f of i) {
          const h = await f.key, v = await f.value;
          if (h.status === "aborted" || v.status === "aborted")
            return m;
          (h.status === "dirty" || v.status === "dirty") && t.dirty(), d.set(h.value, v.value);
        }
        return { status: t.value, value: d };
      });
    } else {
      const d = /* @__PURE__ */ new Map();
      for (const f of i) {
        const h = f.key, v = f.value;
        if (h.status === "aborted" || v.status === "aborted")
          return m;
        (h.status === "dirty" || v.status === "dirty") && t.dirty(), d.set(h.value, v.value);
      }
      return { status: t.value, value: d };
    }
  }
}
ue.create = (s, e, t) => new ue({
  valueType: e,
  keyType: s,
  typeName: p.ZodMap,
  ..._(t)
});
class z extends y {
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== u.set)
      return c(r, {
        code: o.invalid_type,
        expected: u.set,
        received: r.parsedType
      }), m;
    const a = this._def;
    a.minSize !== null && r.data.size < a.minSize.value && (c(r, {
      code: o.too_small,
      minimum: a.minSize.value,
      type: "set",
      inclusive: !0,
      exact: !1,
      message: a.minSize.message
    }), t.dirty()), a.maxSize !== null && r.data.size > a.maxSize.value && (c(r, {
      code: o.too_big,
      maximum: a.maxSize.value,
      type: "set",
      inclusive: !0,
      exact: !1,
      message: a.maxSize.message
    }), t.dirty());
    const n = this._def.valueType;
    function i(f) {
      const h = /* @__PURE__ */ new Set();
      for (const v of f) {
        if (v.status === "aborted")
          return m;
        v.status === "dirty" && t.dirty(), h.add(v.value);
      }
      return { status: t.value, value: h };
    }
    const d = [...r.data.values()].map((f, h) => n._parse(new S(r, f, r.path, h)));
    return r.common.async ? Promise.all(d).then((f) => i(f)) : i(d);
  }
  min(e, t) {
    return new z({
      ...this._def,
      minSize: { value: e, message: l.toString(t) }
    });
  }
  max(e, t) {
    return new z({
      ...this._def,
      maxSize: { value: e, message: l.toString(t) }
    });
  }
  size(e, t) {
    return this.min(e, t).max(e, t);
  }
  nonempty(e) {
    return this.min(1, e);
  }
}
z.create = (s, e) => new z({
  valueType: s,
  minSize: null,
  maxSize: null,
  typeName: p.ZodSet,
  ..._(e)
});
class le extends y {
  get schema() {
    return this._def.getter();
  }
  _parse(e) {
    const { ctx: t } = this._processInputParams(e);
    return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
  }
}
le.create = (s, e) => new le({
  getter: s,
  typeName: p.ZodLazy,
  ..._(e)
});
class fe extends y {
  _parse(e) {
    if (e.data !== this._def.value) {
      const t = this._getOrReturnCtx(e);
      return c(t, {
        received: t.data,
        code: o.invalid_literal,
        expected: this._def.value
      }), m;
    }
    return { status: "valid", value: e.data };
  }
  get value() {
    return this._def.value;
  }
}
fe.create = (s, e) => new fe({
  value: s,
  typeName: p.ZodLiteral,
  ..._(e)
});
function ge(s, e) {
  return new V({
    values: s,
    typeName: p.ZodEnum,
    ..._(e)
  });
}
class V extends y {
  _parse(e) {
    if (typeof e.data != "string") {
      const t = this._getOrReturnCtx(e), r = this._def.values;
      return c(t, {
        expected: g.joinValues(r),
        received: t.parsedType,
        code: o.invalid_type
      }), m;
    }
    if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
      const t = this._getOrReturnCtx(e), r = this._def.values;
      return c(t, {
        received: t.data,
        code: o.invalid_enum_value,
        options: r
      }), m;
    }
    return b(e.data);
  }
  get options() {
    return this._def.values;
  }
  get enum() {
    const e = {};
    for (const t of this._def.values)
      e[t] = t;
    return e;
  }
  get Values() {
    const e = {};
    for (const t of this._def.values)
      e[t] = t;
    return e;
  }
  get Enum() {
    const e = {};
    for (const t of this._def.values)
      e[t] = t;
    return e;
  }
  extract(e, t = this._def) {
    return V.create(e, {
      ...this._def,
      ...t
    });
  }
  exclude(e, t = this._def) {
    return V.create(this.options.filter((r) => !e.includes(r)), {
      ...this._def,
      ...t
    });
  }
}
V.create = ge;
class he extends y {
  _parse(e) {
    const t = g.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
    if (r.parsedType !== u.string && r.parsedType !== u.number) {
      const a = g.objectValues(t);
      return c(r, {
        expected: g.joinValues(a),
        received: r.parsedType,
        code: o.invalid_type
      }), m;
    }
    if (this._cache || (this._cache = new Set(g.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
      const a = g.objectValues(t);
      return c(r, {
        received: r.data,
        code: o.invalid_enum_value,
        options: a
      }), m;
    }
    return b(e.data);
  }
  get enum() {
    return this._def.values;
  }
}
he.create = (s, e) => new he({
  values: s,
  typeName: p.ZodNativeEnum,
  ..._(e)
});
class G extends y {
  unwrap() {
    return this._def.type;
  }
  _parse(e) {
    const { ctx: t } = this._processInputParams(e);
    if (t.parsedType !== u.promise && t.common.async === !1)
      return c(t, {
        code: o.invalid_type,
        expected: u.promise,
        received: t.parsedType
      }), m;
    const r = t.parsedType === u.promise ? t.data : Promise.resolve(t.data);
    return b(r.then((a) => this._def.type.parseAsync(a, {
      path: t.path,
      errorMap: t.common.contextualErrorMap
    })));
  }
}
G.create = (s, e) => new G({
  type: s,
  typeName: p.ZodPromise,
  ..._(e)
});
class M extends y {
  innerType() {
    return this._def.schema;
  }
  sourceType() {
    return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
  }
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e), a = this._def.effect || null, n = {
      addIssue: (i) => {
        c(r, i), i.fatal ? t.abort() : t.dirty();
      },
      get path() {
        return r.path;
      }
    };
    if (n.addIssue = n.addIssue.bind(n), a.type === "preprocess") {
      const i = a.transform(r.data, n);
      if (r.common.async)
        return Promise.resolve(i).then(async (d) => {
          if (t.value === "aborted")
            return m;
          const f = await this._def.schema._parseAsync({
            data: d,
            path: r.path,
            parent: r
          });
          return f.status === "aborted" ? m : f.status === "dirty" || t.value === "dirty" ? P(f.value) : f;
        });
      {
        if (t.value === "aborted")
          return m;
        const d = this._def.schema._parseSync({
          data: i,
          path: r.path,
          parent: r
        });
        return d.status === "aborted" ? m : d.status === "dirty" || t.value === "dirty" ? P(d.value) : d;
      }
    }
    if (a.type === "refinement") {
      const i = (d) => {
        const f = a.refinement(d, n);
        if (r.common.async)
          return Promise.resolve(f);
        if (f instanceof Promise)
          throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
        return d;
      };
      if (r.common.async === !1) {
        const d = this._def.schema._parseSync({
          data: r.data,
          path: r.path,
          parent: r
        });
        return d.status === "aborted" ? m : (d.status === "dirty" && t.dirty(), i(d.value), { status: t.value, value: d.value });
      } else
        return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((d) => d.status === "aborted" ? m : (d.status === "dirty" && t.dirty(), i(d.value).then(() => ({ status: t.value, value: d.value }))));
    }
    if (a.type === "transform")
      if (r.common.async === !1) {
        const i = this._def.schema._parseSync({
          data: r.data,
          path: r.path,
          parent: r
        });
        if (!R(i))
          return m;
        const d = a.transform(i.value, n);
        if (d instanceof Promise)
          throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
        return { status: t.value, value: d };
      } else
        return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => R(i) ? Promise.resolve(a.transform(i.value, n)).then((d) => ({
          status: t.value,
          value: d
        })) : m);
    g.assertNever(a);
  }
}
M.create = (s, e, t) => new M({
  schema: s,
  typeName: p.ZodEffects,
  effect: e,
  ..._(t)
});
M.createWithPreprocess = (s, e, t) => new M({
  schema: e,
  effect: { type: "preprocess", transform: s },
  typeName: p.ZodEffects,
  ..._(t)
});
class N extends y {
  _parse(e) {
    return this._getType(e) === u.undefined ? b(void 0) : this._def.innerType._parse(e);
  }
  unwrap() {
    return this._def.innerType;
  }
}
N.create = (s, e) => new N({
  innerType: s,
  typeName: p.ZodOptional,
  ..._(e)
});
class D extends y {
  _parse(e) {
    return this._getType(e) === u.null ? b(null) : this._def.innerType._parse(e);
  }
  unwrap() {
    return this._def.innerType;
  }
}
D.create = (s, e) => new D({
  innerType: s,
  typeName: p.ZodNullable,
  ..._(e)
});
class Q extends y {
  _parse(e) {
    const { ctx: t } = this._processInputParams(e);
    let r = t.data;
    return t.parsedType === u.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
      data: r,
      path: t.path,
      parent: t
    });
  }
  removeDefault() {
    return this._def.innerType;
  }
}
Q.create = (s, e) => new Q({
  innerType: s,
  typeName: p.ZodDefault,
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
  ..._(e)
});
class X extends y {
  _parse(e) {
    const { ctx: t } = this._processInputParams(e), r = {
      ...t,
      common: {
        ...t.common,
        issues: []
      }
    }, a = this._def.innerType._parse({
      data: r.data,
      path: r.path,
      parent: {
        ...r
      }
    });
    return U(a) ? a.then((n) => ({
      status: "valid",
      value: n.status === "valid" ? n.value : this._def.catchValue({
        get error() {
          return new T(r.common.issues);
        },
        input: r.data
      })
    })) : {
      status: "valid",
      value: a.status === "valid" ? a.value : this._def.catchValue({
        get error() {
          return new T(r.common.issues);
        },
        input: r.data
      })
    };
  }
  removeCatch() {
    return this._def.innerType;
  }
}
X.create = (s, e) => new X({
  innerType: s,
  typeName: p.ZodCatch,
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
  ..._(e)
});
class me extends y {
  _parse(e) {
    if (this._getType(e) !== u.nan) {
      const r = this._getOrReturnCtx(e);
      return c(r, {
        code: o.invalid_type,
        expected: u.nan,
        received: r.parsedType
      }), m;
    }
    return { status: "valid", value: e.data };
  }
}
me.create = (s) => new me({
  typeName: p.ZodNaN,
  ..._(s)
});
class We extends y {
  _parse(e) {
    const { ctx: t } = this._processInputParams(e), r = t.data;
    return this._def.type._parse({
      data: r,
      path: t.path,
      parent: t
    });
  }
  unwrap() {
    return this._def.type;
  }
}
class ee extends y {
  _parse(e) {
    const { status: t, ctx: r } = this._processInputParams(e);
    if (r.common.async)
      return (async () => {
        const n = await this._def.in._parseAsync({
          data: r.data,
          path: r.path,
          parent: r
        });
        return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), P(n.value)) : this._def.out._parseAsync({
          data: n.value,
          path: r.path,
          parent: r
        });
      })();
    {
      const a = this._def.in._parseSync({
        data: r.data,
        path: r.path,
        parent: r
      });
      return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), {
        status: "dirty",
        value: a.value
      }) : this._def.out._parseSync({
        data: a.value,
        path: r.path,
        parent: r
      });
    }
  }
  static create(e, t) {
    return new ee({
      in: e,
      out: t,
      typeName: p.ZodPipeline
    });
  }
}
class K extends y {
  _parse(e) {
    const t = this._def.innerType._parse(e), r = (a) => (R(a) && (a.value = Object.freeze(a.value)), a);
    return U(t) ? t.then((a) => r(a)) : r(t);
  }
  unwrap() {
    return this._def.innerType;
  }
}
K.create = (s, e) => new K({
  innerType: s,
  typeName: p.ZodReadonly,
  ..._(e)
});
function pe(s, e) {
  const t = typeof s == "function" ? s(e) : typeof s == "string" ? { message: s } : s;
  return typeof t == "string" ? { message: t } : t;
}
function qe(s, e = {}, t) {
  return s ? F.create().superRefine((r, a) => {
    const n = s(r);
    if (n instanceof Promise)
      return n.then((i) => {
        if (!i) {
          const d = pe(e, r), f = d.fatal ?? t ?? !0;
          a.addIssue({ code: "custom", ...d, fatal: f });
        }
      });
    if (!n) {
      const i = pe(e, r), d = i.fatal ?? t ?? !0;
      a.addIssue({ code: "custom", ...i, fatal: d });
    }
  }) : F.create();
}
var p;
(function(s) {
  s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
})(p || (p = {}));
const Je = (s, e = {
  message: `Input not instance of ${s.name}`
}) => qe((t) => t instanceof s, e), Ye = C.create, He = B.create, Ge = E.create, Qe = w.create, Xe = x.create, Ke = V.create, et = {
  string: ((s) => C.create({ ...s, coerce: !0 })),
  number: ((s) => I.create({ ...s, coerce: !0 })),
  boolean: ((s) => B.create({
    ...s,
    coerce: !0
  })),
  bigint: ((s) => j.create({ ...s, coerce: !0 })),
  date: ((s) => E.create({ ...s, coerce: !0 }))
};
export {
  o as Z,
  Qe as a,
  He as b,
  et as c,
  Ge as d,
  Ke as e,
  Je as i,
  Xe as o,
  Ye as s
};
//# sourceMappingURL=types-Brp6Qwfh.js.map
