@oxog/vld 2.4.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +113 -1
  3. package/dist/chunks/errors-core-BU14-Dk8.js +1 -0
  4. package/dist/cjs/chunks/errors-core-C0mA6tfa.cjs +1 -0
  5. package/dist/cjs/cli/bin.cjs +1 -1
  6. package/dist/cjs/codecs/index.cjs +1 -1
  7. package/dist/cjs/coercion/index.cjs +1 -1
  8. package/dist/cjs/compile.cjs +1 -1
  9. package/dist/cjs/errors.cjs +1 -1
  10. package/dist/cjs/index.cjs +1 -1
  11. package/dist/cjs/mini.cjs +1 -1
  12. package/dist/cjs/v3/index.cjs +1 -1
  13. package/dist/cjs/v4/core/index.cjs +1 -1
  14. package/dist/cjs/v4/index.cjs +1 -1
  15. package/dist/cjs/v4/mini/index.cjs +1 -1
  16. package/dist/cjs/v4-mini/index.cjs +1 -1
  17. package/dist/cjs/validators/any.cjs +1 -1
  18. package/dist/cjs/validators/array-v2.cjs +1 -0
  19. package/dist/cjs/validators/array.cjs +1 -1
  20. package/dist/cjs/validators/base.cjs +1 -1
  21. package/dist/cjs/validators/base64.cjs +1 -1
  22. package/dist/cjs/validators/bigint-v2.cjs +1 -0
  23. package/dist/cjs/validators/bigint.cjs +1 -1
  24. package/dist/cjs/validators/boolean.cjs +1 -1
  25. package/dist/cjs/validators/codec.cjs +1 -1
  26. package/dist/cjs/validators/composite-v2.cjs +1 -0
  27. package/dist/cjs/validators/custom.cjs +1 -1
  28. package/dist/cjs/validators/date-v2.cjs +1 -0
  29. package/dist/cjs/validators/date.cjs +1 -1
  30. package/dist/cjs/validators/discriminated-union.cjs +1 -1
  31. package/dist/cjs/validators/enum.cjs +1 -1
  32. package/dist/cjs/validators/file.cjs +1 -1
  33. package/dist/cjs/validators/function.cjs +1 -1
  34. package/dist/cjs/validators/hex.cjs +1 -1
  35. package/dist/cjs/validators/index.cjs +1 -1
  36. package/dist/cjs/validators/intersection.cjs +1 -1
  37. package/dist/cjs/validators/json.cjs +1 -1
  38. package/dist/cjs/validators/lazy.cjs +1 -1
  39. package/dist/cjs/validators/leaf-v2.cjs +1 -0
  40. package/dist/cjs/validators/literal.cjs +1 -1
  41. package/dist/cjs/validators/map.cjs +1 -1
  42. package/dist/cjs/validators/nan.cjs +1 -1
  43. package/dist/cjs/validators/never.cjs +1 -1
  44. package/dist/cjs/validators/null.cjs +1 -1
  45. package/dist/cjs/validators/number-v2.cjs +1 -0
  46. package/dist/cjs/validators/number.cjs +1 -1
  47. package/dist/cjs/validators/object-v2.cjs +1 -0
  48. package/dist/cjs/validators/object.cjs +1 -1
  49. package/dist/cjs/validators/promise.cjs +1 -1
  50. package/dist/cjs/validators/record.cjs +1 -1
  51. package/dist/cjs/validators/set.cjs +1 -1
  52. package/dist/cjs/validators/string-bool.cjs +1 -1
  53. package/dist/cjs/validators/string-formats.cjs +1 -1
  54. package/dist/cjs/validators/string-v2.cjs +1 -0
  55. package/dist/cjs/validators/string.cjs +1 -1
  56. package/dist/cjs/validators/symbol.cjs +1 -1
  57. package/dist/cjs/validators/template-literal.cjs +1 -1
  58. package/dist/cjs/validators/tuple.cjs +1 -1
  59. package/dist/cjs/validators/uint8array.cjs +1 -1
  60. package/dist/cjs/validators/undefined.cjs +1 -1
  61. package/dist/cjs/validators/union-v2.cjs +1 -0
  62. package/dist/cjs/validators/union.cjs +1 -1
  63. package/dist/cjs/validators/unknown.cjs +1 -1
  64. package/dist/cjs/validators/void.cjs +1 -1
  65. package/dist/cjs/validators/wrapper-v2.cjs +1 -0
  66. package/dist/cjs/validators/xor.cjs +1 -1
  67. package/dist/errors-core.d.ts +3 -0
  68. package/dist/errors.js +1 -1
  69. package/dist/index.d.ts +168 -12
  70. package/dist/index.js +1 -1
  71. package/dist/v3/index.js +1 -1
  72. package/dist/v4/core/index.js +1 -1
  73. package/dist/v4/index.js +1 -1
  74. package/dist/v4/mini/index.js +1 -1
  75. package/dist/v4-mini/index.js +1 -1
  76. package/dist/validators/array-v2.d.ts +113 -0
  77. package/dist/validators/array-v2.js +1 -0
  78. package/dist/validators/array.js +1 -1
  79. package/dist/validators/base.js +1 -1
  80. package/dist/validators/base64.js +1 -1
  81. package/dist/validators/bigint-v2.d.ts +105 -0
  82. package/dist/validators/bigint-v2.js +1 -0
  83. package/dist/validators/bigint.js +1 -1
  84. package/dist/validators/boolean.js +1 -1
  85. package/dist/validators/codec.js +1 -1
  86. package/dist/validators/composite-v2.d.ts +59 -0
  87. package/dist/validators/composite-v2.js +1 -0
  88. package/dist/validators/date-v2.d.ts +140 -0
  89. package/dist/validators/date-v2.js +1 -0
  90. package/dist/validators/date.js +1 -1
  91. package/dist/validators/enum.js +1 -1
  92. package/dist/validators/file.js +1 -1
  93. package/dist/validators/function.js +1 -1
  94. package/dist/validators/hex.js +1 -1
  95. package/dist/validators/intersection.js +1 -1
  96. package/dist/validators/leaf-v2.d.ts +138 -0
  97. package/dist/validators/leaf-v2.js +1 -0
  98. package/dist/validators/literal.js +1 -1
  99. package/dist/validators/map.js +1 -1
  100. package/dist/validators/nan.js +1 -1
  101. package/dist/validators/never.js +1 -1
  102. package/dist/validators/null.js +1 -1
  103. package/dist/validators/number-v2.d.ts +252 -0
  104. package/dist/validators/number-v2.js +1 -0
  105. package/dist/validators/number.js +1 -1
  106. package/dist/validators/object-v2.d.ts +40 -0
  107. package/dist/validators/object-v2.js +1 -0
  108. package/dist/validators/object.js +1 -1
  109. package/dist/validators/record.js +1 -1
  110. package/dist/validators/set.js +1 -1
  111. package/dist/validators/string-formats.js +1 -1
  112. package/dist/validators/string-v2.d.ts +274 -0
  113. package/dist/validators/string-v2.js +1 -0
  114. package/dist/validators/string.js +1 -1
  115. package/dist/validators/symbol.js +1 -1
  116. package/dist/validators/tuple.js +1 -1
  117. package/dist/validators/uint8array.js +1 -1
  118. package/dist/validators/undefined.js +1 -1
  119. package/dist/validators/union-v2.d.ts +28 -0
  120. package/dist/validators/union-v2.js +1 -0
  121. package/dist/validators/void.js +1 -1
  122. package/dist/validators/wrapper-v2.d.ts +74 -0
  123. package/dist/validators/wrapper-v2.js +1 -0
  124. package/dist/zod-error.d.ts +84 -0
  125. package/package.json +1 -1
  126. package/dist/chunks/errors-core-CerMg2rq.js +0 -1
  127. package/dist/cjs/chunks/errors-core-DrydF46s.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../v4-mini/index.cjs"),r=require("../../index.cjs"),o=require("../../compat/result.cjs"),t=require("../../validators/base.cjs"),s=require("../../chunks/errors-core-DrydF46s.cjs"),i=require("../../validators/intersection.cjs"),p=require("../../validators/any.cjs"),a=require("../../validators/array.cjs"),n=require("../../validators/string-formats.cjs"),l=require("../../validators/bigint.cjs"),d=require("../../validators/boolean.cjs"),x=require("../../validators/codec.cjs"),c=require("../../compile.cjs"),u=require("../../validators/custom.cjs"),m=require("../../validators/date.cjs"),g=require("../../validators/discriminated-union.cjs"),V=require("../../validators/enum.cjs"),Z=require("../../validators/file.cjs"),y=require("../../validators/function.cjs"),j=require("../../validators/json.cjs"),S=require("../../validators/lazy.cjs"),f=require("../../validators/literal.cjs"),v=require("../../validators/map.cjs"),M=require("../../validators/nan.cjs"),b=require("../../validators/never.cjs"),q=require("../../validators/null.cjs"),F=require("../../validators/number.cjs"),T=require("../../validators/object.cjs"),h=require("../../validators/promise.cjs"),E=require("../../validators/record.cjs"),L=require("../../validators/set.cjs"),U=require("../../validators/string.cjs"),C=require("../../validators/symbol.cjs"),D=require("../../validators/template-literal.cjs"),I=require("../../validators/tuple.cjs"),B=require("../../validators/undefined.cjs"),A=require("../../validators/union.cjs"),O=require("../../validators/unknown.cjs"),N=require("../../validators/void.cjs"),P=require("../../validators/xor.cjs"),R=require("../../chunks/index-ZjHAxYdA.cjs"),w=require("../../pigment.cjs"),k=require("../../compat/emitter.cjs"),z=require("../../kernel.cjs"),J=require("../../errors.cjs"),K=require("../../locales/runtime.cjs"),_=require("../../registry.cjs"),X=require("../../chunks/index-lejEpLfv.cjs");require("../../validators/string-bool.cjs"),require("../../locales/en.cjs"),require("../../validators/base64.cjs"),require("../../validators/hex.cjs"),require("../../validators/uint8array.cjs"),require("../../coercion/index.cjs"),require("../../chunks/ip-validation-BZqPamPC.cjs"),require("../../chunks/security-aXZVI7qW.cjs"),require("../../locales/tr.cjs"),require("../../locales/es.cjs"),require("../../locales/fr.cjs"),require("../../locales/de.cjs"),require("../../locales/it.cjs"),require("../../locales/pt.cjs"),require("../../locales/ru.cjs"),require("../../locales/ja.cjs"),require("../../locales/ko.cjs"),require("../../locales/zh.cjs"),require("../../locales/ar.cjs"),require("../../locales/hi.cjs"),require("../../locales/nl.cjs"),require("../../locales/pl.cjs"),require("../../locales/da.cjs"),require("../../locales/sv.cjs"),require("../../locales/no.cjs"),require("../../locales/fi.cjs"),require("../../locales/th.cjs"),require("../../locales/vi.cjs"),require("../../locales/id.cjs"),require("../../locales/bn.cjs"),require("../../locales/gu.cjs"),require("../../locales/kn.cjs"),require("../../locales/ne.cjs"),require("../../locales/sk.cjs"),require("../../locales/sw.cjs"),require("../../locales/af.cjs"),require("../../locales/pt-BR.cjs"),require("../../locales/es-MX.cjs"),exports._default=e._default,exports.catchall=e.catchall,exports.exactPartial=e.exactPartial,exports.extend=e.extend,exports.maximum=e.maximum,exports.merge=e.merge,exports.minimum=e.minimum,exports.omit=e.omit,exports.partial=e.partial,exports.pick=e.pick,exports.required=e.required,exports.safeExtend=e.safeExtend,exports.$brand=r.$brand,exports.$input=r.$input,exports.$output=r.$output,exports.NEVER=r.NEVER,exports.TimePrecision=r.TimePrecision,exports.ZodFirstPartyTypeKind=r.ZodFirstPartyTypeKind,exports.ZodIssueCode=r.ZodIssueCode,exports._ZodString=r._ZodString,exports._function=r._function,exports.any=r.any,exports.array=r.array,exports.base64=r.base64,exports.base64Bytes=r.base64Bytes,exports.base64url=r.base64url,exports.bigint=r.bigint,exports.boolean=r.boolean,exports.catch=r.catch,exports.check=r.check,exports.cidrv4=r.cidrv4,exports.cidrv6=r.cidrv6,exports.clone=r.clone,exports.codec=r.codec,exports.coerce=r.coerce,exports.config=r.config,exports.core=r.core,exports.createLogger=r.createLogger,exports.createNoOpLogger=r.createNoOpLogger,exports.creditCard=r.creditCard,exports.cuid=r.cuid,exports.cuid2=r.cuid2,exports.custom=r.custom,exports.date=r.date,exports.decode=r.decode,exports.decodeAsync=r.decodeAsync,exports.deepPartial=r.deepPartial,exports.default=r.default,exports.describe=r.describe,exports.disableLogging=r.disableLogging,exports.discriminatedUnion=r.discriminatedUnion,exports.e164=r.e164,exports.email=r.email,exports.emoji=r.emoji,exports.enableDebug=r.enableDebug,exports.encode=r.encode,exports.encodeAsync=r.encodeAsync,exports.endsWith=r.endsWith,exports.enum=r.enum,exports.exactOptional=r.exactOptional,exports.file=r.file,exports.float32=r.float32,exports.float64=r.float64,exports.formatError=r.formatError,exports.fromJSONSchema=r.fromJSONSchema,exports.function=r._function,exports.getErrorMap=r.getErrorMap,exports.getLogger=r.getLogger,exports.gt=r.gt,exports.gte=r.gte,exports.guid=r.guid,exports.hash=r.hash,exports.hex=r.hex,exports.hexBytes=r.hexBytes,exports.hostname=r.hostname,exports.httpUrl=r.httpUrl,exports.includes=r.includes,exports.initLogger=r.initLogger,exports.input=r.input,exports.instanceof=r.instanceof,exports.int=r.int,exports.int32=r.int32,exports.int64=r.int64,exports.intersection=r.intersection,exports.ipv4=r.ipv4,exports.ipv6=r.ipv6,exports.iso=r.iso,exports.json=r.json,exports.jwt=r.jwt,exports.keyof=r.keyof,exports.ksuid=r.ksuid,exports.lazy=r.lazy,exports.length=r.length,exports.literal=r.literal,exports.locales=r.locales,exports.looseObject=r.looseObject,exports.looseRecord=r.looseRecord,exports.lowercase=r.lowercase,exports.lt=r.lt,exports.lte=r.lte,exports.mac=r.mac,exports.map=r.map,exports.mapSchema=r.mapSchema,exports.maxLength=r.maxLength,exports.maxSize=r.maxSize,exports.meta=r.meta,exports.mime=r.mime,exports.minLength=r.minLength,exports.minSize=r.minSize,exports.multipleOf=r.multipleOf,exports.nan=r.nan,exports.nanoid=r.nanoid,exports.nativeEnum=r.nativeEnum,exports.negative=r.negative,exports.never=r.never,exports.nonnegative=r.nonnegative,exports.nonoptional=r.nonoptional,exports.nonpositive=r.nonpositive,exports.normalize=r.normalize,exports.null=r.null,exports.nullable=r.nullable,exports.nullish=r.nullish,exports.number=r.number,exports.object=r.object,exports.optional=r.optional,exports.output=r.output,exports.overwrite=r.overwrite,exports.parse=r.parse,exports.parseAsync=r.parseAsync,exports.partialRecord=r.partialRecord,exports.pipe=r.pipe,exports.positive=r.positive,exports.prefault=r.prefault,exports.preprocess=r.preprocess,exports.promise=r.promise,exports.property=r.property,exports.readonly=r.readonly,exports.record=r.record,exports.refine=r.refine,exports.regex=r.regex,exports.regexes=r.regexes,exports.safeDecode=r.safeDecode,exports.safeDecodeAsync=r.safeDecodeAsync,exports.safeEncode=r.safeEncode,exports.safeEncodeAsync=r.safeEncodeAsync,exports.safeParse=r.safeParse,exports.safeParseAsync=r.safeParseAsync,exports.set=r.set,exports.setErrorMap=r.setErrorMap,exports.setLogLevel=r.setLogLevel,exports.size=r.size,exports.slugify=r.slugify,exports.startsWith=r.startsWith,exports.strictObject=r.strictObject,exports.string=r.string,exports.stringFormat=r.stringFormat,exports.stringbool=r.stringbool,exports.superRefine=r.superRefine,exports.symbol=r.symbol,exports.templateLiteral=r.templateLiteral,exports.toJSONSchema=r.toJSONSchema,exports.toLowerCase=r.toLowerCase,exports.toUpperCase=r.toUpperCase,exports.transform=r.transform,exports.trim=r.trim,exports.tuple=r.tuple,exports.uint32=r.uint32,exports.uint64=r.uint64,exports.uint8Array=r.uint8Array,exports.ulid=r.ulid,exports.undefined=r.undefined,exports.union=r.union,exports.unknown=r.unknown,exports.uppercase=r.uppercase,exports.url=r.url,exports.util=r.util,exports.uuid=r.uuid,exports.uuidv4=r.uuidv4,exports.uuidv6=r.uuidv6,exports.uuidv7=r.uuidv7,exports.v=r.default,exports.void=r.void,exports.xid=r.xid,exports.xor=r.xor,exports.z=r.z,exports.Err=o.Err,exports.Ok=o.Ok,exports.ResultUtils=o.ResultUtils,exports.all=o.all,exports.failure=o.failure,exports.flatMap=o.flatMap,exports.fromNullable=o.fromNullable,exports.isErr=o.isErr,exports.isOk=o.isOk,exports.isResult=o.isResult,exports.mapErr=o.mapErr,exports.match=o.match,exports.success=o.success,exports.tryCatch=o.tryCatch,exports.tryCatchAsync=o.tryCatchAsync,exports.unwrap=o.unwrap,exports.unwrapOr=o.unwrapOr,exports.VldBase=t.VldBase,exports.VldMeta=t.VldMeta,exports.ZodBranded=t.VldBrand,exports.ZodCatch=t.VldCatch,exports.ZodDefault=t.VldDefault,exports.ZodExactOptional=t.VldExactOptional,exports.ZodMeta=t.VldMeta,exports.ZodMiniBrand=t.VldBrand,exports.ZodMiniCatch=t.VldCatch,exports.ZodMiniDefault=t.VldDefault,exports.ZodMiniExactOptional=t.VldExactOptional,exports.ZodMiniNonOptional=t.VldRefine,exports.ZodMiniNullable=t.VldNullable,exports.ZodMiniOptional=t.VldOptional,exports.ZodMiniPipe=t.VldPipe,exports.ZodMiniPrefault=t.VldPrefault,exports.ZodMiniReadonly=t.VldReadonly,exports.ZodMiniTransform=t.VldTransform,exports.ZodMiniType=t.VldBase,exports.ZodNonOptional=t.VldRefine,exports.ZodNullable=t.VldNullable,exports.ZodOptional=t.VldOptional,exports.ZodPipe=t.VldPipe,exports.ZodPrefault=t.VldPrefault,exports.ZodPreprocess=t.VldPreprocess,exports.ZodReadonly=t.VldReadonly,exports.ZodTransform=t.VldTransform,exports.ZodType=t.VldBase,exports.VldError=s.VldError,exports.ZodError=s.VldError,exports.ZodRealError=s.VldError,exports.VldIntersection=i.VldIntersection,exports.ZodIntersection=i.VldIntersection,exports.ZodMiniIntersection=i.VldIntersection,exports.ZodAny=p.VldAny,exports.ZodMiniAny=p.VldAny,exports.ZodArray=a.VldArray,exports.ZodMiniArray=a.VldArray,exports.ZodBase64=n.VldStringFormat,exports.ZodBase64URL=n.VldStringFormat,exports.ZodCIDRv4=n.VldStringFormat,exports.ZodCIDRv6=n.VldStringFormat,exports.ZodCUID=n.VldStringFormat,exports.ZodCUID2=n.VldStringFormat,exports.ZodCreditCard=n.VldStringFormat,exports.ZodCustomStringFormat=n.VldStringFormat,exports.ZodE164=n.VldStringFormat,exports.ZodEmail=n.VldStringFormat,exports.ZodEmoji=n.VldStringFormat,exports.ZodGUID=n.VldStringFormat,exports.ZodIPv4=n.VldStringFormat,exports.ZodIPv6=n.VldStringFormat,exports.ZodISODate=n.VldStringFormat,exports.ZodISODateTime=n.VldStringFormat,exports.ZodISODuration=n.VldStringFormat,exports.ZodISOTime=n.VldStringFormat,exports.ZodJWT=n.VldStringFormat,exports.ZodKSUID=n.VldStringFormat,exports.ZodMAC=n.VldStringFormat,exports.ZodMiniBase64=n.VldStringFormat,exports.ZodMiniBase64URL=n.VldStringFormat,exports.ZodMiniCIDRv4=n.VldStringFormat,exports.ZodMiniCIDRv6=n.VldStringFormat,exports.ZodMiniCUID=n.VldStringFormat,exports.ZodMiniCUID2=n.VldStringFormat,exports.ZodMiniCreditCard=n.VldStringFormat,exports.ZodMiniCustomStringFormat=n.VldStringFormat,exports.ZodMiniE164=n.VldStringFormat,exports.ZodMiniEmail=n.VldStringFormat,exports.ZodMiniEmoji=n.VldStringFormat,exports.ZodMiniGUID=n.VldStringFormat,exports.ZodMiniIPv4=n.VldStringFormat,exports.ZodMiniIPv6=n.VldStringFormat,exports.ZodMiniISODate=n.VldStringFormat,exports.ZodMiniISODateTime=n.VldStringFormat,exports.ZodMiniISODuration=n.VldStringFormat,exports.ZodMiniISOTime=n.VldStringFormat,exports.ZodMiniJWT=n.VldStringFormat,exports.ZodMiniKSUID=n.VldStringFormat,exports.ZodMiniMAC=n.VldStringFormat,exports.ZodMiniNanoID=n.VldStringFormat,exports.ZodMiniStringFormat=n.VldStringFormat,exports.ZodMiniULID=n.VldStringFormat,exports.ZodMiniURL=n.VldStringFormat,exports.ZodMiniUUID=n.VldStringFormat,exports.ZodMiniXID=n.VldStringFormat,exports.ZodNanoID=n.VldStringFormat,exports.ZodStringFormat=n.VldStringFormat,exports.ZodULID=n.VldStringFormat,exports.ZodURL=n.VldStringFormat,exports.ZodUUID=n.VldStringFormat,exports.ZodXID=n.VldStringFormat,exports.ZodBigInt=l.VldBigInt,exports.ZodBigIntFormat=l.VldBigInt,exports.ZodMiniBigInt=l.VldBigInt,exports.ZodMiniBigIntFormat=l.VldBigInt,exports.ZodBoolean=d.VldBoolean,exports.ZodMiniBoolean=d.VldBoolean,exports.ZodCodec=x.VldCodec,exports.ZodMiniCodec=x.VldCodec,exports.ZodCompileAsyncError=c.ZodCompileAsyncError,exports.ZodCompileError=c.ZodCompileError,exports.ZodCompileUnsupportedError=c.ZodCompileUnsupportedError,exports.compile=c.compile,exports.getDiscriminatedOption=c.getDiscriminatedOption,exports.memoizer=c.memoizer,exports.properties=c.properties,exports.toZod=c.toZod,exports.validate=c.validate,exports.validateAsync=c.validateAsync,exports.zodCompileFn=c.compileFn,exports.ZodCustom=u.VldCustom,exports.ZodMiniCustom=u.VldCustom,exports.ZodMiniSuccess=u.VldCustom,exports.ZodSuccess=u.VldCustom,exports.ZodDate=m.VldDate,exports.ZodMiniDate=m.VldDate,exports.ZodDiscriminatedUnion=g.VldDiscriminatedUnion,exports.ZodMiniDiscriminatedUnion=g.VldDiscriminatedUnion,exports.ZodEnum=V.VldEnum,exports.ZodMiniEnum=V.VldEnum,exports.ZodFile=Z.VldFile,exports.ZodMiniFile=Z.VldFile,exports.ZodFunction=y.VldFunction,exports.ZodMiniFunction=y.VldFunction,exports.ZodJSON=j.VldJson,exports.ZodLazy=S.VldLazy,exports.ZodMiniLazy=S.VldLazy,exports.ZodLiteral=f.VldLiteral,exports.ZodMiniLiteral=f.VldLiteral,exports.ZodMap=v.VldMap,exports.ZodMiniMap=v.VldMap,exports.ZodMiniNaN=M.VldNan,exports.ZodNaN=M.VldNan,exports.ZodMiniNever=b.VldNever,exports.ZodNever=b.VldNever,exports.ZodMiniNull=q.VldNull,exports.ZodNull=q.VldNull,exports.ZodMiniNumber=F.VldNumber,exports.ZodMiniNumberFormat=F.VldNumber,exports.ZodNumber=F.VldNumber,exports.ZodNumberFormat=F.VldNumber,exports.ZodMiniObject=T.VldObject,exports.ZodObject=T.VldObject,exports.ZodMiniPromise=h.VldPromise,exports.ZodPromise=h.VldPromise,exports.ZodMiniRecord=E.VldRecord,exports.ZodRecord=E.VldRecord,exports.ZodMiniSet=L.VldSet,exports.ZodSet=L.VldSet,exports.ZodMiniString=U.VldString,exports.ZodString=U.VldString,exports.ZodMiniSymbol=C.VldSymbol,exports.ZodSymbol=C.VldSymbol,exports.ZodMiniTemplateLiteral=D.VldTemplateLiteral,exports.ZodTemplateLiteral=D.VldTemplateLiteral,exports.ZodMiniTuple=I.VldTuple,exports.ZodTuple=I.VldTuple,exports.ZodMiniUndefined=B.VldUndefined,exports.ZodUndefined=B.VldUndefined,exports.ZodMiniUnion=A.VldUnion,exports.ZodUnion=A.VldUnion,exports.ZodMiniUnknown=O.VldUnknown,exports.ZodUnknown=O.VldUnknown,exports.ZodMiniVoid=N.VldVoid,exports.ZodVoid=N.VldVoid,exports.ZodMiniXor=P.VldXor,exports.ZodXor=P.VldXor,exports.base64Json=R.base64Json,exports.base64ToBytes=R.base64ToBytes,exports.base64ToUint8Array=R.base64ToUint8Array,exports.base64UrlToBytes=R.base64UrlToBytes,exports.base64urlToBytes=R.base64urlToBytes,exports.bytesToUtf8=R.bytesToUtf8,exports.epochMillisToDate=R.epochMillisToDate,exports.epochSecondsToDate=R.epochSecondsToDate,exports.hexLowerToBytes=R.hexLowerToBytes,exports.hexToBytes=R.hexToBytes,exports.hexToUint8Array=R.hexToUint8Array,exports.invertCodec=R.invertCodec,exports.isoDatetimeToDate=R.isoDatetimeToDate,exports.jsonCodec=R.jsonCodec,exports.jwtPayload=R.jwtPayload,exports.numberToBigInt=R.numberToBigInt,exports.stringToBigInt=R.stringToBigInt,exports.stringToBoolean=R.stringToBoolean,exports.stringToHttpURL=R.stringToHttpURL,exports.stringToInt=R.stringToInt,exports.stringToNumber=R.stringToNumber,exports.stringToURL=R.stringToURL,exports.stringToUint8Array=R.stringToUint8Array,exports.uint8ArrayToBase64=R.uint8ArrayToBase64,exports.uint8ArrayToBase64Url=R.uint8ArrayToBase64Url,exports.uint8ArrayToHex=R.uint8ArrayToHex,exports.uint8ArrayToString=R.uint8ArrayToString,exports.uriComponent=R.uriComponent,exports.utf8ToBytes=R.utf8ToBytes,exports.blue=w.blue,exports.bold=w.bold,exports.createTheme=w.createTheme,exports.cyan=w.cyan,exports.dim=w.dim,exports.gray=w.gray,exports.green=w.green,exports.grey=w.grey,exports.italic=w.italic,exports.magenta=w.magenta,exports.pigment=w.default,exports.red=w.red,exports.strip=w.strip,exports.supportsColor=w.supportsColor,exports.underline=w.underline,exports.vldTheme=w.vldTheme,exports.white=w.white,exports.yellow=w.yellow,exports.createEmitter=k.createEmitter,exports.createEventBus=k.createEventBus,exports.withEmitter=k.withEmitter,exports.createVldKernel=z.createVldKernel,exports.definePlugin=z.definePlugin,exports.getVldKernel=z.getVldKernel,exports.resetVldKernel=z.resetVldKernel,exports.usePlugin=z.usePlugin,exports.flattenError=J.flattenError,exports.prettifyError=J.prettifyError,exports.prettifyErrorColored=J.prettifyErrorColored,exports.prettifyErrorPlain=J.prettifyErrorPlain,exports.treeifyError=J.treeifyError,exports.getLocale=K.getLocale,exports.getMessages=K.getMessages,exports.getSupportedLocales=K.getSupportedLocales,exports.isLocaleLoaded=K.isLocaleLoaded,exports.isLocaleSupported=K.isLocaleSupported,exports.registerLocale=K.registerLocale,exports.setLocale=K.setLocale,exports.globalRegistry=_.globalRegistry,exports.registry=_.registry,exports.setLocaleAsync=X.setLocaleAsync;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../v4-mini/index.cjs"),r=require("../../index.cjs"),o=require("../../compat/result.cjs"),t=require("../../validators/base.cjs"),s=require("../../chunks/errors-core-C0mA6tfa.cjs"),i=require("../../validators/intersection.cjs"),p=require("../../validators/any.cjs"),a=require("../../validators/array.cjs"),n=require("../../validators/string-formats.cjs"),l=require("../../validators/bigint.cjs"),d=require("../../validators/boolean.cjs"),x=require("../../validators/codec.cjs"),c=require("../../compile.cjs"),u=require("../../validators/custom.cjs"),m=require("../../validators/date.cjs"),g=require("../../validators/discriminated-union.cjs"),V=require("../../validators/enum.cjs"),Z=require("../../validators/file.cjs"),y=require("../../validators/function.cjs"),v=require("../../validators/json.cjs"),j=require("../../validators/lazy.cjs"),S=require("../../validators/literal.cjs"),f=require("../../validators/map.cjs"),q=require("../../validators/nan.cjs"),M=require("../../validators/never.cjs"),b=require("../../validators/null.cjs"),F=require("../../validators/number.cjs"),T=require("../../validators/object.cjs"),h=require("../../validators/promise.cjs"),E=require("../../validators/record.cjs"),L=require("../../validators/set.cjs"),U=require("../../validators/string.cjs"),C=require("../../validators/symbol.cjs"),D=require("../../validators/template-literal.cjs"),I=require("../../validators/tuple.cjs"),B=require("../../validators/undefined.cjs"),A=require("../../validators/union.cjs"),O=require("../../validators/unknown.cjs"),N=require("../../validators/void.cjs"),R=require("../../validators/xor.cjs"),P=require("../../chunks/index-ZjHAxYdA.cjs"),w=require("../../pigment.cjs"),k=require("../../compat/emitter.cjs"),z=require("../../kernel.cjs"),J=require("../../errors.cjs"),K=require("../../locales/runtime.cjs"),_=require("../../registry.cjs"),X=require("../../chunks/index-lejEpLfv.cjs");require("../../validators/string-v2.cjs"),require("../../chunks/ip-validation-BZqPamPC.cjs"),require("../../locales/en.cjs"),require("../../validators/number-v2.cjs"),require("../../validators/date-v2.cjs"),require("../../validators/bigint-v2.cjs"),require("../../validators/array-v2.cjs"),require("../../validators/union-v2.cjs"),require("../../validators/wrapper-v2.cjs"),require("../../validators/leaf-v2.cjs"),require("../../validators/composite-v2.cjs"),require("../../validators/string-bool.cjs"),require("../../validators/base64.cjs"),require("../../validators/hex.cjs"),require("../../validators/uint8array.cjs"),require("../../coercion/index.cjs"),require("../../chunks/security-aXZVI7qW.cjs"),require("../../locales/tr.cjs"),require("../../locales/es.cjs"),require("../../locales/fr.cjs"),require("../../locales/de.cjs"),require("../../locales/it.cjs"),require("../../locales/pt.cjs"),require("../../locales/ru.cjs"),require("../../locales/ja.cjs"),require("../../locales/ko.cjs"),require("../../locales/zh.cjs"),require("../../locales/ar.cjs"),require("../../locales/hi.cjs"),require("../../locales/nl.cjs"),require("../../locales/pl.cjs"),require("../../locales/da.cjs"),require("../../locales/sv.cjs"),require("../../locales/no.cjs"),require("../../locales/fi.cjs"),require("../../locales/th.cjs"),require("../../locales/vi.cjs"),require("../../locales/id.cjs"),require("../../locales/bn.cjs"),require("../../locales/gu.cjs"),require("../../locales/kn.cjs"),require("../../locales/ne.cjs"),require("../../locales/sk.cjs"),require("../../locales/sw.cjs"),require("../../locales/af.cjs"),require("../../locales/pt-BR.cjs"),require("../../locales/es-MX.cjs"),exports._default=e._default,exports.catchall=e.catchall,exports.exactPartial=e.exactPartial,exports.extend=e.extend,exports.maximum=e.maximum,exports.merge=e.merge,exports.minimum=e.minimum,exports.omit=e.omit,exports.partial=e.partial,exports.pick=e.pick,exports.required=e.required,exports.safeExtend=e.safeExtend,exports.$brand=r.$brand,exports.$input=r.$input,exports.$output=r.$output,exports.NEVER=r.NEVER,exports.TimePrecision=r.TimePrecision,exports.ZodFirstPartyTypeKind=r.ZodFirstPartyTypeKind,exports.ZodIssueCode=r.ZodIssueCode,exports.ZodLikeError=r.ZodLikeError,exports._ZodString=r._ZodString,exports._function=r._function,exports.any=r.any,exports.array=r.array,exports.base64=r.base64,exports.base64Bytes=r.base64Bytes,exports.base64url=r.base64url,exports.bigint=r.bigint,exports.boolean=r.boolean,exports.catch=r.catch,exports.check=r.check,exports.cidrv4=r.cidrv4,exports.cidrv6=r.cidrv6,exports.clone=r.clone,exports.codec=r.codec,exports.coerce=r.coerce,exports.config=r.config,exports.core=r.core,exports.createLogger=r.createLogger,exports.createNoOpLogger=r.createNoOpLogger,exports.creditCard=r.creditCard,exports.cuid=r.cuid,exports.cuid2=r.cuid2,exports.custom=r.custom,exports.date=r.date,exports.decode=r.decode,exports.decodeAsync=r.decodeAsync,exports.deepPartial=r.deepPartial,exports.default=r.default,exports.describe=r.describe,exports.disableLogging=r.disableLogging,exports.discriminatedUnion=r.discriminatedUnion,exports.e164=r.e164,exports.email=r.email,exports.emoji=r.emoji,exports.enableDebug=r.enableDebug,exports.encode=r.encode,exports.encodeAsync=r.encodeAsync,exports.endsWith=r.endsWith,exports.enum=r.enum,exports.exactOptional=r.exactOptional,exports.file=r.file,exports.float32=r.float32,exports.float64=r.float64,exports.formatError=r.formatError,exports.fromJSONSchema=r.fromJSONSchema,exports.function=r._function,exports.getErrorMap=r.getErrorMap,exports.getLogger=r.getLogger,exports.gt=r.gt,exports.gte=r.gte,exports.guid=r.guid,exports.hash=r.hash,exports.hex=r.hex,exports.hexBytes=r.hexBytes,exports.hostname=r.hostname,exports.httpUrl=r.httpUrl,exports.includes=r.includes,exports.initLogger=r.initLogger,exports.input=r.input,exports.instanceof=r.instanceof,exports.int=r.int,exports.int32=r.int32,exports.int64=r.int64,exports.intersection=r.intersection,exports.ipv4=r.ipv4,exports.ipv6=r.ipv6,exports.iso=r.iso,exports.json=r.json,exports.jwt=r.jwt,exports.keyof=r.keyof,exports.ksuid=r.ksuid,exports.lazy=r.lazy,exports.length=r.length,exports.literal=r.literal,exports.locales=r.locales,exports.looseObject=r.looseObject,exports.looseRecord=r.looseRecord,exports.lowercase=r.lowercase,exports.lt=r.lt,exports.lte=r.lte,exports.mac=r.mac,exports.map=r.map,exports.mapSchema=r.mapSchema,exports.maxLength=r.maxLength,exports.maxSize=r.maxSize,exports.meta=r.meta,exports.mime=r.mime,exports.minLength=r.minLength,exports.minSize=r.minSize,exports.multipleOf=r.multipleOf,exports.nan=r.nan,exports.nanoid=r.nanoid,exports.nativeEnum=r.nativeEnum,exports.negative=r.negative,exports.never=r.never,exports.nonnegative=r.nonnegative,exports.nonoptional=r.nonoptional,exports.nonpositive=r.nonpositive,exports.normalize=r.normalize,exports.null=r.null,exports.nullable=r.nullable,exports.nullish=r.nullish,exports.number=r.number,exports.object=r.object,exports.optional=r.optional,exports.output=r.output,exports.overwrite=r.overwrite,exports.parse=r.parse,exports.parseAsync=r.parseAsync,exports.partialRecord=r.partialRecord,exports.pipe=r.pipe,exports.positive=r.positive,exports.prefault=r.prefault,exports.preprocess=r.preprocess,exports.promise=r.promise,exports.property=r.property,exports.readonly=r.readonly,exports.record=r.record,exports.refine=r.refine,exports.regex=r.regex,exports.regexes=r.regexes,exports.safeDecode=r.safeDecode,exports.safeDecodeAsync=r.safeDecodeAsync,exports.safeEncode=r.safeEncode,exports.safeEncodeAsync=r.safeEncodeAsync,exports.safeParse=r.safeParse,exports.safeParseAsync=r.safeParseAsync,exports.set=r.set,exports.setErrorMap=r.setErrorMap,exports.setLogLevel=r.setLogLevel,exports.size=r.size,exports.slugify=r.slugify,exports.startsWith=r.startsWith,exports.strictObject=r.strictObject,exports.string=r.string,exports.stringFormat=r.stringFormat,exports.stringbool=r.stringbool,exports.superRefine=r.superRefine,exports.symbol=r.symbol,exports.templateLiteral=r.templateLiteral,exports.toJSONSchema=r.toJSONSchema,exports.toLowerCase=r.toLowerCase,exports.toUpperCase=r.toUpperCase,exports.toZodError=r.toZodError,exports.toZodSafeResult=r.toZodSafeResult,exports.transform=r.transform,exports.trim=r.trim,exports.tuple=r.tuple,exports.uint32=r.uint32,exports.uint64=r.uint64,exports.uint8Array=r.uint8Array,exports.ulid=r.ulid,exports.undefined=r.undefined,exports.union=r.union,exports.unknown=r.unknown,exports.uppercase=r.uppercase,exports.url=r.url,exports.util=r.util,exports.uuid=r.uuid,exports.uuidv4=r.uuidv4,exports.uuidv6=r.uuidv6,exports.uuidv7=r.uuidv7,exports.v=r.default,exports.vV2=r.vV2,exports.void=r.void,exports.xid=r.xid,exports.xor=r.xor,exports.z=r.z,exports.Err=o.Err,exports.Ok=o.Ok,exports.ResultUtils=o.ResultUtils,exports.all=o.all,exports.failure=o.failure,exports.flatMap=o.flatMap,exports.fromNullable=o.fromNullable,exports.isErr=o.isErr,exports.isOk=o.isOk,exports.isResult=o.isResult,exports.mapErr=o.mapErr,exports.match=o.match,exports.success=o.success,exports.tryCatch=o.tryCatch,exports.tryCatchAsync=o.tryCatchAsync,exports.unwrap=o.unwrap,exports.unwrapOr=o.unwrapOr,exports.VldBase=t.VldBase,exports.VldMeta=t.VldMeta,exports.ZodBranded=t.VldBrand,exports.ZodCatch=t.VldCatch,exports.ZodDefault=t.VldDefault,exports.ZodExactOptional=t.VldExactOptional,exports.ZodMeta=t.VldMeta,exports.ZodMiniBrand=t.VldBrand,exports.ZodMiniCatch=t.VldCatch,exports.ZodMiniDefault=t.VldDefault,exports.ZodMiniExactOptional=t.VldExactOptional,exports.ZodMiniNonOptional=t.VldRefine,exports.ZodMiniNullable=t.VldNullable,exports.ZodMiniOptional=t.VldOptional,exports.ZodMiniPipe=t.VldPipe,exports.ZodMiniPrefault=t.VldPrefault,exports.ZodMiniReadonly=t.VldReadonly,exports.ZodMiniTransform=t.VldTransform,exports.ZodMiniType=t.VldBase,exports.ZodNonOptional=t.VldRefine,exports.ZodNullable=t.VldNullable,exports.ZodOptional=t.VldOptional,exports.ZodPipe=t.VldPipe,exports.ZodPrefault=t.VldPrefault,exports.ZodPreprocess=t.VldPreprocess,exports.ZodReadonly=t.VldReadonly,exports.ZodTransform=t.VldTransform,exports.ZodType=t.VldBase,exports.VldError=s.VldError,exports.ZodError=s.VldError,exports.ZodRealError=s.VldError,exports.VldIntersection=i.VldIntersection,exports.ZodIntersection=i.VldIntersection,exports.ZodMiniIntersection=i.VldIntersection,exports.ZodAny=p.VldAny,exports.ZodMiniAny=p.VldAny,exports.ZodArray=a.VldArray,exports.ZodMiniArray=a.VldArray,exports.ZodBase64=n.VldStringFormat,exports.ZodBase64URL=n.VldStringFormat,exports.ZodCIDRv4=n.VldStringFormat,exports.ZodCIDRv6=n.VldStringFormat,exports.ZodCUID=n.VldStringFormat,exports.ZodCUID2=n.VldStringFormat,exports.ZodCreditCard=n.VldStringFormat,exports.ZodCustomStringFormat=n.VldStringFormat,exports.ZodE164=n.VldStringFormat,exports.ZodEmail=n.VldStringFormat,exports.ZodEmoji=n.VldStringFormat,exports.ZodGUID=n.VldStringFormat,exports.ZodIPv4=n.VldStringFormat,exports.ZodIPv6=n.VldStringFormat,exports.ZodISODate=n.VldStringFormat,exports.ZodISODateTime=n.VldStringFormat,exports.ZodISODuration=n.VldStringFormat,exports.ZodISOTime=n.VldStringFormat,exports.ZodJWT=n.VldStringFormat,exports.ZodKSUID=n.VldStringFormat,exports.ZodMAC=n.VldStringFormat,exports.ZodMiniBase64=n.VldStringFormat,exports.ZodMiniBase64URL=n.VldStringFormat,exports.ZodMiniCIDRv4=n.VldStringFormat,exports.ZodMiniCIDRv6=n.VldStringFormat,exports.ZodMiniCUID=n.VldStringFormat,exports.ZodMiniCUID2=n.VldStringFormat,exports.ZodMiniCreditCard=n.VldStringFormat,exports.ZodMiniCustomStringFormat=n.VldStringFormat,exports.ZodMiniE164=n.VldStringFormat,exports.ZodMiniEmail=n.VldStringFormat,exports.ZodMiniEmoji=n.VldStringFormat,exports.ZodMiniGUID=n.VldStringFormat,exports.ZodMiniIPv4=n.VldStringFormat,exports.ZodMiniIPv6=n.VldStringFormat,exports.ZodMiniISODate=n.VldStringFormat,exports.ZodMiniISODateTime=n.VldStringFormat,exports.ZodMiniISODuration=n.VldStringFormat,exports.ZodMiniISOTime=n.VldStringFormat,exports.ZodMiniJWT=n.VldStringFormat,exports.ZodMiniKSUID=n.VldStringFormat,exports.ZodMiniMAC=n.VldStringFormat,exports.ZodMiniNanoID=n.VldStringFormat,exports.ZodMiniStringFormat=n.VldStringFormat,exports.ZodMiniULID=n.VldStringFormat,exports.ZodMiniURL=n.VldStringFormat,exports.ZodMiniUUID=n.VldStringFormat,exports.ZodMiniXID=n.VldStringFormat,exports.ZodNanoID=n.VldStringFormat,exports.ZodStringFormat=n.VldStringFormat,exports.ZodULID=n.VldStringFormat,exports.ZodURL=n.VldStringFormat,exports.ZodUUID=n.VldStringFormat,exports.ZodXID=n.VldStringFormat,exports.ZodBigInt=l.VldBigInt,exports.ZodBigIntFormat=l.VldBigInt,exports.ZodMiniBigInt=l.VldBigInt,exports.ZodMiniBigIntFormat=l.VldBigInt,exports.ZodBoolean=d.VldBoolean,exports.ZodMiniBoolean=d.VldBoolean,exports.ZodCodec=x.VldCodec,exports.ZodMiniCodec=x.VldCodec,exports.ZodCompileAsyncError=c.ZodCompileAsyncError,exports.ZodCompileError=c.ZodCompileError,exports.ZodCompileUnsupportedError=c.ZodCompileUnsupportedError,exports.compile=c.compile,exports.getDiscriminatedOption=c.getDiscriminatedOption,exports.memoizer=c.memoizer,exports.properties=c.properties,exports.toZod=c.toZod,exports.validate=c.validate,exports.validateAsync=c.validateAsync,exports.zodCompileFn=c.compileFn,exports.ZodCustom=u.VldCustom,exports.ZodMiniCustom=u.VldCustom,exports.ZodMiniSuccess=u.VldCustom,exports.ZodSuccess=u.VldCustom,exports.ZodDate=m.VldDate,exports.ZodMiniDate=m.VldDate,exports.ZodDiscriminatedUnion=g.VldDiscriminatedUnion,exports.ZodMiniDiscriminatedUnion=g.VldDiscriminatedUnion,exports.ZodEnum=V.VldEnum,exports.ZodMiniEnum=V.VldEnum,exports.ZodFile=Z.VldFile,exports.ZodMiniFile=Z.VldFile,exports.ZodFunction=y.VldFunction,exports.ZodMiniFunction=y.VldFunction,exports.ZodJSON=v.VldJson,exports.ZodLazy=j.VldLazy,exports.ZodMiniLazy=j.VldLazy,exports.ZodLiteral=S.VldLiteral,exports.ZodMiniLiteral=S.VldLiteral,exports.ZodMap=f.VldMap,exports.ZodMiniMap=f.VldMap,exports.ZodMiniNaN=q.VldNan,exports.ZodNaN=q.VldNan,exports.ZodMiniNever=M.VldNever,exports.ZodNever=M.VldNever,exports.ZodMiniNull=b.VldNull,exports.ZodNull=b.VldNull,exports.ZodMiniNumber=F.VldNumber,exports.ZodMiniNumberFormat=F.VldNumber,exports.ZodNumber=F.VldNumber,exports.ZodNumberFormat=F.VldNumber,exports.ZodMiniObject=T.VldObject,exports.ZodObject=T.VldObject,exports.ZodMiniPromise=h.VldPromise,exports.ZodPromise=h.VldPromise,exports.ZodMiniRecord=E.VldRecord,exports.ZodRecord=E.VldRecord,exports.ZodMiniSet=L.VldSet,exports.ZodSet=L.VldSet,exports.ZodMiniString=U.VldString,exports.ZodString=U.VldString,exports.ZodMiniSymbol=C.VldSymbol,exports.ZodSymbol=C.VldSymbol,exports.ZodMiniTemplateLiteral=D.VldTemplateLiteral,exports.ZodTemplateLiteral=D.VldTemplateLiteral,exports.ZodMiniTuple=I.VldTuple,exports.ZodTuple=I.VldTuple,exports.ZodMiniUndefined=B.VldUndefined,exports.ZodUndefined=B.VldUndefined,exports.ZodMiniUnion=A.VldUnion,exports.ZodUnion=A.VldUnion,exports.ZodMiniUnknown=O.VldUnknown,exports.ZodUnknown=O.VldUnknown,exports.ZodMiniVoid=N.VldVoid,exports.ZodVoid=N.VldVoid,exports.ZodMiniXor=R.VldXor,exports.ZodXor=R.VldXor,exports.base64Json=P.base64Json,exports.base64ToBytes=P.base64ToBytes,exports.base64ToUint8Array=P.base64ToUint8Array,exports.base64UrlToBytes=P.base64UrlToBytes,exports.base64urlToBytes=P.base64urlToBytes,exports.bytesToUtf8=P.bytesToUtf8,exports.epochMillisToDate=P.epochMillisToDate,exports.epochSecondsToDate=P.epochSecondsToDate,exports.hexLowerToBytes=P.hexLowerToBytes,exports.hexToBytes=P.hexToBytes,exports.hexToUint8Array=P.hexToUint8Array,exports.invertCodec=P.invertCodec,exports.isoDatetimeToDate=P.isoDatetimeToDate,exports.jsonCodec=P.jsonCodec,exports.jwtPayload=P.jwtPayload,exports.numberToBigInt=P.numberToBigInt,exports.stringToBigInt=P.stringToBigInt,exports.stringToBoolean=P.stringToBoolean,exports.stringToHttpURL=P.stringToHttpURL,exports.stringToInt=P.stringToInt,exports.stringToNumber=P.stringToNumber,exports.stringToURL=P.stringToURL,exports.stringToUint8Array=P.stringToUint8Array,exports.uint8ArrayToBase64=P.uint8ArrayToBase64,exports.uint8ArrayToBase64Url=P.uint8ArrayToBase64Url,exports.uint8ArrayToHex=P.uint8ArrayToHex,exports.uint8ArrayToString=P.uint8ArrayToString,exports.uriComponent=P.uriComponent,exports.utf8ToBytes=P.utf8ToBytes,exports.blue=w.blue,exports.bold=w.bold,exports.createTheme=w.createTheme,exports.cyan=w.cyan,exports.dim=w.dim,exports.gray=w.gray,exports.green=w.green,exports.grey=w.grey,exports.italic=w.italic,exports.magenta=w.magenta,exports.pigment=w.default,exports.red=w.red,exports.strip=w.strip,exports.supportsColor=w.supportsColor,exports.underline=w.underline,exports.vldTheme=w.vldTheme,exports.white=w.white,exports.yellow=w.yellow,exports.createEmitter=k.createEmitter,exports.createEventBus=k.createEventBus,exports.withEmitter=k.withEmitter,exports.createVldKernel=z.createVldKernel,exports.definePlugin=z.definePlugin,exports.getVldKernel=z.getVldKernel,exports.resetVldKernel=z.resetVldKernel,exports.usePlugin=z.usePlugin,exports.flattenError=J.flattenError,exports.prettifyError=J.prettifyError,exports.prettifyErrorColored=J.prettifyErrorColored,exports.prettifyErrorPlain=J.prettifyErrorPlain,exports.treeifyError=J.treeifyError,exports.getLocale=K.getLocale,exports.getMessages=K.getMessages,exports.getSupportedLocales=K.getSupportedLocales,exports.isLocaleLoaded=K.isLocaleLoaded,exports.isLocaleSupported=K.isLocaleSupported,exports.registerLocale=K.registerLocale,exports.setLocale=K.setLocale,exports.globalRegistry=_.globalRegistry,exports.registry=_.registry,exports.setLocaleAsync=X.setLocaleAsync;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../index.cjs"),r=require("../compile.cjs"),o=require("../compat/result.cjs"),t=require("../validators/base.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs"),i=require("../validators/intersection.cjs"),p=require("../validators/any.cjs"),n=require("../validators/array.cjs"),a=require("../validators/string-formats.cjs"),l=require("../validators/bigint.cjs"),d=require("../validators/boolean.cjs"),x=require("../validators/codec.cjs"),c=require("../validators/custom.cjs"),u=require("../validators/date.cjs"),m=require("../validators/discriminated-union.cjs"),g=require("../validators/enum.cjs"),V=require("../validators/file.cjs"),Z=require("../validators/function.cjs"),y=require("../validators/json.cjs"),j=require("../validators/lazy.cjs"),f=require("../validators/literal.cjs"),S=require("../validators/map.cjs"),v=require("../validators/nan.cjs"),M=require("../validators/never.cjs"),b=require("../validators/null.cjs"),q=require("../validators/number.cjs"),F=require("../validators/object.cjs"),T=require("../validators/promise.cjs"),h=require("../validators/record.cjs"),E=require("../validators/set.cjs"),L=require("../validators/string.cjs"),U=require("../validators/symbol.cjs"),C=require("../validators/template-literal.cjs"),D=require("../validators/tuple.cjs"),I=require("../validators/undefined.cjs"),B=require("../validators/union.cjs"),O=require("../validators/unknown.cjs"),A=require("../validators/void.cjs"),N=require("../validators/xor.cjs"),P=require("../chunks/index-ZjHAxYdA.cjs"),R=require("../pigment.cjs"),w=require("../compat/emitter.cjs"),k=require("../kernel.cjs"),z=require("../errors.cjs"),J=require("../locales/runtime.cjs"),K=require("../registry.cjs"),_=require("../chunks/index-lejEpLfv.cjs");function X(e){return Object.keys(e).filter(r=>e[r])}function W(e){return"string"==typeof e?e:e?.message||e?.error}require("../validators/string-bool.cjs"),require("../locales/en.cjs"),require("../validators/base64.cjs"),require("../validators/hex.cjs"),require("../validators/uint8array.cjs"),require("../coercion/index.cjs"),require("../chunks/ip-validation-BZqPamPC.cjs"),require("../chunks/security-aXZVI7qW.cjs"),require("../locales/tr.cjs"),require("../locales/es.cjs"),require("../locales/fr.cjs"),require("../locales/de.cjs"),require("../locales/it.cjs"),require("../locales/pt.cjs"),require("../locales/ru.cjs"),require("../locales/ja.cjs"),require("../locales/ko.cjs"),require("../locales/zh.cjs"),require("../locales/ar.cjs"),require("../locales/hi.cjs"),require("../locales/nl.cjs"),require("../locales/pl.cjs"),require("../locales/da.cjs"),require("../locales/sv.cjs"),require("../locales/no.cjs"),require("../locales/fi.cjs"),require("../locales/th.cjs"),require("../locales/vi.cjs"),require("../locales/id.cjs"),require("../locales/bn.cjs"),require("../locales/gu.cjs"),require("../locales/kn.cjs"),require("../locales/ne.cjs"),require("../locales/sk.cjs"),require("../locales/sw.cjs"),require("../locales/af.cjs"),require("../locales/pt-BR.cjs"),require("../locales/es-MX.cjs");exports.$brand=e.$brand,exports.$input=e.$input,exports.$output=e.$output,exports.NEVER=e.NEVER,exports.TimePrecision=e.TimePrecision,exports.ZodFirstPartyTypeKind=e.ZodFirstPartyTypeKind,exports.ZodIssueCode=e.ZodIssueCode,exports._ZodString=e._ZodString,exports._function=e._function,exports.any=e.any,exports.array=e.array,exports.base64=e.base64,exports.base64Bytes=e.base64Bytes,exports.base64url=e.base64url,exports.bigint=e.bigint,exports.boolean=e.boolean,exports.catch=e.catch,exports.check=e.check,exports.cidrv4=e.cidrv4,exports.cidrv6=e.cidrv6,exports.clone=e.clone,exports.codec=e.codec,exports.coerce=e.coerce,exports.config=e.config,exports.core=e.core,exports.createLogger=e.createLogger,exports.createNoOpLogger=e.createNoOpLogger,exports.creditCard=e.creditCard,exports.cuid=e.cuid,exports.cuid2=e.cuid2,exports.custom=e.custom,exports.date=e.date,exports.decode=e.decode,exports.decodeAsync=e.decodeAsync,exports.deepPartial=e.deepPartial,exports.default=e.default,exports.describe=e.describe,exports.disableLogging=e.disableLogging,exports.discriminatedUnion=e.discriminatedUnion,exports.e164=e.e164,exports.email=e.email,exports.emoji=e.emoji,exports.enableDebug=e.enableDebug,exports.encode=e.encode,exports.encodeAsync=e.encodeAsync,exports.endsWith=e.endsWith,exports.enum=e.enum,exports.exactOptional=e.exactOptional,exports.file=e.file,exports.float32=e.float32,exports.float64=e.float64,exports.formatError=e.formatError,exports.fromJSONSchema=e.fromJSONSchema,exports.function=e._function,exports.getErrorMap=e.getErrorMap,exports.getLogger=e.getLogger,exports.gt=e.gt,exports.gte=e.gte,exports.guid=e.guid,exports.hash=e.hash,exports.hex=e.hex,exports.hexBytes=e.hexBytes,exports.hostname=e.hostname,exports.httpUrl=e.httpUrl,exports.includes=e.includes,exports.initLogger=e.initLogger,exports.input=e.input,exports.instanceof=e.instanceof,exports.int=e.int,exports.int32=e.int32,exports.int64=e.int64,exports.intersection=e.intersection,exports.ipv4=e.ipv4,exports.ipv6=e.ipv6,exports.iso=e.iso,exports.json=e.json,exports.jwt=e.jwt,exports.keyof=e.keyof,exports.ksuid=e.ksuid,exports.lazy=e.lazy,exports.length=e.length,exports.literal=e.literal,exports.locales=e.locales,exports.looseObject=e.looseObject,exports.looseRecord=e.looseRecord,exports.lowercase=e.lowercase,exports.lt=e.lt,exports.lte=e.lte,exports.mac=e.mac,exports.map=e.map,exports.mapSchema=e.mapSchema,exports.maxLength=e.maxLength,exports.maxSize=e.maxSize,exports.meta=e.meta,exports.mime=e.mime,exports.minLength=e.minLength,exports.minSize=e.minSize,exports.multipleOf=e.multipleOf,exports.nan=e.nan,exports.nanoid=e.nanoid,exports.nativeEnum=e.nativeEnum,exports.negative=e.negative,exports.never=e.never,exports.nonnegative=e.nonnegative,exports.nonoptional=e.nonoptional,exports.nonpositive=e.nonpositive,exports.normalize=e.normalize,exports.null=e.null,exports.nullable=e.nullable,exports.nullish=e.nullish,exports.number=e.number,exports.object=e.object,exports.optional=e.optional,exports.output=e.output,exports.overwrite=e.overwrite,exports.parse=e.parse,exports.parseAsync=e.parseAsync,exports.partialRecord=e.partialRecord,exports.pipe=e.pipe,exports.positive=e.positive,exports.prefault=e.prefault,exports.preprocess=e.preprocess,exports.promise=e.promise,exports.property=e.property,exports.readonly=e.readonly,exports.record=e.record,exports.refine=e.refine,exports.regex=e.regex,exports.regexes=e.regexes,exports.safeDecode=e.safeDecode,exports.safeDecodeAsync=e.safeDecodeAsync,exports.safeEncode=e.safeEncode,exports.safeEncodeAsync=e.safeEncodeAsync,exports.safeParse=e.safeParse,exports.safeParseAsync=e.safeParseAsync,exports.set=e.set,exports.setErrorMap=e.setErrorMap,exports.setLogLevel=e.setLogLevel,exports.size=e.size,exports.slugify=e.slugify,exports.startsWith=e.startsWith,exports.strictObject=e.strictObject,exports.string=e.string,exports.stringFormat=e.stringFormat,exports.stringbool=e.stringbool,exports.superRefine=e.superRefine,exports.symbol=e.symbol,exports.templateLiteral=e.templateLiteral,exports.toJSONSchema=e.toJSONSchema,exports.toLowerCase=e.toLowerCase,exports.toUpperCase=e.toUpperCase,exports.transform=e.transform,exports.trim=e.trim,exports.tuple=e.tuple,exports.uint32=e.uint32,exports.uint64=e.uint64,exports.uint8Array=e.uint8Array,exports.ulid=e.ulid,exports.undefined=e.undefined,exports.union=e.union,exports.unknown=e.unknown,exports.uppercase=e.uppercase,exports.url=e.url,exports.util=e.util,exports.uuid=e.uuid,exports.uuidv4=e.uuidv4,exports.uuidv6=e.uuidv6,exports.uuidv7=e.uuidv7,exports.v=e.default,exports.void=e.void,exports.xid=e.xid,exports.xor=e.xor,exports.z=e.z,exports.ZodCompileAsyncError=r.ZodCompileAsyncError,exports.ZodCompileError=r.ZodCompileError,exports.ZodCompileUnsupportedError=r.ZodCompileUnsupportedError,exports.compile=r.compile,exports.getDiscriminatedOption=r.getDiscriminatedOption,exports.memoizer=r.memoizer,exports.properties=r.properties,exports.toZod=r.toZod,exports.validate=r.validate,exports.validateAsync=r.validateAsync,exports.zodCompileFn=r.compileFn,exports.Err=o.Err,exports.Ok=o.Ok,exports.ResultUtils=o.ResultUtils,exports.all=o.all,exports.failure=o.failure,exports.flatMap=o.flatMap,exports.fromNullable=o.fromNullable,exports.isErr=o.isErr,exports.isOk=o.isOk,exports.isResult=o.isResult,exports.mapErr=o.mapErr,exports.match=o.match,exports.success=o.success,exports.tryCatch=o.tryCatch,exports.tryCatchAsync=o.tryCatchAsync,exports.unwrap=o.unwrap,exports.unwrapOr=o.unwrapOr,exports.VldBase=t.VldBase,exports.VldMeta=t.VldMeta,exports.ZodBranded=t.VldBrand,exports.ZodCatch=t.VldCatch,exports.ZodDefault=t.VldDefault,exports.ZodExactOptional=t.VldExactOptional,exports.ZodMeta=t.VldMeta,exports.ZodMiniBrand=t.VldBrand,exports.ZodMiniCatch=t.VldCatch,exports.ZodMiniDefault=t.VldDefault,exports.ZodMiniExactOptional=t.VldExactOptional,exports.ZodMiniNonOptional=t.VldRefine,exports.ZodMiniNullable=t.VldNullable,exports.ZodMiniOptional=t.VldOptional,exports.ZodMiniPipe=t.VldPipe,exports.ZodMiniPrefault=t.VldPrefault,exports.ZodMiniReadonly=t.VldReadonly,exports.ZodMiniTransform=t.VldTransform,exports.ZodMiniType=t.VldBase,exports.ZodNonOptional=t.VldRefine,exports.ZodNullable=t.VldNullable,exports.ZodOptional=t.VldOptional,exports.ZodPipe=t.VldPipe,exports.ZodPrefault=t.VldPrefault,exports.ZodPreprocess=t.VldPreprocess,exports.ZodReadonly=t.VldReadonly,exports.ZodTransform=t.VldTransform,exports.ZodType=t.VldBase,exports.VldError=s.VldError,exports.ZodError=s.VldError,exports.ZodRealError=s.VldError,exports.VldIntersection=i.VldIntersection,exports.ZodIntersection=i.VldIntersection,exports.ZodMiniIntersection=i.VldIntersection,exports.ZodAny=p.VldAny,exports.ZodMiniAny=p.VldAny,exports.ZodArray=n.VldArray,exports.ZodMiniArray=n.VldArray,exports.ZodBase64=a.VldStringFormat,exports.ZodBase64URL=a.VldStringFormat,exports.ZodCIDRv4=a.VldStringFormat,exports.ZodCIDRv6=a.VldStringFormat,exports.ZodCUID=a.VldStringFormat,exports.ZodCUID2=a.VldStringFormat,exports.ZodCreditCard=a.VldStringFormat,exports.ZodCustomStringFormat=a.VldStringFormat,exports.ZodE164=a.VldStringFormat,exports.ZodEmail=a.VldStringFormat,exports.ZodEmoji=a.VldStringFormat,exports.ZodGUID=a.VldStringFormat,exports.ZodIPv4=a.VldStringFormat,exports.ZodIPv6=a.VldStringFormat,exports.ZodISODate=a.VldStringFormat,exports.ZodISODateTime=a.VldStringFormat,exports.ZodISODuration=a.VldStringFormat,exports.ZodISOTime=a.VldStringFormat,exports.ZodJWT=a.VldStringFormat,exports.ZodKSUID=a.VldStringFormat,exports.ZodMAC=a.VldStringFormat,exports.ZodMiniBase64=a.VldStringFormat,exports.ZodMiniBase64URL=a.VldStringFormat,exports.ZodMiniCIDRv4=a.VldStringFormat,exports.ZodMiniCIDRv6=a.VldStringFormat,exports.ZodMiniCUID=a.VldStringFormat,exports.ZodMiniCUID2=a.VldStringFormat,exports.ZodMiniCreditCard=a.VldStringFormat,exports.ZodMiniCustomStringFormat=a.VldStringFormat,exports.ZodMiniE164=a.VldStringFormat,exports.ZodMiniEmail=a.VldStringFormat,exports.ZodMiniEmoji=a.VldStringFormat,exports.ZodMiniGUID=a.VldStringFormat,exports.ZodMiniIPv4=a.VldStringFormat,exports.ZodMiniIPv6=a.VldStringFormat,exports.ZodMiniISODate=a.VldStringFormat,exports.ZodMiniISODateTime=a.VldStringFormat,exports.ZodMiniISODuration=a.VldStringFormat,exports.ZodMiniISOTime=a.VldStringFormat,exports.ZodMiniJWT=a.VldStringFormat,exports.ZodMiniKSUID=a.VldStringFormat,exports.ZodMiniMAC=a.VldStringFormat,exports.ZodMiniNanoID=a.VldStringFormat,exports.ZodMiniStringFormat=a.VldStringFormat,exports.ZodMiniULID=a.VldStringFormat,exports.ZodMiniURL=a.VldStringFormat,exports.ZodMiniUUID=a.VldStringFormat,exports.ZodMiniXID=a.VldStringFormat,exports.ZodNanoID=a.VldStringFormat,exports.ZodStringFormat=a.VldStringFormat,exports.ZodULID=a.VldStringFormat,exports.ZodURL=a.VldStringFormat,exports.ZodUUID=a.VldStringFormat,exports.ZodXID=a.VldStringFormat,exports.ZodBigInt=l.VldBigInt,exports.ZodBigIntFormat=l.VldBigInt,exports.ZodMiniBigInt=l.VldBigInt,exports.ZodMiniBigIntFormat=l.VldBigInt,exports.ZodBoolean=d.VldBoolean,exports.ZodMiniBoolean=d.VldBoolean,exports.ZodCodec=x.VldCodec,exports.ZodMiniCodec=x.VldCodec,exports.ZodCustom=c.VldCustom,exports.ZodMiniCustom=c.VldCustom,exports.ZodMiniSuccess=c.VldCustom,exports.ZodSuccess=c.VldCustom,exports.ZodDate=u.VldDate,exports.ZodMiniDate=u.VldDate,exports.ZodDiscriminatedUnion=m.VldDiscriminatedUnion,exports.ZodMiniDiscriminatedUnion=m.VldDiscriminatedUnion,exports.ZodEnum=g.VldEnum,exports.ZodMiniEnum=g.VldEnum,exports.ZodFile=V.VldFile,exports.ZodMiniFile=V.VldFile,exports.ZodFunction=Z.VldFunction,exports.ZodMiniFunction=Z.VldFunction,exports.ZodJSON=y.VldJson,exports.ZodLazy=j.VldLazy,exports.ZodMiniLazy=j.VldLazy,exports.ZodLiteral=f.VldLiteral,exports.ZodMiniLiteral=f.VldLiteral,exports.ZodMap=S.VldMap,exports.ZodMiniMap=S.VldMap,exports.ZodMiniNaN=v.VldNan,exports.ZodNaN=v.VldNan,exports.ZodMiniNever=M.VldNever,exports.ZodNever=M.VldNever,exports.ZodMiniNull=b.VldNull,exports.ZodNull=b.VldNull,exports.ZodMiniNumber=q.VldNumber,exports.ZodMiniNumberFormat=q.VldNumber,exports.ZodNumber=q.VldNumber,exports.ZodNumberFormat=q.VldNumber,exports.ZodMiniObject=F.VldObject,exports.ZodObject=F.VldObject,exports.ZodMiniPromise=T.VldPromise,exports.ZodPromise=T.VldPromise,exports.ZodMiniRecord=h.VldRecord,exports.ZodRecord=h.VldRecord,exports.ZodMiniSet=E.VldSet,exports.ZodSet=E.VldSet,exports.ZodMiniString=L.VldString,exports.ZodString=L.VldString,exports.ZodMiniSymbol=U.VldSymbol,exports.ZodSymbol=U.VldSymbol,exports.ZodMiniTemplateLiteral=C.VldTemplateLiteral,exports.ZodTemplateLiteral=C.VldTemplateLiteral,exports.ZodMiniTuple=D.VldTuple,exports.ZodTuple=D.VldTuple,exports.ZodMiniUndefined=I.VldUndefined,exports.ZodUndefined=I.VldUndefined,exports.ZodMiniUnion=B.VldUnion,exports.ZodUnion=B.VldUnion,exports.ZodMiniUnknown=O.VldUnknown,exports.ZodUnknown=O.VldUnknown,exports.ZodMiniVoid=A.VldVoid,exports.ZodVoid=A.VldVoid,exports.ZodMiniXor=N.VldXor,exports.ZodXor=N.VldXor,exports.base64Json=P.base64Json,exports.base64ToBytes=P.base64ToBytes,exports.base64ToUint8Array=P.base64ToUint8Array,exports.base64UrlToBytes=P.base64UrlToBytes,exports.base64urlToBytes=P.base64urlToBytes,exports.bytesToUtf8=P.bytesToUtf8,exports.epochMillisToDate=P.epochMillisToDate,exports.epochSecondsToDate=P.epochSecondsToDate,exports.hexLowerToBytes=P.hexLowerToBytes,exports.hexToBytes=P.hexToBytes,exports.hexToUint8Array=P.hexToUint8Array,exports.invertCodec=P.invertCodec,exports.isoDatetimeToDate=P.isoDatetimeToDate,exports.jsonCodec=P.jsonCodec,exports.jwtPayload=P.jwtPayload,exports.numberToBigInt=P.numberToBigInt,exports.stringToBigInt=P.stringToBigInt,exports.stringToBoolean=P.stringToBoolean,exports.stringToHttpURL=P.stringToHttpURL,exports.stringToInt=P.stringToInt,exports.stringToNumber=P.stringToNumber,exports.stringToURL=P.stringToURL,exports.stringToUint8Array=P.stringToUint8Array,exports.uint8ArrayToBase64=P.uint8ArrayToBase64,exports.uint8ArrayToBase64Url=P.uint8ArrayToBase64Url,exports.uint8ArrayToHex=P.uint8ArrayToHex,exports.uint8ArrayToString=P.uint8ArrayToString,exports.uriComponent=P.uriComponent,exports.utf8ToBytes=P.utf8ToBytes,exports.blue=R.blue,exports.bold=R.bold,exports.createTheme=R.createTheme,exports.cyan=R.cyan,exports.dim=R.dim,exports.gray=R.gray,exports.green=R.green,exports.grey=R.grey,exports.italic=R.italic,exports.magenta=R.magenta,exports.pigment=R.default,exports.red=R.red,exports.strip=R.strip,exports.supportsColor=R.supportsColor,exports.underline=R.underline,exports.vldTheme=R.vldTheme,exports.white=R.white,exports.yellow=R.yellow,exports.createEmitter=w.createEmitter,exports.createEventBus=w.createEventBus,exports.withEmitter=w.withEmitter,exports.createVldKernel=k.createVldKernel,exports.definePlugin=k.definePlugin,exports.getVldKernel=k.getVldKernel,exports.resetVldKernel=k.resetVldKernel,exports.usePlugin=k.usePlugin,exports.flattenError=z.flattenError,exports.prettifyError=z.prettifyError,exports.prettifyErrorColored=z.prettifyErrorColored,exports.prettifyErrorPlain=z.prettifyErrorPlain,exports.treeifyError=z.treeifyError,exports.getLocale=J.getLocale,exports.getMessages=J.getMessages,exports.getSupportedLocales=J.getSupportedLocales,exports.isLocaleLoaded=J.isLocaleLoaded,exports.isLocaleSupported=J.isLocaleSupported,exports.registerLocale=J.registerLocale,exports.setLocale=J.setLocale,exports.globalRegistry=K.globalRegistry,exports.registry=K.registry,exports.setLocaleAsync=_.setLocaleAsync,exports._default=(e,r)=>e.default("function"==typeof r?r():r),exports.catchall=(e,r)=>e.catchall(r),exports.exactPartial=e=>e.exactPartial(),exports.extend=(e,r)=>e.extend(r),exports.maximum=(r,o)=>{const t=W(o);return e.number().max(r,t)},exports.merge=(e,r)=>r&&"function"==typeof r.parse?e.merge(r):e.extend(r),exports.minimum=(r,o)=>{const t=W(o);return e.number().min(r,t)},exports.omit=(e,r)=>e.omit(...X(r)),exports.partial=e=>e.partial(),exports.pick=(e,r)=>e.pick(...X(r)),exports.required=e=>e.required(),exports.safeExtend=(e,r)=>e.safeExtend(r);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../index.cjs"),r=require("../compile.cjs"),o=require("../compat/result.cjs"),t=require("../validators/base.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs"),i=require("../validators/intersection.cjs"),p=require("../validators/any.cjs"),a=require("../validators/array.cjs"),n=require("../validators/string-formats.cjs"),l=require("../validators/bigint.cjs"),d=require("../validators/boolean.cjs"),x=require("../validators/codec.cjs"),c=require("../validators/custom.cjs"),u=require("../validators/date.cjs"),m=require("../validators/discriminated-union.cjs"),g=require("../validators/enum.cjs"),V=require("../validators/file.cjs"),Z=require("../validators/function.cjs"),y=require("../validators/json.cjs"),j=require("../validators/lazy.cjs"),v=require("../validators/literal.cjs"),f=require("../validators/map.cjs"),S=require("../validators/nan.cjs"),q=require("../validators/never.cjs"),M=require("../validators/null.cjs"),b=require("../validators/number.cjs"),F=require("../validators/object.cjs"),T=require("../validators/promise.cjs"),h=require("../validators/record.cjs"),E=require("../validators/set.cjs"),L=require("../validators/string.cjs"),U=require("../validators/symbol.cjs"),C=require("../validators/template-literal.cjs"),D=require("../validators/tuple.cjs"),I=require("../validators/undefined.cjs"),B=require("../validators/union.cjs"),O=require("../validators/unknown.cjs"),A=require("../validators/void.cjs"),N=require("../validators/xor.cjs"),R=require("../chunks/index-ZjHAxYdA.cjs"),P=require("../pigment.cjs"),k=require("../compat/emitter.cjs"),w=require("../kernel.cjs"),z=require("../errors.cjs"),J=require("../locales/runtime.cjs"),K=require("../registry.cjs"),_=require("../chunks/index-lejEpLfv.cjs");function X(e){return Object.keys(e).filter(r=>e[r])}function W(e){return"string"==typeof e?e:e?.message||e?.error}require("../validators/string-v2.cjs"),require("../chunks/ip-validation-BZqPamPC.cjs"),require("../locales/en.cjs"),require("../validators/number-v2.cjs"),require("../validators/date-v2.cjs"),require("../validators/bigint-v2.cjs"),require("../validators/array-v2.cjs"),require("../validators/union-v2.cjs"),require("../validators/wrapper-v2.cjs"),require("../validators/leaf-v2.cjs"),require("../validators/composite-v2.cjs"),require("../validators/string-bool.cjs"),require("../validators/base64.cjs"),require("../validators/hex.cjs"),require("../validators/uint8array.cjs"),require("../coercion/index.cjs"),require("../chunks/security-aXZVI7qW.cjs"),require("../locales/tr.cjs"),require("../locales/es.cjs"),require("../locales/fr.cjs"),require("../locales/de.cjs"),require("../locales/it.cjs"),require("../locales/pt.cjs"),require("../locales/ru.cjs"),require("../locales/ja.cjs"),require("../locales/ko.cjs"),require("../locales/zh.cjs"),require("../locales/ar.cjs"),require("../locales/hi.cjs"),require("../locales/nl.cjs"),require("../locales/pl.cjs"),require("../locales/da.cjs"),require("../locales/sv.cjs"),require("../locales/no.cjs"),require("../locales/fi.cjs"),require("../locales/th.cjs"),require("../locales/vi.cjs"),require("../locales/id.cjs"),require("../locales/bn.cjs"),require("../locales/gu.cjs"),require("../locales/kn.cjs"),require("../locales/ne.cjs"),require("../locales/sk.cjs"),require("../locales/sw.cjs"),require("../locales/af.cjs"),require("../locales/pt-BR.cjs"),require("../locales/es-MX.cjs");exports.$brand=e.$brand,exports.$input=e.$input,exports.$output=e.$output,exports.NEVER=e.NEVER,exports.TimePrecision=e.TimePrecision,exports.ZodFirstPartyTypeKind=e.ZodFirstPartyTypeKind,exports.ZodIssueCode=e.ZodIssueCode,exports.ZodLikeError=e.ZodLikeError,exports._ZodString=e._ZodString,exports._function=e._function,exports.any=e.any,exports.array=e.array,exports.base64=e.base64,exports.base64Bytes=e.base64Bytes,exports.base64url=e.base64url,exports.bigint=e.bigint,exports.boolean=e.boolean,exports.catch=e.catch,exports.check=e.check,exports.cidrv4=e.cidrv4,exports.cidrv6=e.cidrv6,exports.clone=e.clone,exports.codec=e.codec,exports.coerce=e.coerce,exports.config=e.config,exports.core=e.core,exports.createLogger=e.createLogger,exports.createNoOpLogger=e.createNoOpLogger,exports.creditCard=e.creditCard,exports.cuid=e.cuid,exports.cuid2=e.cuid2,exports.custom=e.custom,exports.date=e.date,exports.decode=e.decode,exports.decodeAsync=e.decodeAsync,exports.deepPartial=e.deepPartial,exports.default=e.default,exports.describe=e.describe,exports.disableLogging=e.disableLogging,exports.discriminatedUnion=e.discriminatedUnion,exports.e164=e.e164,exports.email=e.email,exports.emoji=e.emoji,exports.enableDebug=e.enableDebug,exports.encode=e.encode,exports.encodeAsync=e.encodeAsync,exports.endsWith=e.endsWith,exports.enum=e.enum,exports.exactOptional=e.exactOptional,exports.file=e.file,exports.float32=e.float32,exports.float64=e.float64,exports.formatError=e.formatError,exports.fromJSONSchema=e.fromJSONSchema,exports.function=e._function,exports.getErrorMap=e.getErrorMap,exports.getLogger=e.getLogger,exports.gt=e.gt,exports.gte=e.gte,exports.guid=e.guid,exports.hash=e.hash,exports.hex=e.hex,exports.hexBytes=e.hexBytes,exports.hostname=e.hostname,exports.httpUrl=e.httpUrl,exports.includes=e.includes,exports.initLogger=e.initLogger,exports.input=e.input,exports.instanceof=e.instanceof,exports.int=e.int,exports.int32=e.int32,exports.int64=e.int64,exports.intersection=e.intersection,exports.ipv4=e.ipv4,exports.ipv6=e.ipv6,exports.iso=e.iso,exports.json=e.json,exports.jwt=e.jwt,exports.keyof=e.keyof,exports.ksuid=e.ksuid,exports.lazy=e.lazy,exports.length=e.length,exports.literal=e.literal,exports.locales=e.locales,exports.looseObject=e.looseObject,exports.looseRecord=e.looseRecord,exports.lowercase=e.lowercase,exports.lt=e.lt,exports.lte=e.lte,exports.mac=e.mac,exports.map=e.map,exports.mapSchema=e.mapSchema,exports.maxLength=e.maxLength,exports.maxSize=e.maxSize,exports.meta=e.meta,exports.mime=e.mime,exports.minLength=e.minLength,exports.minSize=e.minSize,exports.multipleOf=e.multipleOf,exports.nan=e.nan,exports.nanoid=e.nanoid,exports.nativeEnum=e.nativeEnum,exports.negative=e.negative,exports.never=e.never,exports.nonnegative=e.nonnegative,exports.nonoptional=e.nonoptional,exports.nonpositive=e.nonpositive,exports.normalize=e.normalize,exports.null=e.null,exports.nullable=e.nullable,exports.nullish=e.nullish,exports.number=e.number,exports.object=e.object,exports.optional=e.optional,exports.output=e.output,exports.overwrite=e.overwrite,exports.parse=e.parse,exports.parseAsync=e.parseAsync,exports.partialRecord=e.partialRecord,exports.pipe=e.pipe,exports.positive=e.positive,exports.prefault=e.prefault,exports.preprocess=e.preprocess,exports.promise=e.promise,exports.property=e.property,exports.readonly=e.readonly,exports.record=e.record,exports.refine=e.refine,exports.regex=e.regex,exports.regexes=e.regexes,exports.safeDecode=e.safeDecode,exports.safeDecodeAsync=e.safeDecodeAsync,exports.safeEncode=e.safeEncode,exports.safeEncodeAsync=e.safeEncodeAsync,exports.safeParse=e.safeParse,exports.safeParseAsync=e.safeParseAsync,exports.set=e.set,exports.setErrorMap=e.setErrorMap,exports.setLogLevel=e.setLogLevel,exports.size=e.size,exports.slugify=e.slugify,exports.startsWith=e.startsWith,exports.strictObject=e.strictObject,exports.string=e.string,exports.stringFormat=e.stringFormat,exports.stringbool=e.stringbool,exports.superRefine=e.superRefine,exports.symbol=e.symbol,exports.templateLiteral=e.templateLiteral,exports.toJSONSchema=e.toJSONSchema,exports.toLowerCase=e.toLowerCase,exports.toUpperCase=e.toUpperCase,exports.toZodError=e.toZodError,exports.toZodSafeResult=e.toZodSafeResult,exports.transform=e.transform,exports.trim=e.trim,exports.tuple=e.tuple,exports.uint32=e.uint32,exports.uint64=e.uint64,exports.uint8Array=e.uint8Array,exports.ulid=e.ulid,exports.undefined=e.undefined,exports.union=e.union,exports.unknown=e.unknown,exports.uppercase=e.uppercase,exports.url=e.url,exports.util=e.util,exports.uuid=e.uuid,exports.uuidv4=e.uuidv4,exports.uuidv6=e.uuidv6,exports.uuidv7=e.uuidv7,exports.v=e.default,exports.vV2=e.vV2,exports.void=e.void,exports.xid=e.xid,exports.xor=e.xor,exports.z=e.z,exports.ZodCompileAsyncError=r.ZodCompileAsyncError,exports.ZodCompileError=r.ZodCompileError,exports.ZodCompileUnsupportedError=r.ZodCompileUnsupportedError,exports.compile=r.compile,exports.getDiscriminatedOption=r.getDiscriminatedOption,exports.memoizer=r.memoizer,exports.properties=r.properties,exports.toZod=r.toZod,exports.validate=r.validate,exports.validateAsync=r.validateAsync,exports.zodCompileFn=r.compileFn,exports.Err=o.Err,exports.Ok=o.Ok,exports.ResultUtils=o.ResultUtils,exports.all=o.all,exports.failure=o.failure,exports.flatMap=o.flatMap,exports.fromNullable=o.fromNullable,exports.isErr=o.isErr,exports.isOk=o.isOk,exports.isResult=o.isResult,exports.mapErr=o.mapErr,exports.match=o.match,exports.success=o.success,exports.tryCatch=o.tryCatch,exports.tryCatchAsync=o.tryCatchAsync,exports.unwrap=o.unwrap,exports.unwrapOr=o.unwrapOr,exports.VldBase=t.VldBase,exports.VldMeta=t.VldMeta,exports.ZodBranded=t.VldBrand,exports.ZodCatch=t.VldCatch,exports.ZodDefault=t.VldDefault,exports.ZodExactOptional=t.VldExactOptional,exports.ZodMeta=t.VldMeta,exports.ZodMiniBrand=t.VldBrand,exports.ZodMiniCatch=t.VldCatch,exports.ZodMiniDefault=t.VldDefault,exports.ZodMiniExactOptional=t.VldExactOptional,exports.ZodMiniNonOptional=t.VldRefine,exports.ZodMiniNullable=t.VldNullable,exports.ZodMiniOptional=t.VldOptional,exports.ZodMiniPipe=t.VldPipe,exports.ZodMiniPrefault=t.VldPrefault,exports.ZodMiniReadonly=t.VldReadonly,exports.ZodMiniTransform=t.VldTransform,exports.ZodMiniType=t.VldBase,exports.ZodNonOptional=t.VldRefine,exports.ZodNullable=t.VldNullable,exports.ZodOptional=t.VldOptional,exports.ZodPipe=t.VldPipe,exports.ZodPrefault=t.VldPrefault,exports.ZodPreprocess=t.VldPreprocess,exports.ZodReadonly=t.VldReadonly,exports.ZodTransform=t.VldTransform,exports.ZodType=t.VldBase,exports.VldError=s.VldError,exports.ZodError=s.VldError,exports.ZodRealError=s.VldError,exports.VldIntersection=i.VldIntersection,exports.ZodIntersection=i.VldIntersection,exports.ZodMiniIntersection=i.VldIntersection,exports.ZodAny=p.VldAny,exports.ZodMiniAny=p.VldAny,exports.ZodArray=a.VldArray,exports.ZodMiniArray=a.VldArray,exports.ZodBase64=n.VldStringFormat,exports.ZodBase64URL=n.VldStringFormat,exports.ZodCIDRv4=n.VldStringFormat,exports.ZodCIDRv6=n.VldStringFormat,exports.ZodCUID=n.VldStringFormat,exports.ZodCUID2=n.VldStringFormat,exports.ZodCreditCard=n.VldStringFormat,exports.ZodCustomStringFormat=n.VldStringFormat,exports.ZodE164=n.VldStringFormat,exports.ZodEmail=n.VldStringFormat,exports.ZodEmoji=n.VldStringFormat,exports.ZodGUID=n.VldStringFormat,exports.ZodIPv4=n.VldStringFormat,exports.ZodIPv6=n.VldStringFormat,exports.ZodISODate=n.VldStringFormat,exports.ZodISODateTime=n.VldStringFormat,exports.ZodISODuration=n.VldStringFormat,exports.ZodISOTime=n.VldStringFormat,exports.ZodJWT=n.VldStringFormat,exports.ZodKSUID=n.VldStringFormat,exports.ZodMAC=n.VldStringFormat,exports.ZodMiniBase64=n.VldStringFormat,exports.ZodMiniBase64URL=n.VldStringFormat,exports.ZodMiniCIDRv4=n.VldStringFormat,exports.ZodMiniCIDRv6=n.VldStringFormat,exports.ZodMiniCUID=n.VldStringFormat,exports.ZodMiniCUID2=n.VldStringFormat,exports.ZodMiniCreditCard=n.VldStringFormat,exports.ZodMiniCustomStringFormat=n.VldStringFormat,exports.ZodMiniE164=n.VldStringFormat,exports.ZodMiniEmail=n.VldStringFormat,exports.ZodMiniEmoji=n.VldStringFormat,exports.ZodMiniGUID=n.VldStringFormat,exports.ZodMiniIPv4=n.VldStringFormat,exports.ZodMiniIPv6=n.VldStringFormat,exports.ZodMiniISODate=n.VldStringFormat,exports.ZodMiniISODateTime=n.VldStringFormat,exports.ZodMiniISODuration=n.VldStringFormat,exports.ZodMiniISOTime=n.VldStringFormat,exports.ZodMiniJWT=n.VldStringFormat,exports.ZodMiniKSUID=n.VldStringFormat,exports.ZodMiniMAC=n.VldStringFormat,exports.ZodMiniNanoID=n.VldStringFormat,exports.ZodMiniStringFormat=n.VldStringFormat,exports.ZodMiniULID=n.VldStringFormat,exports.ZodMiniURL=n.VldStringFormat,exports.ZodMiniUUID=n.VldStringFormat,exports.ZodMiniXID=n.VldStringFormat,exports.ZodNanoID=n.VldStringFormat,exports.ZodStringFormat=n.VldStringFormat,exports.ZodULID=n.VldStringFormat,exports.ZodURL=n.VldStringFormat,exports.ZodUUID=n.VldStringFormat,exports.ZodXID=n.VldStringFormat,exports.ZodBigInt=l.VldBigInt,exports.ZodBigIntFormat=l.VldBigInt,exports.ZodMiniBigInt=l.VldBigInt,exports.ZodMiniBigIntFormat=l.VldBigInt,exports.ZodBoolean=d.VldBoolean,exports.ZodMiniBoolean=d.VldBoolean,exports.ZodCodec=x.VldCodec,exports.ZodMiniCodec=x.VldCodec,exports.ZodCustom=c.VldCustom,exports.ZodMiniCustom=c.VldCustom,exports.ZodMiniSuccess=c.VldCustom,exports.ZodSuccess=c.VldCustom,exports.ZodDate=u.VldDate,exports.ZodMiniDate=u.VldDate,exports.ZodDiscriminatedUnion=m.VldDiscriminatedUnion,exports.ZodMiniDiscriminatedUnion=m.VldDiscriminatedUnion,exports.ZodEnum=g.VldEnum,exports.ZodMiniEnum=g.VldEnum,exports.ZodFile=V.VldFile,exports.ZodMiniFile=V.VldFile,exports.ZodFunction=Z.VldFunction,exports.ZodMiniFunction=Z.VldFunction,exports.ZodJSON=y.VldJson,exports.ZodLazy=j.VldLazy,exports.ZodMiniLazy=j.VldLazy,exports.ZodLiteral=v.VldLiteral,exports.ZodMiniLiteral=v.VldLiteral,exports.ZodMap=f.VldMap,exports.ZodMiniMap=f.VldMap,exports.ZodMiniNaN=S.VldNan,exports.ZodNaN=S.VldNan,exports.ZodMiniNever=q.VldNever,exports.ZodNever=q.VldNever,exports.ZodMiniNull=M.VldNull,exports.ZodNull=M.VldNull,exports.ZodMiniNumber=b.VldNumber,exports.ZodMiniNumberFormat=b.VldNumber,exports.ZodNumber=b.VldNumber,exports.ZodNumberFormat=b.VldNumber,exports.ZodMiniObject=F.VldObject,exports.ZodObject=F.VldObject,exports.ZodMiniPromise=T.VldPromise,exports.ZodPromise=T.VldPromise,exports.ZodMiniRecord=h.VldRecord,exports.ZodRecord=h.VldRecord,exports.ZodMiniSet=E.VldSet,exports.ZodSet=E.VldSet,exports.ZodMiniString=L.VldString,exports.ZodString=L.VldString,exports.ZodMiniSymbol=U.VldSymbol,exports.ZodSymbol=U.VldSymbol,exports.ZodMiniTemplateLiteral=C.VldTemplateLiteral,exports.ZodTemplateLiteral=C.VldTemplateLiteral,exports.ZodMiniTuple=D.VldTuple,exports.ZodTuple=D.VldTuple,exports.ZodMiniUndefined=I.VldUndefined,exports.ZodUndefined=I.VldUndefined,exports.ZodMiniUnion=B.VldUnion,exports.ZodUnion=B.VldUnion,exports.ZodMiniUnknown=O.VldUnknown,exports.ZodUnknown=O.VldUnknown,exports.ZodMiniVoid=A.VldVoid,exports.ZodVoid=A.VldVoid,exports.ZodMiniXor=N.VldXor,exports.ZodXor=N.VldXor,exports.base64Json=R.base64Json,exports.base64ToBytes=R.base64ToBytes,exports.base64ToUint8Array=R.base64ToUint8Array,exports.base64UrlToBytes=R.base64UrlToBytes,exports.base64urlToBytes=R.base64urlToBytes,exports.bytesToUtf8=R.bytesToUtf8,exports.epochMillisToDate=R.epochMillisToDate,exports.epochSecondsToDate=R.epochSecondsToDate,exports.hexLowerToBytes=R.hexLowerToBytes,exports.hexToBytes=R.hexToBytes,exports.hexToUint8Array=R.hexToUint8Array,exports.invertCodec=R.invertCodec,exports.isoDatetimeToDate=R.isoDatetimeToDate,exports.jsonCodec=R.jsonCodec,exports.jwtPayload=R.jwtPayload,exports.numberToBigInt=R.numberToBigInt,exports.stringToBigInt=R.stringToBigInt,exports.stringToBoolean=R.stringToBoolean,exports.stringToHttpURL=R.stringToHttpURL,exports.stringToInt=R.stringToInt,exports.stringToNumber=R.stringToNumber,exports.stringToURL=R.stringToURL,exports.stringToUint8Array=R.stringToUint8Array,exports.uint8ArrayToBase64=R.uint8ArrayToBase64,exports.uint8ArrayToBase64Url=R.uint8ArrayToBase64Url,exports.uint8ArrayToHex=R.uint8ArrayToHex,exports.uint8ArrayToString=R.uint8ArrayToString,exports.uriComponent=R.uriComponent,exports.utf8ToBytes=R.utf8ToBytes,exports.blue=P.blue,exports.bold=P.bold,exports.createTheme=P.createTheme,exports.cyan=P.cyan,exports.dim=P.dim,exports.gray=P.gray,exports.green=P.green,exports.grey=P.grey,exports.italic=P.italic,exports.magenta=P.magenta,exports.pigment=P.default,exports.red=P.red,exports.strip=P.strip,exports.supportsColor=P.supportsColor,exports.underline=P.underline,exports.vldTheme=P.vldTheme,exports.white=P.white,exports.yellow=P.yellow,exports.createEmitter=k.createEmitter,exports.createEventBus=k.createEventBus,exports.withEmitter=k.withEmitter,exports.createVldKernel=w.createVldKernel,exports.definePlugin=w.definePlugin,exports.getVldKernel=w.getVldKernel,exports.resetVldKernel=w.resetVldKernel,exports.usePlugin=w.usePlugin,exports.flattenError=z.flattenError,exports.prettifyError=z.prettifyError,exports.prettifyErrorColored=z.prettifyErrorColored,exports.prettifyErrorPlain=z.prettifyErrorPlain,exports.treeifyError=z.treeifyError,exports.getLocale=J.getLocale,exports.getMessages=J.getMessages,exports.getSupportedLocales=J.getSupportedLocales,exports.isLocaleLoaded=J.isLocaleLoaded,exports.isLocaleSupported=J.isLocaleSupported,exports.registerLocale=J.registerLocale,exports.setLocale=J.setLocale,exports.globalRegistry=K.globalRegistry,exports.registry=K.registry,exports.setLocaleAsync=_.setLocaleAsync,exports._default=(e,r)=>e.default("function"==typeof r?r():r),exports.catchall=(e,r)=>e.catchall(r),exports.exactPartial=e=>e.exactPartial(),exports.extend=(e,r)=>e.extend(r),exports.maximum=(r,o)=>{const t=W(o);return e.number().max(r,t)},exports.merge=(e,r)=>r&&"function"==typeof r.parse?e.merge(r):e.extend(r),exports.minimum=(r,o)=>{const t=W(o);return e.number().min(r,t)},exports.omit=(e,r)=>e.omit(...X(r)),exports.partial=e=>e.partial(),exports.pick=(e,r)=>e.pick(...X(r)),exports.required=e=>e.required(),exports.safeExtend=(e,r)=>e.safeExtend(r);
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs");require("../registry.cjs"),require("../chunks/errors-core-DrydF46s.cjs");class VldAny extends e.VldBase{constructor(){super(e.VLD_VALIDATOR_TYPES.ANY)}static create(){return new VldAny}get isSimple(){return!0}parse(e){return e}safeParse(e){return{success:!0,data:e}}}exports.VldAny=VldAny;
1
+ "use strict";var e=require("./base.cjs");require("../registry.cjs"),require("../chunks/errors-core-C0mA6tfa.cjs");class VldAny extends e.VldBase{constructor(){super(e.VLD_VALIDATOR_TYPES.ANY)}static create(){return new VldAny}get isSimple(){return!0}parse(e){return e}safeParse(e){return{success:!0,data:e}}}exports.VldAny=VldAny;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./base.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs"),r=require("../locales/runtime.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldArrayCheck{}class VldArrayCheckMin extends VldArrayCheck{constructor(e,t){super(),this.minLength=e,this.kind="minLength",this._msg=t}get message(){return this._msg}check(e,t){e.length<this.minLength&&t.issues.push({code:"too_small",path:[],origin:"array",minimum:this.minLength,inclusive:!0,message:this._msg||`Array must have at least ${this.minLength} items`})}meta(){return{kind:"minLength",value:this.minLength,message:this._msg}}}class VldArrayCheckMax extends VldArrayCheck{constructor(e,t){super(),this.maxLength=e,this.kind="maxLength",this._msg=t}get message(){return this._msg}check(e,t){e.length>this.maxLength&&t.issues.push({code:"too_big",path:[],origin:"array",maximum:this.maxLength,inclusive:!0,message:this._msg||`Array must have at most ${this.maxLength} items`})}meta(){return{kind:"maxLength",value:this.maxLength,message:this._msg}}}class VldArrayCheckLength extends VldArrayCheck{constructor(e,t){super(),this.exactLength=e,this.kind="exactLength",this._msg=t}get message(){return this._msg}check(e,t){e.length!==this.exactLength&&t.issues.push({code:"too_big",path:[],origin:"array",exact:this.exactLength,message:this._msg||`Array must have exactly ${this.exactLength} items`})}meta(){return{kind:"exactLength",value:this.exactLength,message:this._msg}}}class VldArrayCheckUnique extends VldArrayCheck{constructor(e){super(),this.kind="unique",this._msg=e}get message(){return this._msg}check(e,t){const r=new Set;for(let s=0;s<e.items.length;s++){const a=e.items[s];if(r.has(a))return void t.issues.push({code:"custom",path:[s],message:this._msg||`Duplicate item at index ${s}`});r.add(a)}}meta(){return{kind:"unique",message:this._msg}}}function s(t){if(!0===t.isSimple)switch(t.validatorType){case e.VLD_VALIDATOR_TYPES.STRING:return"string";case e.VLD_VALIDATOR_TYPES.NUMBER:return"number";case e.VLD_VALIDATOR_TYPES.BOOLEAN:return"boolean";default:return}}class VldArrayV2 extends e.VldBase{constructor(t){super(e.VLD_VALIDATOR_TYPES.ARRAY),this.__def=t}static create(e){return new VldArrayV2({type:"array",itemValidator:e,checks:Object.freeze([]),simpleItemMode:s(e),hasUnique:!1})}get element(){return this.__def.itemValidator}unwrap(){return this.__def.itemValidator}get isSimple(){return 0===this.__def.checks.length}parse(e){if(!Array.isArray(e))throw new t.VldError([t.createInvalidTypeIssue("array",t.getTypeName(e),this.__def.errorMessage)]);return this.parseKnownArray(e)}parseKnownArray(e){const s=this.__def,a=s.checks;if(a.length>0)for(let r=0;r<a.length;r++){const i=a[r];if("minLength"===i.kind&&e.length<i.minLength)throw new t.VldError([{code:"too_small",path:[],origin:"array",minimum:i.minLength,inclusive:!0,message:i.message||`Array must have at least ${i.minLength} items`}]);if("maxLength"===i.kind&&e.length>i.maxLength)throw new t.VldError([{code:"too_big",path:[],origin:"array",maximum:i.maxLength,inclusive:!0,message:i.message||`Array must have at most ${i.maxLength} items`}]);if("exactLength"===i.kind&&e.length!==i.exactLength)throw new t.VldError([{code:"too_big",path:[],origin:"array",exact:i.exactLength,message:i.message||`Array must have exactly ${i.exactLength} items`}]);if("unique"===i.kind&&s.hasUnique){const r=new Set;for(let s=0;s<e.length;s++){const a=e[s];if(r.has(a))throw new t.VldError([{code:"custom",path:[s],message:i.message||`Duplicate item at index ${s}`}]);r.add(a)}}}const i=e.length,n=new Array(i),h=s.simpleItemMode,c=s.itemValidator;if(void 0!==h)for(let t=0;t<i;t++){const s=e[t];switch(h){case"string":if("string"!=typeof s)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidString));n[t]=s;break;case"number":if("number"!=typeof s||isNaN(s))throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidNumber));n[t]=s;break;case"boolean":if("boolean"!=typeof s)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidBoolean));n[t]=s}}else for(let t=0;t<i;t++)n[t]=c.parse(e[t]);return n}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof t.VldError?e:new t.VldError([{code:"custom",path:[],message:String(e)}])}}}withDef(e){const t={...this.__def,...e,type:"array"};return new this.constructor(t)}min(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(e,t)]})}max(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMax(e,t)]})}length(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckLength(e,t)]})}nonempty(e){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(1,e)]})}unique(e){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckUnique(e)],hasUnique:!0})}between(e,t,r){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(e,r),new VldArrayCheckMax(t,r)]})}}exports.VldArrayCheck=VldArrayCheck,exports.VldArrayCheckLength=VldArrayCheckLength,exports.VldArrayCheckMax=VldArrayCheckMax,exports.VldArrayCheckMin=VldArrayCheckMin,exports.VldArrayCheckUnique=VldArrayCheckUnique,exports.VldArrayV2=VldArrayV2;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),t=require("../chunks/errors-core-DrydF46s.cjs");function n(e){return new t.VldError([{code:"invalid_array",path:[],message:e}])}function s(e,r){return new t.VldError([{code:"too_small",path:[],origin:"array",minimum:e,inclusive:!0,message:r}])}require("../registry.cjs"),require("../locales/en.cjs");class VldArray extends e.VldBase{constructor(r){super(e.VLD_VALIDATOR_TYPES.ARRAY),this.config=r,this._simpleItemMode=this.getSimpleItemMode(r.itemValidator)}getSimpleItemMode(r){if(!0===r.isSimple)switch(r.validatorType){case e.VLD_VALIDATOR_TYPES.STRING:return"string";case e.VLD_VALIDATOR_TYPES.NUMBER:return"number";case e.VLD_VALIDATOR_TYPES.BOOLEAN:return"boolean";default:return}}static create(e){return new VldArray({itemValidator:e})}get element(){return this.config.itemValidator}unwrap(){return this.config.itemValidator}parse(e){if(!Array.isArray(e)){const n=this.config.errorMessage||r.getMessages().invalidArray;throw new t.VldError([t.createInvalidTypeIssue("array",t.getTypeName(e),n)])}return this.parseArrayValue(e)}parseKnownArray(e){return this.parseArrayValue(e)}parseArrayValue(e){if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw s(this.config.exactLength,this.config.errorMessage||r.getMessages().arrayLength(this.config.exactLength));if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw s(this.config.minLength,this.config.errorMessage||r.getMessages().arrayMin(this.config.minLength));if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw n=this.config.maxLength,i=this.config.errorMessage||r.getMessages().arrayMax(this.config.maxLength),new t.VldError([{code:"too_big",path:[],origin:"array",maximum:n,inclusive:!0,message:i}]);var n,i;const a=e.length,o=new Array(a),g=this._simpleItemMode;if(void 0!==g){for(let t=0;t<a;t++){const n=e[t];switch(g){case"string":if("string"!=typeof n)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidString));o[t]=n;break;case"number":if("number"!=typeof n||isNaN(n))throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidNumber));o[t]=n;break;case"boolean":if("boolean"!=typeof n)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidBoolean));o[t]=n}}return this.config.unique&&this.checkUnique(o),o}for(let t=0;t<a;t++)try{o[t]=this.config.itemValidator.parse(e[t])}catch(e){const n=e instanceof Error?e.message:String(e);throw new Error(r.getMessages().arrayItem(t,n))}return this.config.unique&&this.checkUnique(o),o}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return e instanceof t.VldError?{success:!1,error:e}:{success:!1,error:n(e.message)}}}encode(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=this.config.itemValidator.encode(e[t]);return r}safeEncode(e){try{return{success:!0,data:this.encode(e)}}catch(e){return{success:!1,error:n(e.message)}}}async encodeAsync(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=await this.config.itemValidator.encodeAsync(e[t]);return r}async safeEncodeAsync(e){try{return{success:!0,data:await this.encodeAsync(e)}}catch(e){return{success:!1,error:n(e.message)}}}validateEncodedArray(e){if(!Array.isArray(e))throw new Error(this.config.errorMessage||r.getMessages().invalidArray);if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw new Error(this.config.errorMessage);this.config.unique&&this.checkUnique(e)}checkUnique(e){const r=new Set,t=new WeakMap;for(const n of e){let e;if("object"==typeof n&&null!==n){const r=t.get(n);if(void 0!==r)e=r;else{const r=this.stableStringify(n);e=r,t.set(n,r)}}else e=n;if(r.has(e))throw new Error("Array must contain unique items");r.add(e)}}stableStringify(e){const r=new WeakSet,t=(e,n=0)=>{if(n>100)return'"[Max Depth Exceeded]"';if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return JSON.stringify(e);if(r.has(e))return'"[Circular]"';r.add(e);try{if(Array.isArray(e)){return`[${e.map(e=>t(e,n+1)).join(",")}]`}const r=Object.keys(e).sort();return`{${r.map(r=>`${JSON.stringify(r)}:${t(e[r],n+1)}`).join(",")}}`}finally{r.delete(e)}};try{return t(e)}catch{return String(e)}}min(e,t){return new VldArray({...this.config,minLength:e,errorMessage:t||r.getMessages().arrayMin(e)})}max(e,t){return new VldArray({...this.config,maxLength:e,errorMessage:t||r.getMessages().arrayMax(e)})}length(e,t){return new VldArray({...this.config,exactLength:e,minLength:void 0,maxLength:void 0,errorMessage:t||r.getMessages().arrayLength(e)})}nonempty(e){return new VldArray({...this.config,minLength:1,errorMessage:e||r.getMessages().arrayEmpty})}unique(e){return new VldArray({...this.config,unique:!0,errorMessage:e||"Array must contain unique items"})}between(e,r,t){return new VldArray({...this.config,minLength:e,maxLength:r,errorMessage:t||`Array length must be between ${e} and ${r}`})}}exports.VldArray=VldArray;
1
+ "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs");function n(e){return new t.VldError([{code:"invalid_array",path:[],message:e}])}function s(e,r){return new t.VldError([{code:"too_small",path:[],origin:"array",minimum:e,inclusive:!0,message:r}])}require("../registry.cjs"),require("../locales/en.cjs");class VldArray extends e.VldBase{constructor(r){super(e.VLD_VALIDATOR_TYPES.ARRAY),this.config=r,this._simpleItemMode=this.getSimpleItemMode(r.itemValidator)}getSimpleItemMode(r){if(!0===r.isSimple)switch(r.validatorType){case e.VLD_VALIDATOR_TYPES.STRING:return"string";case e.VLD_VALIDATOR_TYPES.NUMBER:return"number";case e.VLD_VALIDATOR_TYPES.BOOLEAN:return"boolean";default:return}}static create(e){return new VldArray({itemValidator:e})}get element(){return this.config.itemValidator}unwrap(){return this.config.itemValidator}parse(e){if(!Array.isArray(e)){const n=this.config.errorMessage||r.getMessages().invalidArray;throw new t.VldError([t.createInvalidTypeIssue("array",t.getTypeName(e),n)])}return this.parseArrayValue(e)}parseKnownArray(e){return this.parseArrayValue(e)}parseArrayValue(e){if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw s(this.config.exactLength,this.config.errorMessage||r.getMessages().arrayLength(this.config.exactLength));if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw s(this.config.minLength,this.config.errorMessage||r.getMessages().arrayMin(this.config.minLength));if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw n=this.config.maxLength,i=this.config.errorMessage||r.getMessages().arrayMax(this.config.maxLength),new t.VldError([{code:"too_big",path:[],origin:"array",maximum:n,inclusive:!0,message:i}]);var n,i;const a=e.length,o=new Array(a),g=this._simpleItemMode;if(void 0!==g){for(let t=0;t<a;t++){const n=e[t];switch(g){case"string":if("string"!=typeof n)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidString));o[t]=n;break;case"number":if("number"!=typeof n||isNaN(n))throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidNumber));o[t]=n;break;case"boolean":if("boolean"!=typeof n)throw new Error(r.getMessages().arrayItem(t,r.getMessages().invalidBoolean));o[t]=n}}return this.config.unique&&this.checkUnique(o),o}for(let t=0;t<a;t++)try{o[t]=this.config.itemValidator.parse(e[t])}catch(e){const n=e instanceof Error?e.message:String(e);throw new Error(r.getMessages().arrayItem(t,n))}return this.config.unique&&this.checkUnique(o),o}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return e instanceof t.VldError?{success:!1,error:e}:{success:!1,error:n(e.message)}}}encode(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=this.config.itemValidator.encode(e[t]);return r}safeEncode(e){try{return{success:!0,data:this.encode(e)}}catch(e){return{success:!1,error:n(e.message)}}}async encodeAsync(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=await this.config.itemValidator.encodeAsync(e[t]);return r}async safeEncodeAsync(e){try{return{success:!0,data:await this.encodeAsync(e)}}catch(e){return{success:!1,error:n(e.message)}}}validateEncodedArray(e){if(!Array.isArray(e))throw new Error(this.config.errorMessage||r.getMessages().invalidArray);if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw new Error(this.config.errorMessage);this.config.unique&&this.checkUnique(e)}checkUnique(e){const r=new Set,t=new WeakMap;for(const n of e){let e;if("object"==typeof n&&null!==n){const r=t.get(n);if(void 0!==r)e=r;else{const r=this.stableStringify(n);e=r,t.set(n,r)}}else e=n;if(r.has(e))throw new Error("Array must contain unique items");r.add(e)}}stableStringify(e){const r=new WeakSet,t=(e,n=0)=>{if(n>100)return'"[Max Depth Exceeded]"';if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return JSON.stringify(e);if(r.has(e))return'"[Circular]"';r.add(e);try{if(Array.isArray(e)){return`[${e.map(e=>t(e,n+1)).join(",")}]`}const r=Object.keys(e).sort();return`{${r.map(r=>`${JSON.stringify(r)}:${t(e[r],n+1)}`).join(",")}}`}finally{r.delete(e)}};try{return t(e)}catch{return String(e)}}min(e,t){return new VldArray({...this.config,minLength:e,errorMessage:t||r.getMessages().arrayMin(e)})}max(e,t){return new VldArray({...this.config,maxLength:e,errorMessage:t||r.getMessages().arrayMax(e)})}length(e,t){return new VldArray({...this.config,exactLength:e,minLength:void 0,maxLength:void 0,errorMessage:t||r.getMessages().arrayLength(e)})}nonempty(e){return new VldArray({...this.config,minLength:1,errorMessage:e||r.getMessages().arrayEmpty})}unique(e){return new VldArray({...this.config,unique:!0,errorMessage:e||"Array must contain unique items"})}between(e,r,t){return new VldArray({...this.config,minLength:e,maxLength:r,errorMessage:t||`Array length must be between ${e} and ${r}`})}}exports.VldArray=VldArray;
@@ -1 +1 @@
1
- "use strict";var e=require("../registry.cjs"),t=require("../chunks/errors-core-DrydF46s.cjs");function s(e){if(e instanceof t.VldError)return e;const s=e instanceof Error?e.message:String(e);return new t.VldError([{code:"custom",path:[],message:s}])}const r={STRING:"string",STRING_FORMAT:"stringFormat",STRING_BOOL:"stringBool",NUMBER:"number",BOOLEAN:"boolean",DATE:"date",BIGINT:"bigint",UNDEFINED:"undefined",NULL:"null",UNKNOWN:"unknown",ANY:"any",VOID:"void",NEVER:"never",SYMBOL:"symbol",NAN:"nan",HEX:"hex",BASE64:"base64",UINT8_ARRAY:"uint8Array",COERCE_STRING:"coerceString",COERCE_NUMBER:"coerceNumber",COERCE_BOOLEAN:"coerceBoolean",COERCE_DATE:"coerceDate",COERCE_BIGINT:"coerceBigint",OBJECT:"object",ARRAY:"array",TUPLE:"tuple",SET:"set",MAP:"map",RECORD:"record",UNION:"union",DISCRIMINATED_UNION:"discriminatedUnion",INTERSECTION:"intersection",XOR:"xor",ENUM:"enum",LITERAL:"literal",LAZY:"lazy",CUSTOM:"custom",FUNCTION:"function",FILE:"file",JSON:"json",TEMPLATE_LITERAL:"templateLiteral",PROMISE:"promise",OPTIONAL:"optional",NULLABLE:"nullable",NULLISH:"nullish",EXACT_OPTIONAL:"exactOptional",DEFAULT:"default",CATCH:"catch",REFINE:"refine",TRANSFORM:"transform",PIPE:"pipe",PREPROCESS:"preprocess",SUPER_REFINE:"superRefine",BRAND:"brand",READONLY:"readonly",META:"meta",PREFAULT:"prefault",PREFault:"prefault",CODEC:"codec"};function a(e,t){if("string"==typeof e)return e;if("function"==typeof e){const s=e(void 0);return"string"==typeof s?s:"object"==typeof s&&s?.message?s.message:t}if("object"==typeof e&&null!==e){if("string"==typeof e.error)return e.error;if("function"==typeof e.error)return e.error({})||t;if("string"==typeof e.message)return e.message}return t}function i(e){return null!==e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}let n;function o(e){return"function"==typeof e?e():function(e){if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(null!==e&&"object"==typeof e){const t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return{...e}}return e}(e)}function h(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";case r.BIGINT:return"bigint";case r.SYMBOL:return"symbol";default:return}}function l(e,t){switch(e){case"string":return"string"==typeof t?t:void 0;case"number":return"number"!=typeof t||isNaN(t)?void 0:t;case"boolean":return"boolean"==typeof t?t:void 0;case"bigint":return"bigint"==typeof t?t:void 0;case"symbol":return"symbol"==typeof t?t:void 0;default:return}}class VldBase{constructor(e="unknown"){this.validatorType=e}get type(){return this.validatorType}get _def(){return{typeName:"Zod"+this.validatorType.charAt(0).toUpperCase()+this.validatorType.slice(1),...this.config||{}}}get def(){return this._def}get _zod(){return this._def}get"~standard"(){return{version:1,vendor:"vld",validate:e=>{const t=this.safeParse(e);return t.success?{value:t.data}:{issues:[{message:t.error.message}]}},types:void 0}}async parseAsync(e){return this.parse(e)}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}decode(e){return this.parse(e)}safeDecode(e){return this.safeParse(e)}async decodeAsync(e){return this.parseAsync(e)}async safeDecodeAsync(e){return this.safeParseAsync(e)}encode(e){return this.parse(e)}safeEncode(e){const t=this.safeParse(e);return t.success?{success:!0,data:t.data}:t}async encodeAsync(e){return this.parseAsync(e)}async safeEncodeAsync(e){const t=await this.safeParseAsync(e);return t.success?{success:!0,data:t.data}:t}spa(e){return this.safeParseAsync(e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}clone(){return this}isValid(e){return this.safeParse(e).success}parseOrDefault(e,t){const s=this.safeParse(e);if(s.success)return s.data;const r=this.safeParse(t);if(!r.success)throw new Error(`Invalid default value provided: ${r.error.message}`);return r.data}refine(e,t){return new VldRefine(this,e,t)}superRefine(e){return new VldSuperRefine(this,e)}transform(e){return new VldTransform(this,e)}default(e){return new VldDefault(this,e)}prefault(e){return new VldPrefault(this,e)}nonoptional(e){return new VldRefine(this,e=>void 0!==e,a(e,"Expected non-optional value"))}array(){return n.array(this)}or(e){return n.union(this,e)}and(e){return n.intersection(this,e)}overwrite(e){return new VldTransform(this,e)}with(...e){return new VldSuperRefine(this,(t,s)=>{const r={value:t,issues:[]},a=[];for(const t of e){const e="function"==typeof t?t:t._zod?.check;if(!e)continue;const s=e(r);i(s)&&a.push(Promise.resolve(s))}const n=()=>{for(const e of r.issues)s.addIssue(void 0===e.code?{message:e.message||"Custom check failed"}:{message:e.message||"Custom check failed",code:e.code})};if(a.length>0)return Promise.all(a).then(n);n()})}toJSONSchema(e){return n.toJSONSchema(this,e)}catch(e){return new VldCatch(this,e)}optional(){return new VldOptional(this)}nullable(){return new VldNullable(this)}nullish(){return new VldNullish(this)}exactOptional(){return new VldExactOptional(this)}pipe(e){return new VldPipe(this,e)}readonly(){return new VldReadonly(this)}brand(){return new VldBrand(this)}apply(e){return e(this)}check(e,t){return this.refine(e,t)}meta(t){if(void 0===t)return e.globalRegistry.get(this)??this.baseValidator?.meta?.()??this.schema?.meta?.()??this.inner?.meta?.();const s=new VldMeta(this,t);return e.globalRegistry.add(s,t),s}register(e,t){return e.add(this,t),this}describe(e){return this.meta({description:e})}get description(){return this.meta()?.description??this.baseValidator?.description??this.schema?.description??this.inner?.description}}class VldMeta extends VldBase{constructor(e,t){super(r.META),this.baseValidator=e,this.metadata=t}parse(e){return this.baseValidator.parse(e)}safeParse(e){return this.baseValidator.safeParse(e)}getMeta(){return{...this.metadata}}meta(t){if(void 0===t)return{...this.metadata,...e.globalRegistry.get(this)};const s=new VldMeta(this.baseValidator,{...this.metadata,...t});return e.globalRegistry.add(s,s.getMeta()),s}describe(e){return this.meta({description:e})}}class VldReadonly extends VldBase{constructor(e){super(r.READONLY),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldBrand extends VldBase{constructor(e){super(r.BRAND),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldRefine extends VldBase{constructor(e,t,s){super(r.REFINE),this.baseValidator=e,this.predicate=t,this.customMessage=s??"Refinement check failed","object"==typeof s&&null!==s&&"path"in s&&Array.isArray(s.path)&&(this.refinePath=s.path)}_createIssue(e){if("function"==typeof this.customMessage){const t=this.customMessage(e);return"string"==typeof t?{code:"custom",path:this.refinePath??[],message:t}:{code:"custom",path:t?.path??this.refinePath??[],message:t?.message??"Refinement check failed"}}if("object"==typeof this.customMessage&&null!==this.customMessage){const e=this.customMessage.message??this.customMessage.error,t="function"==typeof e?e({}):"string"==typeof e?e:"Refinement check failed";return{code:"custom",path:this.customMessage.path??this.refinePath??[],message:t}}return{code:"custom",path:this.refinePath??[],message:"string"==typeof this.customMessage?this.customMessage:"Refinement check failed"}}parse(e){const s=this.baseValidator.parse(e),r=this.predicate(s);if(i(r))throw new Error("Use parseAsync for async refinements");if(!r)throw new t.VldError([this._createIssue(s)]);return s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const s=await this.baseValidator.parseAsync(e);if(!await this.predicate(s))throw new t.VldError([this._createIssue(s)]);return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldRefine(e,this.predicate,this.customMessage)}min(e,t){return this._wrap(this.baseValidator.min?.(e,t)??this.baseValidator)}max(e,t){return this._wrap(this.baseValidator.max?.(e,t)??this.baseValidator)}length(e,t){return this._wrap(this.baseValidator.length?.(e,t)??this.baseValidator)}email(e){return this._wrap(this.baseValidator.email?.(e)??this.baseValidator)}url(e){return this._wrap(this.baseValidator.url?.(e)??this.baseValidator)}uuid(e){return this._wrap(this.baseValidator.uuid?.(e)??this.baseValidator)}regex(e,t){return this._wrap(this.baseValidator.regex?.(e,t)??this.baseValidator)}startsWith(e,t){return this._wrap(this.baseValidator.startsWith?.(e,t)??this.baseValidator)}endsWith(e,t){return this._wrap(this.baseValidator.endsWith?.(e,t)??this.baseValidator)}includes(e,t){return this._wrap(this.baseValidator.includes?.(e,t)??this.baseValidator)}ip(e){return this._wrap(this.baseValidator.ip?.(e)??this.baseValidator)}ipv4(e){return this._wrap(this.baseValidator.ipv4?.(e)??this.baseValidator)}ipv6(e){return this._wrap(this.baseValidator.ipv6?.(e)??this.baseValidator)}nonempty(e){return this._wrap(this.baseValidator.nonempty?.(e)??this.baseValidator)}trim(){return this._wrap(this.baseValidator.trim?.()??this.baseValidator)}toLowerCase(){return this._wrap(this.baseValidator.toLowerCase?.()??this.baseValidator)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this.baseValidator.toUpperCase?.()??this.baseValidator)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this.baseValidator.positive?.(e)??this.baseValidator)}negative(e){return this._wrap(this.baseValidator.negative?.(e)??this.baseValidator)}nonnegative(e){return this._wrap(this.baseValidator.nonnegative?.(e)??this.baseValidator)}nonpositive(e){return this._wrap(this.baseValidator.nonpositive?.(e)??this.baseValidator)}int(e){return this._wrap(this.baseValidator.int?.(e)??this.baseValidator)}finite(e){return this._wrap(this.baseValidator.finite?.(e)??this.baseValidator)}safe(e){return this._wrap(this.baseValidator.safe?.(e)??this.baseValidator)}multipleOf(e,t){return this._wrap(this.baseValidator.multipleOf?.(e,t)??this.baseValidator)}step(e,t){return this._wrap(this.baseValidator.step?.(e,t)??this.baseValidator)}gt(e,t){return this._wrap(this.baseValidator.gt?.(e,t)??this.baseValidator)}gte(e,t){return this._wrap(this.baseValidator.gte?.(e,t)??this.baseValidator)}lt(e,t){return this._wrap(this.baseValidator.lt?.(e,t)??this.baseValidator)}lte(e,t){return this._wrap(this.baseValidator.lte?.(e,t)??this.baseValidator)}extend(e){return this._wrap(this.baseValidator.extend?.(e)??this.baseValidator)}merge(e){return this._wrap(this.baseValidator.merge?.(e)??this.baseValidator)}pick(...e){return this._wrap(this.baseValidator.pick?.(...e)??this.baseValidator)}omit(...e){return this._wrap(this.baseValidator.omit?.(...e)??this.baseValidator)}partial(){return this._wrap(this.baseValidator.partial?.()??this.baseValidator)}required(){return this._wrap(this.baseValidator.required?.()??this.baseValidator)}strict(e){return this._wrap(this.baseValidator.strict?.(e)??this.baseValidator)}passthrough(){return this._wrap(this.baseValidator.passthrough?.()??this.baseValidator)}strip(){return this._wrap(this.baseValidator.strip?.()??this.baseValidator)}catchall(e){return this._wrap(this.baseValidator.catchall?.(e)??this.baseValidator)}get shape(){return this.baseValidator.shape}get keyof(){return this.baseValidator.keyof}unwrap(){return this.baseValidator.unwrap?this.baseValidator.unwrap():this.baseValidator}get element(){return this.baseValidator.element}}class VldTransform extends VldBase{constructor(e,t){super(r.TRANSFORM),this.baseValidator=e,this.transformer=t}parse(e){const t=this.baseValidator.parse(e);try{const e=this.transformer(t);if(i(e))throw new Error("Use parseAsync for async transforms");return e}catch(e){throw new Error(`Transform failed: ${e.message}`)}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const t=await this.baseValidator.parseAsync(e);try{return await this.transformer(t)}catch(e){throw new Error(`Transform failed: ${e.message}`)}}}class VldDefault extends VldBase{constructor(e,t){super(r.DEFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?o(this.defaultValue):this.baseValidator.parse(e)}safeParse(e){return void 0===e?{success:!0,data:o(this.defaultValue)}:this.baseValidator.safeParse(e)}prefault(e){return new VldPrefault(this.baseValidator,void 0===e?this.defaultValue:e)}unwrap(){return this.baseValidator}removeDefault(){return this.baseValidator}}class VldPrefault extends VldBase{constructor(e,t){super(r.PREFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?this.baseValidator.parse(o(this.defaultValue)):this.baseValidator.parse(e)}safeParse(e){return void 0===e?this.baseValidator.safeParse(o(this.defaultValue)):this.baseValidator.safeParse(e)}prefault(e){return void 0===e?this:new VldPrefault(this.baseValidator,e)}unwrap(){return this.baseValidator}}class VldCatch extends VldBase{constructor(e,t){super(r.CATCH),this.baseValidator=e,this.fallbackValue=t,this.simpleMode=h(e);const s=e.safeParse(t);if(!s.success)throw new Error(`Invalid fallback value: ${s.error.message}`)}parse(e){const t=l(this.simpleMode,e);if(void 0!==t)return t;if(void 0!==this.simpleMode)return this.fallbackValue;try{return this.baseValidator.parse(e)}catch{return this.fallbackValue}}safeParse(e){const t=l(this.simpleMode,e);if(void 0!==t)return{success:!0,data:t};if(void 0!==this.simpleMode)return{success:!0,data:this.fallbackValue};const s=this.baseValidator.safeParse(e);return s.success?s:{success:!0,data:this.fallbackValue}}}class VldOptional extends VldBase{constructor(e){super(r.OPTIONAL),this.baseValidator=e,this.simpleMode=h(e)}parseSimpleValue(e){return l(this.simpleMode,e)}static create(e){return new VldOptional(e)}parse(e){if(void 0===e)return;const t=this.parseSimpleValue(e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=this.parseSimpleValue(e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldExactOptional extends VldBase{constructor(e){super(r.EXACT_OPTIONAL),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldExactOptional(e)}parse(e){if(void 0===e)return;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullable extends VldBase{constructor(e){super(r.NULLABLE),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldNullable(e)}parse(e){if(null===e)return null;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null===e)return{success:!0,data:null};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullish extends VldBase{constructor(e){super(r.NULLISH),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldNullish(e)}parse(e){if(null==e)return e;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null==e)return{success:!0,data:e};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldPipe extends VldBase{constructor(e,t){super(r.PIPE),this.first=e,this.second=t}parse(e){const t=this.first.parse(e);return this.second.parse(t)}safeParse(e){const t=this.first.safeParse(e);return t.success?this.second.safeParse(t.data):{success:!1,error:t.error}}}class VldSuperRefine extends VldBase{constructor(e,t){super(r.SUPER_REFINE),this._inner=e,this._refinement=t}parse(e){const s=this._inner.parse(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(s,a)instanceof Promise)throw new Error("Use parseAsync for async refinements");if(r.length>0)throw new t.VldError(r,r.map(e=>e.message).join("; "));return s}safeParse(e){const r=this._inner.safeParse(e);if(!r.success)return{success:!1,error:s(r.error)};const a=[],i={addIssue:e=>{a.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(r.data,i)instanceof Promise)throw new Error("Use safeParseAsync for async refinements");return a.length>0?{success:!1,error:new t.VldError(a,a.map(e=>e.message).join("; "))}:r}async parseAsync(e){const s=await this._inner.parseAsync(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(await this._refinement(s,a),r.length>0)throw new t.VldError(r,r.map(e=>e.message).join("; "));return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldSuperRefine(e,this._refinement)}min(e,t){return this._wrap(this._inner.min?.(e,t)??this._inner)}max(e,t){return this._wrap(this._inner.max?.(e,t)??this._inner)}length(e,t){return this._wrap(this._inner.length?.(e,t)??this._inner)}email(e){return this._wrap(this._inner.email?.(e)??this._inner)}url(e){return this._wrap(this._inner.url?.(e)??this._inner)}uuid(e){return this._wrap(this._inner.uuid?.(e)??this._inner)}regex(e,t){return this._wrap(this._inner.regex?.(e,t)??this._inner)}startsWith(e,t){return this._wrap(this._inner.startsWith?.(e,t)??this._inner)}endsWith(e,t){return this._wrap(this._inner.endsWith?.(e,t)??this._inner)}includes(e,t){return this._wrap(this._inner.includes?.(e,t)??this._inner)}ip(e){return this._wrap(this._inner.ip?.(e)??this._inner)}ipv4(e){return this._wrap(this._inner.ipv4?.(e)??this._inner)}ipv6(e){return this._wrap(this._inner.ipv6?.(e)??this._inner)}nonempty(e){return this._wrap(this._inner.nonempty?.(e)??this._inner)}trim(){return this._wrap(this._inner.trim?.()??this._inner)}toLowerCase(){return this._wrap(this._inner.toLowerCase?.()??this._inner)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this._inner.toUpperCase?.()??this._inner)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this._inner.positive?.(e)??this._inner)}negative(e){return this._wrap(this._inner.negative?.(e)??this._inner)}nonnegative(e){return this._wrap(this._inner.nonnegative?.(e)??this._inner)}nonpositive(e){return this._wrap(this._inner.nonpositive?.(e)??this._inner)}int(e){return this._wrap(this._inner.int?.(e)??this._inner)}finite(e){return this._wrap(this._inner.finite?.(e)??this._inner)}safe(e){return this._wrap(this._inner.safe?.(e)??this._inner)}multipleOf(e,t){return this._wrap(this._inner.multipleOf?.(e,t)??this._inner)}step(e,t){return this._wrap(this._inner.step?.(e,t)??this._inner)}gt(e,t){return this._wrap(this._inner.gt?.(e,t)??this._inner)}gte(e,t){return this._wrap(this._inner.gte?.(e,t)??this._inner)}lt(e,t){return this._wrap(this._inner.lt?.(e,t)??this._inner)}lte(e,t){return this._wrap(this._inner.lte?.(e,t)??this._inner)}extend(e){return this._wrap(this._inner.extend?.(e)??this._inner)}merge(e){return this._wrap(this._inner.merge?.(e)??this._inner)}pick(...e){return this._wrap(this._inner.pick?.(...e)??this._inner)}omit(...e){return this._wrap(this._inner.omit?.(...e)??this._inner)}partial(){return this._wrap(this._inner.partial?.()??this._inner)}required(){return this._wrap(this._inner.required?.()??this._inner)}strict(e){return this._wrap(this._inner.strict?.(e)??this._inner)}passthrough(){return this._wrap(this._inner.passthrough?.()??this._inner)}strip(){return this._wrap(this._inner.strip?.()??this._inner)}catchall(e){return this._wrap(this._inner.catchall?.(e)??this._inner)}get shape(){return this._inner.shape}get keyof(){return this._inner.keyof}unwrap(){return this._inner.unwrap?this._inner.unwrap():this._inner}get element(){return this._inner.element}}class VldPreprocess extends VldBase{constructor(e,t){super(r.PREPROCESS),this._preprocessor=e,this._schema=t}static create(e,t){return new VldPreprocess(e,t)}parse(e){const t=this._preprocessor(e);return this._schema.parse(t)}safeParse(e){try{const t=this._preprocessor(e);return this._schema.safeParse(t)}catch(e){return{success:!1,error:s(e)}}}}exports.VLD_VALIDATOR_TYPES=r,exports.VldBase=VldBase,exports.VldBrand=VldBrand,exports.VldCatch=VldCatch,exports.VldDefault=VldDefault,exports.VldExactOptional=VldExactOptional,exports.VldMeta=VldMeta,exports.VldNullable=VldNullable,exports.VldNullish=VldNullish,exports.VldOptional=VldOptional,exports.VldPipe=VldPipe,exports.VldPrefault=VldPrefault,exports.VldPreprocess=VldPreprocess,exports.VldReadonly=VldReadonly,exports.VldRefine=VldRefine,exports.VldSuperRefine=VldSuperRefine,exports.VldTransform=VldTransform,exports.configureSchemaCompositionFactories=function(e){n=e},exports.ensureVldError=s,exports.isPromiseLike=i,exports.resolveErrorMessage=a;
1
+ "use strict";var e=require("../registry.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs");function s(e){if(e instanceof t.VldError)return e;const s=e instanceof Error?e.message:String(e);return new t.VldError([{code:"custom",path:[],message:s}])}const r={STRING:"string",STRING_FORMAT:"stringFormat",STRING_BOOL:"stringBool",NUMBER:"number",BOOLEAN:"boolean",DATE:"date",BIGINT:"bigint",UNDEFINED:"undefined",NULL:"null",UNKNOWN:"unknown",ANY:"any",VOID:"void",NEVER:"never",SYMBOL:"symbol",NAN:"nan",HEX:"hex",BASE64:"base64",UINT8_ARRAY:"uint8Array",COERCE_STRING:"coerceString",COERCE_NUMBER:"coerceNumber",COERCE_BOOLEAN:"coerceBoolean",COERCE_DATE:"coerceDate",COERCE_BIGINT:"coerceBigint",OBJECT:"object",ARRAY:"array",TUPLE:"tuple",SET:"set",MAP:"map",RECORD:"record",UNION:"union",DISCRIMINATED_UNION:"discriminatedUnion",INTERSECTION:"intersection",XOR:"xor",ENUM:"enum",LITERAL:"literal",LAZY:"lazy",CUSTOM:"custom",FUNCTION:"function",FILE:"file",JSON:"json",TEMPLATE_LITERAL:"templateLiteral",PROMISE:"promise",OPTIONAL:"optional",NULLABLE:"nullable",NULLISH:"nullish",EXACT_OPTIONAL:"exactOptional",DEFAULT:"default",CATCH:"catch",REFINE:"refine",TRANSFORM:"transform",PIPE:"pipe",PREPROCESS:"preprocess",SUPER_REFINE:"superRefine",BRAND:"brand",READONLY:"readonly",META:"meta",PREFAULT:"prefault",PREFault:"prefault",CODEC:"codec"};function a(e,t){if("string"==typeof e)return e;if("function"==typeof e){const s=e(void 0);return"string"==typeof s?s:"object"==typeof s&&s?.message?s.message:t}if("object"==typeof e&&null!==e){if("string"==typeof e.error)return e.error;if("function"==typeof e.error)return e.error({})||t;if("string"==typeof e.message)return e.message}return t}function i(e){return null!==e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}let n;function o(e){return"function"==typeof e?e():function(e){if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(null!==e&&"object"==typeof e){const t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return{...e}}return e}(e)}function h(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";case r.BIGINT:return"bigint";case r.SYMBOL:return"symbol";default:return}}function l(e,t){switch(e){case"string":return"string"==typeof t?t:void 0;case"number":return"number"!=typeof t||isNaN(t)?void 0:t;case"boolean":return"boolean"==typeof t?t:void 0;case"bigint":return"bigint"==typeof t?t:void 0;case"symbol":return"symbol"==typeof t?t:void 0;default:return}}class VldBase{constructor(e="unknown"){this.validatorType=e}get type(){return this.validatorType}get _def(){return{typeName:"Zod"+this.validatorType.charAt(0).toUpperCase()+this.validatorType.slice(1),...this.config||{}}}get def(){return this._def}get _zod(){return this._def}get"~standard"(){return{version:1,vendor:"vld",validate:e=>{const t=this.safeParse(e);return t.success?{value:t.data}:{issues:[{message:t.error.message}]}},types:void 0}}async parseAsync(e){return this.parse(e)}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}decode(e){return this.parse(e)}safeDecode(e){return this.safeParse(e)}async decodeAsync(e){return this.parseAsync(e)}async safeDecodeAsync(e){return this.safeParseAsync(e)}encode(e){return this.parse(e)}safeEncode(e){const t=this.safeParse(e);return t.success?{success:!0,data:t.data}:t}async encodeAsync(e){return this.parseAsync(e)}async safeEncodeAsync(e){const t=await this.safeParseAsync(e);return t.success?{success:!0,data:t.data}:t}spa(e){return this.safeParseAsync(e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}clone(){return this}isValid(e){return this.safeParse(e).success}parseOrDefault(e,t){const s=this.safeParse(e);if(s.success)return s.data;const r=this.safeParse(t);if(!r.success)throw new Error(`Invalid default value provided: ${r.error.message}`);return r.data}refine(e,t){return new VldRefine(this,e,t)}superRefine(e){return new VldSuperRefine(this,e)}transform(e){return new VldTransform(this,e)}default(e){return new VldDefault(this,e)}prefault(e){return new VldPrefault(this,e)}nonoptional(e){return new VldRefine(this,e=>void 0!==e,a(e,"Expected non-optional value"))}array(){return n.array(this)}or(e){return n.union(this,e)}and(e){return n.intersection(this,e)}overwrite(e){return new VldTransform(this,e)}with(...e){return new VldSuperRefine(this,(t,s)=>{const r={value:t,issues:[]},a=[];for(const t of e){const e="function"==typeof t?t:t._zod?.check;if(!e)continue;const s=e(r);i(s)&&a.push(Promise.resolve(s))}const n=()=>{for(const e of r.issues)s.addIssue(void 0===e.code?{message:e.message||"Custom check failed"}:{message:e.message||"Custom check failed",code:e.code})};if(a.length>0)return Promise.all(a).then(n);n()})}toJSONSchema(e){return n.toJSONSchema(this,e)}catch(e){return new VldCatch(this,e)}optional(){return new VldOptional(this)}nullable(){return new VldNullable(this)}nullish(){return new VldNullish(this)}exactOptional(){return new VldExactOptional(this)}pipe(e){return new VldPipe(this,e)}readonly(){return new VldReadonly(this)}brand(){return new VldBrand(this)}apply(e){return e(this)}check(e,t){return this.refine(e,t)}meta(t){if(void 0===t)return e.globalRegistry.get(this)??this.baseValidator?.meta?.()??this.schema?.meta?.()??this.inner?.meta?.();const s=new VldMeta(this,t);return e.globalRegistry.add(s,t),s}register(e,t){return e.add(this,t),this}describe(e){return this.meta({description:e})}get description(){return this.meta()?.description??this.baseValidator?.description??this.schema?.description??this.inner?.description}}class VldMeta extends VldBase{constructor(e,t){super(r.META),this.baseValidator=e,this.metadata=t}parse(e){return this.baseValidator.parse(e)}safeParse(e){return this.baseValidator.safeParse(e)}getMeta(){return{...this.metadata}}meta(t){if(void 0===t)return{...this.metadata,...e.globalRegistry.get(this)};const s=new VldMeta(this.baseValidator,{...this.metadata,...t});return e.globalRegistry.add(s,s.getMeta()),s}describe(e){return this.meta({description:e})}}class VldReadonly extends VldBase{constructor(e){super(r.READONLY),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldBrand extends VldBase{constructor(e){super(r.BRAND),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldRefine extends VldBase{constructor(e,t,s){super(r.REFINE),this.baseValidator=e,this.predicate=t,this.customMessage=s??"Refinement check failed","object"==typeof s&&null!==s&&"path"in s&&Array.isArray(s.path)&&(this.refinePath=s.path)}_createIssue(e){if("function"==typeof this.customMessage){const t=this.customMessage(e);return"string"==typeof t?{code:"custom",path:this.refinePath??[],message:t}:{code:"custom",path:t?.path??this.refinePath??[],message:t?.message??"Refinement check failed"}}if("object"==typeof this.customMessage&&null!==this.customMessage){const e=this.customMessage.message??this.customMessage.error,t="function"==typeof e?e({}):"string"==typeof e?e:"Refinement check failed";return{code:"custom",path:this.customMessage.path??this.refinePath??[],message:t}}return{code:"custom",path:this.refinePath??[],message:"string"==typeof this.customMessage?this.customMessage:"Refinement check failed"}}parse(e){const s=this.baseValidator.parse(e),r=this.predicate(s);if(i(r))throw new Error("Use parseAsync for async refinements");if(!r)throw new t.VldError([this._createIssue(s)]);return s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const s=await this.baseValidator.parseAsync(e);if(!await this.predicate(s))throw new t.VldError([this._createIssue(s)]);return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldRefine(e,this.predicate,this.customMessage)}min(e,t){return this._wrap(this.baseValidator.min?.(e,t)??this.baseValidator)}max(e,t){return this._wrap(this.baseValidator.max?.(e,t)??this.baseValidator)}length(e,t){return this._wrap(this.baseValidator.length?.(e,t)??this.baseValidator)}email(e){return this._wrap(this.baseValidator.email?.(e)??this.baseValidator)}url(e){return this._wrap(this.baseValidator.url?.(e)??this.baseValidator)}uuid(e){return this._wrap(this.baseValidator.uuid?.(e)??this.baseValidator)}regex(e,t){return this._wrap(this.baseValidator.regex?.(e,t)??this.baseValidator)}startsWith(e,t){return this._wrap(this.baseValidator.startsWith?.(e,t)??this.baseValidator)}endsWith(e,t){return this._wrap(this.baseValidator.endsWith?.(e,t)??this.baseValidator)}includes(e,t){return this._wrap(this.baseValidator.includes?.(e,t)??this.baseValidator)}ip(e){return this._wrap(this.baseValidator.ip?.(e)??this.baseValidator)}ipv4(e){return this._wrap(this.baseValidator.ipv4?.(e)??this.baseValidator)}ipv6(e){return this._wrap(this.baseValidator.ipv6?.(e)??this.baseValidator)}nonempty(e){return this._wrap(this.baseValidator.nonempty?.(e)??this.baseValidator)}trim(){return this._wrap(this.baseValidator.trim?.()??this.baseValidator)}toLowerCase(){return this._wrap(this.baseValidator.toLowerCase?.()??this.baseValidator)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this.baseValidator.toUpperCase?.()??this.baseValidator)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this.baseValidator.positive?.(e)??this.baseValidator)}negative(e){return this._wrap(this.baseValidator.negative?.(e)??this.baseValidator)}nonnegative(e){return this._wrap(this.baseValidator.nonnegative?.(e)??this.baseValidator)}nonpositive(e){return this._wrap(this.baseValidator.nonpositive?.(e)??this.baseValidator)}int(e){return this._wrap(this.baseValidator.int?.(e)??this.baseValidator)}finite(e){return this._wrap(this.baseValidator.finite?.(e)??this.baseValidator)}safe(e){return this._wrap(this.baseValidator.safe?.(e)??this.baseValidator)}multipleOf(e,t){return this._wrap(this.baseValidator.multipleOf?.(e,t)??this.baseValidator)}step(e,t){return this._wrap(this.baseValidator.step?.(e,t)??this.baseValidator)}gt(e,t){return this._wrap(this.baseValidator.gt?.(e,t)??this.baseValidator)}gte(e,t){return this._wrap(this.baseValidator.gte?.(e,t)??this.baseValidator)}lt(e,t){return this._wrap(this.baseValidator.lt?.(e,t)??this.baseValidator)}lte(e,t){return this._wrap(this.baseValidator.lte?.(e,t)??this.baseValidator)}extend(e){return this._wrap(this.baseValidator.extend?.(e)??this.baseValidator)}merge(e){return this._wrap(this.baseValidator.merge?.(e)??this.baseValidator)}pick(...e){return this._wrap(this.baseValidator.pick?.(...e)??this.baseValidator)}omit(...e){return this._wrap(this.baseValidator.omit?.(...e)??this.baseValidator)}partial(){return this._wrap(this.baseValidator.partial?.()??this.baseValidator)}required(){return this._wrap(this.baseValidator.required?.()??this.baseValidator)}strict(e){return this._wrap(this.baseValidator.strict?.(e)??this.baseValidator)}passthrough(){return this._wrap(this.baseValidator.passthrough?.()??this.baseValidator)}strip(){return this._wrap(this.baseValidator.strip?.()??this.baseValidator)}catchall(e){return this._wrap(this.baseValidator.catchall?.(e)??this.baseValidator)}get shape(){return this.baseValidator.shape}get keyof(){return this.baseValidator.keyof}unwrap(){return this.baseValidator.unwrap?this.baseValidator.unwrap():this.baseValidator}get element(){return this.baseValidator.element}}class VldTransform extends VldBase{constructor(e,t){super(r.TRANSFORM),this.baseValidator=e,this.transformer=t}parse(e){const t=this.baseValidator.parse(e);try{const e=this.transformer(t);if(i(e))throw new Error("Use parseAsync for async transforms");return e}catch(e){throw new Error(`Transform failed: ${e.message}`)}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const t=await this.baseValidator.parseAsync(e);try{return await this.transformer(t)}catch(e){throw new Error(`Transform failed: ${e.message}`)}}}class VldDefault extends VldBase{constructor(e,t){super(r.DEFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?o(this.defaultValue):this.baseValidator.parse(e)}safeParse(e){return void 0===e?{success:!0,data:o(this.defaultValue)}:this.baseValidator.safeParse(e)}prefault(e){return new VldPrefault(this.baseValidator,void 0===e?this.defaultValue:e)}unwrap(){return this.baseValidator}removeDefault(){return this.baseValidator}}class VldPrefault extends VldBase{constructor(e,t){super(r.PREFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?this.baseValidator.parse(o(this.defaultValue)):this.baseValidator.parse(e)}safeParse(e){return void 0===e?this.baseValidator.safeParse(o(this.defaultValue)):this.baseValidator.safeParse(e)}prefault(e){return void 0===e?this:new VldPrefault(this.baseValidator,e)}unwrap(){return this.baseValidator}}class VldCatch extends VldBase{constructor(e,t){super(r.CATCH),this.baseValidator=e,this.fallbackValue=t,this.simpleMode=h(e);const s=e.safeParse(t);if(!s.success)throw new Error(`Invalid fallback value: ${s.error.message}`)}parse(e){const t=l(this.simpleMode,e);if(void 0!==t)return t;if(void 0!==this.simpleMode)return this.fallbackValue;try{return this.baseValidator.parse(e)}catch{return this.fallbackValue}}safeParse(e){const t=l(this.simpleMode,e);if(void 0!==t)return{success:!0,data:t};if(void 0!==this.simpleMode)return{success:!0,data:this.fallbackValue};const s=this.baseValidator.safeParse(e);return s.success?s:{success:!0,data:this.fallbackValue}}}class VldOptional extends VldBase{constructor(e){super(r.OPTIONAL),this.baseValidator=e,this.simpleMode=h(e)}parseSimpleValue(e){return l(this.simpleMode,e)}static create(e){return new VldOptional(e)}parse(e){if(void 0===e)return;const t=this.parseSimpleValue(e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=this.parseSimpleValue(e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldExactOptional extends VldBase{constructor(e){super(r.EXACT_OPTIONAL),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldExactOptional(e)}parse(e){if(void 0===e)return;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullable extends VldBase{constructor(e){super(r.NULLABLE),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldNullable(e)}parse(e){if(null===e)return null;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null===e)return{success:!0,data:null};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullish extends VldBase{constructor(e){super(r.NULLISH),this.baseValidator=e,this.simpleMode=h(e)}static create(e){return new VldNullish(e)}parse(e){if(null==e)return e;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null==e)return{success:!0,data:e};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldPipe extends VldBase{constructor(e,t){super(r.PIPE),this.first=e,this.second=t}parse(e){const t=this.first.parse(e);return this.second.parse(t)}safeParse(e){const t=this.first.safeParse(e);return t.success?this.second.safeParse(t.data):{success:!1,error:t.error}}}class VldSuperRefine extends VldBase{constructor(e,t){super(r.SUPER_REFINE),this._inner=e,this._refinement=t}parse(e){const s=this._inner.parse(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(s,a)instanceof Promise)throw new Error("Use parseAsync for async refinements");if(r.length>0)throw new t.VldError(r,r.map(e=>e.message).join("; "));return s}safeParse(e){const r=this._inner.safeParse(e);if(!r.success)return{success:!1,error:s(r.error)};const a=[],i={addIssue:e=>{a.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(r.data,i)instanceof Promise)throw new Error("Use safeParseAsync for async refinements");return a.length>0?{success:!1,error:new t.VldError(a,a.map(e=>e.message).join("; "))}:r}async parseAsync(e){const s=await this._inner.parseAsync(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(await this._refinement(s,a),r.length>0)throw new t.VldError(r,r.map(e=>e.message).join("; "));return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldSuperRefine(e,this._refinement)}min(e,t){return this._wrap(this._inner.min?.(e,t)??this._inner)}max(e,t){return this._wrap(this._inner.max?.(e,t)??this._inner)}length(e,t){return this._wrap(this._inner.length?.(e,t)??this._inner)}email(e){return this._wrap(this._inner.email?.(e)??this._inner)}url(e){return this._wrap(this._inner.url?.(e)??this._inner)}uuid(e){return this._wrap(this._inner.uuid?.(e)??this._inner)}regex(e,t){return this._wrap(this._inner.regex?.(e,t)??this._inner)}startsWith(e,t){return this._wrap(this._inner.startsWith?.(e,t)??this._inner)}endsWith(e,t){return this._wrap(this._inner.endsWith?.(e,t)??this._inner)}includes(e,t){return this._wrap(this._inner.includes?.(e,t)??this._inner)}ip(e){return this._wrap(this._inner.ip?.(e)??this._inner)}ipv4(e){return this._wrap(this._inner.ipv4?.(e)??this._inner)}ipv6(e){return this._wrap(this._inner.ipv6?.(e)??this._inner)}nonempty(e){return this._wrap(this._inner.nonempty?.(e)??this._inner)}trim(){return this._wrap(this._inner.trim?.()??this._inner)}toLowerCase(){return this._wrap(this._inner.toLowerCase?.()??this._inner)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this._inner.toUpperCase?.()??this._inner)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this._inner.positive?.(e)??this._inner)}negative(e){return this._wrap(this._inner.negative?.(e)??this._inner)}nonnegative(e){return this._wrap(this._inner.nonnegative?.(e)??this._inner)}nonpositive(e){return this._wrap(this._inner.nonpositive?.(e)??this._inner)}int(e){return this._wrap(this._inner.int?.(e)??this._inner)}finite(e){return this._wrap(this._inner.finite?.(e)??this._inner)}safe(e){return this._wrap(this._inner.safe?.(e)??this._inner)}multipleOf(e,t){return this._wrap(this._inner.multipleOf?.(e,t)??this._inner)}step(e,t){return this._wrap(this._inner.step?.(e,t)??this._inner)}gt(e,t){return this._wrap(this._inner.gt?.(e,t)??this._inner)}gte(e,t){return this._wrap(this._inner.gte?.(e,t)??this._inner)}lt(e,t){return this._wrap(this._inner.lt?.(e,t)??this._inner)}lte(e,t){return this._wrap(this._inner.lte?.(e,t)??this._inner)}extend(e){return this._wrap(this._inner.extend?.(e)??this._inner)}merge(e){return this._wrap(this._inner.merge?.(e)??this._inner)}pick(...e){return this._wrap(this._inner.pick?.(...e)??this._inner)}omit(...e){return this._wrap(this._inner.omit?.(...e)??this._inner)}partial(){return this._wrap(this._inner.partial?.()??this._inner)}required(){return this._wrap(this._inner.required?.()??this._inner)}strict(e){return this._wrap(this._inner.strict?.(e)??this._inner)}passthrough(){return this._wrap(this._inner.passthrough?.()??this._inner)}strip(){return this._wrap(this._inner.strip?.()??this._inner)}catchall(e){return this._wrap(this._inner.catchall?.(e)??this._inner)}get shape(){return this._inner.shape}get keyof(){return this._inner.keyof}unwrap(){return this._inner.unwrap?this._inner.unwrap():this._inner}get element(){return this._inner.element}}class VldPreprocess extends VldBase{constructor(e,t){super(r.PREPROCESS),this._preprocessor=e,this._schema=t}static create(e,t){return new VldPreprocess(e,t)}parse(e){const t=this._preprocessor(e);return this._schema.parse(t)}safeParse(e){try{const t=this._preprocessor(e);return this._schema.safeParse(t)}catch(e){return{success:!1,error:s(e)}}}}exports.VLD_VALIDATOR_TYPES=r,exports.VldBase=VldBase,exports.VldBrand=VldBrand,exports.VldCatch=VldCatch,exports.VldDefault=VldDefault,exports.VldExactOptional=VldExactOptional,exports.VldMeta=VldMeta,exports.VldNullable=VldNullable,exports.VldNullish=VldNullish,exports.VldOptional=VldOptional,exports.VldPipe=VldPipe,exports.VldPrefault=VldPrefault,exports.VldPreprocess=VldPreprocess,exports.VldReadonly=VldReadonly,exports.VldRefine=VldRefine,exports.VldSuperRefine=VldSuperRefine,exports.VldTransform=VldTransform,exports.configureSchemaCompositionFactories=function(e){n=e},exports.ensureVldError=s,exports.isPromiseLike=i,exports.resolveErrorMessage=a;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),s=require("../errors.cjs"),r=require("../locales/runtime.cjs"),a=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldBase64 extends e.VldBase{constructor(s=!1){super(e.VLD_VALIDATOR_TYPES.BASE64),this.urlSafe=s}parse(e){const s=this.safeParse(e);if(!s.success)throw s.error;return s.data}safeParse(e){if("string"!=typeof e)return{success:!1,error:new a.VldError([s.createIssue("invalid_type",[],r.getMessages().expectedString)])};return(this.urlSafe?VldBase64.BASE64_URL_REGEX:VldBase64.BASE64_REGEX).test(e)?!this.urlSafe&&e.length>0&&e.length%4!=0?{success:!1,error:new a.VldError([s.createIssue("custom",[],r.getMessages().invalidBase64)])}:{success:!0,data:e}:{success:!1,error:new a.VldError([s.createIssue("custom",[],r.getMessages().invalidBase64)])}}urlSafeMode(){return new VldBase64(!0)}static create(e=!1){return new VldBase64(e)}}VldBase64.BASE64_REGEX=/^[A-Za-z0-9+/]*={0,2}$/,VldBase64.BASE64_URL_REGEX=/^[A-Za-z0-9_-]*={0,2}$/,exports.VldBase64=VldBase64;
1
+ "use strict";var e=require("./base.cjs"),s=require("../errors.cjs"),r=require("../locales/runtime.cjs"),a=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldBase64 extends e.VldBase{constructor(s=!1){super(e.VLD_VALIDATOR_TYPES.BASE64),this.urlSafe=s}parse(e){const s=this.safeParse(e);if(!s.success)throw s.error;return s.data}safeParse(e){if("string"!=typeof e)return{success:!1,error:new a.VldError([s.createIssue("invalid_type",[],r.getMessages().expectedString)])};return(this.urlSafe?VldBase64.BASE64_URL_REGEX:VldBase64.BASE64_REGEX).test(e)?!this.urlSafe&&e.length>0&&e.length%4!=0?{success:!1,error:new a.VldError([s.createIssue("custom",[],r.getMessages().invalidBase64)])}:{success:!0,data:e}:{success:!1,error:new a.VldError([s.createIssue("custom",[],r.getMessages().invalidBase64)])}}urlSafeMode(){return new VldBase64(!0)}static create(e=!1){return new VldBase64(e)}}VldBase64.BASE64_REGEX=/^[A-Za-z0-9+/]*={0,2}$/,VldBase64.BASE64_URL_REGEX=/^[A-Za-z0-9_-]*={0,2}$/,exports.VldBase64=VldBase64;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./base.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs");class VldBigIntCheck{}function s(e){return"bigint"==typeof e?e:BigInt(e)}class VldBigIntCheckMin extends VldBigIntCheck{constructor(e,t){super(),this._msg=t,this.kind="min",this._threshold=s(e)}check(e){return e<this._threshold?{code:"too_small",path:[],origin:"bigint",message:this._msg||`BigInt must be >= ${this._threshold}`}:null}meta(){return{kind:"min",value:this._threshold,message:this._msg}}}class VldBigIntCheckMax extends VldBigIntCheck{constructor(e,t){super(),this._msg=t,this.kind="max",this._threshold=s(e)}check(e){return e>this._threshold?{code:"too_big",path:[],origin:"bigint",message:this._msg||`BigInt must be <= ${this._threshold}`}:null}meta(){return{kind:"max",value:this._threshold,message:this._msg}}}class VldBigIntCheckGt extends VldBigIntCheck{constructor(e,t){super(),this._msg=t,this.kind="gt",this._threshold=s(e)}check(e){return e<=this._threshold?{code:"too_small",path:[],origin:"bigint",message:this._msg||`BigInt must be > ${this._threshold}`}:null}meta(){return{kind:"gt",value:this._threshold,message:this._msg}}}class VldBigIntCheckLt extends VldBigIntCheck{constructor(e,t){super(),this._msg=t,this.kind="lt",this._threshold=s(e)}check(e){return e>=this._threshold?{code:"too_big",path:[],origin:"bigint",message:this._msg||`BigInt must be < ${this._threshold}`}:null}meta(){return{kind:"lt",value:this._threshold,message:this._msg}}}class VldBigIntCheckMultipleOf extends VldBigIntCheck{constructor(e,t){super(),this._msg=t,this.kind="multipleOf",this._divisor=s(e)}check(e){return 0n===this._divisor?null:e%this._divisor!==0n?{code:"custom",path:[],message:this._msg||`BigInt must be a multiple of ${this._divisor}`}:null}meta(){return{kind:"multipleOf",value:this._divisor,message:this._msg}}}const i=Object.freeze({type:"bigint",checks:Object.freeze([]),isSimple:!0});class VldBigIntV2 extends e.VldBase{constructor(t=i){super(e.VLD_VALIDATOR_TYPES.BIGINT),this.__def=t}static create(){return new VldBigIntV2}get isSimple(){return this.__def.isSimple}parse(e){if("bigint"!=typeof e)throw new t.VldError([t.createInvalidTypeIssue("bigint",t.getTypeName(e),this.__def.errorMessage)]);return this.__def.isSimple?e:this.parseKnownBigInt(e)}parseKnownBigInt(e){const s=this.__def.checks;for(let i=0;i<s.length;i++){const h=s[i].check(e);if(null!==h)throw new t.VldError([h])}return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof t.VldError?e:new t.VldError([{code:"custom",path:[],message:String(e)}])}}}withDef(e){const t=(s=e.checks??this.__def.checks,i=e.jsonSchema??this.__def.jsonSchema,h=e.errorMessage??this.__def.errorMessage,Object.freeze({type:"bigint",checks:s,jsonSchema:i,errorMessage:h,isSimple:0===s.length}));var s,i,h;return new this.constructor(t)}min(e,t){const i=s(e);return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckMin(e,t)],jsonSchema:{...this.__def.jsonSchema,minimum:i.toString()}})}max(e,t){const i=s(e);return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckMax(e,t)],jsonSchema:{...this.__def.jsonSchema,maximum:i.toString()}})}positive(e){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckGt(0n,e)]})}negative(e){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckLt(0n,e)]})}nonnegative(e){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckMin(0n,e)]})}nonpositive(e){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckMax(0n,e)]})}gt(e,t){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckGt(e,t)]})}lt(e,t){return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckLt(e,t)]})}gte(e,t){return this.min(e,t)}lte(e,t){return this.max(e,t)}multipleOf(e,t){const i=s(e);return this.withDef({type:"bigint",checks:[...this.__def.checks,new VldBigIntCheckMultipleOf(e,t)],jsonSchema:{...this.__def.jsonSchema,multipleOf:i.toString()}})}}exports.VldBigIntCheck=VldBigIntCheck,exports.VldBigIntCheckGt=VldBigIntCheckGt,exports.VldBigIntCheckLt=VldBigIntCheckLt,exports.VldBigIntCheckMax=VldBigIntCheckMax,exports.VldBigIntCheckMin=VldBigIntCheckMin,exports.VldBigIntCheckMultipleOf=VldBigIntCheckMultipleOf,exports.VldBigIntV2=VldBigIntV2;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),i=require("../locales/runtime.cjs"),n=require("../chunks/errors-core-DrydF46s.cjs");function t(e){return new n.VldError([{code:"invalid_type",path:[],message:e}])}require("../registry.cjs"),require("../locales/en.cjs");class VldBigInt extends e.VldBase{constructor(i){super(i?.validatorType||e.VLD_VALIDATOR_TYPES.BIGINT),this.config={checks:i?.checks||[],errorMessage:i?.errorMessage,jsonSchema:i?.jsonSchema},this._checks=this.config.checks,this._fastCheckMode=this.detectFastCheckMode()}get jsonSchema(){return this.config.jsonSchema}get isSimple(){return 0===this._checks.length}get minValue(){return this.config.jsonSchema?.minimum?BigInt(this.config.jsonSchema.minimum):null}get maxValue(){return this.config.jsonSchema?.maximum?BigInt(this.config.jsonSchema.maximum):null}get format(){return this.config.jsonSchema?.format??null}static create(){return new VldBigInt}detectFastCheckMode(){if(0===this._checks.length)return"none";if(1!==this._checks.length)return;const e=this.config.jsonSchema;return 0n===e?.exclusiveMinimum&&void 0===e.minimum&&void 0===e.maximum?"positive":0n===e?.exclusiveMaximum&&void 0===e.minimum&&void 0===e.maximum?"negative":0n===e?.minimum&&void 0===e.maximum&&void 0===e.exclusiveMaximum?"nonnegative":0n===e?.maximum&&void 0===e.minimum&&void 0===e.exclusiveMinimum?"nonpositive":void 0}getValidationError(){return new Error(this.config.errorMessage||i.getMessages().invalidBigint)}parse(e){if("bigint"!=typeof e)throw this.getValidationError();return this.parseKnownBigInt(e)}parseKnownBigInt(e){switch(this._fastCheckMode){case"none":return e;case"positive":if(e>0n)return e;throw this.getValidationError();case"negative":if(e<0n)return e;throw this.getValidationError();case"nonnegative":if(e>=0n)return e;throw this.getValidationError();case"nonpositive":if(e<=0n)return e;throw this.getValidationError()}for(const i of this._checks)if(!i(e))throw this.getValidationError();return e}safeParse(e){if("bigint"!=typeof e)return{success:!1,error:t(this.getValidationError().message)};try{return{success:!0,data:this.parseKnownBigInt(e)}}catch(e){return{success:!1,error:t(e.message)}}}min(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i>=e],errorMessage:i||`BigInt must be at least ${e}`,jsonSchema:{...this.config.jsonSchema,minimum:e}})}max(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i<=e],errorMessage:i||`BigInt must be at most ${e}`,jsonSchema:{...this.config.jsonSchema,maximum:e}})}positive(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>0n],errorMessage:e||"BigInt must be positive",jsonSchema:{...this.config.jsonSchema,exclusiveMinimum:0n}})}negative(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<0n],errorMessage:e||"BigInt must be negative",jsonSchema:{...this.config.jsonSchema,exclusiveMaximum:0n}})}nonnegative(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>=0n],errorMessage:e||"BigInt must be non-negative",jsonSchema:{...this.config.jsonSchema,minimum:0n}})}nonpositive(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<=0n],errorMessage:e||"BigInt must be non-positive",jsonSchema:{...this.config.jsonSchema,maximum:0n}})}gt(e,i){const n="bigint"==typeof e?e:BigInt(e);return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>n],errorMessage:i||`BigInt must be greater than ${n}`,jsonSchema:{...this.config.jsonSchema,exclusiveMinimum:n}})}lt(e,i){const n="bigint"==typeof e?e:BigInt(e);return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<n],errorMessage:i||`BigInt must be less than ${n}`,jsonSchema:{...this.config.jsonSchema,exclusiveMaximum:n}})}gte(e,i){const n="bigint"==typeof e?e:BigInt(e);return this.min(n,i)}lte(e,i){const n="bigint"==typeof e?e:BigInt(e);return this.max(n,i)}multipleOf(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i%e===0n],errorMessage:i||`BigInt must be a multiple of ${e}`,jsonSchema:{...this.config.jsonSchema,multipleOf:e}})}}exports.VldBigInt=VldBigInt;
1
+ "use strict";var e=require("./base.cjs"),i=require("../locales/runtime.cjs"),n=require("../chunks/errors-core-C0mA6tfa.cjs");function t(e){return new n.VldError([{code:"invalid_type",path:[],message:e}])}require("../registry.cjs"),require("../locales/en.cjs");class VldBigInt extends e.VldBase{constructor(i){super(i?.validatorType||e.VLD_VALIDATOR_TYPES.BIGINT),this.config={checks:i?.checks||[],errorMessage:i?.errorMessage,jsonSchema:i?.jsonSchema},this._checks=this.config.checks,this._fastCheckMode=this.detectFastCheckMode()}get jsonSchema(){return this.config.jsonSchema}get isSimple(){return 0===this._checks.length}get minValue(){return this.config.jsonSchema?.minimum?BigInt(this.config.jsonSchema.minimum):null}get maxValue(){return this.config.jsonSchema?.maximum?BigInt(this.config.jsonSchema.maximum):null}get format(){return this.config.jsonSchema?.format??null}static create(){return new VldBigInt}detectFastCheckMode(){if(0===this._checks.length)return"none";if(1!==this._checks.length)return;const e=this.config.jsonSchema;return 0n===e?.exclusiveMinimum&&void 0===e.minimum&&void 0===e.maximum?"positive":0n===e?.exclusiveMaximum&&void 0===e.minimum&&void 0===e.maximum?"negative":0n===e?.minimum&&void 0===e.maximum&&void 0===e.exclusiveMaximum?"nonnegative":0n===e?.maximum&&void 0===e.minimum&&void 0===e.exclusiveMinimum?"nonpositive":void 0}getValidationError(){return new Error(this.config.errorMessage||i.getMessages().invalidBigint)}parse(e){if("bigint"!=typeof e)throw this.getValidationError();return this.parseKnownBigInt(e)}parseKnownBigInt(e){switch(this._fastCheckMode){case"none":return e;case"positive":if(e>0n)return e;throw this.getValidationError();case"negative":if(e<0n)return e;throw this.getValidationError();case"nonnegative":if(e>=0n)return e;throw this.getValidationError();case"nonpositive":if(e<=0n)return e;throw this.getValidationError()}for(const i of this._checks)if(!i(e))throw this.getValidationError();return e}safeParse(e){if("bigint"!=typeof e)return{success:!1,error:t(this.getValidationError().message)};try{return{success:!0,data:this.parseKnownBigInt(e)}}catch(e){return{success:!1,error:t(e.message)}}}min(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i>=e],errorMessage:i||`BigInt must be at least ${e}`,jsonSchema:{...this.config.jsonSchema,minimum:e}})}max(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i<=e],errorMessage:i||`BigInt must be at most ${e}`,jsonSchema:{...this.config.jsonSchema,maximum:e}})}positive(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>0n],errorMessage:e||"BigInt must be positive",jsonSchema:{...this.config.jsonSchema,exclusiveMinimum:0n}})}negative(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<0n],errorMessage:e||"BigInt must be negative",jsonSchema:{...this.config.jsonSchema,exclusiveMaximum:0n}})}nonnegative(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>=0n],errorMessage:e||"BigInt must be non-negative",jsonSchema:{...this.config.jsonSchema,minimum:0n}})}nonpositive(e){return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<=0n],errorMessage:e||"BigInt must be non-positive",jsonSchema:{...this.config.jsonSchema,maximum:0n}})}gt(e,i){const n="bigint"==typeof e?e:BigInt(e);return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e>n],errorMessage:i||`BigInt must be greater than ${n}`,jsonSchema:{...this.config.jsonSchema,exclusiveMinimum:n}})}lt(e,i){const n="bigint"==typeof e?e:BigInt(e);return new VldBigInt({...this.config,checks:[...this.config.checks,e=>e<n],errorMessage:i||`BigInt must be less than ${n}`,jsonSchema:{...this.config.jsonSchema,exclusiveMaximum:n}})}gte(e,i){const n="bigint"==typeof e?e:BigInt(e);return this.min(n,i)}lte(e,i){const n="bigint"==typeof e?e:BigInt(e);return this.max(n,i)}multipleOf(e,i){return new VldBigInt({...this.config,checks:[...this.config.checks,i=>i%e===0n],errorMessage:i||`BigInt must be a multiple of ${e}`,jsonSchema:{...this.config.jsonSchema,multipleOf:e}})}}exports.VldBigInt=VldBigInt;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs");class VldBoolean extends e.VldBase{constructor(s,r){super(r||e.VLD_VALIDATOR_TYPES.BOOLEAN),this.errorMessage=s}get isSimple(){return!0}static create(){return new VldBoolean}parse(e){if("boolean"!=typeof e)throw new s.VldError([s.createInvalidTypeIssue("boolean",s.getTypeName(e),this.errorMessage)]);return e}parseKnownBoolean(e){return e}safeParse(e){return"boolean"==typeof e?{success:!0,data:e}:{success:!1,error:new s.VldError([s.createInvalidTypeIssue("boolean",s.getTypeName(e),this.errorMessage)])}}true(e){return new VldTrue(e||"Value must be true")}false(e){return new VldFalse(e||"Value must be false")}}class VldTrue extends VldBoolean{constructor(e){super(e),this.message=e}get isSimple(){return!1}parse(e){if(!0!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!0}parseKnownBoolean(e){if(!0!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!0}safeParse(e){return!0!==e?{success:!1,error:new s.VldError([{code:"custom",path:[],message:this.message}])}:{success:!0,data:!0}}}class VldFalse extends VldBoolean{constructor(e){super(e),this.message=e}get isSimple(){return!1}parse(e){if(!1!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!1}parseKnownBoolean(e){if(!1!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!1}safeParse(e){return!1!==e?{success:!1,error:new s.VldError([{code:"custom",path:[],message:this.message}])}:{success:!0,data:!1}}}exports.VldBoolean=VldBoolean;
1
+ "use strict";var e=require("./base.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs");class VldBoolean extends e.VldBase{constructor(s,r){super(r||e.VLD_VALIDATOR_TYPES.BOOLEAN),this.errorMessage=s}get isSimple(){return!0}static create(){return new VldBoolean}parse(e){if("boolean"!=typeof e)throw new s.VldError([s.createInvalidTypeIssue("boolean",s.getTypeName(e),this.errorMessage)]);return e}parseKnownBoolean(e){return e}safeParse(e){return"boolean"==typeof e?{success:!0,data:e}:{success:!1,error:new s.VldError([s.createInvalidTypeIssue("boolean",s.getTypeName(e),this.errorMessage)])}}true(e){return new VldTrue(e||"Value must be true")}false(e){return new VldFalse(e||"Value must be false")}}class VldTrue extends VldBoolean{constructor(e){super(e),this.message=e}get isSimple(){return!1}parse(e){if(!0!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!0}parseKnownBoolean(e){if(!0!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!0}safeParse(e){return!0!==e?{success:!1,error:new s.VldError([{code:"custom",path:[],message:this.message}])}:{success:!0,data:!0}}}class VldFalse extends VldBoolean{constructor(e){super(e),this.message=e}get isSimple(){return!1}parse(e){if(!1!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!1}parseKnownBoolean(e){if(!1!==e)throw new s.VldError([{code:"custom",path:[],message:this.message}]);return!1}safeParse(e){return!1!==e?{success:!1,error:new s.VldError([{code:"custom",path:[],message:this.message}])}:{success:!0,data:!1}}}exports.VldBoolean=VldBoolean;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../errors.cjs"),s=require("../locales/runtime.cjs"),c=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldCodec extends e.VldBase{constructor(r,s,c){super(e.VLD_VALIDATOR_TYPES.CODEC),this.inputValidator=r,this.outputValidator=s,this.codecTransform=c}parse(e){const r=this.safeParse(e);if(!r.success)throw r.error;return r.data}safeParse(e){const t=this.inputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=this.codecTransform.decode(t.data);if(e instanceof Promise)throw new c.VldError([r.createIssue("custom",[],s.getMessages().codecAsyncNotSupported)]);return this.outputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecDecodeFailed)])}}}invert(){return new VldCodec(this.outputValidator,this.inputValidator,{decode:this.codecTransform.encode,encode:this.codecTransform.decode})}encode(e){const r=this.safeEncode(e);if(!r.success)throw r.error;return r.data}safeEncode(e){const t=this.outputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=this.codecTransform.encode(t.data);if(e instanceof Promise)throw new c.VldError([r.createIssue("custom",[],s.getMessages().codecAsyncNotSupported)]);return this.inputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecEncodeFailed)])}}}async parseAsync(e){const r=await this.safeParseAsync(e);if(!r.success)throw r.error;return r.data}async safeParseAsync(e){const t=this.inputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=await this.codecTransform.decode(t.data);return this.outputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecDecodeFailed)])}}}async encodeAsync(e){const r=await this.safeEncodeAsync(e);if(!r.success)throw r.error;return r.data}async safeEncodeAsync(e){const t=this.outputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=await this.codecTransform.encode(t.data);return this.inputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecEncodeFailed)])}}}static create(e,r,s){return new VldCodec(e,r,s)}static invert(e){return e.invert()}}exports.VldCodec=VldCodec;
1
+ "use strict";var e=require("./base.cjs"),r=require("../errors.cjs"),s=require("../locales/runtime.cjs"),c=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldCodec extends e.VldBase{constructor(r,s,c){super(e.VLD_VALIDATOR_TYPES.CODEC),this.inputValidator=r,this.outputValidator=s,this.codecTransform=c}parse(e){const r=this.safeParse(e);if(!r.success)throw r.error;return r.data}safeParse(e){const t=this.inputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=this.codecTransform.decode(t.data);if(e instanceof Promise)throw new c.VldError([r.createIssue("custom",[],s.getMessages().codecAsyncNotSupported)]);return this.outputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecDecodeFailed)])}}}invert(){return new VldCodec(this.outputValidator,this.inputValidator,{decode:this.codecTransform.encode,encode:this.codecTransform.decode})}encode(e){const r=this.safeEncode(e);if(!r.success)throw r.error;return r.data}safeEncode(e){const t=this.outputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=this.codecTransform.encode(t.data);if(e instanceof Promise)throw new c.VldError([r.createIssue("custom",[],s.getMessages().codecAsyncNotSupported)]);return this.inputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecEncodeFailed)])}}}async parseAsync(e){const r=await this.safeParseAsync(e);if(!r.success)throw r.error;return r.data}async safeParseAsync(e){const t=this.inputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=await this.codecTransform.decode(t.data);return this.outputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecDecodeFailed)])}}}async encodeAsync(e){const r=await this.safeEncodeAsync(e);if(!r.success)throw r.error;return r.data}async safeEncodeAsync(e){const t=this.outputValidator.safeParse(e);if(!t.success)return{success:!1,error:t.error};try{const e=await this.codecTransform.encode(t.data);return this.inputValidator.safeParse(e)}catch(e){return e instanceof c.VldError?{success:!1,error:e}:{success:!1,error:new c.VldError([r.createIssue("custom",[],s.getMessages().codecEncodeFailed)])}}}static create(e,r,s){return new VldCodec(e,r,s)}static invert(e){return e.invert()}}exports.VldCodec=VldCodec;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./base.cjs"),r=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs");class VldTupleV2 extends e.VldBase{constructor(r){super(e.VLD_VALIDATOR_TYPES.TUPLE),this.__def=Object.freeze({type:"tuple",validators:Object.freeze([...r]),validatorTypes:Object.freeze(r.map(e=>e.validatorType))})}static create(...e){return new VldTupleV2(e)}parse(e){if(!Array.isArray(e))throw new r.VldError([r.createInvalidTypeIssue("tuple",r.getTypeName(e),void 0)]);return this.parseKnownTuple(e)}parseKnownTuple(e){const r=this.__def.validators,t=r.length;if(e.length<t)throw new Error(`Tuple must have at least ${t} items, got ${e.length}`);const s=new Array(t);for(let a=0;a<t;a++)s[a]=r[a].parse(e[a]);return s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof r.VldError?e:new r.VldError([{code:"custom",path:[],message:String(e)}])}}}get items(){return this.__def.validators}}class VldSetV2 extends e.VldBase{constructor(r,t){super(e.VLD_VALIDATOR_TYPES.SET),this.__def=Object.freeze({type:"set",valueValidator:r,errorMessage:t,isSimple:!0===r.isSimple})}static create(e){return new VldSetV2(e)}parse(e){if(!(e instanceof Set))throw new r.VldError([r.createInvalidTypeIssue("set",r.getTypeName(e),this.__def.errorMessage)]);if(this.__def.isSimple)return e;const t=new Set;for(const r of e)t.add(this.__def.valueValidator.parse(r));return t}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof r.VldError?e:new r.VldError([{code:"custom",path:[],message:String(e)}])}}}get isSimple(){return this.__def.isSimple}}class VldMapV2 extends e.VldBase{constructor(r,t){super(e.VLD_VALIDATOR_TYPES.MAP);const s=!0===r.isSimple,a=!0===t.isSimple;this.__def=Object.freeze({type:"map",keyValidator:r,valueValidator:t,isSimple:s&&a})}static create(e,r){return new VldMapV2(e,r)}parse(e){if(!(e instanceof Map))throw new r.VldError([r.createInvalidTypeIssue("map",r.getTypeName(e),void 0)]);if(this.__def.isSimple)return e;const t=new Map;for(const[r,s]of e)t.set(this.__def.keyValidator.parse(r),this.__def.valueValidator.parse(s));return t}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof r.VldError?e:new r.VldError([{code:"custom",path:[],message:String(e)}])}}}get isSimple(){return this.__def.isSimple}}class VldIntersectionV2 extends e.VldBase{constructor(r,t){super(e.VLD_VALIDATOR_TYPES.INTERSECTION),this.__def=Object.freeze({type:"intersection",left:r,right:t})}static create(e,r){return new VldIntersectionV2(e,r)}parse(e){return{...this.__def.left.parse(e),...this.__def.right.parse(e)}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof r.VldError?e:new r.VldError([{code:"custom",path:[],message:String(e)}])}}}}exports.VldIntersectionV2=VldIntersectionV2,exports.VldMapV2=VldMapV2,exports.VldSetV2=VldSetV2,exports.VldTupleV2=VldTupleV2;
@@ -1 +1 @@
1
- "use strict";var s=require("./base.cjs");require("../registry.cjs"),require("../chunks/errors-core-DrydF46s.cjs");class VldCustom extends s.VldBase{constructor(r){super(s.VLD_VALIDATOR_TYPES.CUSTOM),this._parseFn=r.parse,this._parseAsyncFn=r.parseAsync||(s=>Promise.resolve(this._parseFn(s))),this._safeParseFn=r.safeParse?e=>{const a=r.safeParse(e);return a.success?{success:!0,data:a.data}:{success:!1,error:s.ensureVldError(a.error)}}:r=>{try{return{success:!0,data:this._parseFn(r)}}catch(r){return{success:!1,error:s.ensureVldError(r)}}},this._safeParseAsyncFn=r.safeParseAsync?async e=>{const a=await r.safeParseAsync(e);return a.success?{success:!0,data:a.data}:{success:!1,error:s.ensureVldError(a.error)}}:async r=>{try{return{success:!0,data:await this._parseAsyncFn(r)}}catch(r){return{success:!1,error:s.ensureVldError(r)}}}}static create(s){return new VldCustom(s)}parse(s){return this._parseFn(s)}safeParse(s){return this._safeParseFn(s)}async parseAsync(s){return this._parseAsyncFn(s)}async safeParseAsync(s){return this._safeParseAsyncFn(s)}}exports.VldCustom=VldCustom,exports.custom=function(r,e){if("function"==typeof r){const a=r;return VldCustom.create({parse:r=>{if(!a(r))throw s.ensureVldError(s.resolveErrorMessage(e,"Custom validation failed"));return r}})}return r?VldCustom.create(r):VldCustom.create({parse:s=>s})};
1
+ "use strict";var s=require("./base.cjs");require("../registry.cjs"),require("../chunks/errors-core-C0mA6tfa.cjs");class VldCustom extends s.VldBase{constructor(r){super(s.VLD_VALIDATOR_TYPES.CUSTOM),this._parseFn=r.parse,this._parseAsyncFn=r.parseAsync||(s=>Promise.resolve(this._parseFn(s))),this._safeParseFn=r.safeParse?e=>{const a=r.safeParse(e);return a.success?{success:!0,data:a.data}:{success:!1,error:s.ensureVldError(a.error)}}:r=>{try{return{success:!0,data:this._parseFn(r)}}catch(r){return{success:!1,error:s.ensureVldError(r)}}},this._safeParseAsyncFn=r.safeParseAsync?async e=>{const a=await r.safeParseAsync(e);return a.success?{success:!0,data:a.data}:{success:!1,error:s.ensureVldError(a.error)}}:async r=>{try{return{success:!0,data:await this._parseAsyncFn(r)}}catch(r){return{success:!1,error:s.ensureVldError(r)}}}}static create(s){return new VldCustom(s)}parse(s){return this._parseFn(s)}safeParse(s){return this._safeParseFn(s)}async parseAsync(s){return this._parseAsyncFn(s)}async safeParseAsync(s){return this._safeParseAsyncFn(s)}}exports.VldCustom=VldCustom,exports.custom=function(r,e){if("function"==typeof r){const a=r;return VldCustom.create({parse:r=>{if(!a(r))throw s.ensureVldError(s.resolveErrorMessage(e,"Custom validation failed"));return r}})}return r?VldCustom.create(r):VldCustom.create({parse:s=>s})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./base.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs");class VldDateCheck{}function s(e){return e instanceof Date?e:new Date(e)}class VldDateCheckMin extends VldDateCheck{constructor(e,t){super(),this._msg=t,this.kind="min",this._threshold=s(e)}check(e){return e.getTime()<this._threshold.getTime()?{code:"too_small",path:[],origin:"date",message:this._msg||`Date must be >= ${this._threshold.toISOString()}`}:null}meta(){return{kind:"min",value:this._threshold,message:this._msg}}}class VldDateCheckMax extends VldDateCheck{constructor(e,t){super(),this._msg=t,this.kind="max",this._threshold=s(e)}check(e){return e.getTime()>this._threshold.getTime()?{code:"too_big",path:[],origin:"date",message:this._msg||`Date must be <= ${this._threshold.toISOString()}`}:null}meta(){return{kind:"max",value:this._threshold,message:this._msg}}}class VldDateCheckGt extends VldDateCheck{constructor(e,t){super(),this._msg=t,this.kind="gt",this._threshold=s(e)}check(e){return e.getTime()<=this._threshold.getTime()?{code:"too_small",path:[],origin:"date",message:this._msg||`Date must be > ${this._threshold.toISOString()}`}:null}meta(){return{kind:"gt",value:this._threshold,message:this._msg}}}class VldDateCheckLt extends VldDateCheck{constructor(e,t){super(),this._msg=t,this.kind="lt",this._threshold=s(e)}check(e){return e.getTime()>=this._threshold.getTime()?{code:"too_big",path:[],origin:"date",message:this._msg||`Date must be < ${this._threshold.toISOString()}`}:null}meta(){return{kind:"lt",value:this._threshold,message:this._msg}}}class VldDateCheckPast extends VldDateCheck{constructor(e){super(),this._msg=e,this.kind="past"}check(e){return e.getTime()>=Date.now()?{code:"custom",path:[],message:this._msg||"Date must be in the past"}:null}meta(){return{kind:"past",message:this._msg}}}class VldDateCheckFuture extends VldDateCheck{constructor(e){super(),this._msg=e,this.kind="future"}check(e){return e.getTime()<=Date.now()?{code:"custom",path:[],message:this._msg||"Date must be in the future"}:null}meta(){return{kind:"future",message:this._msg}}}class VldDateCheckToday extends VldDateCheck{constructor(e){super(),this._msg=e,this.kind="today"}check(e){const t=new Date;return e.toDateString()!==t.toDateString()?{code:"custom",path:[],message:this._msg||"Date must be today"}:null}meta(){return{kind:"today",message:this._msg}}}class VldDateCheckWeekday extends VldDateCheck{constructor(e){super(),this._msg=e,this.kind="weekday"}check(e){const t=e.getDay();return 0===t||6===t?{code:"custom",path:[],message:this._msg||"Date must be a weekday"}:null}meta(){return{kind:"weekday",message:this._msg}}}class VldDateCheckWeekend extends VldDateCheck{constructor(e){super(),this._msg=e,this.kind="weekend"}check(e){const t=e.getDay();return 0!==t&&6!==t?{code:"custom",path:[],message:this._msg||"Date must be a weekend"}:null}meta(){return{kind:"weekend",message:this._msg}}}const h=Object.freeze({type:"date",checks:Object.freeze([]),isSimple:!0});class VldDateV2 extends e.VldBase{constructor(t=h){super(e.VLD_VALIDATOR_TYPES.DATE),this.__def=t}static create(){return new VldDateV2}get isSimple(){return this.__def.isSimple}parse(e){let s;if(e instanceof Date){if(Number.isNaN(e.getTime()))throw new t.VldError([t.createInvalidTypeIssue("date","Invalid Date",this.__def.errorMessage)]);s=e}else{if("string"!=typeof e&&"number"!=typeof e)throw new t.VldError([t.createInvalidTypeIssue("date",t.getTypeName(e),this.__def.errorMessage)]);if(s=new Date(e),Number.isNaN(s.getTime()))throw new t.VldError([t.createInvalidTypeIssue("date",t.getTypeName(e),this.__def.errorMessage)])}return this.__def.isSimple?s:this.parseKnownDate(s)}parseKnownDate(e){const s=this.__def.checks;for(let h=0;h<s.length;h++){const r=s[h].check(e);if(null!==r)throw new t.VldError([r])}return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof t.VldError?e:new t.VldError([{code:"custom",path:[],message:String(e)}])}}}withDef(e){const t=(s=e.checks??this.__def.checks,h=e.jsonSchema??this.__def.jsonSchema,r=e.errorMessage??this.__def.errorMessage,Object.freeze({type:"date",checks:s,jsonSchema:h,errorMessage:r,isSimple:0===s.length}));var s,h,r;return new this.constructor(t)}min(e,t){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckMin(e,t)],jsonSchema:{...this.__def.jsonSchema,minimum:s(e).toISOString()}})}max(e,t){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckMax(e,t)],jsonSchema:{...this.__def.jsonSchema,maximum:s(e).toISOString()}})}past(e){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckPast(e)]})}future(e){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckFuture(e)]})}today(e){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckToday(e)]})}weekday(e){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckWeekday(e)]})}weekend(e){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckWeekend(e)]})}gt(e,t){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckGt(e,t)]})}lt(e,t){return this.withDef({type:"date",checks:[...this.__def.checks,new VldDateCheckLt(e,t)]})}}exports.VldDateCheck=VldDateCheck,exports.VldDateCheckFuture=VldDateCheckFuture,exports.VldDateCheckGt=VldDateCheckGt,exports.VldDateCheckLt=VldDateCheckLt,exports.VldDateCheckMax=VldDateCheckMax,exports.VldDateCheckMin=VldDateCheckMin,exports.VldDateCheckPast=VldDateCheckPast,exports.VldDateCheckToday=VldDateCheckToday,exports.VldDateCheckWeekday=VldDateCheckWeekday,exports.VldDateCheckWeekend=VldDateCheckWeekend,exports.VldDateV2=VldDateV2;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),t=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs");function n(e){return new s.VldError([{code:"invalid_date",path:[],message:e}])}require("../registry.cjs"),require("../locales/en.cjs");class VldDate extends e.VldBase{constructor(t){super(t?.validatorType||e.VLD_VALIDATOR_TYPES.DATE),this.config={checks:t?.checks||[],errorMessage:t?.errorMessage,jsonSchema:t?.jsonSchema},this._checks=this.config.checks,this._isSimple=0===this._checks.length}get jsonSchema(){return this.config.jsonSchema}get minDate(){const e=this.config.jsonSchema?.formatMinimum??this.config.jsonSchema?.minimum;return e?new Date(e):null}get maxDate(){const e=this.config.jsonSchema?.formatMaximum??this.config.jsonSchema?.maximum;return e?new Date(e):null}static create(){return new VldDate}parse(e){let s;if(e instanceof Date)s=e;else{if("string"!=typeof e&&"number"!=typeof e)throw new Error(this.config.errorMessage||t.getMessages().invalidDate);s=new Date(e)}if(isNaN(s.getTime()))throw new Error(this.config.errorMessage||t.getMessages().invalidDate);return this.parseValidDate(s)}parseKnownDate(e){if(isNaN(e.getTime()))throw new Error(this.config.errorMessage||t.getMessages().invalidDate);return this.parseValidDate(e)}parseValidDate(e){if(this._isSimple)return e;for(const t of this._checks)if(!t.fn(e))throw new Error(t.message);return e}safeParse(e){if(e instanceof Date)try{return{success:!0,data:this.parseKnownDate(e)}}catch(e){return{success:!1,error:n(e.message)}}try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:n(e.message)}}}min(e,s){const n=e instanceof Date?e:new Date(e);if(isNaN(n.getTime()))throw new Error(`Invalid date provided to min(): ${e}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>=n,message:s||t.getMessages().dateMin(n)}],jsonSchema:{...this.config.jsonSchema,formatMinimum:n.toISOString()}})}max(e,s){const n=e instanceof Date?e:new Date(e);if(isNaN(n.getTime()))throw new Error(`Invalid date provided to max(): ${e}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e<=n,message:s||t.getMessages().dateMax(n)}],jsonSchema:{...this.config.jsonSchema,formatMaximum:n.toISOString()}})}between(e,t,s){const n=e instanceof Date?e:new Date(e),a=t instanceof Date?t:new Date(t);if(isNaN(n.getTime()))throw new Error(`Invalid min date provided to between(): ${e}`);if(isNaN(a.getTime()))throw new Error(`Invalid max date provided to between(): ${t}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>=n&&e<=a,message:s||`Date must be between ${n.toISOString()} and ${a.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatMinimum:n.toISOString(),formatMaximum:a.toISOString()}})}past(e){const t=new Date;return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e<t,message:e||"Date must be in the past"}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMaximum:t.toISOString()}})}future(e){const t=new Date;return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>t,message:e||"Date must be in the future"}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMinimum:t.toISOString()}})}today(e){const t=new Date,s=t.getFullYear(),n=t.getMonth(),a=t.getDate();return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getFullYear()===s&&e.getMonth()===n&&e.getDate()===a,message:e||"Date must be today"}]})}weekday(e){return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>{const t=e.getDay();return t>=1&&t<=5},message:e||"Date must be a weekday"}]})}weekend(e){return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>{const t=e.getDay();return 0===t||6===t},message:e||"Date must be a weekend"}]})}gt(e,t){const s=e instanceof Date?e:new Date(e);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getTime()>s.getTime(),message:t||`Date must be greater than ${s.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMinimum:s.toISOString()}})}lt(e,t){const s=e instanceof Date?e:new Date(e);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getTime()<s.getTime(),message:t||`Date must be less than ${s.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMaximum:s.toISOString()}})}}exports.VldDate=VldDate;
1
+ "use strict";var e=require("./base.cjs"),t=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs");function n(e){return new s.VldError([{code:"invalid_date",path:[],message:e}])}require("../registry.cjs"),require("../locales/en.cjs");class VldDate extends e.VldBase{constructor(t){super(t?.validatorType||e.VLD_VALIDATOR_TYPES.DATE),this.config={checks:t?.checks||[],errorMessage:t?.errorMessage,jsonSchema:t?.jsonSchema},this._checks=this.config.checks,this._isSimple=0===this._checks.length}get jsonSchema(){return this.config.jsonSchema}get minDate(){const e=this.config.jsonSchema?.formatMinimum??this.config.jsonSchema?.minimum;return e?new Date(e):null}get maxDate(){const e=this.config.jsonSchema?.formatMaximum??this.config.jsonSchema?.maximum;return e?new Date(e):null}static create(){return new VldDate}parse(e){let s;if(e instanceof Date)s=e;else{if("string"!=typeof e&&"number"!=typeof e)throw new Error(this.config.errorMessage||t.getMessages().invalidDate);s=new Date(e)}if(isNaN(s.getTime()))throw new Error(this.config.errorMessage||t.getMessages().invalidDate);return this.parseValidDate(s)}parseKnownDate(e){if(isNaN(e.getTime()))throw new Error(this.config.errorMessage||t.getMessages().invalidDate);return this.parseValidDate(e)}parseValidDate(e){if(this._isSimple)return e;for(const t of this._checks)if(!t.fn(e))throw new Error(t.message);return e}safeParse(e){if(e instanceof Date)try{return{success:!0,data:this.parseKnownDate(e)}}catch(e){return{success:!1,error:n(e.message)}}try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:n(e.message)}}}min(e,s){const n=e instanceof Date?e:new Date(e);if(isNaN(n.getTime()))throw new Error(`Invalid date provided to min(): ${e}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>=n,message:s||t.getMessages().dateMin(n)}],jsonSchema:{...this.config.jsonSchema,formatMinimum:n.toISOString()}})}max(e,s){const n=e instanceof Date?e:new Date(e);if(isNaN(n.getTime()))throw new Error(`Invalid date provided to max(): ${e}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e<=n,message:s||t.getMessages().dateMax(n)}],jsonSchema:{...this.config.jsonSchema,formatMaximum:n.toISOString()}})}between(e,t,s){const n=e instanceof Date?e:new Date(e),a=t instanceof Date?t:new Date(t);if(isNaN(n.getTime()))throw new Error(`Invalid min date provided to between(): ${e}`);if(isNaN(a.getTime()))throw new Error(`Invalid max date provided to between(): ${t}`);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>=n&&e<=a,message:s||`Date must be between ${n.toISOString()} and ${a.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatMinimum:n.toISOString(),formatMaximum:a.toISOString()}})}past(e){const t=new Date;return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e<t,message:e||"Date must be in the past"}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMaximum:t.toISOString()}})}future(e){const t=new Date;return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e>t,message:e||"Date must be in the future"}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMinimum:t.toISOString()}})}today(e){const t=new Date,s=t.getFullYear(),n=t.getMonth(),a=t.getDate();return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getFullYear()===s&&e.getMonth()===n&&e.getDate()===a,message:e||"Date must be today"}]})}weekday(e){return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>{const t=e.getDay();return t>=1&&t<=5},message:e||"Date must be a weekday"}]})}weekend(e){return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>{const t=e.getDay();return 0===t||6===t},message:e||"Date must be a weekend"}]})}gt(e,t){const s=e instanceof Date?e:new Date(e);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getTime()>s.getTime(),message:t||`Date must be greater than ${s.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMinimum:s.toISOString()}})}lt(e,t){const s=e instanceof Date?e:new Date(e);return new VldDate({...this.config,checks:[...this.config.checks,{fn:e=>e.getTime()<s.getTime(),message:t||`Date must be less than ${s.toISOString()}`}],jsonSchema:{...this.config.jsonSchema,formatExclusiveMaximum:s.toISOString()}})}}exports.VldDate=VldDate;
@@ -1 +1 @@
1
- "use strict";var i=require("./base.cjs"),r=require("./object.cjs"),t=require("./literal.cjs"),e=require("./enum.cjs");function s(i){if(i instanceof t.VldLiteral)return[...i.values];if(i instanceof e.VldEnum)return[...i.values];throw new Error("Discriminator must be a literal or enum schema")}require("../registry.cjs"),require("../chunks/errors-core-DrydF46s.cjs"),require("../locales/runtime.cjs"),require("../locales/en.cjs"),require("../chunks/security-aXZVI7qW.cjs");class VldDiscriminatedUnion extends i.VldBase{constructor(t,e){super(i.VLD_VALIDATOR_TYPES.DISCRIMINATED_UNION),this._discriminator=t,this._options=e,this._discriminatorMap=new Map,this._stringDiscriminatorMap=Object.create(null);for(const i of e){if(!(i instanceof r.VldObject))throw new Error("All options in a discriminated union must be objects");const t=i.config?.shape?.[this._discriminator];if(!t)throw new Error(`Missing discriminator key "${this._discriminator}" in one of the options`);const e=s(t);for(const r of e){if(this._discriminatorMap.has(r))throw new Error(`Duplicate discriminator value "${String(r)}" found in discriminated union`);this._discriminatorMap.set(r,i),"string"==typeof r&&(this._stringDiscriminatorMap[r]=i)}}this._validValues=Array.from(this._discriminatorMap.keys())}get options(){return this._options}get discriminator(){return this._discriminator}static create(i,r){return new VldDiscriminatedUnion(i,r)}parse(i){if("object"!=typeof i||null===i)throw new Error("Expected object, received "+(null===i?"null":typeof i));const r=i[this._discriminator],t="string"==typeof r?this._stringDiscriminatorMap[r]:this._discriminatorMap.get(r);if(!t)throw new Error(`Invalid discriminator value for "${this._discriminator}". Expected one of: ${JSON.stringify(this._validValues)}, received: ${JSON.stringify(r)}`);return t.parseTrustedKnownObject(i,this._discriminator)}safeParse(r){if("object"!=typeof r||null===r)return{success:!1,error:i.ensureVldError("Expected object, received "+(null===r?"null":typeof r))};const t=r[this._discriminator],e="string"==typeof t?this._stringDiscriminatorMap[t]:this._discriminatorMap.get(t);if(!e)return{success:!1,error:i.ensureVldError(`Invalid discriminator value for "${this._discriminator}". Expected one of: ${JSON.stringify(this._validValues)}, received: ${JSON.stringify(t)}`)};try{return{success:!0,data:e.parseTrustedKnownObject(r,this._discriminator)}}catch(r){return{success:!1,error:i.ensureVldError(r)}}}getDiscriminator(){return this._discriminator}getOptions(){return this._options}}exports.VldDiscriminatedUnion=VldDiscriminatedUnion;
1
+ "use strict";var i=require("./base.cjs"),r=require("./object.cjs"),t=require("./literal.cjs"),e=require("./enum.cjs");function s(i){if(i instanceof t.VldLiteral)return[...i.values];if(i instanceof e.VldEnum)return[...i.values];throw new Error("Discriminator must be a literal or enum schema")}require("../registry.cjs"),require("../chunks/errors-core-C0mA6tfa.cjs"),require("../locales/runtime.cjs"),require("../locales/en.cjs"),require("../chunks/security-aXZVI7qW.cjs");class VldDiscriminatedUnion extends i.VldBase{constructor(t,e){super(i.VLD_VALIDATOR_TYPES.DISCRIMINATED_UNION),this._discriminator=t,this._options=e,this._discriminatorMap=new Map,this._stringDiscriminatorMap=Object.create(null);for(const i of e){if(!(i instanceof r.VldObject))throw new Error("All options in a discriminated union must be objects");const t=i.config?.shape?.[this._discriminator];if(!t)throw new Error(`Missing discriminator key "${this._discriminator}" in one of the options`);const e=s(t);for(const r of e){if(this._discriminatorMap.has(r))throw new Error(`Duplicate discriminator value "${String(r)}" found in discriminated union`);this._discriminatorMap.set(r,i),"string"==typeof r&&(this._stringDiscriminatorMap[r]=i)}}this._validValues=Array.from(this._discriminatorMap.keys())}get options(){return this._options}get discriminator(){return this._discriminator}static create(i,r){return new VldDiscriminatedUnion(i,r)}parse(i){if("object"!=typeof i||null===i)throw new Error("Expected object, received "+(null===i?"null":typeof i));const r=i[this._discriminator],t="string"==typeof r?this._stringDiscriminatorMap[r]:this._discriminatorMap.get(r);if(!t)throw new Error(`Invalid discriminator value for "${this._discriminator}". Expected one of: ${JSON.stringify(this._validValues)}, received: ${JSON.stringify(r)}`);return t.parseTrustedKnownObject(i,this._discriminator)}safeParse(r){if("object"!=typeof r||null===r)return{success:!1,error:i.ensureVldError("Expected object, received "+(null===r?"null":typeof r))};const t=r[this._discriminator],e="string"==typeof t?this._stringDiscriminatorMap[t]:this._discriminatorMap.get(t);if(!e)return{success:!1,error:i.ensureVldError(`Invalid discriminator value for "${this._discriminator}". Expected one of: ${JSON.stringify(this._validValues)}, received: ${JSON.stringify(t)}`)};try{return{success:!0,data:e.parseTrustedKnownObject(r,this._discriminator)}}catch(r){return{success:!1,error:i.ensureVldError(r)}}}getDiscriminator(){return this._discriminator}getOptions(){return this._options}}exports.VldDiscriminatedUnion=VldDiscriminatedUnion;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldEnum extends e.VldBase{constructor(r,s){super(e.VLD_VALIDATOR_TYPES.ENUM),this._values=r,this.errorMessage=s,this._valueSet=r.length>6?new Set(r):void 0}createError(e){const t={code:"invalid_value",path:[],values:[...this._values],message:this.errorMessage||r.getMessages().enumExpected([...this._values],JSON.stringify(e))};return new s.VldError([t])}get values(){return this._values}get options(){return this._values}get enum(){const e={};for(const r of this._values)e[r]=r;return e}static create(e){return new VldEnum(e)}parse(e){if("string"!=typeof e&&"number"!=typeof e)throw this.createError(e);const r=this._values;switch(r.length){case 1:if(e===r[0])return e;break;case 2:if(e===r[0]||e===r[1])return e;break;case 3:if(e===r[0]||e===r[1]||e===r[2])return e;break;case 4:if(e===r[0]||e===r[1]||e===r[2]||e===r[3])return e;break;case 5:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4])return e;break;case 6:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4]||e===r[5])return e;break;default:if(this._valueSet.has(e))return e}throw this.createError(e)}safeParse(e){if("string"!=typeof e&&"number"!=typeof e)return{success:!1,error:this.createError(e)};const r=this._values;switch(r.length){case 1:if(e===r[0])return{success:!0,data:e};break;case 2:if(e===r[0]||e===r[1])return{success:!0,data:e};break;case 3:if(e===r[0]||e===r[1]||e===r[2])return{success:!0,data:e};break;case 4:if(e===r[0]||e===r[1]||e===r[2]||e===r[3])return{success:!0,data:e};break;case 5:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4])return{success:!0,data:e};break;case 6:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4]||e===r[5])return{success:!0,data:e};break;default:if(this._valueSet.has(e))return{success:!0,data:e}}return{success:!1,error:this.createError(e)}}exclude(...e){const r=1===e.length&&Array.isArray(e[0])?e[0]:e,s=this._values.filter(e=>!r.includes(e));if(0===s.length)throw new Error("Cannot exclude all enum values");return new VldEnum(s,this.errorMessage)}extract(...e){const r=1===e.length&&Array.isArray(e[0])?e[0]:e,s=this._values.filter(e=>r.includes(e));if(0===s.length)throw new Error("Cannot extract non-existent enum values");return new VldEnum(s,this.errorMessage)}}exports.VldEnum=VldEnum;
1
+ "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldEnum extends e.VldBase{constructor(r,s){super(e.VLD_VALIDATOR_TYPES.ENUM),this._values=r,this.errorMessage=s,this._valueSet=r.length>6?new Set(r):void 0}createError(e){const t={code:"invalid_value",path:[],values:[...this._values],message:this.errorMessage||r.getMessages().enumExpected([...this._values],JSON.stringify(e))};return new s.VldError([t])}get values(){return this._values}get options(){return this._values}get enum(){const e={};for(const r of this._values)e[r]=r;return e}static create(e){return new VldEnum(e)}parse(e){if("string"!=typeof e&&"number"!=typeof e)throw this.createError(e);const r=this._values;switch(r.length){case 1:if(e===r[0])return e;break;case 2:if(e===r[0]||e===r[1])return e;break;case 3:if(e===r[0]||e===r[1]||e===r[2])return e;break;case 4:if(e===r[0]||e===r[1]||e===r[2]||e===r[3])return e;break;case 5:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4])return e;break;case 6:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4]||e===r[5])return e;break;default:if(this._valueSet.has(e))return e}throw this.createError(e)}safeParse(e){if("string"!=typeof e&&"number"!=typeof e)return{success:!1,error:this.createError(e)};const r=this._values;switch(r.length){case 1:if(e===r[0])return{success:!0,data:e};break;case 2:if(e===r[0]||e===r[1])return{success:!0,data:e};break;case 3:if(e===r[0]||e===r[1]||e===r[2])return{success:!0,data:e};break;case 4:if(e===r[0]||e===r[1]||e===r[2]||e===r[3])return{success:!0,data:e};break;case 5:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4])return{success:!0,data:e};break;case 6:if(e===r[0]||e===r[1]||e===r[2]||e===r[3]||e===r[4]||e===r[5])return{success:!0,data:e};break;default:if(this._valueSet.has(e))return{success:!0,data:e}}return{success:!1,error:this.createError(e)}}exclude(...e){const r=1===e.length&&Array.isArray(e[0])?e[0]:e,s=this._values.filter(e=>!r.includes(e));if(0===s.length)throw new Error("Cannot exclude all enum values");return new VldEnum(s,this.errorMessage)}extract(...e){const r=1===e.length&&Array.isArray(e[0])?e[0]:e,s=this._values.filter(e=>r.includes(e));if(0===s.length)throw new Error("Cannot extract non-existent enum values");return new VldEnum(s,this.errorMessage)}}exports.VldEnum=VldEnum;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),s=require("../locales/runtime.cjs"),r=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldFile extends e.VldBase{constructor(s=[]){super(e.VLD_VALIDATOR_TYPES.FILE),this.checks=s}static create(){return new VldFile}isFileLike(e){return"object"==typeof e&&null!==e&&("undefined"!=typeof File&&e instanceof File||"size"in e&&"type"in e)}parse(e){if(this.isFileLike(e))return this.parseKnownFile(e);if("undefined"==typeof File)throw new Error(s.getMessages().fileNotSupported||"File API not supported in this environment");throw new Error(s.getMessages().invalidFile||"Expected a File object")}parseKnownFile(e){return this.runChecks(e)}runChecks(e){const r=s.getMessages();for(const s of this.checks)switch(s.type){case"min":if(e.size<s.value)throw new Error(s.message||r.fileMinSize?.(s.value)||`File size must be at least ${s.value} bytes`);break;case"max":if(e.size>s.value)throw new Error(s.message||r.fileMaxSize?.(s.value)||`File size must not exceed ${s.value} bytes`);break;case"mime":if(!s.value.includes(e.type))throw new Error(s.message||r.fileMimeType?.(s.value)||`Invalid file type. Expected: ${s.value.join(", ")}`)}return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(s=e.message,new r.VldError([{code:"invalid_type",path:[],message:s}]))}}var s}min(e,s){return new VldFile([...this.checks,{type:"min",value:e,message:s}])}max(e,s){return new VldFile([...this.checks,{type:"max",value:e,message:s}])}mime(e,s){const r=Array.isArray(e)?e:[e];return new VldFile([...this.checks,{type:"mime",value:r,message:s}])}size(e,s,r){return this.min(e,r).max(s,r)}}exports.VldFile=VldFile,exports.file=function(){return VldFile.create()};
1
+ "use strict";var e=require("./base.cjs"),s=require("../locales/runtime.cjs"),r=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldFile extends e.VldBase{constructor(s=[]){super(e.VLD_VALIDATOR_TYPES.FILE),this.checks=s}static create(){return new VldFile}isFileLike(e){return"object"==typeof e&&null!==e&&("undefined"!=typeof File&&e instanceof File||"size"in e&&"type"in e)}parse(e){if(this.isFileLike(e))return this.parseKnownFile(e);if("undefined"==typeof File)throw new Error(s.getMessages().fileNotSupported||"File API not supported in this environment");throw new Error(s.getMessages().invalidFile||"Expected a File object")}parseKnownFile(e){return this.runChecks(e)}runChecks(e){const r=s.getMessages();for(const s of this.checks)switch(s.type){case"min":if(e.size<s.value)throw new Error(s.message||r.fileMinSize?.(s.value)||`File size must be at least ${s.value} bytes`);break;case"max":if(e.size>s.value)throw new Error(s.message||r.fileMaxSize?.(s.value)||`File size must not exceed ${s.value} bytes`);break;case"mime":if(!s.value.includes(e.type))throw new Error(s.message||r.fileMimeType?.(s.value)||`Invalid file type. Expected: ${s.value.join(", ")}`)}return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(s=e.message,new r.VldError([{code:"invalid_type",path:[],message:s}]))}}var s}min(e,s){return new VldFile([...this.checks,{type:"min",value:e,message:s}])}max(e,s){return new VldFile([...this.checks,{type:"max",value:e,message:s}])}mime(e,s){const r=Array.isArray(e)?e:[e];return new VldFile([...this.checks,{type:"mime",value:r,message:s}])}size(e,s,r){return this.min(e,r).max(s,r)}}exports.VldFile=VldFile,exports.file=function(){return VldFile.create()};
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldFunction extends e.VldBase{constructor(){super(e.VLD_VALIDATOR_TYPES.FUNCTION)}static create(){return new VldFunction}parse(e){if("function"!=typeof e)throw new Error(r.getMessages().invalidFunction||"Expected a function");return e}parseKnownFunction(e){return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(r=e.message,new s.VldError([{code:"invalid_type",path:[],message:r}]))}}var r}}exports.VldFunction=VldFunction,exports.functionValidator=function(){return VldFunction.create()};
1
+ "use strict";var e=require("./base.cjs"),r=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../locales/en.cjs");class VldFunction extends e.VldBase{constructor(){super(e.VLD_VALIDATOR_TYPES.FUNCTION)}static create(){return new VldFunction}parse(e){if("function"!=typeof e)throw new Error(r.getMessages().invalidFunction||"Expected a function");return e}parseKnownFunction(e){return e}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(r=e.message,new s.VldError([{code:"invalid_type",path:[],message:r}]))}}var r}}exports.VldFunction=VldFunction,exports.functionValidator=function(){return VldFunction.create()};
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../errors.cjs"),s=require("../locales/runtime.cjs"),t=require("../chunks/errors-core-DrydF46s.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldHex extends e.VldBase{constructor(r=!1){super(e.VLD_VALIDATOR_TYPES.HEX),this.lowercase=r}parse(e){const r=this.safeParse(e);if(!r.success)throw r.error;return r.data}safeParse(e){if("string"!=typeof e)return{success:!1,error:new t.VldError([r.createIssue("invalid_type",[],s.getMessages().expectedString)])};if(!VldHex.HEX_REGEX.test(e))return{success:!1,error:new t.VldError([r.createIssue("custom",[],s.getMessages().invalidHex)])};if(e.length%2!=0)return{success:!1,error:new t.VldError([r.createIssue("custom",[],s.getMessages().invalidHex)])};return{success:!0,data:this.lowercase?e.toLowerCase():e}}lowercaseMode(){return new VldHex(!0)}static create(e=!1){return new VldHex(e)}}VldHex.HEX_REGEX=/^[0-9a-fA-F]*$/,exports.VldHex=VldHex;
1
+ "use strict";var e=require("./base.cjs"),r=require("../errors.cjs"),s=require("../locales/runtime.cjs"),t=require("../chunks/errors-core-C0mA6tfa.cjs");require("../registry.cjs"),require("../pigment.cjs"),require("../locales/en.cjs");class VldHex extends e.VldBase{constructor(r=!1){super(e.VLD_VALIDATOR_TYPES.HEX),this.lowercase=r}parse(e){const r=this.safeParse(e);if(!r.success)throw r.error;return r.data}safeParse(e){if("string"!=typeof e)return{success:!1,error:new t.VldError([r.createIssue("invalid_type",[],s.getMessages().expectedString)])};if(!VldHex.HEX_REGEX.test(e))return{success:!1,error:new t.VldError([r.createIssue("custom",[],s.getMessages().invalidHex)])};if(e.length%2!=0)return{success:!1,error:new t.VldError([r.createIssue("custom",[],s.getMessages().invalidHex)])};return{success:!0,data:this.lowercase?e.toLowerCase():e}}lowercaseMode(){return new VldHex(!0)}static create(e=!1){return new VldHex(e)}}VldHex.HEX_REGEX=/^[0-9a-fA-F]*$/,exports.VldHex=VldHex;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("./string.cjs"),s=require("./number.cjs"),l=require("./boolean.cjs"),t=require("./date.cjs"),o=require("./string-bool.cjs"),i=require("./array.cjs"),d=require("./object.cjs"),p=require("./union.cjs"),u=require("./intersection.cjs"),n=require("./literal.cjs"),V=require("./enum.cjs"),x=require("./tuple.cjs"),c=require("./record.cjs"),a=require("./set.cjs"),j=require("./map.cjs"),m=require("./bigint.cjs"),q=require("./symbol.cjs"),v=require("./any.cjs"),b=require("./unknown.cjs"),f=require("./void.cjs"),g=require("./never.cjs"),h=require("./null.cjs"),y=require("./undefined.cjs"),N=require("./nan.cjs"),B=require("./lazy.cjs"),S=require("./discriminated-union.cjs"),U=require("./xor.cjs"),k=require("./json.cjs"),L=require("./template-literal.cjs"),R=require("./custom.cjs"),D=require("./file.cjs"),F=require("./function.cjs"),O=require("./promise.cjs"),P=require("./string-formats.cjs");require("../registry.cjs"),require("../chunks/errors-core-DrydF46s.cjs"),require("../locales/runtime.cjs"),require("../locales/en.cjs"),require("../chunks/ip-validation-BZqPamPC.cjs"),require("../chunks/security-aXZVI7qW.cjs"),exports.VldBase=e.VldBase,exports.VldBrand=e.VldBrand,exports.VldCatch=e.VldCatch,exports.VldDefault=e.VldDefault,exports.VldExactOptional=e.VldExactOptional,exports.VldNullable=e.VldNullable,exports.VldNullish=e.VldNullish,exports.VldOptional=e.VldOptional,exports.VldPipe=e.VldPipe,exports.VldPreprocess=e.VldPreprocess,exports.VldReadonly=e.VldReadonly,exports.VldRefine=e.VldRefine,exports.VldSuperRefine=e.VldSuperRefine,exports.VldTransform=e.VldTransform,exports.VldString=r.VldString,exports.VldNumber=s.VldNumber,exports.VldBoolean=l.VldBoolean,exports.VldDate=t.VldDate,exports.VldStringBool=o.VldStringBool,exports.VldArray=i.VldArray,exports.VldObject=d.VldObject,exports.VldUnion=p.VldUnion,exports.VldIntersection=u.VldIntersection,exports.VldLiteral=n.VldLiteral,exports.VldEnum=V.VldEnum,exports.VldTuple=x.VldTuple,exports.VldRecord=c.VldRecord,exports.VldSet=a.VldSet,exports.VldMap=j.VldMap,exports.VldBigInt=m.VldBigInt,exports.VldSymbol=q.VldSymbol,exports.VldAny=v.VldAny,exports.VldUnknown=b.VldUnknown,exports.VldVoid=f.VldVoid,exports.VldNever=g.VldNever,exports.VldNull=h.VldNull,exports.VldUndefined=y.VldUndefined,exports.VldNan=N.VldNan,exports.VldLazy=B.VldLazy,exports.VldDiscriminatedUnion=S.VldDiscriminatedUnion,exports.VldXor=U.VldXor,exports.VldJson=k.VldJson,exports.VldTemplateLiteral=L.VldTemplateLiteral,exports.templateLiteral=L.templateLiteral,exports.VldCustom=R.VldCustom,exports.custom=R.custom,exports.VldFile=D.VldFile,exports.file=D.file,exports.VldFunction=F.VldFunction,exports.functionValidator=F.functionValidator,exports.VldPromise=O.VldPromise,exports.promise=O.promise,exports.base64=P.base64,exports.base64url=P.base64url,exports.cidrv4=P.cidrv4,exports.cidrv6=P.cidrv6,exports.cuid=P.cuid,exports.cuid2=P.cuid2,exports.e164=P.e164,exports.email=P.email,exports.emoji=P.emoji,exports.guid=P.guid,exports.hash=P.hash,exports.hex=P.hex,exports.hostname=P.hostname,exports.httpUrl=P.httpUrl,exports.ipv4=P.ipv4,exports.ipv6=P.ipv6,exports.iso=P.iso,exports.jwt=P.jwt,exports.ksuid=P.ksuid,exports.mac=P.mac,exports.nanoid=P.nanoid,exports.regexes=P.regexes,exports.stringFormat=P.stringFormat,exports.ulid=P.ulid,exports.url=P.url,exports.uuid=P.uuid,exports.uuidv4=P.uuidv4,exports.uuidv6=P.uuidv6,exports.uuidv7=P.uuidv7,exports.xid=P.xid;
1
+ "use strict";var e=require("./base.cjs"),r=require("./string.cjs"),s=require("./number.cjs"),l=require("./boolean.cjs"),t=require("./date.cjs"),o=require("./string-bool.cjs"),i=require("./array.cjs"),d=require("./object.cjs"),p=require("./union.cjs"),u=require("./intersection.cjs"),n=require("./literal.cjs"),V=require("./enum.cjs"),x=require("./tuple.cjs"),c=require("./record.cjs"),a=require("./set.cjs"),j=require("./map.cjs"),m=require("./bigint.cjs"),q=require("./symbol.cjs"),v=require("./any.cjs"),b=require("./unknown.cjs"),f=require("./void.cjs"),g=require("./never.cjs"),h=require("./null.cjs"),y=require("./undefined.cjs"),N=require("./nan.cjs"),B=require("./lazy.cjs"),S=require("./discriminated-union.cjs"),U=require("./xor.cjs"),k=require("./json.cjs"),L=require("./template-literal.cjs"),R=require("./custom.cjs"),D=require("./file.cjs"),F=require("./function.cjs"),O=require("./promise.cjs"),P=require("./string-formats.cjs");require("../registry.cjs"),require("../chunks/errors-core-C0mA6tfa.cjs"),require("../locales/runtime.cjs"),require("../locales/en.cjs"),require("../chunks/ip-validation-BZqPamPC.cjs"),require("../chunks/security-aXZVI7qW.cjs"),exports.VldBase=e.VldBase,exports.VldBrand=e.VldBrand,exports.VldCatch=e.VldCatch,exports.VldDefault=e.VldDefault,exports.VldExactOptional=e.VldExactOptional,exports.VldNullable=e.VldNullable,exports.VldNullish=e.VldNullish,exports.VldOptional=e.VldOptional,exports.VldPipe=e.VldPipe,exports.VldPreprocess=e.VldPreprocess,exports.VldReadonly=e.VldReadonly,exports.VldRefine=e.VldRefine,exports.VldSuperRefine=e.VldSuperRefine,exports.VldTransform=e.VldTransform,exports.VldString=r.VldString,exports.VldNumber=s.VldNumber,exports.VldBoolean=l.VldBoolean,exports.VldDate=t.VldDate,exports.VldStringBool=o.VldStringBool,exports.VldArray=i.VldArray,exports.VldObject=d.VldObject,exports.VldUnion=p.VldUnion,exports.VldIntersection=u.VldIntersection,exports.VldLiteral=n.VldLiteral,exports.VldEnum=V.VldEnum,exports.VldTuple=x.VldTuple,exports.VldRecord=c.VldRecord,exports.VldSet=a.VldSet,exports.VldMap=j.VldMap,exports.VldBigInt=m.VldBigInt,exports.VldSymbol=q.VldSymbol,exports.VldAny=v.VldAny,exports.VldUnknown=b.VldUnknown,exports.VldVoid=f.VldVoid,exports.VldNever=g.VldNever,exports.VldNull=h.VldNull,exports.VldUndefined=y.VldUndefined,exports.VldNan=N.VldNan,exports.VldLazy=B.VldLazy,exports.VldDiscriminatedUnion=S.VldDiscriminatedUnion,exports.VldXor=U.VldXor,exports.VldJson=k.VldJson,exports.VldTemplateLiteral=L.VldTemplateLiteral,exports.templateLiteral=L.templateLiteral,exports.VldCustom=R.VldCustom,exports.custom=R.custom,exports.VldFile=D.VldFile,exports.file=D.file,exports.VldFunction=F.VldFunction,exports.functionValidator=F.functionValidator,exports.VldPromise=O.VldPromise,exports.promise=O.promise,exports.base64=P.base64,exports.base64url=P.base64url,exports.cidrv4=P.cidrv4,exports.cidrv6=P.cidrv6,exports.cuid=P.cuid,exports.cuid2=P.cuid2,exports.e164=P.e164,exports.email=P.email,exports.emoji=P.emoji,exports.guid=P.guid,exports.hash=P.hash,exports.hex=P.hex,exports.hostname=P.hostname,exports.httpUrl=P.httpUrl,exports.ipv4=P.ipv4,exports.ipv6=P.ipv6,exports.iso=P.iso,exports.jwt=P.jwt,exports.ksuid=P.ksuid,exports.mac=P.mac,exports.nanoid=P.nanoid,exports.regexes=P.regexes,exports.stringFormat=P.stringFormat,exports.ulid=P.ulid,exports.url=P.url,exports.uuid=P.uuid,exports.uuidv4=P.uuidv4,exports.uuidv6=P.uuidv6,exports.uuidv7=P.uuidv7,exports.xid=P.xid;
@@ -1 +1 @@
1
- "use strict";var e=require("./base.cjs"),r=require("../chunks/security-aXZVI7qW.cjs"),t=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-DrydF46s.cjs");function c(e){return null!==e&&"object"==typeof e&&e.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){const s={...e},n=Object.keys(t);for(let i=0;i<n.length;i++){const a=n[i];if(r.isDangerousKey(a))continue;if(!Object.prototype.hasOwnProperty.call(t,a))continue;const u=t[a],l=e[a];c(u)&&c(l)?s[a]=o(l,u):s[a]=u}return s}require("../registry.cjs"),require("../locales/en.cjs");class VldIntersection extends e.VldBase{constructor(r,t){super(e.VLD_VALIDATOR_TYPES.INTERSECTION),this.validatorA=r,this.validatorB=t}static create(e,r){return new VldIntersection(e,r)}parse(e){try{const r=this.validatorA.parse(e),t=this.validatorB.parse(e),s=c(r),n=c(t);if(s&&n)return o(r,t);if(!s&&!n){if(r===t)return r;throw new Error("Values must be identical for intersection of primitive types")}throw new Error("Cannot create intersection of object and primitive types. Both validators must produce the same type category.")}catch(e){throw new Error(t.getMessages().intersectionError(e.message))}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(r=e.message,new s.VldError([{code:"invalid_type",path:[],message:r}]))}}var r}}exports.VldIntersection=VldIntersection;
1
+ "use strict";var e=require("./base.cjs"),r=require("../chunks/security-aXZVI7qW.cjs"),t=require("../locales/runtime.cjs"),s=require("../chunks/errors-core-C0mA6tfa.cjs");function c(e){return null!==e&&"object"==typeof e&&e.constructor===Object&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){const s={...e},n=Object.keys(t);for(let i=0;i<n.length;i++){const a=n[i];if(r.isDangerousKey(a))continue;if(!Object.prototype.hasOwnProperty.call(t,a))continue;const u=t[a],l=e[a];c(u)&&c(l)?s[a]=o(l,u):s[a]=u}return s}require("../registry.cjs"),require("../locales/en.cjs");class VldIntersection extends e.VldBase{constructor(r,t){super(e.VLD_VALIDATOR_TYPES.INTERSECTION),this.validatorA=r,this.validatorB=t}static create(e,r){return new VldIntersection(e,r)}parse(e){try{const r=this.validatorA.parse(e),t=this.validatorB.parse(e),s=c(r),n=c(t);if(s&&n)return o(r,t);if(!s&&!n){if(r===t)return r;throw new Error("Values must be identical for intersection of primitive types")}throw new Error("Cannot create intersection of object and primitive types. Both validators must produce the same type category.")}catch(e){throw new Error(t.getMessages().intersectionError(e.message))}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:(r=e.message,new s.VldError([{code:"invalid_type",path:[],message:r}]))}}var r}}exports.VldIntersection=VldIntersection;