import { datetime as K, date as J, time as M, duration as Y } from "./iso.js";
import { parse as V, safeParse as X, parseAsync as q, safeParseAsync as H, encode as Q, decode as s, encodeAsync as ee, decodeAsync as oe, safeEncode as ce, safeDecode as re, safeEncodeAsync as ne, safeDecodeAsync as ae } from "./parse.js";
import { $constructor as n, $ZodEncodeError as ue } from "../core/core.js";
import { normalizeParams as l, assignProp as f, defineLazy as te, extend as de, safeExtend as le, merge as ie, pick as pe, omit as Ze, partial as me, required as he, objectClone as I, clone as ye, shallowClone as C, issue as g } from "../core/util.js";
import { _string as ke, _custom as _e, _boolean as fe, _unknown as Ie, _array as we, _base64 as j, _number as ve, _never as ge, _null as be, _email as $e, _url as De, _jwt as Ue, _emoji as Te, _guid as b, _uuid as Ne, _uuidv4 as Ee, _uuidv6 as ze, _uuidv7 as Pe, _nanoid as Ce, _cuid as je, _cuid2 as Oe, _ulid as xe, _base64url as Ae, _xid as Le, _ksuid as Re, _ipv4 as Se, _ipv6 as Fe, _cidrv4 as Be, _cidrv6 as We, _e164 as Ge, _gt as $, _gte as h, _lt as D, _lte as y, _multipleOf as U, _minLength as m, _maxLength as O, _length as x, _overwrite as Ke, _regex as Je, _includes as Me, _startsWith as Ye, _endsWith as Ve, _lowercase as Xe, _uppercase as qe, _trim as He, _normalize as Qe, _toLowerCase as se, _toUpperCase as eo, _int as oo, _refine as co, _superRefine as ro } from "../core/api.js";
import { $ZodObjectJIT as no, $ZodUnion as ao, $ZodDiscriminatedUnion as uo, $ZodRecord as to, $ZodEnum as lo, $ZodLiteral as io, $ZodOptional as po, $ZodNonOptional as Zo, $ZodLazy as mo, $ZodCustom as ho, $ZodString as A, $ZodBase64 as yo, $ZodNumber as ko, $ZodBoolean as _o, $ZodNull as fo, $ZodUnknown as Io, $ZodNever as wo, $ZodArray as vo, $ZodType as go, $ZodStringFormat as bo, $ZodNullable as $o, $ZodIntersection as Do, $ZodPipe as Uo, $ZodTransform as To, $ZodDefault as No, $ZodPrefault as Eo, $ZodCatch as zo, $ZodReadonly as Po, $ZodEmail as Co, $ZodGUID as jo, $ZodUUID as Oo, $ZodURL as xo, $ZodEmoji as Ao, $ZodNanoID as Lo, $ZodCUID as Ro, $ZodCUID2 as So, $ZodULID as Fo, $ZodXID as Bo, $ZodKSUID as Wo, $ZodIPv4 as Go, $ZodIPv6 as Ko, $ZodCIDRv4 as Jo, $ZodCIDRv6 as Mo, $ZodBase64URL as Yo, $ZodE164 as Vo, $ZodJWT as Xo, $ZodNumberFormat as qo } from "../core/schemas.js";
import { globalRegistry as p } from "../core/registries.js";
const a = /* @__PURE__ */ n("ZodType", (e, o) => (go.init(e, o), e.def = o, e.type = o.type, Object.defineProperty(e, "_def", { value: o }), e.check = (...c) => e.clone(
  {
    ...o,
    checks: [
      ...o.checks ?? [],
      ...c.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
    ]
  }
  // { parent: true }
), e.clone = (c, r) => ye(e, c, r), e.brand = () => e, e.register = (c, r) => (c.add(e, r), e), e.parse = (c, r) => V(e, c, r, { callee: e.parse }), e.safeParse = (c, r) => X(e, c, r), e.parseAsync = async (c, r) => q(e, c, r, { callee: e.parseAsync }), e.safeParseAsync = async (c, r) => H(e, c, r), e.spa = e.safeParseAsync, e.encode = (c, r) => Q(e, c, r), e.decode = (c, r) => s(e, c, r), e.encodeAsync = async (c, r) => ee(e, c, r), e.decodeAsync = async (c, r) => oe(e, c, r), e.safeEncode = (c, r) => ce(e, c, r), e.safeDecode = (c, r) => re(e, c, r), e.safeEncodeAsync = async (c, r) => ne(e, c, r), e.safeDecodeAsync = async (c, r) => ae(e, c, r), e.refine = (c, r) => e.check(Wc(c, r)), e.superRefine = (c) => e.check(Gc(c)), e.overwrite = (c) => e.check(Ke(c)), e.optional = () => E(e), e.nullable = () => z(e), e.nullish = () => E(z(e)), e.nonoptional = (c) => xc(e, c), e.array = () => wc(e), e.or = (c) => vc([e, c]), e.and = (c) => $c(e, c), e.transform = (c) => P(e, Ec(c)), e.default = (c) => Cc(e, c), e.prefault = (c) => Oc(e, c), e.catch = (c) => Lc(e, c), e.pipe = (c) => P(e, c), e.readonly = () => Fc(e), e.describe = (c) => {
  const r = e.clone();
  return p.add(r, { description: c }), r;
}, Object.defineProperty(e, "description", {
  get() {
    return p.get(e)?.description;
  },
  configurable: !0
}), e.meta = (...c) => {
  if (c.length === 0)
    return p.get(e);
  const r = e.clone();
  return p.add(r, c[0]), r;
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), L = /* @__PURE__ */ n("_ZodString", (e, o) => {
  A.init(e, o), a.init(e, o);
  const c = e._zod.bag;
  e.format = c.format ?? null, e.minLength = c.minimum ?? null, e.maxLength = c.maximum ?? null, e.regex = (...r) => e.check(Je(...r)), e.includes = (...r) => e.check(Me(...r)), e.startsWith = (...r) => e.check(Ye(...r)), e.endsWith = (...r) => e.check(Ve(...r)), e.min = (...r) => e.check(m(...r)), e.max = (...r) => e.check(O(...r)), e.length = (...r) => e.check(x(...r)), e.nonempty = (...r) => e.check(m(1, ...r)), e.lowercase = (r) => e.check(Xe(r)), e.uppercase = (r) => e.check(qe(r)), e.trim = () => e.check(He()), e.normalize = (...r) => e.check(Qe(...r)), e.toLowerCase = () => e.check(se()), e.toUpperCase = () => e.check(eo());
}), Ho = /* @__PURE__ */ n("ZodString", (e, o) => {
  A.init(e, o), L.init(e, o), e.email = (c) => e.check($e(Qo, c)), e.url = (c) => e.check(De(so, c)), e.jwt = (c) => e.check(Ue(mc, c)), e.emoji = (c) => e.check(Te(ec, c)), e.guid = (c) => e.check(b(T, c)), e.uuid = (c) => e.check(Ne(Z, c)), e.uuidv4 = (c) => e.check(Ee(Z, c)), e.uuidv6 = (c) => e.check(ze(Z, c)), e.uuidv7 = (c) => e.check(Pe(Z, c)), e.nanoid = (c) => e.check(Ce(oc, c)), e.guid = (c) => e.check(b(T, c)), e.cuid = (c) => e.check(je(cc, c)), e.cuid2 = (c) => e.check(Oe(rc, c)), e.ulid = (c) => e.check(xe(nc, c)), e.base64 = (c) => e.check(j(R, c)), e.base64url = (c) => e.check(Ae(pc, c)), e.xid = (c) => e.check(Le(ac, c)), e.ksuid = (c) => e.check(Re(uc, c)), e.ipv4 = (c) => e.check(Se(tc, c)), e.ipv6 = (c) => e.check(Fe(dc, c)), e.cidrv4 = (c) => e.check(Be(lc, c)), e.cidrv6 = (c) => e.check(We(ic, c)), e.e164 = (c) => e.check(Ge(Zc, c)), e.datetime = (c) => e.check(K(c)), e.date = (c) => e.check(J(c)), e.time = (c) => e.check(M(c)), e.duration = (c) => e.check(Y(c));
});
function Hc(e) {
  return ke(Ho, e);
}
const t = /* @__PURE__ */ n("ZodStringFormat", (e, o) => {
  bo.init(e, o), L.init(e, o);
}), Qo = /* @__PURE__ */ n("ZodEmail", (e, o) => {
  Co.init(e, o), t.init(e, o);
}), T = /* @__PURE__ */ n("ZodGUID", (e, o) => {
  jo.init(e, o), t.init(e, o);
}), Z = /* @__PURE__ */ n("ZodUUID", (e, o) => {
  Oo.init(e, o), t.init(e, o);
}), so = /* @__PURE__ */ n("ZodURL", (e, o) => {
  xo.init(e, o), t.init(e, o);
}), ec = /* @__PURE__ */ n("ZodEmoji", (e, o) => {
  Ao.init(e, o), t.init(e, o);
}), oc = /* @__PURE__ */ n("ZodNanoID", (e, o) => {
  Lo.init(e, o), t.init(e, o);
}), cc = /* @__PURE__ */ n("ZodCUID", (e, o) => {
  Ro.init(e, o), t.init(e, o);
}), rc = /* @__PURE__ */ n("ZodCUID2", (e, o) => {
  So.init(e, o), t.init(e, o);
}), nc = /* @__PURE__ */ n("ZodULID", (e, o) => {
  Fo.init(e, o), t.init(e, o);
}), ac = /* @__PURE__ */ n("ZodXID", (e, o) => {
  Bo.init(e, o), t.init(e, o);
}), uc = /* @__PURE__ */ n("ZodKSUID", (e, o) => {
  Wo.init(e, o), t.init(e, o);
}), tc = /* @__PURE__ */ n("ZodIPv4", (e, o) => {
  Go.init(e, o), t.init(e, o);
}), dc = /* @__PURE__ */ n("ZodIPv6", (e, o) => {
  Ko.init(e, o), t.init(e, o);
}), lc = /* @__PURE__ */ n("ZodCIDRv4", (e, o) => {
  Jo.init(e, o), t.init(e, o);
}), ic = /* @__PURE__ */ n("ZodCIDRv6", (e, o) => {
  Mo.init(e, o), t.init(e, o);
}), R = /* @__PURE__ */ n("ZodBase64", (e, o) => {
  yo.init(e, o), t.init(e, o);
});
function Qc(e) {
  return j(R, e);
}
const pc = /* @__PURE__ */ n("ZodBase64URL", (e, o) => {
  Yo.init(e, o), t.init(e, o);
}), Zc = /* @__PURE__ */ n("ZodE164", (e, o) => {
  Vo.init(e, o), t.init(e, o);
}), mc = /* @__PURE__ */ n("ZodJWT", (e, o) => {
  Xo.init(e, o), t.init(e, o);
}), S = /* @__PURE__ */ n("ZodNumber", (e, o) => {
  ko.init(e, o), a.init(e, o), e.gt = (r, u) => e.check($(r, u)), e.gte = (r, u) => e.check(h(r, u)), e.min = (r, u) => e.check(h(r, u)), e.lt = (r, u) => e.check(D(r, u)), e.lte = (r, u) => e.check(y(r, u)), e.max = (r, u) => e.check(y(r, u)), e.int = (r) => e.check(N(r)), e.safe = (r) => e.check(N(r)), e.positive = (r) => e.check($(0, r)), e.nonnegative = (r) => e.check(h(0, r)), e.negative = (r) => e.check(D(0, r)), e.nonpositive = (r) => e.check(y(0, r)), e.multipleOf = (r, u) => e.check(U(r, u)), e.step = (r, u) => e.check(U(r, u)), e.finite = () => e;
  const c = e._zod.bag;
  e.minValue = Math.max(c.minimum ?? Number.NEGATIVE_INFINITY, c.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(c.maximum ?? Number.POSITIVE_INFINITY, c.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (c.format ?? "").includes("int") || Number.isSafeInteger(c.multipleOf ?? 0.5), e.isFinite = !0, e.format = c.format ?? null;
});
function sc(e) {
  return ve(S, e);
}
const hc = /* @__PURE__ */ n("ZodNumberFormat", (e, o) => {
  qo.init(e, o), S.init(e, o);
});
function N(e) {
  return oo(hc, e);
}
const yc = /* @__PURE__ */ n("ZodBoolean", (e, o) => {
  _o.init(e, o), a.init(e, o);
});
function er(e) {
  return fe(yc, e);
}
const kc = /* @__PURE__ */ n("ZodNull", (e, o) => {
  fo.init(e, o), a.init(e, o);
});
function or(e) {
  return be(kc, e);
}
const _c = /* @__PURE__ */ n("ZodUnknown", (e, o) => {
  Io.init(e, o), a.init(e, o);
});
function k() {
  return Ie(_c);
}
const fc = /* @__PURE__ */ n("ZodNever", (e, o) => {
  wo.init(e, o), a.init(e, o);
});
function F(e) {
  return ge(fc, e);
}
const Ic = /* @__PURE__ */ n("ZodArray", (e, o) => {
  vo.init(e, o), a.init(e, o), e.element = o.element, e.min = (c, r) => e.check(m(c, r)), e.nonempty = (c) => e.check(m(1, c)), e.max = (c, r) => e.check(O(c, r)), e.length = (c, r) => e.check(x(c, r)), e.unwrap = () => e.element;
});
function wc(e, o) {
  return we(Ic, e, o);
}
const w = /* @__PURE__ */ n("ZodObject", (e, o) => {
  no.init(e, o), a.init(e, o), te(e, "shape", () => o.shape), e.keyof = () => Uc(Object.keys(e._zod.def.shape)), e.catchall = (c) => e.clone({ ...e._zod.def, catchall: c }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: k() }), e.loose = () => e.clone({ ...e._zod.def, catchall: k() }), e.strict = () => e.clone({ ...e._zod.def, catchall: F() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (c) => de(e, c), e.safeExtend = (c) => le(e, c), e.merge = (c) => ie(e, c), e.pick = (c) => pe(e, c), e.omit = (c) => Ze(e, c), e.partial = (...c) => me(W, e, c[0]), e.required = (...c) => he(G, e, c[0]);
});
function cr(e, o) {
  const c = {
    type: "object",
    get shape() {
      return f(this, "shape", e ? I(e) : {}), this.shape;
    },
    ...l(o)
  };
  return new w(c);
}
function rr(e, o) {
  return new w({
    type: "object",
    get shape() {
      return f(this, "shape", I(e)), this.shape;
    },
    catchall: F(),
    ...l(o)
  });
}
function nr(e, o) {
  return new w({
    type: "object",
    get shape() {
      return f(this, "shape", I(e)), this.shape;
    },
    catchall: k(),
    ...l(o)
  });
}
const B = /* @__PURE__ */ n("ZodUnion", (e, o) => {
  ao.init(e, o), a.init(e, o), e.options = o.options;
});
function vc(e, o) {
  return new B({
    type: "union",
    options: e,
    ...l(o)
  });
}
const gc = /* @__PURE__ */ n("ZodDiscriminatedUnion", (e, o) => {
  B.init(e, o), uo.init(e, o);
});
function ar(e, o, c) {
  return new gc({
    type: "union",
    options: o,
    discriminator: e,
    ...l(c)
  });
}
const bc = /* @__PURE__ */ n("ZodIntersection", (e, o) => {
  Do.init(e, o), a.init(e, o);
});
function $c(e, o) {
  return new bc({
    type: "intersection",
    left: e,
    right: o
  });
}
const Dc = /* @__PURE__ */ n("ZodRecord", (e, o) => {
  to.init(e, o), a.init(e, o), e.keyType = o.keyType, e.valueType = o.valueType;
});
function ur(e, o, c) {
  return new Dc({
    type: "record",
    keyType: e,
    valueType: o,
    ...l(c)
  });
}
const _ = /* @__PURE__ */ n("ZodEnum", (e, o) => {
  lo.init(e, o), a.init(e, o), e.enum = o.entries, e.options = Object.values(o.entries);
  const c = new Set(Object.keys(o.entries));
  e.extract = (r, u) => {
    const i = {};
    for (const d of r)
      if (c.has(d))
        i[d] = o.entries[d];
      else
        throw new Error(`Key ${d} not found in enum`);
    return new _({
      ...o,
      checks: [],
      ...l(u),
      entries: i
    });
  }, e.exclude = (r, u) => {
    const i = { ...o.entries };
    for (const d of r)
      if (c.has(d))
        delete i[d];
      else
        throw new Error(`Key ${d} not found in enum`);
    return new _({
      ...o,
      checks: [],
      ...l(u),
      entries: i
    });
  };
});
function Uc(e, o) {
  const c = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
  return new _({
    type: "enum",
    entries: c,
    ...l(o)
  });
}
const Tc = /* @__PURE__ */ n("ZodLiteral", (e, o) => {
  io.init(e, o), a.init(e, o), e.values = new Set(o.values), Object.defineProperty(e, "value", {
    get() {
      if (o.values.length > 1)
        throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
      return o.values[0];
    }
  });
});
function tr(e, o) {
  return new Tc({
    type: "literal",
    values: Array.isArray(e) ? e : [e],
    ...l(o)
  });
}
const Nc = /* @__PURE__ */ n("ZodTransform", (e, o) => {
  To.init(e, o), a.init(e, o), e._zod.parse = (c, r) => {
    if (r.direction === "backward")
      throw new ue(e.constructor.name);
    c.addIssue = (i) => {
      if (typeof i == "string")
        c.issues.push(g(i, c.value, o));
      else {
        const d = i;
        d.fatal && (d.continue = !1), d.code ?? (d.code = "custom"), d.input ?? (d.input = c.value), d.inst ?? (d.inst = e), c.issues.push(g(d));
      }
    };
    const u = o.transform(c.value, c);
    return u instanceof Promise ? u.then((i) => (c.value = i, c)) : (c.value = u, c);
  };
});
function Ec(e) {
  return new Nc({
    type: "transform",
    transform: e
  });
}
const W = /* @__PURE__ */ n("ZodOptional", (e, o) => {
  po.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function E(e) {
  return new W({
    type: "optional",
    innerType: e
  });
}
const zc = /* @__PURE__ */ n("ZodNullable", (e, o) => {
  $o.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function z(e) {
  return new zc({
    type: "nullable",
    innerType: e
  });
}
const Pc = /* @__PURE__ */ n("ZodDefault", (e, o) => {
  No.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
});
function Cc(e, o) {
  return new Pc({
    type: "default",
    innerType: e,
    get defaultValue() {
      return typeof o == "function" ? o() : C(o);
    }
  });
}
const jc = /* @__PURE__ */ n("ZodPrefault", (e, o) => {
  Eo.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function Oc(e, o) {
  return new jc({
    type: "prefault",
    innerType: e,
    get defaultValue() {
      return typeof o == "function" ? o() : C(o);
    }
  });
}
const G = /* @__PURE__ */ n("ZodNonOptional", (e, o) => {
  Zo.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function xc(e, o) {
  return new G({
    type: "nonoptional",
    innerType: e,
    ...l(o)
  });
}
const Ac = /* @__PURE__ */ n("ZodCatch", (e, o) => {
  zo.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
});
function Lc(e, o) {
  return new Ac({
    type: "catch",
    innerType: e,
    catchValue: typeof o == "function" ? o : () => o
  });
}
const Rc = /* @__PURE__ */ n("ZodPipe", (e, o) => {
  Uo.init(e, o), a.init(e, o), e.in = o.in, e.out = o.out;
});
function P(e, o) {
  return new Rc({
    type: "pipe",
    in: e,
    out: o
    // ...util.normalizeParams(params),
  });
}
const Sc = /* @__PURE__ */ n("ZodReadonly", (e, o) => {
  Po.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.innerType;
});
function Fc(e) {
  return new Sc({
    type: "readonly",
    innerType: e
  });
}
const Bc = /* @__PURE__ */ n("ZodLazy", (e, o) => {
  mo.init(e, o), a.init(e, o), e.unwrap = () => e._zod.def.getter();
});
function dr(e) {
  return new Bc({
    type: "lazy",
    getter: e
  });
}
const v = /* @__PURE__ */ n("ZodCustom", (e, o) => {
  ho.init(e, o), a.init(e, o);
});
function lr(e, o) {
  return _e(v, e ?? (() => !0), o);
}
function Wc(e, o = {}) {
  return co(v, e, o);
}
function Gc(e) {
  return ro(e);
}
function ir(e, o = {
  error: `Input not instance of ${e.name}`
}) {
  const c = new v({
    type: "custom",
    check: "custom",
    fn: (r) => r instanceof e,
    abort: !0,
    ...l(o)
  });
  return c._zod.bag.Class = e, c;
}
export {
  Ic as ZodArray,
  R as ZodBase64,
  pc as ZodBase64URL,
  yc as ZodBoolean,
  lc as ZodCIDRv4,
  ic as ZodCIDRv6,
  cc as ZodCUID,
  rc as ZodCUID2,
  Ac as ZodCatch,
  v as ZodCustom,
  Pc as ZodDefault,
  gc as ZodDiscriminatedUnion,
  Zc as ZodE164,
  Qo as ZodEmail,
  ec as ZodEmoji,
  _ as ZodEnum,
  T as ZodGUID,
  tc as ZodIPv4,
  dc as ZodIPv6,
  bc as ZodIntersection,
  mc as ZodJWT,
  uc as ZodKSUID,
  Bc as ZodLazy,
  Tc as ZodLiteral,
  oc as ZodNanoID,
  fc as ZodNever,
  G as ZodNonOptional,
  kc as ZodNull,
  zc as ZodNullable,
  S as ZodNumber,
  hc as ZodNumberFormat,
  w as ZodObject,
  W as ZodOptional,
  Rc as ZodPipe,
  jc as ZodPrefault,
  Sc as ZodReadonly,
  Dc as ZodRecord,
  Ho as ZodString,
  t as ZodStringFormat,
  Nc as ZodTransform,
  a as ZodType,
  nc as ZodULID,
  so as ZodURL,
  Z as ZodUUID,
  B as ZodUnion,
  _c as ZodUnknown,
  ac as ZodXID,
  L as _ZodString,
  Cc as _default,
  wc as array,
  Qc as base64,
  er as boolean,
  Lc as catch,
  lr as custom,
  ar as discriminatedUnion,
  Uc as enum,
  ir as instanceof,
  N as int,
  $c as intersection,
  dr as lazy,
  tr as literal,
  nr as looseObject,
  F as never,
  xc as nonoptional,
  or as null,
  z as nullable,
  sc as number,
  cr as object,
  E as optional,
  P as pipe,
  Oc as prefault,
  Fc as readonly,
  ur as record,
  Wc as refine,
  rr as strictObject,
  Hc as string,
  Gc as superRefine,
  Ec as transform,
  vc as union,
  k as unknown
};
//# sourceMappingURL=schemas.js.map
