@maroonedog/luq 0.1.0-alpha
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.
- package/LICENSE +9 -0
- package/README.md +879 -0
- package/dist/constants.d.ts +27 -0
- package/dist/core/async.experimental/async-context.d.ts +60 -0
- package/dist/core/builder/array-batch-optimizer.d.ts +66 -0
- package/dist/core/builder/context/field-context.d.ts +31 -0
- package/dist/core/builder/context/field-type-detector.d.ts +19 -0
- package/dist/core/builder/core/builder.d.ts +10 -0
- package/dist/core/builder/core/field-builder.d.ts +13 -0
- package/dist/core/builder/core/index.d.ts +17 -0
- package/dist/core/builder/index.d.ts +24 -0
- package/dist/core/builder/nested-array-processor.d.ts +52 -0
- package/dist/core/builder/plugins/composable-conditional-plugin.d.ts +32 -0
- package/dist/core/builder/plugins/composable-directly-plugin.d.ts +32 -0
- package/dist/core/builder/plugins/composable-plugin.d.ts +242 -0
- package/dist/core/builder/plugins/plugin-creator.d.ts +38 -0
- package/dist/core/builder/plugins/plugin-interfaces.d.ts +343 -0
- package/dist/core/builder/plugins/plugin-types.d.ts +441 -0
- package/dist/core/builder/raw-validator.d.ts +22 -0
- package/dist/core/builder/types/field-options.d.ts +46 -0
- package/dist/core/builder/types/types.d.ts +318 -0
- package/dist/core/builder/ultra-fast-validator.d.ts +30 -0
- package/dist/core/builder/validator-factory.d.ts +29 -0
- package/dist/core/global-config.d.ts +27 -0
- package/dist/core/index.d.ts +36 -0
- package/dist/core/optimization/array-batch-validator.d.ts +68 -0
- package/dist/core/optimization/core/field-utils.d.ts +103 -0
- package/dist/core/optimization/core/strategy-factory.d.ts +84 -0
- package/dist/core/optimization/core/validation-engine.d.ts +107 -0
- package/dist/core/optimization/execution-strategy-selector.d.ts +23 -0
- package/dist/core/optimization/unified-validator.d.ts +45 -0
- package/dist/core/plugin/__tests__/test-utils.d.ts +1 -0
- package/dist/core/plugin/arrayContains.d.ts +37 -0
- package/dist/core/plugin/arrayIncludes.d.ts +42 -0
- package/dist/core/plugin/arrayMaxLength.d.ts +43 -0
- package/dist/core/plugin/arrayMinLength.d.ts +43 -0
- package/dist/core/plugin/arrayUnique.d.ts +41 -0
- package/dist/core/plugin/booleanFalsy.d.ts +41 -0
- package/dist/core/plugin/booleanTruthy.d.ts +38 -0
- package/dist/core/plugin/compareField.d.ts +58 -0
- package/dist/core/plugin/conditionalSchema.d.ts +24 -0
- package/dist/core/plugin/custom.d.ts +60 -0
- package/dist/core/plugin/fromContext.d.ts +150 -0
- package/dist/core/plugin/index.d.ts +71 -0
- package/dist/core/plugin/jsonSchema/dsl-converter.d.ts +22 -0
- package/dist/core/plugin/jsonSchema/error-generation.d.ts +14 -0
- package/dist/core/plugin/jsonSchema/format-validators.d.ts +20 -0
- package/dist/core/plugin/jsonSchema/index.d.ts +11 -0
- package/dist/core/plugin/jsonSchema/plugin.d.ts +35 -0
- package/dist/core/plugin/jsonSchema/ref-resolver.d.ts +14 -0
- package/dist/core/plugin/jsonSchema/types.d.ts +69 -0
- package/dist/core/plugin/jsonSchema/validation-core.d.ts +29 -0
- package/dist/core/plugin/jsonSchemaFullFeature.d.ts +31 -0
- package/dist/core/plugin/literal.d.ts +40 -0
- package/dist/core/plugin/message-factories.d.ts +9 -0
- package/dist/core/plugin/nullable.d.ts +34 -0
- package/dist/core/plugin/numberFinite.d.ts +41 -0
- package/dist/core/plugin/numberInteger.d.ts +41 -0
- package/dist/core/plugin/numberMax.d.ts +49 -0
- package/dist/core/plugin/numberMin.d.ts +49 -0
- package/dist/core/plugin/numberMultipleOf.d.ts +42 -0
- package/dist/core/plugin/numberNegative.d.ts +41 -0
- package/dist/core/plugin/numberPositive.d.ts +41 -0
- package/dist/core/plugin/numberRange.d.ts +48 -0
- package/dist/core/plugin/object.d.ts +43 -0
- package/dist/core/plugin/objectAdditionalProperties.d.ts +51 -0
- package/dist/core/plugin/objectDependentRequired.d.ts +42 -0
- package/dist/core/plugin/objectDependentSchemas.d.ts +40 -0
- package/dist/core/plugin/objectMaxProperties.d.ts +42 -0
- package/dist/core/plugin/objectMinProperties.d.ts +42 -0
- package/dist/core/plugin/objectPatternProperties.d.ts +46 -0
- package/dist/core/plugin/objectPropertyNames.d.ts +36 -0
- package/dist/core/plugin/objectRecursively.d.ts +81 -0
- package/dist/core/plugin/oneOf.d.ts +44 -0
- package/dist/core/plugin/optional.d.ts +35 -0
- package/dist/core/plugin/optionalIf.d.ts +42 -0
- package/dist/core/plugin/orFail.d.ts +132 -0
- package/dist/core/plugin/readOnlyWriteOnly.d.ts +48 -0
- package/dist/core/plugin/required.d.ts +45 -0
- package/dist/core/plugin/requiredIf.d.ts +66 -0
- package/dist/core/plugin/shared-constants.d.ts +45 -0
- package/dist/core/plugin/shared.d.ts +3 -0
- package/dist/core/plugin/skip.d.ts +57 -0
- package/dist/core/plugin/stitch-typed.d.ts +15 -0
- package/dist/core/plugin/stitch.d.ts +1 -0
- package/dist/core/plugin/stitchSimple.d.ts +4 -0
- package/dist/core/plugin/stringAlphanumeric.d.ts +42 -0
- package/dist/core/plugin/stringBase64.d.ts +119 -0
- package/dist/core/plugin/stringContentEncoding.d.ts +43 -0
- package/dist/core/plugin/stringContentMediaType.d.ts +47 -0
- package/dist/core/plugin/stringDate.d.ts +48 -0
- package/dist/core/plugin/stringDatetime.d.ts +108 -0
- package/dist/core/plugin/stringDuration.d.ts +41 -0
- package/dist/core/plugin/stringEmail.d.ts +81 -0
- package/dist/core/plugin/stringEndsWith.d.ts +42 -0
- package/dist/core/plugin/stringExactLength.d.ts +46 -0
- package/dist/core/plugin/stringHostname.d.ts +104 -0
- package/dist/core/plugin/stringIpv4.d.ts +85 -0
- package/dist/core/plugin/stringIpv6.d.ts +104 -0
- package/dist/core/plugin/stringIri.d.ts +117 -0
- package/dist/core/plugin/stringIriReference.d.ts +43 -0
- package/dist/core/plugin/stringJsonPointer.d.ts +107 -0
- package/dist/core/plugin/stringMax.d.ts +43 -0
- package/dist/core/plugin/stringMin.d.ts +43 -0
- package/dist/core/plugin/stringPattern.d.ts +40 -0
- package/dist/core/plugin/stringRelativeJsonPointer.d.ts +42 -0
- package/dist/core/plugin/stringStartsWith.d.ts +42 -0
- package/dist/core/plugin/stringTime.d.ts +39 -0
- package/dist/core/plugin/stringUriTemplate.d.ts +43 -0
- package/dist/core/plugin/stringUrl.d.ts +97 -0
- package/dist/core/plugin/testUtils.d.ts +15 -0
- package/dist/core/plugin/transform-type-restrictions.d.ts +61 -0
- package/dist/core/plugin/transform.d.ts +35 -0
- package/dist/core/plugin/tupleBuilder.d.ts +66 -0
- package/dist/core/plugin/types.d.ts +143 -0
- package/dist/core/plugin/unionGuard.d.ts +50 -0
- package/dist/core/plugin/utils/field-accessor-optimized.d.ts +50 -0
- package/dist/core/plugin/utils/field-accessor.d.ts +107 -0
- package/dist/core/plugin/uuid.d.ts +95 -0
- package/dist/core/plugin/validateIf.d.ts +57 -0
- package/dist/core/registry/plugin-registry.d.ts +116 -0
- package/dist/core/registry.d.ts +6 -0
- package/dist/core/transform/index.d.ts +1 -0
- package/dist/core/transform/string/defaultValue.d.ts +6 -0
- package/dist/core/transform/string/index.d.ts +3 -0
- package/dist/core/transform/string/replace.d.ts +14 -0
- package/dist/core/transform/string/sanitize.d.ts +6 -0
- package/dist/core/utils/type-guards.d.ts +68 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +7 -0
- package/dist/plugins/arrayContains.d.ts +37 -0
- package/dist/plugins/arrayContains.js +1 -0
- package/dist/plugins/arrayContains.mjs +1 -0
- package/dist/plugins/arrayIncludes.d.ts +42 -0
- package/dist/plugins/arrayIncludes.js +1 -0
- package/dist/plugins/arrayIncludes.mjs +1 -0
- package/dist/plugins/arrayMaxLength.d.ts +43 -0
- package/dist/plugins/arrayMaxLength.js +1 -0
- package/dist/plugins/arrayMaxLength.mjs +1 -0
- package/dist/plugins/arrayMinLength.d.ts +43 -0
- package/dist/plugins/arrayMinLength.js +1 -0
- package/dist/plugins/arrayMinLength.mjs +1 -0
- package/dist/plugins/arrayUnique.d.ts +41 -0
- package/dist/plugins/arrayUnique.js +1 -0
- package/dist/plugins/arrayUnique.mjs +1 -0
- package/dist/plugins/booleanFalsy.d.ts +41 -0
- package/dist/plugins/booleanFalsy.js +1 -0
- package/dist/plugins/booleanFalsy.mjs +1 -0
- package/dist/plugins/booleanTruthy.d.ts +38 -0
- package/dist/plugins/booleanTruthy.js +1 -0
- package/dist/plugins/booleanTruthy.mjs +1 -0
- package/dist/plugins/compareField.d.ts +58 -0
- package/dist/plugins/compareField.js +1 -0
- package/dist/plugins/compareField.mjs +1 -0
- package/dist/plugins/custom.d.ts +60 -0
- package/dist/plugins/custom.js +1 -0
- package/dist/plugins/custom.mjs +1 -0
- package/dist/plugins/jsonSchema.d.ts +11 -0
- package/dist/plugins/jsonSchema.js +1 -0
- package/dist/plugins/jsonSchema.mjs +1 -0
- package/dist/plugins/jsonSchemaFullFeature.d.ts +31 -0
- package/dist/plugins/jsonSchemaFullFeature.js +1 -0
- package/dist/plugins/jsonSchemaFullFeature.mjs +1 -0
- package/dist/plugins/literal.d.ts +40 -0
- package/dist/plugins/literal.js +1 -0
- package/dist/plugins/literal.mjs +1 -0
- package/dist/plugins/nullable.d.ts +34 -0
- package/dist/plugins/nullable.js +1 -0
- package/dist/plugins/nullable.mjs +1 -0
- package/dist/plugins/numberInteger.d.ts +41 -0
- package/dist/plugins/numberInteger.js +1 -0
- package/dist/plugins/numberInteger.mjs +1 -0
- package/dist/plugins/numberMax.d.ts +49 -0
- package/dist/plugins/numberMax.js +1 -0
- package/dist/plugins/numberMax.mjs +1 -0
- package/dist/plugins/numberMin.d.ts +49 -0
- package/dist/plugins/numberMin.js +1 -0
- package/dist/plugins/numberMin.mjs +1 -0
- package/dist/plugins/numberMultipleOf.d.ts +42 -0
- package/dist/plugins/numberMultipleOf.js +1 -0
- package/dist/plugins/numberMultipleOf.mjs +1 -0
- package/dist/plugins/numberNegative.d.ts +41 -0
- package/dist/plugins/numberNegative.js +1 -0
- package/dist/plugins/numberNegative.mjs +1 -0
- package/dist/plugins/numberPositive.d.ts +41 -0
- package/dist/plugins/numberPositive.js +1 -0
- package/dist/plugins/numberPositive.mjs +1 -0
- package/dist/plugins/object.d.ts +43 -0
- package/dist/plugins/object.js +1 -0
- package/dist/plugins/object.mjs +1 -0
- package/dist/plugins/objectAdditionalProperties.d.ts +51 -0
- package/dist/plugins/objectAdditionalProperties.js +1 -0
- package/dist/plugins/objectAdditionalProperties.mjs +1 -0
- package/dist/plugins/objectDependentRequired.d.ts +42 -0
- package/dist/plugins/objectDependentRequired.js +1 -0
- package/dist/plugins/objectDependentRequired.mjs +1 -0
- package/dist/plugins/objectDependentSchemas.d.ts +40 -0
- package/dist/plugins/objectDependentSchemas.js +1 -0
- package/dist/plugins/objectDependentSchemas.mjs +1 -0
- package/dist/plugins/objectMaxProperties.d.ts +42 -0
- package/dist/plugins/objectMaxProperties.js +1 -0
- package/dist/plugins/objectMaxProperties.mjs +1 -0
- package/dist/plugins/objectMinProperties.d.ts +42 -0
- package/dist/plugins/objectMinProperties.js +1 -0
- package/dist/plugins/objectMinProperties.mjs +1 -0
- package/dist/plugins/objectPatternProperties.d.ts +46 -0
- package/dist/plugins/objectPatternProperties.js +1 -0
- package/dist/plugins/objectPatternProperties.mjs +1 -0
- package/dist/plugins/objectPropertyNames.d.ts +36 -0
- package/dist/plugins/objectPropertyNames.js +1 -0
- package/dist/plugins/objectPropertyNames.mjs +1 -0
- package/dist/plugins/oneOf.d.ts +44 -0
- package/dist/plugins/oneOf.js +1 -0
- package/dist/plugins/oneOf.mjs +1 -0
- package/dist/plugins/optional.d.ts +35 -0
- package/dist/plugins/optional.js +1 -0
- package/dist/plugins/optional.mjs +1 -0
- package/dist/plugins/readOnlyWriteOnly.d.ts +48 -0
- package/dist/plugins/readOnlyWriteOnly.js +1 -0
- package/dist/plugins/readOnlyWriteOnly.mjs +1 -0
- package/dist/plugins/required.d.ts +45 -0
- package/dist/plugins/required.js +1 -0
- package/dist/plugins/required.mjs +1 -0
- package/dist/plugins/requiredIf.d.ts +66 -0
- package/dist/plugins/requiredIf.js +1 -0
- package/dist/plugins/requiredIf.mjs +1 -0
- package/dist/plugins/skip.d.ts +57 -0
- package/dist/plugins/skip.js +1 -0
- package/dist/plugins/skip.mjs +1 -0
- package/dist/plugins/stringBase64.d.ts +119 -0
- package/dist/plugins/stringBase64.js +1 -0
- package/dist/plugins/stringBase64.mjs +1 -0
- package/dist/plugins/stringContentEncoding.d.ts +43 -0
- package/dist/plugins/stringContentEncoding.js +1 -0
- package/dist/plugins/stringContentEncoding.mjs +1 -0
- package/dist/plugins/stringContentMediaType.d.ts +47 -0
- package/dist/plugins/stringContentMediaType.js +1 -0
- package/dist/plugins/stringContentMediaType.mjs +1 -0
- package/dist/plugins/stringDate.d.ts +48 -0
- package/dist/plugins/stringDate.js +1 -0
- package/dist/plugins/stringDate.mjs +1 -0
- package/dist/plugins/stringDatetime.d.ts +108 -0
- package/dist/plugins/stringDatetime.js +1 -0
- package/dist/plugins/stringDatetime.mjs +1 -0
- package/dist/plugins/stringDuration.d.ts +41 -0
- package/dist/plugins/stringDuration.js +1 -0
- package/dist/plugins/stringDuration.mjs +1 -0
- package/dist/plugins/stringEmail.d.ts +81 -0
- package/dist/plugins/stringEmail.js +1 -0
- package/dist/plugins/stringEmail.mjs +1 -0
- package/dist/plugins/stringHostname.d.ts +104 -0
- package/dist/plugins/stringHostname.js +1 -0
- package/dist/plugins/stringHostname.mjs +1 -0
- package/dist/plugins/stringIpv4.d.ts +85 -0
- package/dist/plugins/stringIpv4.js +1 -0
- package/dist/plugins/stringIpv4.mjs +1 -0
- package/dist/plugins/stringIpv6.d.ts +104 -0
- package/dist/plugins/stringIpv6.js +1 -0
- package/dist/plugins/stringIpv6.mjs +1 -0
- package/dist/plugins/stringIri.d.ts +117 -0
- package/dist/plugins/stringIri.js +1 -0
- package/dist/plugins/stringIri.mjs +1 -0
- package/dist/plugins/stringIriReference.d.ts +43 -0
- package/dist/plugins/stringIriReference.js +1 -0
- package/dist/plugins/stringIriReference.mjs +1 -0
- package/dist/plugins/stringJsonPointer.d.ts +107 -0
- package/dist/plugins/stringJsonPointer.js +1 -0
- package/dist/plugins/stringJsonPointer.mjs +1 -0
- package/dist/plugins/stringMax.d.ts +43 -0
- package/dist/plugins/stringMax.js +1 -0
- package/dist/plugins/stringMax.mjs +1 -0
- package/dist/plugins/stringMin.d.ts +43 -0
- package/dist/plugins/stringMin.js +1 -0
- package/dist/plugins/stringMin.mjs +1 -0
- package/dist/plugins/stringPattern.d.ts +40 -0
- package/dist/plugins/stringPattern.js +1 -0
- package/dist/plugins/stringPattern.mjs +1 -0
- package/dist/plugins/stringRelativeJsonPointer.d.ts +42 -0
- package/dist/plugins/stringRelativeJsonPointer.js +1 -0
- package/dist/plugins/stringRelativeJsonPointer.mjs +1 -0
- package/dist/plugins/stringTime.d.ts +39 -0
- package/dist/plugins/stringTime.js +1 -0
- package/dist/plugins/stringTime.mjs +1 -0
- package/dist/plugins/stringUriTemplate.d.ts +43 -0
- package/dist/plugins/stringUriTemplate.js +1 -0
- package/dist/plugins/stringUriTemplate.mjs +1 -0
- package/dist/plugins/stringUrl.d.ts +97 -0
- package/dist/plugins/stringUrl.js +1 -0
- package/dist/plugins/stringUrl.mjs +1 -0
- package/dist/plugins/transform.d.ts +35 -0
- package/dist/plugins/transform.js +1 -0
- package/dist/plugins/transform.mjs +1 -0
- package/dist/plugins/tupleBuilder.d.ts +66 -0
- package/dist/plugins/tupleBuilder.js +1 -0
- package/dist/plugins/tupleBuilder.mjs +1 -0
- package/dist/plugins/uuid.d.ts +95 -0
- package/dist/plugins/uuid.js +1 -0
- package/dist/plugins/uuid.mjs +1 -0
- package/dist/plugins/validateIf.d.ts +57 -0
- package/dist/plugins/validateIf.js +1 -0
- package/dist/plugins/validateIf.mjs +1 -0
- package/dist/types/array-type-analysis.d.ts +115 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/indexed-result.d.ts +44 -0
- package/dist/types/result.d.ts +159 -0
- package/dist/types/stitch-types.d.ts +118 -0
- package/dist/types/util.d.ts +19 -0
- package/dist/types/valitator.d.ts +10 -0
- package/package.json +353 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=(e,t,n)=>{if(!e.startsWith("#"))throw new Error(`External $ref not supported: ${e}`);let r=e.slice(1).split("/"),i=t;for(let o of r)if(o&&(o==="definitions"||o==="$defs"?i=i.definitions||i.$defs||{}:i=i[o],i===void 0))throw new Error(`Cannot resolve $ref: ${e}`);return i},m=(e,t,n)=>{if(!e.$ref)return e;if(!t)throw new Error("Root schema required for $ref resolution");return I(e.$ref,t,n)},a=(e,t,n=new Set)=>{if(e.$ref){if(n.has(e.$ref))throw new Error(`Circular reference detected: ${e.$ref}`);n.add(e.$ref);let i=I(e.$ref,t);return a(i,t,n)}let r={...e};if(e.properties){r.properties={};for(let[i,o]of Object.entries(e.properties))typeof o=="object"?r.properties[i]=a(o,t,new Set(n)):r.properties[i]=o}return e.items&&(Array.isArray(e.items)?r.items=e.items.map(i=>typeof i=="boolean"?i:a(i,t,new Set(n))):typeof e.items=="object"?r.items=a(e.items,t,new Set(n)):r.items=e.items),e.allOf&&(r.allOf=e.allOf.map(i=>typeof i=="boolean"?i:a(i,t,new Set(n)))),e.anyOf&&(r.anyOf=e.anyOf.map(i=>typeof i=="boolean"?i:a(i,t,new Set(n)))),e.oneOf&&(r.oneOf=e.oneOf.map(i=>typeof i=="boolean"?i:a(i,t,new Set(n)))),e.not&&typeof e.not=="object"&&(r.not=a(e.not,t,new Set(n))),e.if&&typeof e.if=="object"&&(r.if=a(e.if,t,new Set(n))),e.then&&typeof e.then=="object"&&(r.then=a(e.then,t,new Set(n))),e.else&&typeof e.else=="object"&&(r.else=a(e.else,t,new Set(n))),r};var _=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var z=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Z=/^\d{4}-\d{2}-\d{2}$/,U=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,W=/^\d{2}:\d{2}:\d{2}(\.\d{3})?$/,F=/^P(?:(\d+Y)?(\d+M)?(\d+D)?)(?:T(\d+H)?(\d+M)?(\d+(?:\.\d+)?S)?)?$/,X=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/,H=/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,Y=/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,G=/^(\/([^\/~]|~[01])*)*$/,Q=/^[0-9]+#?$/,K=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,v=/^([a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*|\/[^\s]*|[^\s:\/]+)$/,h=/^[^{}]*(\{[^{}]+\}[^{}]*)*$/;var b={email:e=>typeof e!="string"||e.includes("..")?!1:_.test(e),url:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return!1}},uri:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{let t=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);if(!t)return!1;let[,n,r]=t;return r.startsWith("//")?r.length>2&&r.substring(2).length>0:r.length>0}},"uri-reference":e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return e.includes(":")&&!e.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:/)?!1:e.startsWith("/")||!e.includes(":")}},uuid:e=>typeof e!="string"?!1:z.test(e),date:e=>{if(typeof e!="string"||!Z.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())&&t.toISOString().startsWith(e)},"date-time":e=>{if(typeof e!="string"||!U.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())},time:e=>{if(typeof e!="string"||!W.test(e))return!1;let t=e.split(":");if(t.length<3)return!1;let n=parseInt(t[0],10),r=parseInt(t[1],10),i=parseFloat(t[2]);return n>=0&&n<=23&&r>=0&&r<=59&&i>=0&&i<60},duration:e=>typeof e!="string"?!1:F.test(e),ipv4:e=>{if(typeof e!="string"||!X.test(e))return!1;let t=e.split(".");return t.length===4&&t.every(n=>{let r=parseInt(n,10);return r>=0&&r<=255})},ipv6:e=>typeof e!="string"?!1:H.test(e)||e.includes("::"),hostname:e=>typeof e!="string"||e.length>253?!1:Y.test(e),"json-pointer":e=>typeof e!="string"?!1:G.test(e),"relative-json-pointer":e=>typeof e!="string"?!1:Q.test(e),iri:e=>typeof e!="string"?!1:K.test(e),"iri-reference":e=>typeof e!="string"?!1:v.test(e),"uri-template":e=>typeof e!="string"?!1:h.test(e),regex:e=>{if(typeof e!="string")return!1;try{return new RegExp(e),!0}catch{return!1}}},P=(e,t,n)=>{if(n&&n[t]){let i=n[t];if(typeof i=="function")return i(e)}let r=b[t];return r?r(e):!0},ee=()=>Object.keys(b),te=e=>e in b;var g=(e,t)=>{if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(typeof e!="object")return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e))return e.length!==t.length?!1:e.every((i,o)=>g(i,t[o]));let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>g(e[i],t[i]))},re=e=>{for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++)if(g(e[t],e[n]))return!0;return!1},E=(e,t)=>{switch(t){case"null":return e===null;case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";case"number":return typeof e=="number"&&!isNaN(e);case"integer":return typeof e=="number"&&Number.isInteger(e)&&!isNaN(e);case"array":return Array.isArray(e);case"object":return typeof e=="object"&&e!==null&&!Array.isArray(e);default:return!1}},$=(e,t)=>t.some(n=>E(e,n)),R=(e,t,n)=>!(t.minLength!==void 0&&e.length<t.minLength||t.maxLength!==void 0&&e.length>t.maxLength||t.pattern&&!new RegExp(t.pattern).test(e)||t.format&&!P(e,t.format,n)||t.contentEncoding&&t.contentEncoding==="base64"&&(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length>0&&e.length%4!==0)),j=(e,t)=>{if(t.minimum!==void 0&&e<t.minimum||t.maximum!==void 0&&e>t.maximum)return!1;if(t.exclusiveMinimum!==void 0){if(typeof t.exclusiveMinimum=="number"){if(e<=t.exclusiveMinimum)return!1}else if(t.exclusiveMinimum===!0&&t.minimum!==void 0&&e<=t.minimum)return!1}if(t.exclusiveMaximum!==void 0){if(typeof t.exclusiveMaximum=="number"){if(e>=t.exclusiveMaximum)return!1}else if(t.exclusiveMaximum===!0&&t.maximum!==void 0&&e>=t.maximum)return!1}if(t.multipleOf!==void 0){let n=e/t.multipleOf;if(!Number.isInteger(n))return!1}return!0},q=(e,t,n,r)=>{if(t.minItems!==void 0&&e.length<t.minItems||t.maxItems!==void 0&&e.length>t.maxItems||t.uniqueItems&&re(e))return!1;if(t.items){if(Array.isArray(t.items))for(let i=0;i<e.length;i++)if(i<t.items.length){if(typeof t.items[i]=="boolean"){if(!t.items[i])return!1}else if(!p(e[i],t.items[i],n,r))return!1}else{if(t.additionalItems===!1)return!1;if(t.additionalItems&&typeof t.additionalItems=="object"&&!p(e[i],t.additionalItems,n,r))return!1}else for(let i of e)if(typeof t.items=="boolean"){if(!t.items)return!1}else if(!p(i,t.items,n,r))return!1}if(t.contains!==void 0){if(typeof t.contains=="boolean"){if(!t.contains||e.length===0)return!1}else if(!e.some(o=>p(o,t.contains,n,r)))return!1}return!0},C=(e,t,n,r)=>{let i=Object.keys(e);if(t.minProperties!==void 0&&i.length<t.minProperties||t.maxProperties!==void 0&&i.length>t.maxProperties)return!1;if(t.required){for(let o of t.required)if(!(o in e))return!1}if(t.properties)for(let[o,f]of Object.entries(e)){let s=t.properties[o];if(s&&typeof s=="object"&&!p(f,s,n,r))return!1}if(t.patternProperties){for(let[o,f]of Object.entries(e))for(let[s,u]of Object.entries(t.patternProperties))if(new RegExp(s).test(o)&&typeof u=="object"&&!p(f,u,n,r))return!1}if(t.additionalProperties===!1){let o=new Set([...t.properties?Object.keys(t.properties):[],...i.filter(f=>t.patternProperties?Object.keys(t.patternProperties).some(s=>new RegExp(s).test(f)):!1)]);for(let f of i)if(!o.has(f))return!1}else if(t.additionalProperties&&typeof t.additionalProperties=="object"){let o=new Set(t.properties?Object.keys(t.properties):[]);for(let[f,s]of Object.entries(e))if(!o.has(f)&&!p(s,t.additionalProperties,n,r))return!1}if(t.propertyNames!==void 0){if(typeof t.propertyNames=="boolean"){if(!t.propertyNames&&i.length>0)return!1}else for(let o of i)if(!p(o,t.propertyNames,n,r))return!1}return!0},p=(e,t,n,r)=>{if(t.$ref&&r&&(t=m(t,r)),e===void 0)return!1;if(e===null){if(t.type==="null"||Array.isArray(t.type)&&t.type.includes("null"))return!0;if(!t.enum&&t.const===void 0)return!1}if(t.type){if(Array.isArray(t.type)){if(!$(e,t.type))return!1}else if(!E(e,t.type))return!1}if(t.const!==void 0)return g(e,t.const);if(t.enum)return t.enum.some(i=>g(e,i));if(typeof e=="string"){if(!R(e,t,n))return!1}else if(typeof e=="number"){if(!j(e,t))return!1}else if(Array.isArray(e)){if(!q(e,t,n,r))return!1}else if(typeof e=="object"&&e!==null&&!C(e,t,n,r))return!1;if(t.allOf)for(let i of t.allOf){if(typeof i=="boolean"){if(!i)return!1;continue}if(!p(e,i,n,r))return!1}if(t.anyOf&&!t.anyOf.some(o=>typeof o=="boolean"?o:p(e,o,n,r)))return!1;if(t.oneOf){let i=0;for(let o of t.oneOf){if(typeof o=="boolean"){o&&i++;continue}p(e,o,n,r)&&i++}if(i!==1)return!1}if(t.not){if(typeof t.not=="boolean"){if(t.not)return!1}else if(p(e,t.not,n,r))return!1}if(t.if){let i=typeof t.if=="boolean"?t.if:p(e,t.if,n,r);if(i&&t.then!==void 0)return typeof t.then=="boolean"?t.then:p(e,t.then,n,r);if(!i&&t.else!==void 0)return typeof t.else=="boolean"?t.else:p(e,t.else,n,r)}return!0};var y=(e,t,n,r,i="")=>{let o=[];if(typeof t=="boolean")return t===!1?(o.push({path:i,message:"Schema is false - value is always invalid",code:"FALSE_SCHEMA",value:e,constraint:!1}),o):[];if(t.$ref&&r&&(t=m(t,r)),p(e,t,n,r))return[];if(e==null)return t.type&&t.type!=="null"&&(!Array.isArray(t.type)||!t.type.includes("null"))&&o.push({path:i,message:`Expected ${Array.isArray(t.type)?t.type.join(" or "):t.type}, got ${e}`,code:"TYPE_MISMATCH",value:e,constraint:t.type}),o;if(t.type){let f=Array.isArray(t.type)?t.type:[t.type],s=ie(e);if(!f.some(u=>oe(e,u)))return o.push({path:i,message:`Expected ${f.join(" or ")}, got ${s}`,code:"TYPE_MISMATCH",value:e,constraint:t.type}),o}return t.const!==void 0&&!O(e,t.const)&&o.push({path:i,message:`Must be equal to ${JSON.stringify(t.const)}`,code:"CONST",value:e,constraint:t.const}),t.enum&&!t.enum.some(f=>O(e,f))&&o.push({path:i,message:`Must be one of: ${t.enum.map(f=>JSON.stringify(f)).join(", ")}`,code:"ENUM",value:e,constraint:t.enum}),typeof e=="string"?o.push(...fe(e,t,i,n)):typeof e=="number"?o.push(...se(e,t,i)):Array.isArray(e)?o.push(...ue(e,t,i,n,r)):typeof e=="object"&&e!==null&&o.push(...le(e,t,i,n,r)),t.allOf&&o.push(...pe(e,t.allOf,i,n,r)),t.anyOf&&o.push(...de(e,t.anyOf,i,n,r)),t.oneOf&&o.push(...ae(e,t.oneOf,i,n,r)),t.not&&o.push(...ye(e,t.not,i,n,r)),t.if&&o.push(...me(e,t,i,n,r)),o},ne=(e,t,n,r,i)=>{let o=y(e,t,r,i),f=n.startsWith("/")?n.substring(1).replace(/\//g,"."):n;return o.filter(s=>!!(s.path===f||s.path.startsWith(f+".")||s.path.startsWith(f+"[")))},ie=e=>e===null?"null":Array.isArray(e)?"array":typeof e,oe=(e,t)=>{switch(t){case"null":return e===null;case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";case"number":return typeof e=="number"&&!isNaN(e);case"integer":return typeof e=="number"&&Number.isInteger(e);case"array":return Array.isArray(e);case"object":return typeof e=="object"&&e!==null&&!Array.isArray(e);default:return!1}},O=(e,t)=>{if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(typeof e!="object")return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e))return e.length!==t.length?!1:e.every((i,o)=>O(i,t[o]));let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(i=>O(e[i],t[i]))},fe=(e,t,n,r)=>{let i=[];if(t.minLength!==void 0&&e.length<t.minLength&&i.push({path:n,message:`String length must be at least ${t.minLength}`,code:"MIN_LENGTH",value:e,constraint:t.minLength}),t.maxLength!==void 0&&e.length>t.maxLength&&i.push({path:n,message:`String length must be at most ${t.maxLength}`,code:"MAX_LENGTH",value:e,constraint:t.maxLength}),t.pattern&&!new RegExp(t.pattern).test(e)&&i.push({path:n,message:`String must match pattern: ${t.pattern}`,code:"PATTERN",value:e,constraint:t.pattern}),t.format){let o=!1;if(r&&r[t.format])o=r[t.format](e);else switch(t.format){case"email":o=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);break;case"uri":case"url":o=/^https?:\/\//.test(e);break;case"date":o=/^\d{4}-\d{2}-\d{2}$/.test(e);break;case"date-time":case"datetime":o=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(e);break;case"uuid":o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);break;default:o=!1}o||i.push({path:n,message:`String must be valid ${t.format}`,code:"FORMAT",value:e,constraint:t.format})}if(t.contentEncoding&&t.contentEncoding==="base64"&&(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length>0&&e.length%4!==0)&&i.push({path:n,message:`String must be valid ${t.contentEncoding} encoding`,code:"CONTENT_ENCODING",value:e,constraint:t.contentEncoding}),t.contentMediaType){let o=!0}return i},se=(e,t,n)=>{let r=[];if(t.minimum!==void 0&&e<t.minimum&&r.push({path:n,message:`Number must be at least ${t.minimum}`,code:"MINIMUM",value:e,constraint:t.minimum}),t.maximum!==void 0&&e>t.maximum&&r.push({path:n,message:`Number must be at most ${t.maximum}`,code:"MAXIMUM",value:e,constraint:t.maximum}),t.exclusiveMinimum!==void 0&&(typeof t.exclusiveMinimum=="number"&&e<=t.exclusiveMinimum?r.push({path:n,message:`Number must be greater than ${t.exclusiveMinimum}`,code:"EXCLUSIVE_MINIMUM",value:e,constraint:t.exclusiveMinimum}):typeof t.exclusiveMinimum=="boolean"&&t.exclusiveMinimum===!0&&t.minimum!==void 0&&e<=t.minimum&&r.push({path:n,message:`Number must be greater than ${t.minimum}`,code:"EXCLUSIVE_MINIMUM",value:e,constraint:t.minimum})),t.exclusiveMaximum!==void 0&&(typeof t.exclusiveMaximum=="number"&&e>=t.exclusiveMaximum?r.push({path:n,message:`Number must be less than ${t.exclusiveMaximum}`,code:"EXCLUSIVE_MAXIMUM",value:e,constraint:t.exclusiveMaximum}):typeof t.exclusiveMaximum=="boolean"&&t.exclusiveMaximum===!0&&t.maximum!==void 0&&e>=t.maximum&&r.push({path:n,message:`Number must be less than ${t.maximum}`,code:"EXCLUSIVE_MAXIMUM",value:e,constraint:t.maximum})),t.multipleOf!==void 0){let i=e/t.multipleOf;Number.isInteger(i)||r.push({path:n,message:`Number must be a multiple of ${t.multipleOf}`,code:"MULTIPLE_OF",value:e,constraint:t.multipleOf})}return r},ue=(e,t,n,r,i)=>{let o=[];return t.minItems!==void 0&&e.length<t.minItems&&o.push({path:n,message:`Array must have at least ${t.minItems} items`,code:"MIN_ITEMS",value:e,constraint:t.minItems}),t.maxItems!==void 0&&e.length>t.maxItems&&o.push({path:n,message:`Array must have at most ${t.maxItems} items`,code:"MAX_ITEMS",value:e,constraint:t.maxItems}),t.uniqueItems&&(s=>{for(let u=0;u<s.length;u++)for(let l=u+1;l<s.length;l++)if(JSON.stringify(s[u])===JSON.stringify(s[l]))return!0;return!1})(e)&&o.push({path:n,message:"Array must contain unique items",code:"UNIQUE_ITEMS",value:e,constraint:!0}),t.items&&(Array.isArray(t.items)?e.forEach((f,s)=>{let u=t.items;if(s<u.length){let l=u[s],d=y(f,l,r,i,n?`${n}[${s}]`:`[${s}]`);o.push(...d)}else if(t.additionalItems===!1)o.push({path:n?`${n}[${s}]`:`[${s}]`,message:"Additional items are not allowed",code:"ADDITIONAL_ITEMS",value:f,constraint:!1});else if(t.additionalItems&&typeof t.additionalItems=="object"){let l=y(f,t.additionalItems,r,i,n?`${n}[${s}]`:`items[${s}]`);o.push(...l)}}):e.forEach((f,s)=>{let u=y(f,t.items,r,i,n?`${n}[${s}]`:`items[${s}]`);o.push(...u)})),t.contains&&typeof t.contains=="object"&&(e.some(s=>p(s,t.contains,r,i))||o.push({path:n,message:"Array must contain at least one item matching the schema",code:"CONTAINS",value:e,constraint:t.contains})),o},le=(e,t,n,r,i)=>{let o=[],f=Object.keys(e);if(t.minProperties!==void 0&&f.length<t.minProperties&&o.push({path:n,message:`Object must have at least ${t.minProperties} properties`,code:"MIN_PROPERTIES",value:e,constraint:t.minProperties}),t.maxProperties!==void 0&&f.length>t.maxProperties&&o.push({path:n,message:`Object must have at most ${t.maxProperties} properties`,code:"MAX_PROPERTIES",value:e,constraint:t.maxProperties}),t.required)for(let s of t.required)s in e||o.push({path:n?`${n}.${s}`:s,message:`Missing required property: ${s}`,code:"REQUIRED",value:void 0,constraint:s});if(t.properties)for(let[s,u]of Object.entries(e)){let l=t.properties[s];if(l&&typeof l=="object"){let d=y(u,l,r,i,n?`${n}.${s}`:s);o.push(...d)}}if(t.patternProperties){for(let[s,u]of Object.entries(e))for(let[l,d]of Object.entries(t.patternProperties))if(new RegExp(l).test(s)&&typeof d=="object"){let A=y(u,d,r,i,n?`${n}.${s}`:s);o.push(...A)}}if(t.additionalProperties!==void 0){let s=new Set(t.properties?Object.keys(t.properties):[]),u=new Set;if(t.patternProperties)for(let l of Object.keys(e))for(let d of Object.keys(t.patternProperties))new RegExp(d).test(l)&&u.add(l);for(let l of Object.keys(e))if(!s.has(l)&&!u.has(l)){if(t.additionalProperties===!1)o.push({path:n?`${n}.${l}`:l,message:`Additional property '${l}' is not allowed`,code:"ADDITIONAL_PROPERTIES",value:e[l],constraint:!1});else if(typeof t.additionalProperties=="object"){let d=y(e[l],t.additionalProperties,r,i,n?`${n}.${l}`:l);o.push(...d)}}}if(t.propertyNames&&typeof t.propertyNames=="object")for(let s of Object.keys(e))p(s,t.propertyNames,r,i)||o.push({path:n?`${n}.${s}`:s,message:`Property name '${s}' does not match schema`,code:"PROPERTY_NAMES",value:s,constraint:t.propertyNames});return o},pe=(e,t,n,r,i)=>{let o=[],f=!1;for(let s of t){let u=y(e,s,r,i,n);u.length>0&&(f=!0,o.push(...u))}return f&&o.push({path:n,message:"Value does not satisfy all schemas",code:"ALL_OF",value:e,constraint:t}),o},de=(e,t,n,r,i)=>t.some(f=>p(e,f,r,i))?[]:[{path:n,message:"Value does not match any of the expected schemas",code:"ANY_OF",value:e,constraint:t}],ae=(e,t,n,r,i)=>{let o=t.filter(f=>p(e,f,r,i));return o.length===1?[]:o.length===0?[{path:n,message:"Value does not match any of the expected schemas",code:"ONE_OF",value:e,constraint:t}]:[{path:n,message:"Value matches more than one schema",code:"ONE_OF",value:e,constraint:t}]},ye=(e,t,n,r,i)=>p(e,t,r,i)?[{path:n,message:"Value must not match the schema",code:"NOT",value:e,constraint:t}]:[],me=(e,t,n,r,i)=>{if(!t.if)return[];let o=p(e,t.if,r,i);return o&&t.then?y(e,t.then,r,i,n):!o&&t.else?y(e,t.else,r,i,n):[]};var M=(e,t="",n)=>{let r=[],i=e.$ref&&n?m(e,n):e;if(t===""&&(i.oneOf||i.anyOf||i.allOf)){let o=w(i,{},""),f=i.type?x(Array.isArray(i.type)?i.type[0]:i.type):"string";return r.push({path:"",type:f,constraints:o}),r}if(i.type==="object"&&t===""){let o=Ne(i);Object.keys(o).length>0&&r.push({path:"",type:"object",constraints:o})}if(i.properties){for(let[o,f]of Object.entries(i.properties))if(typeof f=="object"){let s=t?`${t}.${o}`:o,u=T(o,f,s,i,n);r.push(...u)}}if(i.patternProperties){for(let[o,f]of Object.entries(i.patternProperties))if(typeof f=="object"){let s=t?`${t}.*`:"*",u=T(o,f,s,i,n);r.push(...u)}}return r},T=(e,t,n,r,i)=>{let o=[],f=t.$ref&&i?m(t,i):t,{type:s,nullable:u,multipleTypes:l}=ge(f),d=w(f,r,e),A={path:n,type:s,nullable:u,multipleTypes:l,constraints:d};if(o.push(A),(f.type==="object"||Array.isArray(f.type)&&f.type.includes("object"))&&f.properties){for(let[S,N]of Object.entries(f.properties))if(typeof N=="object"){let k=`${n}.${S}`,B=T(S,N,k,f,i);o.push(...B)}}if((f.type==="array"||Array.isArray(f.type)&&f.type.includes("array"))&&f.items&&!Array.isArray(f.items)&&typeof f.items=="object"){let S=`${n}[*]`,N=T(`${e}[*]`,f.items,S,f,i);o.push(...N)}return o},ge=e=>{let t="string",n=!1,r;if(e.type)if(Array.isArray(e.type)){let i=e.type.filter(f=>f!=="null");e.type.includes("null")&&(n=!0),i.length===1?t=x(i[0]):i.length>1&&(t=x(i[0]),r=i.map(x))}else t=x(e.type);else e.enum?t=xe(e.enum):e.const!==void 0&&(t=Se(e.const));return{type:t,nullable:n,multipleTypes:r}},x=e=>{switch(e){case"string":return"string";case"number":return"number";case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";case"null":return"null";default:return"string"}},xe=e=>{if(e.length===0)return"string";let t=e[0];return typeof t=="string"?"string":typeof t=="number"?"number":typeof t=="boolean"?"boolean":Array.isArray(t)?"array":typeof t=="object"&&t!==null?"object":"string"},Se=e=>typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":e===null?"null":"string",Ne=e=>{let t={};return e.additionalProperties!==void 0&&(t.additionalProperties=e.additionalProperties),e.propertyNames&&(t.propertyNames=e.propertyNames),e.minProperties!==void 0&&(t.minProperties=e.minProperties),e.maxProperties!==void 0&&(t.maxProperties=e.maxProperties),e.patternProperties&&(t.patternProperties=e.patternProperties),e.dependentRequired&&(t.dependentRequired=e.dependentRequired),t},w=(e,t,n)=>{let r={};return t.required&&t.required.includes(n)&&(r.required=!0),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.contentEncoding&&(r.contentEncoding=e.contentEncoding),e.contentMediaType&&(r.contentMediaType=e.contentMediaType),e.minimum!==void 0&&(r.min=e.minimum),e.maximum!==void 0&&(r.max=e.maximum),e.exclusiveMinimum!==void 0&&(typeof e.exclusiveMinimum=="number"?(r.min=e.exclusiveMinimum,r.exclusiveMin=!0):r.exclusiveMin=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(typeof e.exclusiveMaximum=="number"?(r.max=e.exclusiveMaximum,r.exclusiveMax=!0):r.exclusiveMax=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),(e.type==="integer"||Array.isArray(e.type)&&e.type.includes("integer"))&&(r.integer=!0),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=e.uniqueItems),e.items&&(r.items=e.items),e.contains&&(r.contains=e.contains),e.minProperties!==void 0&&(r.minProperties=e.minProperties),e.maxProperties!==void 0&&(r.maxProperties=e.maxProperties),e.additionalProperties!==void 0&&(r.additionalProperties=e.additionalProperties),e.propertyNames&&(r.propertyNames=e.propertyNames),e.patternProperties&&(r.patternProperties=e.patternProperties),e.enum&&(r.enum=e.enum),e.const!==void 0&&(r.const=e.const),e.allOf&&(r.allOf=e.allOf),e.anyOf&&(r.anyOf=e.anyOf),e.oneOf&&(r.oneOf=e.oneOf),e.not&&(r.not=e.not),e.if&&(r.if=e.if),e.then&&(r.then=e.then),e.else&&(r.else=e.else),r},J=(e,t)=>n=>{let r=n;if(e.multipleTypes&&e.multipleTypes.length>1){let i=e.multipleTypes.map(o=>({type:o,constraints:Oe(e.constraints,o)}));return n.oneOf(i.map(o=>f=>be(f,o.type,o.constraints,t)))}return r=c(r,e.type),e.nullable&&(r=r.nullable()),r=L(r,e.constraints,t),r},c=(e,t)=>{switch(t){case"string":return e.string||e;case"number":return e.number||e;case"boolean":return e.boolean||e;case"array":return e.array||e;case"object":return e.object||e;case"date":return e.date||e;case"null":return e.literal(null);default:return e}},be=(e,t,n,r)=>{let i=c(e,t);return L(i,n,r)},Oe=(e,t)=>{let n={};return t==="string"&&(e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern&&(n.pattern=e.pattern),e.format&&(n.format=e.format)),(t==="number"||t==="integer")&&(e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),e.exclusiveMin!==void 0&&(n.exclusiveMin=e.exclusiveMin),e.exclusiveMax!==void 0&&(n.exclusiveMax=e.exclusiveMax)),t==="array"&&(e.minItems!==void 0&&(n.minItems=e.minItems),e.maxItems!==void 0&&(n.maxItems=e.maxItems),e.uniqueItems&&(n.uniqueItems=e.uniqueItems),e.items&&(n.items=e.items)),e.enum&&(n.enum=e.enum),e.const!==void 0&&(n.const=e.const),e.required!==void 0&&(n.required=e.required),n},L=(e,t,n)=>{if(t.const!==void 0)return e.literal?e.literal(t.const):e;if(t.minLength!==void 0&&e.min&&(e=e.min(t.minLength)),t.maxLength!==void 0&&e.max&&(e=e.max(t.maxLength)),t.pattern&&e.pattern&&(e=e.pattern(t.pattern)),t.format)if(n&&n[t.format])e.refine&&(e=e.refine(n[t.format]));else switch(t.format){case"email":e=e.email?e.email():e;break;case"uri":case"url":e=e.url?e.url():e;break;case"uuid":e=e.uuid?e.uuid():e;break;case"date-time":case"datetime":e=e.datetime?e.datetime():e;break}if(t.min!==void 0&&e.min){let r=t.exclusiveMin===!0||typeof t.exclusiveMin=="number";t.exclusiveMin!==void 0?r?e=e.min(t.min,{exclusive:!0}):e=e.min(t.min,{exclusive:!1}):e=e.min(t.min)}if(t.max!==void 0&&e.max){let r=t.exclusiveMax===!0||typeof t.exclusiveMax=="number";t.exclusiveMax!==void 0&&r?e=e.max(t.max,{exclusive:!0}):e=e.max(t.max)}return t.multipleOf!==void 0&&e.multipleOf&&(e=e.multipleOf(t.multipleOf)),t.items&&Array.isArray(t.items)&&e.tupleBuilder?e.tupleBuilder(t.items):(t.minItems!==void 0&&e.minItems&&(e=e.minItems(t.minItems)),t.maxItems!==void 0&&e.maxItems&&(e=e.maxItems(t.maxItems)),t.uniqueItems&&e.unique&&(e=e.unique()),t.minProperties!==void 0&&e.minProperties&&(e=e.minProperties(t.minProperties)),t.maxProperties!==void 0&&e.maxProperties&&(e=e.maxProperties(t.maxProperties)),t.additionalProperties!==void 0&&e.additionalProperties&&(e=e.additionalProperties(t.additionalProperties)),t.propertyNames&&e.propertyNames&&(e=e.propertyNames(t.propertyNames)),t.allOf&&e.custom&&(e=e.custom(r=>t.allOf.every(i=>p(r,i)))),t.anyOf&&e.custom&&(e=e.custom(r=>t.anyOf.some(i=>p(r,i)))),t.oneOf&&e.custom&&(e=e.custom(r=>t.oneOf.filter(o=>p(r,o)).length===1)),t.required&&e.required&&(e=e.required()),e)};function V(e){let{name:t,methodName:n,impl:r,extendBuilder:i}=e;return{name:t,methodName:n,category:"builder-extension",impl:r(),extendBuilder:i}}var D=V({name:"jsonSchema",methodName:"fromJsonSchema",impl:()=>function(e,t={}){let n=M(e,"",e),r=this.for();for(let o of n){if(o.path==="")continue;let f=J(o,t?.customFormats);r=r.v(o.path,f)}let i=n.find(o=>o.path==="");if(i&&(i.constraints.additionalProperties===!1&&typeof r.strict=="function"&&(r=r.strict()),i.constraints.dependentRequired))for(let[o,f]of Object.entries(i.constraints.dependentRequired))for(let s of f)r=r.v(s,u=>u.requiredIf(l=>l[o]!==void 0));return r},extendBuilder:e=>(e.fromJsonSchema=D.impl,e)});export{c as applyBaseType,L as applyConstraints,J as convertDSLToFieldDefinition,M as convertJsonSchemaToLuqDSL,b as formatValidators,c as getBaseChain,y as getDetailedValidationErrors,ne as getSpecificValidationErrors,ee as getSupportedFormats,te as isFormatSupported,D as jsonSchemaPlugin,a as resolveAllRefs,I as resolveRef,m as resolveSchemaRef,q as validateArrayConstraints,P as validateFormat,$ as validateMultipleTypes,j as validateNumberConstraints,C as validateObjectConstraints,R as validateStringConstraints,E as validateType,p as validateValueAgainstSchema};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BuilderExtensionPlugin, FieldBuilder } from "../core/builder/plugins/plugin-types";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
import type { JsonSchemaOptions } from "../core/plugin/jsonSchema/jsonSchema/types";
|
|
4
|
+
/**
|
|
5
|
+
* @luq-plugin
|
|
6
|
+
* @name jsonSchemaFullFeature
|
|
7
|
+
* @category builder-extension
|
|
8
|
+
* @description Complete JSON Schema support with all necessary plugins pre-loaded
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Single plugin import for full JSON Schema support
|
|
12
|
+
* const validator = Builder()
|
|
13
|
+
* .use(jsonSchemaFullFeaturePlugin)
|
|
14
|
+
* .fromJsonSchema({
|
|
15
|
+
* type: 'object',
|
|
16
|
+
* properties: {
|
|
17
|
+
* email: { type: 'string', format: 'email' },
|
|
18
|
+
* age: { type: 'number', minimum: 18 },
|
|
19
|
+
* roles: {
|
|
20
|
+
* type: 'array',
|
|
21
|
+
* items: { type: 'string' },
|
|
22
|
+
* uniqueItems: true
|
|
23
|
+
* }
|
|
24
|
+
* },
|
|
25
|
+
* required: ['email'],
|
|
26
|
+
* additionalProperties: false
|
|
27
|
+
* })
|
|
28
|
+
* .build();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const jsonSchemaFullFeaturePlugin: BuilderExtensionPlugin<"jsonSchemaFullFeature", "fromJsonSchema", <TBuilder extends FieldBuilder<any, any, any, any>>(schema: JSONSchema7 | unknown, options?: JsonSchemaOptions) => TBuilder>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Qe=(e,t)=>{for(var o in t)_(e,o,{get:t[o],enumerable:!0})},et=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Xe(t))!Ke.call(e,n)&&n!==o&&_(e,n,{get:()=>t[n],enumerable:!(r=He(t,n))||r.enumerable});return e};var tt=e=>et(_({},"__esModule",{value:!0}),e);var xn={};Qe(xn,{jsonSchemaFullFeaturePlugin:()=>Tn});module.exports=tt(xn);var rt=(e,t,o)=>{if(!e.startsWith("#"))throw new Error(`External $ref not supported: ${e}`);let r=e.slice(1).split("/"),n=t;for(let s of r)if(s&&(s==="definitions"||s==="$defs"?n=n.definitions||n.$defs||{}:n=n[s],n===void 0))throw new Error(`Cannot resolve $ref: ${e}`);return n},P=(e,t,o)=>{if(!e.$ref)return e;if(!t)throw new Error("Root schema required for $ref resolution");return rt(e.$ref,t,o)};var nt=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var ot=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,st=/^\d{4}-\d{2}-\d{2}$/,it=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,at=/^\d{2}:\d{2}:\d{2}(\.\d{3})?$/,ut=/^P(?:(\d+Y)?(\d+M)?(\d+D)?)(?:T(\d+H)?(\d+M)?(\d+(?:\.\d+)?S)?)?$/,lt=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/,ft=/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,pt=/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ct=/^(\/([^\/~]|~[01])*)*$/,dt=/^[0-9]+#?$/,mt=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,gt=/^([a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*|\/[^\s]*|[^\s:\/]+)$/,yt=/^[^{}]*(\{[^{}]+\}[^{}]*)*$/;var Tt={email:e=>typeof e!="string"||e.includes("..")?!1:nt.test(e),url:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return!1}},uri:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{let t=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);if(!t)return!1;let[,o,r]=t;return r.startsWith("//")?r.length>2&&r.substring(2).length>0:r.length>0}},"uri-reference":e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return e.includes(":")&&!e.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:/)?!1:e.startsWith("/")||!e.includes(":")}},uuid:e=>typeof e!="string"?!1:ot.test(e),date:e=>{if(typeof e!="string"||!st.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())&&t.toISOString().startsWith(e)},"date-time":e=>{if(typeof e!="string"||!it.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())},time:e=>{if(typeof e!="string"||!at.test(e))return!1;let t=e.split(":");if(t.length<3)return!1;let o=parseInt(t[0],10),r=parseInt(t[1],10),n=parseFloat(t[2]);return o>=0&&o<=23&&r>=0&&r<=59&&n>=0&&n<60},duration:e=>typeof e!="string"?!1:ut.test(e),ipv4:e=>{if(typeof e!="string"||!lt.test(e))return!1;let t=e.split(".");return t.length===4&&t.every(o=>{let r=parseInt(o,10);return r>=0&&r<=255})},ipv6:e=>typeof e!="string"?!1:ft.test(e)||e.includes("::"),hostname:e=>typeof e!="string"||e.length>253?!1:pt.test(e),"json-pointer":e=>typeof e!="string"?!1:ct.test(e),"relative-json-pointer":e=>typeof e!="string"?!1:dt.test(e),iri:e=>typeof e!="string"?!1:mt.test(e),"iri-reference":e=>typeof e!="string"?!1:gt.test(e),"uri-template":e=>typeof e!="string"?!1:yt.test(e),regex:e=>{if(typeof e!="string")return!1;try{return new RegExp(e),!0}catch{return!1}}},z=(e,t,o)=>{if(o&&o[t]){let n=o[t];if(typeof n=="function")return n(e)}let r=Tt[t];return r?r(e):!0};var C=(e,t)=>{if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(typeof e!="object")return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e))return e.length!==t.length?!1:e.every((n,s)=>C(n,t[s]));let o=Object.keys(e),r=Object.keys(t);return o.length!==r.length?!1:o.every(n=>C(e[n],t[n]))},xt=e=>{for(let t=0;t<e.length;t++)for(let o=t+1;o<e.length;o++)if(C(e[t],e[o]))return!0;return!1},Z=(e,t)=>{switch(t){case"null":return e===null;case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";case"number":return typeof e=="number"&&!isNaN(e);case"integer":return typeof e=="number"&&Number.isInteger(e)&&!isNaN(e);case"array":return Array.isArray(e);case"object":return typeof e=="object"&&e!==null&&!Array.isArray(e);default:return!1}},bt=(e,t)=>t.some(o=>Z(e,o)),Ot=(e,t,o)=>!(t.minLength!==void 0&&e.length<t.minLength||t.maxLength!==void 0&&e.length>t.maxLength||t.pattern&&!new RegExp(t.pattern).test(e)||t.format&&!z(e,t.format,o)||t.contentEncoding&&t.contentEncoding==="base64"&&(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length>0&&e.length%4!==0)),Et=(e,t)=>{if(t.minimum!==void 0&&e<t.minimum||t.maximum!==void 0&&e>t.maximum)return!1;if(t.exclusiveMinimum!==void 0){if(typeof t.exclusiveMinimum=="number"){if(e<=t.exclusiveMinimum)return!1}else if(t.exclusiveMinimum===!0&&t.minimum!==void 0&&e<=t.minimum)return!1}if(t.exclusiveMaximum!==void 0){if(typeof t.exclusiveMaximum=="number"){if(e>=t.exclusiveMaximum)return!1}else if(t.exclusiveMaximum===!0&&t.maximum!==void 0&&e>=t.maximum)return!1}if(t.multipleOf!==void 0){let o=e/t.multipleOf;if(!Number.isInteger(o))return!1}return!0},Mt=(e,t,o,r)=>{if(t.minItems!==void 0&&e.length<t.minItems||t.maxItems!==void 0&&e.length>t.maxItems||t.uniqueItems&&xt(e))return!1;if(t.items){if(Array.isArray(t.items))for(let n=0;n<e.length;n++)if(n<t.items.length){if(typeof t.items[n]=="boolean"){if(!t.items[n])return!1}else if(!x(e[n],t.items[n],o,r))return!1}else{if(t.additionalItems===!1)return!1;if(t.additionalItems&&typeof t.additionalItems=="object"&&!x(e[n],t.additionalItems,o,r))return!1}else for(let n of e)if(typeof t.items=="boolean"){if(!t.items)return!1}else if(!x(n,t.items,o,r))return!1}if(t.contains!==void 0){if(typeof t.contains=="boolean"){if(!t.contains||e.length===0)return!1}else if(!e.some(s=>x(s,t.contains,o,r)))return!1}return!0},Nt=(e,t,o,r)=>{let n=Object.keys(e);if(t.minProperties!==void 0&&n.length<t.minProperties||t.maxProperties!==void 0&&n.length>t.maxProperties)return!1;if(t.required){for(let s of t.required)if(!(s in e))return!1}if(t.properties)for(let[s,i]of Object.entries(e)){let a=t.properties[s];if(a&&typeof a=="object"&&!x(i,a,o,r))return!1}if(t.patternProperties){for(let[s,i]of Object.entries(e))for(let[a,l]of Object.entries(t.patternProperties))if(new RegExp(a).test(s)&&typeof l=="object"&&!x(i,l,o,r))return!1}if(t.additionalProperties===!1){let s=new Set([...t.properties?Object.keys(t.properties):[],...n.filter(i=>t.patternProperties?Object.keys(t.patternProperties).some(a=>new RegExp(a).test(i)):!1)]);for(let i of n)if(!s.has(i))return!1}else if(t.additionalProperties&&typeof t.additionalProperties=="object"){let s=new Set(t.properties?Object.keys(t.properties):[]);for(let[i,a]of Object.entries(e))if(!s.has(i)&&!x(a,t.additionalProperties,o,r))return!1}if(t.propertyNames!==void 0){if(typeof t.propertyNames=="boolean"){if(!t.propertyNames&&n.length>0)return!1}else for(let s of n)if(!x(s,t.propertyNames,o,r))return!1}return!0},x=(e,t,o,r)=>{if(t.$ref&&r&&(t=P(t,r)),e===void 0)return!1;if(e===null){if(t.type==="null"||Array.isArray(t.type)&&t.type.includes("null"))return!0;if(!t.enum&&t.const===void 0)return!1}if(t.type){if(Array.isArray(t.type)){if(!bt(e,t.type))return!1}else if(!Z(e,t.type))return!1}if(t.const!==void 0)return C(e,t.const);if(t.enum)return t.enum.some(n=>C(e,n));if(typeof e=="string"){if(!Ot(e,t,o))return!1}else if(typeof e=="number"){if(!Et(e,t))return!1}else if(Array.isArray(e)){if(!Mt(e,t,o,r))return!1}else if(typeof e=="object"&&e!==null&&!Nt(e,t,o,r))return!1;if(t.allOf)for(let n of t.allOf){if(typeof n=="boolean"){if(!n)return!1;continue}if(!x(e,n,o,r))return!1}if(t.anyOf&&!t.anyOf.some(s=>typeof s=="boolean"?s:x(e,s,o,r)))return!1;if(t.oneOf){let n=0;for(let s of t.oneOf){if(typeof s=="boolean"){s&&n++;continue}x(e,s,o,r)&&n++}if(n!==1)return!1}if(t.not){if(typeof t.not=="boolean"){if(t.not)return!1}else if(x(e,t.not,o,r))return!1}if(t.if){let n=typeof t.if=="boolean"?t.if:x(e,t.if,o,r);if(n&&t.then!==void 0)return typeof t.then=="boolean"?t.then:x(e,t.then,o,r);if(!n&&t.else!==void 0)return typeof t.else=="boolean"?t.else:x(e,t.else,o,r)}return!0};var W=(e,t="",o)=>{let r=[],n=e.$ref&&o?P(e,o):e;if(t===""&&(n.oneOf||n.anyOf||n.allOf)){let s=Y(n,{},""),i=n.type?I(Array.isArray(n.type)?n.type[0]:n.type):"string";return r.push({path:"",type:i,constraints:s}),r}if(n.type==="object"&&t===""){let s=Pt(n);Object.keys(s).length>0&&r.push({path:"",type:"object",constraints:s})}if(n.properties){for(let[s,i]of Object.entries(n.properties))if(typeof i=="object"){let a=t?`${t}.${s}`:s,l=h(s,i,a,n,o);r.push(...l)}}if(n.patternProperties){for(let[s,i]of Object.entries(n.patternProperties))if(typeof i=="object"){let a=t?`${t}.*`:"*",l=h(s,i,a,n,o);r.push(...l)}}return r},h=(e,t,o,r,n)=>{let s=[],i=t.$ref&&n?P(t,n):t,{type:a,nullable:l,multipleTypes:f}=St(i),p=Y(i,r,e),c={path:o,type:a,nullable:l,multipleTypes:f,constraints:p};if(s.push(c),(i.type==="object"||Array.isArray(i.type)&&i.type.includes("object"))&&i.properties){for(let[d,g]of Object.entries(i.properties))if(typeof g=="object"){let M=`${o}.${d}`,E=h(d,g,M,i,n);s.push(...E)}}if((i.type==="array"||Array.isArray(i.type)&&i.type.includes("array"))&&i.items&&!Array.isArray(i.items)&&typeof i.items=="object"){let d=`${o}[*]`,g=h(`${e}[*]`,i.items,d,i,n);s.push(...g)}return s},St=e=>{let t="string",o=!1,r;if(e.type)if(Array.isArray(e.type)){let n=e.type.filter(i=>i!=="null");e.type.includes("null")&&(o=!0),n.length===1?t=I(n[0]):n.length>1&&(t=I(n[0]),r=n.map(I))}else t=I(e.type);else e.enum?t=At(e.enum):e.const!==void 0&&(t=Rt(e.const));return{type:t,nullable:o,multipleTypes:r}},I=e=>{switch(e){case"string":return"string";case"number":return"number";case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";case"null":return"null";default:return"string"}},At=e=>{if(e.length===0)return"string";let t=e[0];return typeof t=="string"?"string":typeof t=="number"?"number":typeof t=="boolean"?"boolean":Array.isArray(t)?"array":typeof t=="object"&&t!==null?"object":"string"},Rt=e=>typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":e===null?"null":"string",Pt=e=>{let t={};return e.additionalProperties!==void 0&&(t.additionalProperties=e.additionalProperties),e.propertyNames&&(t.propertyNames=e.propertyNames),e.minProperties!==void 0&&(t.minProperties=e.minProperties),e.maxProperties!==void 0&&(t.maxProperties=e.maxProperties),e.patternProperties&&(t.patternProperties=e.patternProperties),e.dependentRequired&&(t.dependentRequired=e.dependentRequired),t},Y=(e,t,o)=>{let r={};return t.required&&t.required.includes(o)&&(r.required=!0),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.contentEncoding&&(r.contentEncoding=e.contentEncoding),e.contentMediaType&&(r.contentMediaType=e.contentMediaType),e.minimum!==void 0&&(r.min=e.minimum),e.maximum!==void 0&&(r.max=e.maximum),e.exclusiveMinimum!==void 0&&(typeof e.exclusiveMinimum=="number"?(r.min=e.exclusiveMinimum,r.exclusiveMin=!0):r.exclusiveMin=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(typeof e.exclusiveMaximum=="number"?(r.max=e.exclusiveMaximum,r.exclusiveMax=!0):r.exclusiveMax=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),(e.type==="integer"||Array.isArray(e.type)&&e.type.includes("integer"))&&(r.integer=!0),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=e.uniqueItems),e.items&&(r.items=e.items),e.contains&&(r.contains=e.contains),e.minProperties!==void 0&&(r.minProperties=e.minProperties),e.maxProperties!==void 0&&(r.maxProperties=e.maxProperties),e.additionalProperties!==void 0&&(r.additionalProperties=e.additionalProperties),e.propertyNames&&(r.propertyNames=e.propertyNames),e.patternProperties&&(r.patternProperties=e.patternProperties),e.enum&&(r.enum=e.enum),e.const!==void 0&&(r.const=e.const),e.allOf&&(r.allOf=e.allOf),e.anyOf&&(r.anyOf=e.anyOf),e.oneOf&&(r.oneOf=e.oneOf),e.not&&(r.not=e.not),e.if&&(r.if=e.if),e.then&&(r.then=e.then),e.else&&(r.else=e.else),r},v=(e,t)=>o=>{let r=o;if(e.multipleTypes&&e.multipleTypes.length>1){let n=e.multipleTypes.map(s=>({type:s,constraints:It(e.constraints,s)}));return o.oneOf(n.map(s=>i=>Ct(i,s.type,s.constraints,t)))}return r=G(r,e.type),e.nullable&&(r=r.nullable()),r=H(r,e.constraints,t),r},G=(e,t)=>{switch(t){case"string":return e.string||e;case"number":return e.number||e;case"boolean":return e.boolean||e;case"array":return e.array||e;case"object":return e.object||e;case"date":return e.date||e;case"null":return e.literal(null);default:return e}},Ct=(e,t,o,r)=>{let n=G(e,t);return H(n,o,r)},It=(e,t)=>{let o={};return t==="string"&&(e.minLength!==void 0&&(o.minLength=e.minLength),e.maxLength!==void 0&&(o.maxLength=e.maxLength),e.pattern&&(o.pattern=e.pattern),e.format&&(o.format=e.format)),(t==="number"||t==="integer")&&(e.min!==void 0&&(o.min=e.min),e.max!==void 0&&(o.max=e.max),e.exclusiveMin!==void 0&&(o.exclusiveMin=e.exclusiveMin),e.exclusiveMax!==void 0&&(o.exclusiveMax=e.exclusiveMax)),t==="array"&&(e.minItems!==void 0&&(o.minItems=e.minItems),e.maxItems!==void 0&&(o.maxItems=e.maxItems),e.uniqueItems&&(o.uniqueItems=e.uniqueItems),e.items&&(o.items=e.items)),e.enum&&(o.enum=e.enum),e.const!==void 0&&(o.const=e.const),e.required!==void 0&&(o.required=e.required),o},H=(e,t,o)=>{if(t.const!==void 0)return e.literal?e.literal(t.const):e;if(t.minLength!==void 0&&e.min&&(e=e.min(t.minLength)),t.maxLength!==void 0&&e.max&&(e=e.max(t.maxLength)),t.pattern&&e.pattern&&(e=e.pattern(t.pattern)),t.format)if(o&&o[t.format])e.refine&&(e=e.refine(o[t.format]));else switch(t.format){case"email":e=e.email?e.email():e;break;case"uri":case"url":e=e.url?e.url():e;break;case"uuid":e=e.uuid?e.uuid():e;break;case"date-time":case"datetime":e=e.datetime?e.datetime():e;break}if(t.min!==void 0&&e.min){let r=t.exclusiveMin===!0||typeof t.exclusiveMin=="number";t.exclusiveMin!==void 0?r?e=e.min(t.min,{exclusive:!0}):e=e.min(t.min,{exclusive:!1}):e=e.min(t.min)}if(t.max!==void 0&&e.max){let r=t.exclusiveMax===!0||typeof t.exclusiveMax=="number";t.exclusiveMax!==void 0&&r?e=e.max(t.max,{exclusive:!0}):e=e.max(t.max)}return t.multipleOf!==void 0&&e.multipleOf&&(e=e.multipleOf(t.multipleOf)),t.items&&Array.isArray(t.items)&&e.tupleBuilder?e.tupleBuilder(t.items):(t.minItems!==void 0&&e.minItems&&(e=e.minItems(t.minItems)),t.maxItems!==void 0&&e.maxItems&&(e=e.maxItems(t.maxItems)),t.uniqueItems&&e.unique&&(e=e.unique()),t.minProperties!==void 0&&e.minProperties&&(e=e.minProperties(t.minProperties)),t.maxProperties!==void 0&&e.maxProperties&&(e=e.maxProperties(t.maxProperties)),t.additionalProperties!==void 0&&e.additionalProperties&&(e=e.additionalProperties(t.additionalProperties)),t.propertyNames&&e.propertyNames&&(e=e.propertyNames(t.propertyNames)),t.allOf&&e.custom&&(e=e.custom(r=>t.allOf.every(n=>x(r,n)))),t.anyOf&&e.custom&&(e=e.custom(r=>t.anyOf.some(n=>x(r,n)))),t.oneOf&&e.custom&&(e=e.custom(r=>t.oneOf.filter(s=>x(r,s)).length===1)),t.required&&e.required&&(e=e.required()),e)};var Ft=(e,t,o,r)=>{let s=(i=>(...a)=>{let l=i(...a);return l&&typeof l=="object"&&"check"in l?{...l,pluginName:r}:l})(o);switch(e){case"conditional":return(i,...a)=>s(i,...a);case"fieldReference":return(i,...a)=>s(i,...a);case"multiFieldReference":return s;case"transform":return i=>s(i);case"arrayElement":return(i,...a)=>s(i,...a);case"context":return i=>s(i);default:return s}};function u(e){let{name:t,methodName:o,allowedTypes:r,category:n,impl:s}=e;return{name:t,methodName:o,allowedTypes:r,category:n,create:()=>Ft(n,o,s,t)}}function X(e){let{name:t,methodName:o,impl:r,extendBuilder:n}=e;return{name:t,methodName:o,category:"builder-extension",impl:r(),extendBuilder:n}}var F=X({name:"jsonSchema",methodName:"fromJsonSchema",impl:()=>function(e,t={}){let o=W(e,"",e),r=this.for();for(let s of o){if(s.path==="")continue;let i=v(s,t?.customFormats);r=r.v(s.path,i)}let n=o.find(s=>s.path==="");if(n&&(n.constraints.additionalProperties===!1&&typeof r.strict=="function"&&(r=r.strict()),n.constraints.dependentRequired))for(let[s,i]of Object.entries(n.constraints.dependentRequired))for(let a of i)r=r.v(a,l=>l.requiredIf(f=>f[s]!==void 0));return r},extendBuilder:e=>(e.fromJsonSchema=F.impl,e)});var ht="required",jt=e=>`${e} is required`,wt=["array","boolean","number","object","string","date","union","tuple"],K=u({name:"required",methodName:"required",allowedTypes:wt,category:"standard",impl:e=>{let t=e?.code||ht,o=e?.messageFactory||(s=>jt(s.field)),r=e?.fieldName,n=e?.allowNull||!1;return{check:s=>n?!(s===void 0||s===""):!(s==null||s===""),code:t,getErrorMessage:(s,i)=>o({field:r||i,path:i,value:s,code:t}),params:e?[e]:[]}}});var $n=Object.freeze({valid:!0,__skipFurtherValidation:!0}),Lt=["string","number","boolean","array","object","date","union"],Q=u({name:"optional",methodName:"optional",allowedTypes:Lt,category:"standard",impl:()=>({check:e=>e!==null,code:"optional",getErrorMessage:(e,t)=>e===null?`${t} cannot be null (use undefined for optional fields)`:"Optional validation error (should not happen)",params:[],isOptional:!0,skipForUndefined:!0})});var Un=Object.freeze({valid:!0,__isNullable:!0}),_t=["string","number","boolean","array","object","date","union"],ee=u({name:"nullable",methodName:"nullable",allowedTypes:_t,category:"standard",impl:()=>({check:e=>!0,code:"nullable",getErrorMessage:(e,t)=>e===void 0?`${t} cannot be undefined (use null for nullable fields)`:"Nullable validation error (should not happen)",params:[],isNullable:!0,skipForNull:!0})});var Vt="requiredIf",$t="Field is required when condition is met";function Dt(e){return $t}var kt=["string","number","boolean","array","object","date","union"],te=u({name:"requiredIf",methodName:"requiredIf",allowedTypes:kt,category:"conditional",impl:(e,t)=>{let o=t?.code||Vt,r=t?.messageFactory||Dt;return{check:(n,s,i)=>s&&e(s,i)?!(n==null||n===""):!0,code:o,getErrorMessage:(n,s,i,a)=>{let l=i?e(i,a):!1;return r({path:s,value:n,code:o,condition:l})},params:[e,t],evaluateCondition:(n,s)=>n?e(n,s):!1}}});var Ut="oneOf",qt=e=>Array.isArray(e)?`Value must be one of: ${e.map(o=>JSON.stringify(o)).join(", ")}`:"Value must be one of the allowed values",Bt=["string","number","boolean"],re=u({name:"oneOf",methodName:"oneOf",allowedTypes:Bt,category:"standard",impl:(e,t)=>{if(!Array.isArray(e)||e.length===0)throw new Error("oneOf requires a non-empty array of allowed values");let o=t?.code||Ut,r=t?.messageFactory||(a=>qt(a.options)),n=Object.freeze([...e]),s=e.length>7,i=s?new Set(e):null;return{check:a=>a==null?!0:s?i.has(a):e.includes(a),code:o,getErrorMessage:(a,l)=>{let f={path:l,value:a,code:o,options:[...n]};return r(f)},params:[e,t],allowedValues:n}}});var Jt="literal",zt=e=>`Value must be ${typeof e=="string"?`"${e}"`:String(e)}`,Zt=["string","number","boolean","null"],ne=u({name:"literal",methodName:"literal",allowedTypes:Zt,category:"standard",impl:(e,t)=>{let o=t?.code||Jt,r=t?.messageFactory||(s=>zt(s.expected??"null")),n=typeof e=="number"&&isNaN(e);return{check:s=>n?typeof s=="number"&&isNaN(s):s===e,code:o,getErrorMessage:(s,i)=>r({path:i,value:s,code:o,expected:e}),params:[e,t]}}});var Wt="CUSTOM_VALIDATION_FAILED",Yt=["string","number","boolean","date","array","object","tuple","union"],oe=u({name:"custom",methodName:"custom",allowedTypes:Yt,category:"standard",impl:(e,t)=>{let o=t?.code||Wt,r="Custom validation failed",n=t?.messageFactory||(i=>`${i.path} ${r.toLowerCase()}`),s;return{check:(i,a)=>{try{let l=e(i,a);return typeof l=="boolean"?l:l&&typeof l=="object"&&"valid"in l?(s=l.message,l.valid):!1}catch{return!1}},code:o,getErrorMessage:(i,a)=>s||n({path:a,value:i,code:o}),params:[e,t]}}});var vt="string",Gt="stringMin",Ht=[vt],se=u({name:"stringMin",methodName:"min",allowedTypes:Ht,category:"standard",impl:(e,t)=>{let o=t?.code||Gt,r=t?.messageFactory||(n=>`String must have at least ${n.min} characters, but got ${n.actual}`);return{check:n=>typeof n!="string"?!0:n.length>=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="string"?n.length:0;if(typeof r=="function"){let a=r;return a.length===0?a():a.length===2?a(o,{path:s,value:n,min:e,actual:i}):a({path:s,value:n,code:o,min:e,actual:i})}return`String must have at least ${e} characters, but got ${i}`},params:[e,t]}}});var Xt="stringMax",Kt=["string"],ie=u({name:"stringMax",methodName:"max",allowedTypes:Kt,category:"standard",impl:(e,t)=>{let o=t?.code||Xt,r=t?.messageFactory||(n=>`String must have at most ${n.max} characters, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid maxLength: ${e}`);return{check:n=>typeof n!="string"?!0:n.length<=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="string"?n.length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var Qt="stringPattern",er=["string"],ae=u({name:"stringPattern",methodName:"pattern",allowedTypes:er,category:"standard",impl:(e,t)=>{let o=t?.code||Qt,r=t?.messageFactory||(i=>"Invalid format"),n=e.toString(),s=typeof e=="string"?new RegExp(e):e;return{check:i=>typeof i!="string"?!0:s.test(i),code:o,getErrorMessage:(i,a)=>r({path:a,value:i,code:o,pattern:n}),params:[e,t]}}});var tr=["string"],rr=/^[a-zA-Z0-9]([a-zA-Z0-9._%+-]*[a-zA-Z0-9])?@[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/,nr="stringEmail",ue=u({name:"stringEmail",methodName:"email",allowedTypes:tr,category:"standard",impl:e=>{let t=e?.code||nr,o=e?.messageFactory||(s=>s.reason?`Invalid email: ${s.reason}`:"Invalid email address"),r=e?.allowedDomains?new Set(e.allowedDomains.map(s=>s.toLowerCase())):null,n=e?.customRegex||rr;return{check:s=>{if(typeof s!="string")return!0;if(!n.test(s))return!1;if(r){let i=s.lastIndexOf("@");if(i===-1)return!1;let a=s.substring(i+1).toLowerCase();return r.has(a)}return!0},code:t,getErrorMessage:(s,i)=>{if(typeof s!="string")return o({path:i,value:s,code:t});let a="";if(!n.test(s))a="invalid format";else if(r){let f=s.lastIndexOf("@");if(f!==-1){let p=s.substring(f+1).toLowerCase();r.has(p)||(a=`domain not allowed (allowed: ${Array.from(r).join(", ")})`)}}return o({path:i,value:s,code:t,reason:a})},params:e?[e]:[],validationOptions:e}}});var or="stringUrl",sr=["string"],le=u({name:"stringUrl",methodName:"url",allowedTypes:sr,category:"standard",impl:e=>{let t=e?.code||or,o=e?.protocols||null,r=e?.allowWithoutProtocol||!1,n=e?.messageFactory||(s=>"Invalid URL format");return{check:s=>{if(typeof s!="string")return!0;try{let i=s;r&&!s.includes("://")&&(i=`https://${s}`);let a=new URL(i);return!(o&&!o.includes(a.protocol))}catch{return!1}},code:t,getErrorMessage:(s,i)=>n({path:i,value:s,code:t}),params:e?[e]:[]}}});function ir(e){return e.version?`Value must be a valid UUID ${e.version} format`:"Value must be a valid UUID format"}var ar=["string"],ur=[1,3,4,5,6,7,8];function lr(e){return new RegExp(`^[0-9a-f]{8}-[0-9a-f]{4}-${e}[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`,"i")}var V={};for(let e of ur)V[e]=lr(e);var fr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,fe=u({name:"stringUuid",methodName:"uuid",allowedTypes:ar,category:"standard",impl:(e,t)=>{let o=t?.messageFactory||ir;if(!e){let i=t?.code||"uuid";return{check:a=>typeof a!="string"?!0:fr.test(a),code:i,getErrorMessage:(a,l)=>o({path:l,value:a,code:i}),params:[e,t]}}let r=Array.isArray(e)?e:[e],n=Array.isArray(e)?`v${e.join(", v")}`:`v${e}`,s=t?.code||"uuidVersion";return{check:i=>{if(typeof i!="string")return!0;let a=r.length;for(let l=0;l<a;l++){let f=r[l];if(V[f]&&V[f].test(i))return!0}return!1},code:s,getErrorMessage:(i,a)=>o({path:a,value:i,code:s,version:n}),params:[e,t]}}});var pr=/^(\d{4})-(\d{2})-(\d{2})$/;function cr(e){let t=e.match(pr);if(!t)return!1;let[,o,r,n]=t,s=parseInt(o,10),i=parseInt(r,10),a=parseInt(n,10);if(i<1||i>12||a<1||a>31)return!1;let l=[31,28,31,30,31,30,31,31,30,31,30,31];if((s%4===0&&s%100!==0||s%400===0)&&(l[1]=29),a>l[i-1])return!1;let p=new Date(`${e}T12:00:00Z`);return isNaN(p.getTime())?!1:p.toISOString().split("T")[0]===e}var pe=u({name:"stringDate",methodName:"date",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:cr(r),code:"FORMAT_DATE",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_DATE"};return e?.messageFactory?.(s)||`${n} must be a valid ISO 8601 date (YYYY-MM-DD)`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid ISO 8601 date (YYYY-MM-DD)`,params:[e]})});var dr=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})$/,mr=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/;function gr(e,t=!1){let o=t?dr:mr,r=e.match(o);if(!r)return!1;let[,n,s,i,a,l,f]=r,p=parseInt(n,10),c=parseInt(s,10),d=parseInt(i,10),g=parseInt(a,10),M=parseInt(l,10),E=parseInt(f,10);if(c<1||c>12||d<1||d>31||g<0||g>23||M<0||M>59||E<0||E>60)return!1;let N=[31,28,31,30,31,30,31,31,30,31,30,31];if((p%4===0&&p%100!==0||p%400===0)&&(N[1]=29),d>N[c-1])return!1;let m=new Date(e);return!isNaN(m.getTime())}var ce=u({name:"stringDatetime",methodName:"datetime",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:gr(r,e?.strict),code:"FORMAT_DATETIME",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_DATETIME"};return e?.messageFactory?.(s)||`${n} must be a valid ISO 8601 datetime`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid ISO 8601 datetime`,params:[e]})});var yr=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,de=u({name:"stringIpv4",methodName:"ipv4",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IPv4 address",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:yr.test(r),code:"FORMAT_IPV4",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IPV4"}),params:[e]}}});var Tr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,me=u({name:"stringIpv6",methodName:"ipv6",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IPv6 address",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Tr.test(r),code:"FORMAT_IPV6",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IPV6"}),params:[e]}}});var xr=/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/,ge=u({name:"stringHostname",methodName:"hostname",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid hostname",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"||r.length>253?!1:xr.test(r),code:"FORMAT_HOSTNAME",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_HOSTNAME"}),params:[e]}}});var br=/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.[0-9]{1,3})?$/,Or=/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/,ye=u({name:"stringTime",methodName:"time",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid time format (HH:MM:SS)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:(e?.allowMilliseconds===!1?Or:br).test(r),code:"FORMAT_TIME",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_TIME"}),params:[e]}}});var Er=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/,Te=u({name:"stringDuration",methodName:"duration",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid ISO 8601 duration",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Er.test(r),code:"FORMAT_DURATION",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_DURATION"}),params:[e]}}});var Mr=/^(\/([^~]|(~[01]))*)*$/,xe=u({name:"stringJsonPointer",methodName:"jsonPointer",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid JSON Pointer (RFC 6901)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Mr.test(r),code:"FORMAT_JSON_POINTER",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_JSON_POINTER"}),params:[e]}}});var Nr=/^[A-Za-z0-9+/]*={0,2}$/,Sr=/^[A-Za-z0-9\-_]*={0,2}$/,be=u({name:"stringBase64",methodName:"base64",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:r===""?!0:r.length%4!==0?!1:(e?.urlSafe?Sr:Nr).test(r),code:"FORMAT_BASE64",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_BASE64"};return e?.messageFactory?.(s)||`${n} must be a valid base64 encoded string`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid base64 encoded string`,params:[e]})});var Ar=/^[a-zA-Z][a-zA-Z0-9+.-]*:(?:\/\/)?[^\s]*$/;function Rr(e){if(!Ar.test(e)||/[\x00-\x1F\x7F\s]/.test(e))return!1;try{return new URL(e),!0}catch{let t=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);if(!t)return!1;let[,o,r]=t;return!(!o||o.length===0||!r||r.length===0)}}var Oe=u({name:"stringIri",methodName:"iri",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IRI (RFC 3987)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Rr(r),code:"FORMAT_IRI",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IRI"}),params:[e]}}});function Pr(e){if(e==="")return!0;if(/[\x00-\x1F\x7F]/.test(e))return!1;let t=e.split(/[?#]/)[0];if(/\s/.test(t))return!1;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))try{return new URL(e),!0}catch{return/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/.test(e)}return e.startsWith("//")?e.length>2&&!e.slice(2).includes("//"):e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("?")||e.startsWith("#")?!0:!e.split(/[/?#]/)[0].includes(":")}var Ee=u({name:"stringIriReference",methodName:"iriReference",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IRI-reference (RFC 3987)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Pr(r),code:"FORMAT_IRI_REFERENCE",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IRI_REFERENCE"}),params:[e]}}});function Cr(e){let t=!1,o=0;for(;o<e.length;){let r=e[o];if(r==="{"){if(t)return!1;if(t=!0,o++,o<e.length){let i=e[o];"+#/;?&=,!@|".includes(i)&&o++}let n=!1,s=o;for(;o<e.length&&e[o]!=="}";){let i=e[o];if(/[a-zA-Z0-9_%]/.test(i))n=!0;else if(i==="."){if(o===s)return!1}else if(i===":"){o++;let a=0;for(;o<e.length&&/\d/.test(e[o])&&a<4;)o++,a++;if(a===0)return!1;continue}else if(i==="*"){if(o++,o<e.length&&e[o]!=="}"&&e[o]!==",")return!1;continue}else if(i===","){if(!n)return!1;n=!1,s=o+1}else return!1;o++}if(o>=e.length||!n)return!1;if(e[o]==="}")t=!1;else return!1}else if(r==="}"){if(!t)return!1;t=!1}else if(r==="{"||r==="}")return!1;o++}return!t}var Me=u({name:"stringUriTemplate",methodName:"uriTemplate",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid URI Template (RFC 6570)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Cr(r),code:"FORMAT_URI_TEMPLATE",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_URI_TEMPLATE"}),params:[e]}}});function Ir(e){let t=e.match(/^(\d+)(.*)$/);if(!t)return!1;let[,o,r]=t;return o.length>1&&o[0]==="0"?!1:r===""||r==="#"?!0:r.startsWith("/")?/^(\/([^~]|(~[01]))*)*$/.test(r):!1}var Ne=u({name:"stringRelativeJsonPointer",methodName:"relativeJsonPointer",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid Relative JSON Pointer",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Ir(r),code:"FORMAT_RELATIVE_JSON_POINTER",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_RELATIVE_JSON_POINTER"}),params:[e]}}});var Fr=/^[A-Za-z0-9+/]*={0,2}$/,hr=/^[A-Z2-7]*={0,6}$/,jr=/^[01\s]*$/;function wr(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Lr(e){return!0}function _r(e){let t=e.split(/\r?\n/);for(let o of t){if(o.length>76)return!1;let r=0;for(;r<o.length;)if(o[r]==="="){if(r===o.length-1)break;if(r+2<o.length){let n=o.substring(r+1,r+3);if(!/^[0-9A-Fa-f]{2}$/.test(n))return!1;r+=3}else return!1}else r++}return!0}function Vr(e,t){switch(t.toLowerCase()){case"base64":return e===""?!0:e.length%4!==0?!1:Fr.test(e);case"base32":return e===""?!0:e.length%8!==0?!1:hr.test(e);case"binary":return jr.test(e);case"7bit":return wr(e);case"8bit":return Lr(e);case"quoted-printable":return _r(e);default:return!0}}var Se=u({name:"stringContentEncoding",methodName:"contentEncoding",allowedTypes:["string"],category:"standard",impl:(e,t)=>({check:n=>typeof n!="string"?!1:Vr(n,e),code:"CONTENT_ENCODING",getErrorMessage:(n,s)=>{let i={path:s,value:n,code:"CONTENT_ENCODING"};return t?.messageFactory?.(i)||`${s} must be valid ${e} encoded content`},messageFactory:n=>t?.messageFactory?.(n)||`${n.path} must be valid ${e} encoded content`,params:[e,t]})});function $r(e,t){try{if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf-8");if(typeof atob<"u")return atob(e)}return e}catch{return null}}var j={"application/json":e=>{try{return JSON.parse(e),!0}catch{return!1}},"text/html":e=>/<\/?[a-z][\s\S]*>/i.test(e),"text/xml":e=>/^<\?xml[^>]*\?>|^<[a-zA-Z][\s\S]*>[\s\S]*<\/[a-zA-Z][\s\S]*>$/m.test(e.trim()),"text/plain":()=>!0,"text/css":e=>/[a-zA-Z-]+\s*:\s*[^;]+;?|\.[a-zA-Z-]+\s*\{|#[a-zA-Z-]+\s*\{|[a-zA-Z]+\s*\{/.test(e),"text/javascript":e=>/function\s+\w+\s*\(|const\s+\w+|let\s+\w+|var\s+\w+|=>\s*{|class\s+\w+/.test(e),"application/xml":e=>j["text/xml"](e),"application/pdf":e=>e.startsWith("%PDF"),"image/png":e=>{if(typeof Buffer<"u"){let t=Buffer.from(e,"binary");return t.length>=8&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71}return e.charCodeAt(0)===137&&e.charCodeAt(1)===80&&e.charCodeAt(2)===78&&e.charCodeAt(3)===71},"image/jpeg":e=>{if(typeof Buffer<"u"){let t=Buffer.from(e,"binary");return t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255}return e.charCodeAt(0)===255&&e.charCodeAt(1)===216&&e.charCodeAt(2)===255},"image/gif":e=>e.startsWith("GIF87a")||e.startsWith("GIF89a"),"image/svg+xml":e=>/<svg[^>]*>[\s\S]*<\/svg>/i.test(e)};function Dr(e,t,o){let r=o?$r(e,o):e;if(r===null)return!1;let n=j[t.toLowerCase()];return n?n(r):t.startsWith("text/")?!0:t.startsWith("application/")&&t.includes("json")?j["application/json"](r):t.startsWith("application/")&&t.includes("xml")?j["application/xml"](r):!0}var Ae=u({name:"stringContentMediaType",methodName:"contentMediaType",allowedTypes:["string"],category:"standard",impl:(e,t)=>({check:n=>typeof n!="string"?!1:Dr(n,e,t?.encoding),code:"CONTENT_MEDIA_TYPE",getErrorMessage:(n,s)=>{let i={path:s,value:n,code:"CONTENT_MEDIA_TYPE"};return t?.messageFactory?.(i)||`${s} must be valid ${e} content${t?.encoding?` (${t.encoding} encoded)`:""}`},messageFactory:n=>t?.messageFactory?.(n)||`${n.path} must be valid ${e} content${t?.encoding?` (${t.encoding} encoded)`:""}`,params:[e,t]})});var kr="numberMin",Ur=["number"],Re=u({name:"numberMin",methodName:"min",allowedTypes:Ur,category:"standard",impl:(e,t)=>{let o=t?.code||kr,r=t?.exclusive||!1,n=t?.messageFactory||(s=>s.exclusive?`Value must be greater than ${s.min}, but got ${s.actual}`:`Value must be at least ${s.min}, but got ${s.actual}`);if(typeof e!="number"||isNaN(e))throw new Error(`Invalid minValue: ${e}`);return{check:s=>typeof s!="number"?!0:r?s>e:s>=e,code:o,getErrorMessage:(s,i)=>n({path:i,value:s,code:o,min:e,actual:s,exclusive:r}),params:[e,t]}}});var qr="numberMax",Br=["number"],Pe=u({name:"numberMax",methodName:"max",allowedTypes:Br,category:"standard",impl:(e,t)=>{let o=t?.code||qr,r=t?.exclusive||!1,n=t?.messageFactory||(s=>s.exclusive?`Value must be less than ${s.max}, but got ${s.actual}`:`Value must be at most ${s.max}, but got ${s.actual}`);if(typeof e!="number"||isNaN(e))throw new Error(`Invalid maxValue: ${e}`);return{check:s=>typeof s!="number"?!0:r?s<e:s<=e,code:o,getErrorMessage:(s,i)=>n({path:i,value:s,code:o,max:e,actual:s,exclusive:r}),params:[e,t]}}});var Ce="number",Jr="numberInteger",zr=()=>"Value must be an integer",Zr=[Ce],Ie=u({name:"numberInteger",methodName:"integer",allowedTypes:Zr,category:"standard",impl:e=>{let t=e?.code||Jr,o=e?.messageFactory||(r=>zr());return{check:r=>typeof r!==Ce?!0:Number.isInteger(r),code:t,getErrorMessage:(r,n)=>o({path:n,value:r,code:t}),params:e?[e]:[]}}});var Wr="not_multiple";function Yr(e){return e.divisor?`Value must be a multiple of ${e.divisor}`:"Value must be a multiple of the specified divisor"}var vr=["number"],Fe=u({name:"numberMultipleOf",methodName:"multipleOf",allowedTypes:vr,category:"standard",impl:(e,t)=>{if(typeof e!="number"||e===0)throw new Error(`Invalid divisor: ${e}. Must be a non-zero number.`);let o=t?.code||Wr,r=t?.messageFactory||Yr;return{check:n=>typeof n!="number"?!0:n%e===0,code:o,getErrorMessage:(n,s)=>r({path:s,value:n,code:o,divisor:e}),params:[e,t]}}});var Gr="arrayUnique",Hr=()=>"Array must contain unique values",Xr=["array"],he=u({name:"arrayUnique",methodName:"unique",allowedTypes:Xr,category:"standard",impl:e=>{let t=e?.code||Gr,o=e?.messageFactory||(r=>Hr());return{check:r=>{if(!Array.isArray(r))return!0;let n=r.length;if(n<=10)for(let s=0;s<n;s++){let i=r[s];for(let a=s+1;a<n;a++)if(i===r[a])return!1}else{let s=new Set;for(let i=0;i<n;i++){let a=r[i];if(s.has(a))return!1;s.add(a)}}return!0},code:t,getErrorMessage:(r,n)=>o({path:n,value:r,code:t}),params:e?[e]:[]}}});var Kr="arrayMinLength",Qr=["array"],je=u({name:"arrayMinLength",methodName:"minLength",allowedTypes:Qr,category:"standard",impl:(e,t)=>{let o=t?.code||Kr,r=t?.messageFactory||(n=>`Array must have at least ${n.min} elements, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid minLength: ${e}`);return{check:n=>Array.isArray(n)?n.length>=e:!0,code:o,getErrorMessage:(n,s)=>{let i=Array.isArray(n)?n.length:0;return r({path:s,value:n,code:o,min:e,actual:i})},params:[e,t]}}});var en="arrayMaxLength",tn=["array"],we=u({name:"arrayMaxLength",methodName:"maxLength",allowedTypes:tn,category:"standard",impl:(e,t)=>{let o=t?.code||en,r=t?.messageFactory||(n=>`Array must have at most ${n.max} elements, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid maxLength: ${e}`);return{check:n=>Array.isArray(n)?n.length<=e:!0,code:o,getErrorMessage:(n,s)=>{let i=Array.isArray(n)?n.length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var rn=(e,t)=>{if(t.type)switch(t.type){case"string":if(typeof e!="string")return!1;break;case"number":if(typeof e!="number")return!1;break;case"boolean":if(typeof e!="boolean")return!1;break;case"array":if(!Array.isArray(e))return!1;break;case"object":if(!e||typeof e!="object"||Array.isArray(e))return!1;break;case"null":if(e!==null)return!1;break}return!(typeof e=="string"&&(t.minLength&&e.length<t.minLength||t.maxLength&&e.length>t.maxLength||t.pattern&&!new RegExp(t.pattern).test(e))||typeof e=="number"&&(t.minimum!==void 0&&e<t.minimum||t.maximum!==void 0&&e>t.maximum||t.multipleOf&&e%t.multipleOf!==0)||t.enum&&!t.enum.includes(e)||t.const!==void 0&&e!==t.const)},Le=u({name:"arrayContains",methodName:"contains",allowedTypes:["array"],category:"standard",impl:e=>({check:t=>Array.isArray(t)?typeof e!="object"||e===null||Array.isArray(e)?t.includes(e):"validator"in e&&typeof e.validator=="function"?t.some(o=>e.validator(o)):typeof e=="object"&&e!==null?t.some(o=>rn(o,e)):!1:!1,code:"ARRAY_CONTAINS",getErrorMessage:(t,o)=>typeof e=="object"&&e!==null&&"message"in e?e.message||`${o} must contain at least one matching item`:typeof e!="object"||e===null||Array.isArray(e)?`${o} must contain ${JSON.stringify(e)}`:`${o} must contain at least one item matching the schema`,params:[e]})});var nn="objectMinProperties",on=["object"],_e=u({name:"objectMinProperties",methodName:"minProperties",allowedTypes:on,category:"standard",impl:(e,t)=>{let o=t?.code||nn,r=t?.messageFactory||(n=>`Must have at least ${n.min} properties, but has ${n.actual}`);if(typeof e!="number"||isNaN(e)||e<0)throw new Error(`Invalid minValue: ${e}. Must be a non-negative number.`);return{check:n=>typeof n!="object"||n===null?!0:Object.keys(n).length>=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="object"&&n!==null?Object.keys(n).length:0;return r({path:s,value:n,code:o,min:e,actual:i})},params:[e,t]}}});var sn="objectMaxProperties",an=["object"],Ve=u({name:"objectMaxProperties",methodName:"maxProperties",allowedTypes:an,category:"standard",impl:(e,t)=>{let o=t?.code||sn,r=t?.messageFactory||(n=>`Must have at most ${n.max} properties, but has ${n.actual}`);if(typeof e!="number"||isNaN(e)||e<0)throw new Error(`Invalid maxValue: ${e}. Must be a non-negative number.`);return{check:n=>typeof n!="object"||n===null?!0:Object.keys(n).length<=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="object"&&n!==null?Object.keys(n).length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var un="objectAdditionalProperties",ln=["object"],$e=u({name:"objectAdditionalProperties",methodName:"additionalProperties",allowedTypes:ln,category:"standard",impl:(e,t)=>{let o=t?.code||un,r=t?.allowedProperties||[],n=e===!1||t?.strict===!0,s=typeof e=="object"?e:t?.additionalPropertiesSchema,i=t?.messageFactory||(a=>n?`Additional properties are not allowed: ${a.extraProperties.join(", ")}`:"Additional properties validation failed");return{check:a=>{if(typeof a!="object"||a===null)return!0;let f=Object.keys(a).filter(p=>!r.includes(p));if(n)return f.length===0;if(s)for(let p of f){let c=a[p];if(s.type){let d=s.type,g=typeof c;if(d==="string"&&g!=="string"||d==="number"&&g!=="number"||d==="boolean"&&g!=="boolean"||d==="object"&&(g!=="object"||c===null||Array.isArray(c))||d==="array"&&!Array.isArray(c))return!1}if(s.minLength&&typeof c=="string"&&c.length<s.minLength||s.maxLength&&typeof c=="string"&&c.length>s.maxLength||s.minimum!==void 0&&typeof c=="number"&&c<s.minimum||s.maximum!==void 0&&typeof c=="number"&&c>s.maximum)return!1}return!0},code:o,getErrorMessage:(a,l)=>{let p=(typeof a=="object"&&a!==null?Object.keys(a):[]).filter(d=>!r.includes(d));return i({path:l,value:a,code:o,extraProperties:p})},params:[e,t]}}});var De=u({name:"objectPropertyNames",methodName:"propertyNames",allowedTypes:["object"],category:"standard",impl:e=>({check:t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;let o=Object.keys(t);for(let r of o)if(e instanceof RegExp){if(!e.test(r))return!1}else if(typeof e=="string"){if(!new RegExp(e).test(r))return!1}else if(typeof e=="object"&&e!==null&&"validator"in e){if(!e.validator(r))return!1}else return!1;return!0},code:"PROPERTY_NAMES",getErrorMessage:(t,o)=>{let r=Object.keys(t||{}).filter(s=>e instanceof RegExp?!e.test(s):typeof e=="string"?!new RegExp(e).test(s):typeof e=="object"&&e!==null&&"validator"in e?!e.validator(s):!0);if(typeof e=="object"&&e!==null&&"message"in e&&e.message)return e.message;let n=e instanceof RegExp?e.toString():typeof e=="string"?`/${e}/`:"the specified pattern";return`${o} has invalid property names: ${r.join(", ")}. Property names must match ${n}`},params:[e]})});var ke=u({name:"objectPatternProperties",methodName:"patternProperties",allowedTypes:["object"],category:"standard",impl:e=>({check:t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;let o=Object.keys(t),r=Object.entries(e);for(let n of o){let s=t[n];for(let[i,a]of r)if(new RegExp(i).test(n)){let f=!1;if(typeof a=="function"?f=a(s):typeof a=="object"&&a!==null&&"validator"in a&&(f=a.validator(s)),!f)return!1;break}}return!0},code:"PATTERN_PROPERTIES",getErrorMessage:(t,o)=>{let r=Object.keys(t||{}),n=Object.entries(e),s=[];for(let i of r){let a=t[i];for(let[l,f]of n)if(new RegExp(l).test(i)){let c=!1,d;typeof f=="function"?c=f(a):typeof f=="object"&&f!==null&&"validator"in f&&(c=f.validator(a),d=f.message),c||(d?s.push(`${i}: ${d}`):s.push(`${i} (matching pattern ${l}) has invalid value`));break}}return s.length>0?`${o} has pattern property violations: ${s.join(", ")}`:`${o} has invalid pattern properties`},params:[e]})});var Ue=u({name:"objectDependentRequired",methodName:"dependentRequired",allowedTypes:["object"],category:"standard",impl:e=>({check:(t,o)=>{let r=o!==void 0?o:t;if(!r||typeof r!="object"||Array.isArray(r))return!0;let n=Object.entries(e);for(let[s,i]of n)if(s in r&&r[s]!==void 0){let a=Array.isArray(i)?i:i.required;for(let l of a)if(!(l in r)||r[l]===void 0)return!1}return!0},code:"DEPENDENT_REQUIRED",getErrorMessage:(t,o,r)=>{let n=r!==void 0?r:t,s=Object.entries(e),i=[];for(let[l,f]of s)if(l in n&&n[l]!==void 0){let p=Array.isArray(f)?f:f.required,c=Array.isArray(f)?void 0:f.message,d=p.filter(g=>!(g in n)||n[g]===void 0);d.length>0&&(c?i.push(c):i.push(`When '${l}' is present, the following properties are required: ${d.join(", ")}`))}let a=o&&o!==""?`${o}: `:"";return i.length>0?`${a}${i.join("; ")}`:`${a}Dependent required validation failed`},params:[e]})});var fn=(e,t)=>{if(t.type&&t.type==="object"&&(!e||typeof e!="object"||Array.isArray(e)))return!1;if(t.required&&Array.isArray(t.required)){for(let o of t.required)if(!(o in e)||e[o]===void 0)return!1}if(t.properties){for(let[o,r]of Object.entries(t.properties))if(o in e){let n=r;if(n.type){let s=e[o];switch(n.type){case"string":if(typeof s!="string"||n.minLength&&s.length<n.minLength||n.maxLength&&s.length>n.maxLength||n.pattern&&!new RegExp(n.pattern).test(s))return!1;break;case"number":if(typeof s!="number"||n.minimum!==void 0&&s<n.minimum||n.maximum!==void 0&&s>n.maximum)return!1;break;case"boolean":if(typeof s!="boolean")return!1;break;case"array":if(!Array.isArray(s)||n.minItems&&s.length<n.minItems||n.maxItems&&s.length>n.maxItems)return!1;break;case"object":if(!s||typeof s!="object"||Array.isArray(s))return!1;break}}if(n.enum&&!n.enum.includes(e[o])||n.const!==void 0&&e[o]!==n.const)return!1}}return!0},qe=u({name:"objectDependentSchemas",methodName:"dependentSchemas",allowedTypes:["object"],category:"standard",impl:e=>({check:(t,o)=>{let r=o!==void 0?o:t;if(!r||typeof r!="object"||Array.isArray(r))return!0;for(let[n,s]of Object.entries(e))if(n in r&&r[n]!==void 0){if("validator"in s&&typeof s.validator=="function"){if(!s.validator(r))return!1}else if(!fn(r,s))return!1}return!0},code:"DEPENDENT_SCHEMAS",getErrorMessage:(t,o,r)=>{let n=r!==void 0?r:t,s=[];for(let[a,l]of Object.entries(e))if(a in n&&n[a]!==void 0)if("validator"in l&&typeof l.validator=="function"){if(!l.validator(n)){let f=l.message||`Schema validation failed when '${a}' is present`;s.push(f)}}else{let f=l;if(f.required){let p=f.required.filter(c=>!(c in n)||n[c]===void 0);p.length>0&&s.push(`When '${a}' is present, the following properties are required: ${p.join(", ")}`)}s.length===0&&s.push(`Schema validation failed when '${a}' is present`)}let i=o&&o!==""?`${o}: `:"";return s.length>0?`${i}${s.join("; ")}`:`${i}Dependent schemas validation failed`},params:[e]})});var $=Object.freeze({valid:!0}),R=Object.freeze({valid:!1});function D(e,t=[],o){return{_validators:e,_transforms:t,validate:o||(r=>{for(let n=0;n<t.length;n++)if(!e[n].check(r,r))return R;return $})}}function k(e,t,o){return{check:t,name:e,inputType:o?.inputType,outputType:o?.outputType,metadata:o?{severity:o.severity||"error",async:o.async||!1}:void 0}}function Be(e,t,o,r){return{name:e,methodName:t,allowedTypes:o,category:"composable",createComposer(n,s){let i=[],a={add(f){return i.push(f),a},build(){return r(i,n,s)}},l=a;return l[t]=function(...f){return l.add(f)},l}}}function Je(e,t,o,r){let n=t.methodName,s=null,i=null;e[n]=function(...a){if(s||(s=t.createComposer(o,r)),s.add(a),e[n]=s[n],s){i=s.build();let l=e._executionPlan;if(!(l&&i&&typeof i.validate=="function")){if(i&&i._validators)for(let f of i._validators)l.addValidator(f.name,(p,c)=>{let d=f.check(p,p);return{valid:d,message:d?void 0:`Validation failed for ${f.name}`}})}}return e}}function ze(e,t,o,r){return{...Be(e,t,o,r),category:"composable-directly"}}function pn(e){switch(e){case"string":return{check:t=>t==null?!0:typeof t=="string",name:"stringType",messageFactory:()=>"Expected string",inputType:"string",outputType:"string",metadata:{severity:"error",async:!1}};case"number":return{check:t=>t==null?!0:typeof t=="number"&&!isNaN(t),name:"numberType",messageFactory:()=>"Expected number",inputType:"number",outputType:"number",metadata:{severity:"error",async:!1}};case"boolean":return{check:t=>t==null?!0:typeof t=="boolean",name:"booleanType",messageFactory:()=>"Expected boolean",inputType:"boolean",outputType:"boolean",metadata:{severity:"error",async:!1}};case"array":return{check:t=>t==null?!0:Array.isArray(t),name:"arrayType",messageFactory:()=>"Expected array",inputType:"array",outputType:"array",metadata:{severity:"error",async:!1}};case"object":return{check:t=>t==null?!0:typeof t=="object"&&t!==null&&!Array.isArray(t),name:"objectType",messageFactory:()=>"Expected object",inputType:"object",outputType:"object",metadata:{severity:"error",async:!1}};case"date":return{check:t=>t==null?!0:t instanceof Date,name:"dateType",messageFactory:()=>"Expected Date",inputType:"date",outputType:"date",metadata:{severity:"error",async:!1}};case"null":return{check:t=>t===null,name:"nullType",messageFactory:()=>"Expected null",inputType:"null",outputType:"null",metadata:{severity:"error",async:!1}};case"any":return{check:()=>!0,name:"anyType",messageFactory:()=>"",inputType:"any",outputType:"any",metadata:{severity:"error",async:!1}};default:return null}}function b(e,t,o,r){let n=r?.validators?[...r.validators]:[];if(!r&&e!=="union"){let a=pn(e);a&&n.push(a)}let s=r?.transforms?[...r.transforms]:[],i={_type:e,_fieldPath:t,_validators:n,_transforms:s,build(){return e==="union"&&n.length===0&&n.push({check:()=>!1,name:"unionGuard",messageFactory:()=>"No union type guards defined",inputType:"union",outputType:"union",metadata:{severity:"error",async:!1}}),{_validators:n,_transforms:s}}};return cn(i,e,t,o,n,s),i.refineString=()=>b("string",t,o,{validators:n,transforms:s}),i.refineNumber=()=>b("number",t,o,{validators:n,transforms:s}),i.refineBoolean=()=>b("boolean",t,o,{validators:n,transforms:s}),i.refineArray=()=>b("array",t,o,{validators:n,transforms:s}),i.refineObject=()=>b("object",t,o,{validators:n,transforms:s}),i.refineTuple=()=>b("tuple",t,o,{validators:n,transforms:s}),i.refineUnion=()=>b("union",t,o,{validators:n,transforms:s}),i.refineDate=()=>b("date",t,o,{validators:n,transforms:s}),i.refineAny=()=>b("any",t,o,{validators:n,transforms:s}),i}function cn(e,t,o,r,n,s){let i=Object.entries(r),a=i.length;for(let l=0;l<a;l++){let[,f]=i[l];if(!f||typeof f!="object")continue;if(f.category?.startsWith("composable")){if(f.allowedTypes&&!f.allowedTypes.includes(t))continue;Je(e,f,o,r);continue}if(typeof f.create!="function"||f.allowedTypes&&!f.allowedTypes.includes(t))continue;let{methodName:p,category:c="standard",name:d}=f,g=f.create();e[p]=function(...M){try{let E=g(...M);if(c==="transform"){let N=dn(E,M[0]);s.push(N)}else{let N=mn(E,o),w=gn(N,d||p,t,M,E);n.push(w)}}catch{}return e}}}function dn(e,t){return typeof e=="function"?t:e?.__isTransform?e.__transformFn:e?.__isCoerce?o=>e.coerce.coerceFn(o):e?.__isDefault?(o,r)=>e.default.applyDefault(o,r):e?.__isPreprocess?(o,r)=>e.preprocess.applyPreprocess(o,r):t||(o=>o)}function mn(e,t){return typeof e=="function"?(o,r)=>e(o,{path:t,allValues:r}).valid:e?.check?(o,r)=>e.check(o,r):()=>!1}function gn(e,t,o,r,n){let s={check:e,name:t,code:n?.code||t,pluginName:n?.pluginName||t,getErrorMessage:n?.getErrorMessage,messageFactory:r[r.length-1]?.messageFactory||n?.messageFactory||(()=>"Validation failed"),inputType:o,outputType:o,metadata:n?.metadata||{severity:"error",async:!1}};return n&&(n.shouldSkipAllValidation&&(s.shouldSkipAllValidation=n.shouldSkipAllValidation),n.shouldSkipValidation&&(s.shouldSkipValidation=n.shouldSkipValidation),n.shouldSkipFurtherValidation&&(s.shouldSkipFurtherValidation=n.shouldSkipFurtherValidation),n.skipForNull!==void 0&&(s.skipForNull=n.skipForNull),n.skipForUndefined!==void 0&&(s.skipForUndefined=n.skipForUndefined),n.__isRecursive&&(s.__isRecursive=n.__isRecursive),n.recursive&&(s.recursive=n.recursive)),s}function U(e,t){let o=b("string",e,t),r=b("number",e,t),n=b("boolean",e,t),s=b("array",e,t),i=b("object",e,t),a=b("union",e,t),l=b("tuple",e,t),f=b("date",e,t),p=b("any",e,t);return{string:o,number:r,boolean:n,date:f,array:s,tuple:l,union:a,object:i,any:p}}var Ze=Array.isArray,We=Object.freeze({code:"TUPLE_NOT_ARRAY",message:"Value must be an array"}),q=Object.freeze({code:"TUPLE_LENGTH_MISMATCH",prefix:"Tuple must have exactly",suffix:"elements, got"}),B=Object.freeze({code:"TUPLE_TOO_SHORT",prefix:"Tuple must have at least",suffix:"elements, got"}),Ye=ze("tupleBuilder","builder",["tuple"],(e,t,o)=>{let r=e[0]||[];if(r.length===0)return D([k("tupleBuilder",()=>!1,{inputType:"tuple",outputType:"tuple"})]);let n=[],s,i=r.length,a=r[i-1],l=a&&typeof a=="object"&&typeof a!="function"&&(Object.prototype.hasOwnProperty.call(a,"rest")||Object.keys(a).length===0),f={};l?(n=r.slice(0,-1),f=a,s=f.rest):n=r;let p=n.length,c=!!s,d=new Array(p);for(let m=0;m<p;m++){let y=U(`${t}[${m}]`,o),T=n[m](y);T&&typeof T.build=="function"?d[m]=T.build():d[m]=null}let g=null;if(s){let m=U(`${t}[rest]`,o),y=s(m);y&&typeof y.build=="function"&&(g=y.build())}let M=m=>{if(m.length!==p)return!1;for(let y=0;y<p;y++){let T=d[y];if(T&&!T.validate(m[y]).valid)return!1}return!0},E=m=>{let y=m.length;if(y<p)return!1;for(let T=0;T<p;T++){let O=d[T];if(O&&!O.validate(m[T]).valid)return!1}if(g&&y>p){for(let T=p;T<y;T++)if(!g.validate(m[T]).valid)return!1}return!0},N=k("tupleBuilder",m=>Ze(m)?c?E(m):M(m):!1,{inputType:"tuple",outputType:"tuple",severity:"error",async:!1});return D([N],[],m=>{if(!Ze(m))return{...R,errors:[{path:t,message:f.messageFactory?.notArray?f.messageFactory.notArray(m):We.message,code:We.code}]};let y=m.length;if(!c&&y!==p)return{...R,errors:[{path:t,message:f.messageFactory?.lengthMismatch?f.messageFactory.lengthMismatch(p,y):`${q.prefix} ${p} ${q.suffix} ${y}`,code:q.code}]};if(c&&y<p)return{...R,errors:[{path:t,message:f.messageFactory?.tooShort?f.messageFactory.tooShort(p,y):`${B.prefix} ${p} ${B.suffix} ${y}`,code:B.code}]};let T=[];for(let O=0;O<p;O++){let S=d[O];if(S){let L=m[O],A=S.validate(L,m);if(!A.isValid()){let J=`${t}[${O}]`;if(A.errors&&A.errors.length>0)for(let Ge of A.errors)T.push({...Ge,path:J});else T.push({path:J,message:`Validation failed for element ${O}`,code:"ELEMENT_INVALID"})}}}if(g&&y>p)for(let O=p;O<y;O++){let S=g.validate(m[O]);if(!S.valid&&S.errors){let L=`${t}[${O}]`;for(let A of S.errors)T.push({...A,path:L})}}return T.length>0?{...R,errors:T}:$})});var ve=u({name:"readOnlyWriteOnly",methodName:"readOnly",allowedTypes:["string","number","boolean","date","array","object"],category:"context",impl:(e={})=>({check:(t,o,r)=>!((r?.operation||"write")==="write"&&t!==void 0&&r?.isUpdate),code:"READ_ONLY",getErrorMessage:(t,o)=>e.errorMessage||`${o} is read-only and cannot be modified`,params:["readOnly",e]})}),As=u({name:"writeOnly",methodName:"writeOnly",allowedTypes:["string","number","boolean","date","array","object"],category:"context",impl:(e={})=>({check:(t,o,r)=>!((r?.operation||"write")==="read"&&t!==void 0),code:"WRITE_ONLY",getErrorMessage:(t,o)=>e.errorMessage||`${o} is write-only and cannot be read`,params:["writeOnly",e]})});var yn=[K,Q,ee,te,re,ne,oe,se,ie,ae,ue,le,fe,pe,ce,de,me,ge,ye,Te,xe,be,Oe,Ee,Me,Ne,Se,Ae,Re,Pe,Ie,Fe,he,je,we,Le,_e,Ve,$e,De,ke,Ue,qe,Ye,ve],Tn={...F,name:"jsonSchemaFullFeature",extendBuilder:e=>{for(let t of yn)e.use(t);return e.use(F),e}};0&&(module.exports={jsonSchemaFullFeaturePlugin});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ge=(e,t,o)=>{if(!e.startsWith("#"))throw new Error(`External $ref not supported: ${e}`);let r=e.slice(1).split("/"),n=t;for(let s of r)if(s&&(s==="definitions"||s==="$defs"?n=n.definitions||n.$defs||{}:n=n[s],n===void 0))throw new Error(`Cannot resolve $ref: ${e}`);return n},P=(e,t,o)=>{if(!e.$ref)return e;if(!t)throw new Error("Root schema required for $ref resolution");return Ge(e.$ref,t,o)};var He=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Ke=/^\d{4}-\d{2}-\d{2}$/,Qe=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,et=/^\d{2}:\d{2}:\d{2}(\.\d{3})?$/,tt=/^P(?:(\d+Y)?(\d+M)?(\d+D)?)(?:T(\d+H)?(\d+M)?(\d+(?:\.\d+)?S)?)?$/,rt=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/,nt=/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,ot=/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,st=/^(\/([^\/~]|~[01])*)*$/,it=/^[0-9]+#?$/,at=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,ut=/^([a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*|\/[^\s]*|[^\s:\/]+)$/,lt=/^[^{}]*(\{[^{}]+\}[^{}]*)*$/;var ft={email:e=>typeof e!="string"||e.includes("..")?!1:He.test(e),url:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return!1}},uri:e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{let t=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);if(!t)return!1;let[,o,r]=t;return r.startsWith("//")?r.length>2&&r.substring(2).length>0:r.length>0}},"uri-reference":e=>{if(typeof e!="string")return!1;try{return new URL(e),!0}catch{return e.includes(":")&&!e.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:/)?!1:e.startsWith("/")||!e.includes(":")}},uuid:e=>typeof e!="string"?!1:Xe.test(e),date:e=>{if(typeof e!="string"||!Ke.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())&&t.toISOString().startsWith(e)},"date-time":e=>{if(typeof e!="string"||!Qe.test(e))return!1;let t=new Date(e);return!isNaN(t.getTime())},time:e=>{if(typeof e!="string"||!et.test(e))return!1;let t=e.split(":");if(t.length<3)return!1;let o=parseInt(t[0],10),r=parseInt(t[1],10),n=parseFloat(t[2]);return o>=0&&o<=23&&r>=0&&r<=59&&n>=0&&n<60},duration:e=>typeof e!="string"?!1:tt.test(e),ipv4:e=>{if(typeof e!="string"||!rt.test(e))return!1;let t=e.split(".");return t.length===4&&t.every(o=>{let r=parseInt(o,10);return r>=0&&r<=255})},ipv6:e=>typeof e!="string"?!1:nt.test(e)||e.includes("::"),hostname:e=>typeof e!="string"||e.length>253?!1:ot.test(e),"json-pointer":e=>typeof e!="string"?!1:st.test(e),"relative-json-pointer":e=>typeof e!="string"?!1:it.test(e),iri:e=>typeof e!="string"?!1:at.test(e),"iri-reference":e=>typeof e!="string"?!1:ut.test(e),"uri-template":e=>typeof e!="string"?!1:lt.test(e),regex:e=>{if(typeof e!="string")return!1;try{return new RegExp(e),!0}catch{return!1}}},J=(e,t,o)=>{if(o&&o[t]){let n=o[t];if(typeof n=="function")return n(e)}let r=ft[t];return r?r(e):!0};var C=(e,t)=>{if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=typeof t)return!1;if(typeof e!="object")return e===t;if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e))return e.length!==t.length?!1:e.every((n,s)=>C(n,t[s]));let o=Object.keys(e),r=Object.keys(t);return o.length!==r.length?!1:o.every(n=>C(e[n],t[n]))},pt=e=>{for(let t=0;t<e.length;t++)for(let o=t+1;o<e.length;o++)if(C(e[t],e[o]))return!0;return!1},z=(e,t)=>{switch(t){case"null":return e===null;case"boolean":return typeof e=="boolean";case"string":return typeof e=="string";case"number":return typeof e=="number"&&!isNaN(e);case"integer":return typeof e=="number"&&Number.isInteger(e)&&!isNaN(e);case"array":return Array.isArray(e);case"object":return typeof e=="object"&&e!==null&&!Array.isArray(e);default:return!1}},ct=(e,t)=>t.some(o=>z(e,o)),dt=(e,t,o)=>!(t.minLength!==void 0&&e.length<t.minLength||t.maxLength!==void 0&&e.length>t.maxLength||t.pattern&&!new RegExp(t.pattern).test(e)||t.format&&!J(e,t.format,o)||t.contentEncoding&&t.contentEncoding==="base64"&&(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length>0&&e.length%4!==0)),mt=(e,t)=>{if(t.minimum!==void 0&&e<t.minimum||t.maximum!==void 0&&e>t.maximum)return!1;if(t.exclusiveMinimum!==void 0){if(typeof t.exclusiveMinimum=="number"){if(e<=t.exclusiveMinimum)return!1}else if(t.exclusiveMinimum===!0&&t.minimum!==void 0&&e<=t.minimum)return!1}if(t.exclusiveMaximum!==void 0){if(typeof t.exclusiveMaximum=="number"){if(e>=t.exclusiveMaximum)return!1}else if(t.exclusiveMaximum===!0&&t.maximum!==void 0&&e>=t.maximum)return!1}if(t.multipleOf!==void 0){let o=e/t.multipleOf;if(!Number.isInteger(o))return!1}return!0},gt=(e,t,o,r)=>{if(t.minItems!==void 0&&e.length<t.minItems||t.maxItems!==void 0&&e.length>t.maxItems||t.uniqueItems&&pt(e))return!1;if(t.items){if(Array.isArray(t.items))for(let n=0;n<e.length;n++)if(n<t.items.length){if(typeof t.items[n]=="boolean"){if(!t.items[n])return!1}else if(!x(e[n],t.items[n],o,r))return!1}else{if(t.additionalItems===!1)return!1;if(t.additionalItems&&typeof t.additionalItems=="object"&&!x(e[n],t.additionalItems,o,r))return!1}else for(let n of e)if(typeof t.items=="boolean"){if(!t.items)return!1}else if(!x(n,t.items,o,r))return!1}if(t.contains!==void 0){if(typeof t.contains=="boolean"){if(!t.contains||e.length===0)return!1}else if(!e.some(s=>x(s,t.contains,o,r)))return!1}return!0},yt=(e,t,o,r)=>{let n=Object.keys(e);if(t.minProperties!==void 0&&n.length<t.minProperties||t.maxProperties!==void 0&&n.length>t.maxProperties)return!1;if(t.required){for(let s of t.required)if(!(s in e))return!1}if(t.properties)for(let[s,i]of Object.entries(e)){let a=t.properties[s];if(a&&typeof a=="object"&&!x(i,a,o,r))return!1}if(t.patternProperties){for(let[s,i]of Object.entries(e))for(let[a,l]of Object.entries(t.patternProperties))if(new RegExp(a).test(s)&&typeof l=="object"&&!x(i,l,o,r))return!1}if(t.additionalProperties===!1){let s=new Set([...t.properties?Object.keys(t.properties):[],...n.filter(i=>t.patternProperties?Object.keys(t.patternProperties).some(a=>new RegExp(a).test(i)):!1)]);for(let i of n)if(!s.has(i))return!1}else if(t.additionalProperties&&typeof t.additionalProperties=="object"){let s=new Set(t.properties?Object.keys(t.properties):[]);for(let[i,a]of Object.entries(e))if(!s.has(i)&&!x(a,t.additionalProperties,o,r))return!1}if(t.propertyNames!==void 0){if(typeof t.propertyNames=="boolean"){if(!t.propertyNames&&n.length>0)return!1}else for(let s of n)if(!x(s,t.propertyNames,o,r))return!1}return!0},x=(e,t,o,r)=>{if(t.$ref&&r&&(t=P(t,r)),e===void 0)return!1;if(e===null){if(t.type==="null"||Array.isArray(t.type)&&t.type.includes("null"))return!0;if(!t.enum&&t.const===void 0)return!1}if(t.type){if(Array.isArray(t.type)){if(!ct(e,t.type))return!1}else if(!z(e,t.type))return!1}if(t.const!==void 0)return C(e,t.const);if(t.enum)return t.enum.some(n=>C(e,n));if(typeof e=="string"){if(!dt(e,t,o))return!1}else if(typeof e=="number"){if(!mt(e,t))return!1}else if(Array.isArray(e)){if(!gt(e,t,o,r))return!1}else if(typeof e=="object"&&e!==null&&!yt(e,t,o,r))return!1;if(t.allOf)for(let n of t.allOf){if(typeof n=="boolean"){if(!n)return!1;continue}if(!x(e,n,o,r))return!1}if(t.anyOf&&!t.anyOf.some(s=>typeof s=="boolean"?s:x(e,s,o,r)))return!1;if(t.oneOf){let n=0;for(let s of t.oneOf){if(typeof s=="boolean"){s&&n++;continue}x(e,s,o,r)&&n++}if(n!==1)return!1}if(t.not){if(typeof t.not=="boolean"){if(t.not)return!1}else if(x(e,t.not,o,r))return!1}if(t.if){let n=typeof t.if=="boolean"?t.if:x(e,t.if,o,r);if(n&&t.then!==void 0)return typeof t.then=="boolean"?t.then:x(e,t.then,o,r);if(!n&&t.else!==void 0)return typeof t.else=="boolean"?t.else:x(e,t.else,o,r)}return!0};var Z=(e,t="",o)=>{let r=[],n=e.$ref&&o?P(e,o):e;if(t===""&&(n.oneOf||n.anyOf||n.allOf)){let s=W(n,{},""),i=n.type?I(Array.isArray(n.type)?n.type[0]:n.type):"string";return r.push({path:"",type:i,constraints:s}),r}if(n.type==="object"&&t===""){let s=Ot(n);Object.keys(s).length>0&&r.push({path:"",type:"object",constraints:s})}if(n.properties){for(let[s,i]of Object.entries(n.properties))if(typeof i=="object"){let a=t?`${t}.${s}`:s,l=h(s,i,a,n,o);r.push(...l)}}if(n.patternProperties){for(let[s,i]of Object.entries(n.patternProperties))if(typeof i=="object"){let a=t?`${t}.*`:"*",l=h(s,i,a,n,o);r.push(...l)}}return r},h=(e,t,o,r,n)=>{let s=[],i=t.$ref&&n?P(t,n):t,{type:a,nullable:l,multipleTypes:f}=Tt(i),p=W(i,r,e),c={path:o,type:a,nullable:l,multipleTypes:f,constraints:p};if(s.push(c),(i.type==="object"||Array.isArray(i.type)&&i.type.includes("object"))&&i.properties){for(let[d,g]of Object.entries(i.properties))if(typeof g=="object"){let M=`${o}.${d}`,E=h(d,g,M,i,n);s.push(...E)}}if((i.type==="array"||Array.isArray(i.type)&&i.type.includes("array"))&&i.items&&!Array.isArray(i.items)&&typeof i.items=="object"){let d=`${o}[*]`,g=h(`${e}[*]`,i.items,d,i,n);s.push(...g)}return s},Tt=e=>{let t="string",o=!1,r;if(e.type)if(Array.isArray(e.type)){let n=e.type.filter(i=>i!=="null");e.type.includes("null")&&(o=!0),n.length===1?t=I(n[0]):n.length>1&&(t=I(n[0]),r=n.map(I))}else t=I(e.type);else e.enum?t=xt(e.enum):e.const!==void 0&&(t=bt(e.const));return{type:t,nullable:o,multipleTypes:r}},I=e=>{switch(e){case"string":return"string";case"number":return"number";case"integer":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";case"null":return"null";default:return"string"}},xt=e=>{if(e.length===0)return"string";let t=e[0];return typeof t=="string"?"string":typeof t=="number"?"number":typeof t=="boolean"?"boolean":Array.isArray(t)?"array":typeof t=="object"&&t!==null?"object":"string"},bt=e=>typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":e===null?"null":"string",Ot=e=>{let t={};return e.additionalProperties!==void 0&&(t.additionalProperties=e.additionalProperties),e.propertyNames&&(t.propertyNames=e.propertyNames),e.minProperties!==void 0&&(t.minProperties=e.minProperties),e.maxProperties!==void 0&&(t.maxProperties=e.maxProperties),e.patternProperties&&(t.patternProperties=e.patternProperties),e.dependentRequired&&(t.dependentRequired=e.dependentRequired),t},W=(e,t,o)=>{let r={};return t.required&&t.required.includes(o)&&(r.required=!0),e.minLength!==void 0&&(r.minLength=e.minLength),e.maxLength!==void 0&&(r.maxLength=e.maxLength),e.pattern&&(r.pattern=e.pattern),e.format&&(r.format=e.format),e.contentEncoding&&(r.contentEncoding=e.contentEncoding),e.contentMediaType&&(r.contentMediaType=e.contentMediaType),e.minimum!==void 0&&(r.min=e.minimum),e.maximum!==void 0&&(r.max=e.maximum),e.exclusiveMinimum!==void 0&&(typeof e.exclusiveMinimum=="number"?(r.min=e.exclusiveMinimum,r.exclusiveMin=!0):r.exclusiveMin=e.exclusiveMinimum),e.exclusiveMaximum!==void 0&&(typeof e.exclusiveMaximum=="number"?(r.max=e.exclusiveMaximum,r.exclusiveMax=!0):r.exclusiveMax=e.exclusiveMaximum),e.multipleOf!==void 0&&(r.multipleOf=e.multipleOf),(e.type==="integer"||Array.isArray(e.type)&&e.type.includes("integer"))&&(r.integer=!0),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.uniqueItems&&(r.uniqueItems=e.uniqueItems),e.items&&(r.items=e.items),e.contains&&(r.contains=e.contains),e.minProperties!==void 0&&(r.minProperties=e.minProperties),e.maxProperties!==void 0&&(r.maxProperties=e.maxProperties),e.additionalProperties!==void 0&&(r.additionalProperties=e.additionalProperties),e.propertyNames&&(r.propertyNames=e.propertyNames),e.patternProperties&&(r.patternProperties=e.patternProperties),e.enum&&(r.enum=e.enum),e.const!==void 0&&(r.const=e.const),e.allOf&&(r.allOf=e.allOf),e.anyOf&&(r.anyOf=e.anyOf),e.oneOf&&(r.oneOf=e.oneOf),e.not&&(r.not=e.not),e.if&&(r.if=e.if),e.then&&(r.then=e.then),e.else&&(r.else=e.else),r},Y=(e,t)=>o=>{let r=o;if(e.multipleTypes&&e.multipleTypes.length>1){let n=e.multipleTypes.map(s=>({type:s,constraints:Mt(e.constraints,s)}));return o.oneOf(n.map(s=>i=>Et(i,s.type,s.constraints,t)))}return r=v(r,e.type),e.nullable&&(r=r.nullable()),r=G(r,e.constraints,t),r},v=(e,t)=>{switch(t){case"string":return e.string||e;case"number":return e.number||e;case"boolean":return e.boolean||e;case"array":return e.array||e;case"object":return e.object||e;case"date":return e.date||e;case"null":return e.literal(null);default:return e}},Et=(e,t,o,r)=>{let n=v(e,t);return G(n,o,r)},Mt=(e,t)=>{let o={};return t==="string"&&(e.minLength!==void 0&&(o.minLength=e.minLength),e.maxLength!==void 0&&(o.maxLength=e.maxLength),e.pattern&&(o.pattern=e.pattern),e.format&&(o.format=e.format)),(t==="number"||t==="integer")&&(e.min!==void 0&&(o.min=e.min),e.max!==void 0&&(o.max=e.max),e.exclusiveMin!==void 0&&(o.exclusiveMin=e.exclusiveMin),e.exclusiveMax!==void 0&&(o.exclusiveMax=e.exclusiveMax)),t==="array"&&(e.minItems!==void 0&&(o.minItems=e.minItems),e.maxItems!==void 0&&(o.maxItems=e.maxItems),e.uniqueItems&&(o.uniqueItems=e.uniqueItems),e.items&&(o.items=e.items)),e.enum&&(o.enum=e.enum),e.const!==void 0&&(o.const=e.const),e.required!==void 0&&(o.required=e.required),o},G=(e,t,o)=>{if(t.const!==void 0)return e.literal?e.literal(t.const):e;if(t.minLength!==void 0&&e.min&&(e=e.min(t.minLength)),t.maxLength!==void 0&&e.max&&(e=e.max(t.maxLength)),t.pattern&&e.pattern&&(e=e.pattern(t.pattern)),t.format)if(o&&o[t.format])e.refine&&(e=e.refine(o[t.format]));else switch(t.format){case"email":e=e.email?e.email():e;break;case"uri":case"url":e=e.url?e.url():e;break;case"uuid":e=e.uuid?e.uuid():e;break;case"date-time":case"datetime":e=e.datetime?e.datetime():e;break}if(t.min!==void 0&&e.min){let r=t.exclusiveMin===!0||typeof t.exclusiveMin=="number";t.exclusiveMin!==void 0?r?e=e.min(t.min,{exclusive:!0}):e=e.min(t.min,{exclusive:!1}):e=e.min(t.min)}if(t.max!==void 0&&e.max){let r=t.exclusiveMax===!0||typeof t.exclusiveMax=="number";t.exclusiveMax!==void 0&&r?e=e.max(t.max,{exclusive:!0}):e=e.max(t.max)}return t.multipleOf!==void 0&&e.multipleOf&&(e=e.multipleOf(t.multipleOf)),t.items&&Array.isArray(t.items)&&e.tupleBuilder?e.tupleBuilder(t.items):(t.minItems!==void 0&&e.minItems&&(e=e.minItems(t.minItems)),t.maxItems!==void 0&&e.maxItems&&(e=e.maxItems(t.maxItems)),t.uniqueItems&&e.unique&&(e=e.unique()),t.minProperties!==void 0&&e.minProperties&&(e=e.minProperties(t.minProperties)),t.maxProperties!==void 0&&e.maxProperties&&(e=e.maxProperties(t.maxProperties)),t.additionalProperties!==void 0&&e.additionalProperties&&(e=e.additionalProperties(t.additionalProperties)),t.propertyNames&&e.propertyNames&&(e=e.propertyNames(t.propertyNames)),t.allOf&&e.custom&&(e=e.custom(r=>t.allOf.every(n=>x(r,n)))),t.anyOf&&e.custom&&(e=e.custom(r=>t.anyOf.some(n=>x(r,n)))),t.oneOf&&e.custom&&(e=e.custom(r=>t.oneOf.filter(s=>x(r,s)).length===1)),t.required&&e.required&&(e=e.required()),e)};var Nt=(e,t,o,r)=>{let s=(i=>(...a)=>{let l=i(...a);return l&&typeof l=="object"&&"check"in l?{...l,pluginName:r}:l})(o);switch(e){case"conditional":return(i,...a)=>s(i,...a);case"fieldReference":return(i,...a)=>s(i,...a);case"multiFieldReference":return s;case"transform":return i=>s(i);case"arrayElement":return(i,...a)=>s(i,...a);case"context":return i=>s(i);default:return s}};function u(e){let{name:t,methodName:o,allowedTypes:r,category:n,impl:s}=e;return{name:t,methodName:o,allowedTypes:r,category:n,create:()=>Nt(n,o,s,t)}}function H(e){let{name:t,methodName:o,impl:r,extendBuilder:n}=e;return{name:t,methodName:o,category:"builder-extension",impl:r(),extendBuilder:n}}var F=H({name:"jsonSchema",methodName:"fromJsonSchema",impl:()=>function(e,t={}){let o=Z(e,"",e),r=this.for();for(let s of o){if(s.path==="")continue;let i=Y(s,t?.customFormats);r=r.v(s.path,i)}let n=o.find(s=>s.path==="");if(n&&(n.constraints.additionalProperties===!1&&typeof r.strict=="function"&&(r=r.strict()),n.constraints.dependentRequired))for(let[s,i]of Object.entries(n.constraints.dependentRequired))for(let a of i)r=r.v(a,l=>l.requiredIf(f=>f[s]!==void 0));return r},extendBuilder:e=>(e.fromJsonSchema=F.impl,e)});var St="required",At=e=>`${e} is required`,Rt=["array","boolean","number","object","string","date","union","tuple"],X=u({name:"required",methodName:"required",allowedTypes:Rt,category:"standard",impl:e=>{let t=e?.code||St,o=e?.messageFactory||(s=>At(s.field)),r=e?.fieldName,n=e?.allowNull||!1;return{check:s=>n?!(s===void 0||s===""):!(s==null||s===""),code:t,getErrorMessage:(s,i)=>o({field:r||i,path:i,value:s,code:t}),params:e?[e]:[]}}});var Pn=Object.freeze({valid:!0,__skipFurtherValidation:!0}),Pt=["string","number","boolean","array","object","date","union"],K=u({name:"optional",methodName:"optional",allowedTypes:Pt,category:"standard",impl:()=>({check:e=>e!==null,code:"optional",getErrorMessage:(e,t)=>e===null?`${t} cannot be null (use undefined for optional fields)`:"Optional validation error (should not happen)",params:[],isOptional:!0,skipForUndefined:!0})});var Fn=Object.freeze({valid:!0,__isNullable:!0}),Ct=["string","number","boolean","array","object","date","union"],Q=u({name:"nullable",methodName:"nullable",allowedTypes:Ct,category:"standard",impl:()=>({check:e=>!0,code:"nullable",getErrorMessage:(e,t)=>e===void 0?`${t} cannot be undefined (use null for nullable fields)`:"Nullable validation error (should not happen)",params:[],isNullable:!0,skipForNull:!0})});var It="requiredIf",Ft="Field is required when condition is met";function ht(e){return Ft}var jt=["string","number","boolean","array","object","date","union"],ee=u({name:"requiredIf",methodName:"requiredIf",allowedTypes:jt,category:"conditional",impl:(e,t)=>{let o=t?.code||It,r=t?.messageFactory||ht;return{check:(n,s,i)=>s&&e(s,i)?!(n==null||n===""):!0,code:o,getErrorMessage:(n,s,i,a)=>{let l=i?e(i,a):!1;return r({path:s,value:n,code:o,condition:l})},params:[e,t],evaluateCondition:(n,s)=>n?e(n,s):!1}}});var wt="oneOf",Lt=e=>Array.isArray(e)?`Value must be one of: ${e.map(o=>JSON.stringify(o)).join(", ")}`:"Value must be one of the allowed values",_t=["string","number","boolean"],te=u({name:"oneOf",methodName:"oneOf",allowedTypes:_t,category:"standard",impl:(e,t)=>{if(!Array.isArray(e)||e.length===0)throw new Error("oneOf requires a non-empty array of allowed values");let o=t?.code||wt,r=t?.messageFactory||(a=>Lt(a.options)),n=Object.freeze([...e]),s=e.length>7,i=s?new Set(e):null;return{check:a=>a==null?!0:s?i.has(a):e.includes(a),code:o,getErrorMessage:(a,l)=>{let f={path:l,value:a,code:o,options:[...n]};return r(f)},params:[e,t],allowedValues:n}}});var Vt="literal",$t=e=>`Value must be ${typeof e=="string"?`"${e}"`:String(e)}`,Dt=["string","number","boolean","null"],re=u({name:"literal",methodName:"literal",allowedTypes:Dt,category:"standard",impl:(e,t)=>{let o=t?.code||Vt,r=t?.messageFactory||(s=>$t(s.expected??"null")),n=typeof e=="number"&&isNaN(e);return{check:s=>n?typeof s=="number"&&isNaN(s):s===e,code:o,getErrorMessage:(s,i)=>r({path:i,value:s,code:o,expected:e}),params:[e,t]}}});var kt="CUSTOM_VALIDATION_FAILED",Ut=["string","number","boolean","date","array","object","tuple","union"],ne=u({name:"custom",methodName:"custom",allowedTypes:Ut,category:"standard",impl:(e,t)=>{let o=t?.code||kt,r="Custom validation failed",n=t?.messageFactory||(i=>`${i.path} ${r.toLowerCase()}`),s;return{check:(i,a)=>{try{let l=e(i,a);return typeof l=="boolean"?l:l&&typeof l=="object"&&"valid"in l?(s=l.message,l.valid):!1}catch{return!1}},code:o,getErrorMessage:(i,a)=>s||n({path:a,value:i,code:o}),params:[e,t]}}});var qt="string",Bt="stringMin",Jt=[qt],oe=u({name:"stringMin",methodName:"min",allowedTypes:Jt,category:"standard",impl:(e,t)=>{let o=t?.code||Bt,r=t?.messageFactory||(n=>`String must have at least ${n.min} characters, but got ${n.actual}`);return{check:n=>typeof n!="string"?!0:n.length>=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="string"?n.length:0;if(typeof r=="function"){let a=r;return a.length===0?a():a.length===2?a(o,{path:s,value:n,min:e,actual:i}):a({path:s,value:n,code:o,min:e,actual:i})}return`String must have at least ${e} characters, but got ${i}`},params:[e,t]}}});var zt="stringMax",Zt=["string"],se=u({name:"stringMax",methodName:"max",allowedTypes:Zt,category:"standard",impl:(e,t)=>{let o=t?.code||zt,r=t?.messageFactory||(n=>`String must have at most ${n.max} characters, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid maxLength: ${e}`);return{check:n=>typeof n!="string"?!0:n.length<=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="string"?n.length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var Wt="stringPattern",Yt=["string"],ie=u({name:"stringPattern",methodName:"pattern",allowedTypes:Yt,category:"standard",impl:(e,t)=>{let o=t?.code||Wt,r=t?.messageFactory||(i=>"Invalid format"),n=e.toString(),s=typeof e=="string"?new RegExp(e):e;return{check:i=>typeof i!="string"?!0:s.test(i),code:o,getErrorMessage:(i,a)=>r({path:a,value:i,code:o,pattern:n}),params:[e,t]}}});var vt=["string"],Gt=/^[a-zA-Z0-9]([a-zA-Z0-9._%+-]*[a-zA-Z0-9])?@[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/,Ht="stringEmail",ae=u({name:"stringEmail",methodName:"email",allowedTypes:vt,category:"standard",impl:e=>{let t=e?.code||Ht,o=e?.messageFactory||(s=>s.reason?`Invalid email: ${s.reason}`:"Invalid email address"),r=e?.allowedDomains?new Set(e.allowedDomains.map(s=>s.toLowerCase())):null,n=e?.customRegex||Gt;return{check:s=>{if(typeof s!="string")return!0;if(!n.test(s))return!1;if(r){let i=s.lastIndexOf("@");if(i===-1)return!1;let a=s.substring(i+1).toLowerCase();return r.has(a)}return!0},code:t,getErrorMessage:(s,i)=>{if(typeof s!="string")return o({path:i,value:s,code:t});let a="";if(!n.test(s))a="invalid format";else if(r){let f=s.lastIndexOf("@");if(f!==-1){let p=s.substring(f+1).toLowerCase();r.has(p)||(a=`domain not allowed (allowed: ${Array.from(r).join(", ")})`)}}return o({path:i,value:s,code:t,reason:a})},params:e?[e]:[],validationOptions:e}}});var Xt="stringUrl",Kt=["string"],ue=u({name:"stringUrl",methodName:"url",allowedTypes:Kt,category:"standard",impl:e=>{let t=e?.code||Xt,o=e?.protocols||null,r=e?.allowWithoutProtocol||!1,n=e?.messageFactory||(s=>"Invalid URL format");return{check:s=>{if(typeof s!="string")return!0;try{let i=s;r&&!s.includes("://")&&(i=`https://${s}`);let a=new URL(i);return!(o&&!o.includes(a.protocol))}catch{return!1}},code:t,getErrorMessage:(s,i)=>n({path:i,value:s,code:t}),params:e?[e]:[]}}});function Qt(e){return e.version?`Value must be a valid UUID ${e.version} format`:"Value must be a valid UUID format"}var er=["string"],tr=[1,3,4,5,6,7,8];function rr(e){return new RegExp(`^[0-9a-f]{8}-[0-9a-f]{4}-${e}[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`,"i")}var _={};for(let e of tr)_[e]=rr(e);var nr=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,le=u({name:"stringUuid",methodName:"uuid",allowedTypes:er,category:"standard",impl:(e,t)=>{let o=t?.messageFactory||Qt;if(!e){let i=t?.code||"uuid";return{check:a=>typeof a!="string"?!0:nr.test(a),code:i,getErrorMessage:(a,l)=>o({path:l,value:a,code:i}),params:[e,t]}}let r=Array.isArray(e)?e:[e],n=Array.isArray(e)?`v${e.join(", v")}`:`v${e}`,s=t?.code||"uuidVersion";return{check:i=>{if(typeof i!="string")return!0;let a=r.length;for(let l=0;l<a;l++){let f=r[l];if(_[f]&&_[f].test(i))return!0}return!1},code:s,getErrorMessage:(i,a)=>o({path:a,value:i,code:s,version:n}),params:[e,t]}}});var or=/^(\d{4})-(\d{2})-(\d{2})$/;function sr(e){let t=e.match(or);if(!t)return!1;let[,o,r,n]=t,s=parseInt(o,10),i=parseInt(r,10),a=parseInt(n,10);if(i<1||i>12||a<1||a>31)return!1;let l=[31,28,31,30,31,30,31,31,30,31,30,31];if((s%4===0&&s%100!==0||s%400===0)&&(l[1]=29),a>l[i-1])return!1;let p=new Date(`${e}T12:00:00Z`);return isNaN(p.getTime())?!1:p.toISOString().split("T")[0]===e}var fe=u({name:"stringDate",methodName:"date",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:sr(r),code:"FORMAT_DATE",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_DATE"};return e?.messageFactory?.(s)||`${n} must be a valid ISO 8601 date (YYYY-MM-DD)`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid ISO 8601 date (YYYY-MM-DD)`,params:[e]})});var ir=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})$/,ar=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/;function ur(e,t=!1){let o=t?ir:ar,r=e.match(o);if(!r)return!1;let[,n,s,i,a,l,f]=r,p=parseInt(n,10),c=parseInt(s,10),d=parseInt(i,10),g=parseInt(a,10),M=parseInt(l,10),E=parseInt(f,10);if(c<1||c>12||d<1||d>31||g<0||g>23||M<0||M>59||E<0||E>60)return!1;let N=[31,28,31,30,31,30,31,31,30,31,30,31];if((p%4===0&&p%100!==0||p%400===0)&&(N[1]=29),d>N[c-1])return!1;let m=new Date(e);return!isNaN(m.getTime())}var pe=u({name:"stringDatetime",methodName:"datetime",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:ur(r,e?.strict),code:"FORMAT_DATETIME",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_DATETIME"};return e?.messageFactory?.(s)||`${n} must be a valid ISO 8601 datetime`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid ISO 8601 datetime`,params:[e]})});var lr=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ce=u({name:"stringIpv4",methodName:"ipv4",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IPv4 address",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:lr.test(r),code:"FORMAT_IPV4",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IPV4"}),params:[e]}}});var fr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,de=u({name:"stringIpv6",methodName:"ipv6",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IPv6 address",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:fr.test(r),code:"FORMAT_IPV6",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IPV6"}),params:[e]}}});var pr=/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/,me=u({name:"stringHostname",methodName:"hostname",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid hostname",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"||r.length>253?!1:pr.test(r),code:"FORMAT_HOSTNAME",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_HOSTNAME"}),params:[e]}}});var cr=/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.[0-9]{1,3})?$/,dr=/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/,ge=u({name:"stringTime",methodName:"time",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid time format (HH:MM:SS)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:(e?.allowMilliseconds===!1?dr:cr).test(r),code:"FORMAT_TIME",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_TIME"}),params:[e]}}});var mr=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/,ye=u({name:"stringDuration",methodName:"duration",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid ISO 8601 duration",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:mr.test(r),code:"FORMAT_DURATION",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_DURATION"}),params:[e]}}});var gr=/^(\/([^~]|(~[01]))*)*$/,Te=u({name:"stringJsonPointer",methodName:"jsonPointer",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid JSON Pointer (RFC 6901)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:gr.test(r),code:"FORMAT_JSON_POINTER",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_JSON_POINTER"}),params:[e]}}});var yr=/^[A-Za-z0-9+/]*={0,2}$/,Tr=/^[A-Za-z0-9\-_]*={0,2}$/,xe=u({name:"stringBase64",methodName:"base64",allowedTypes:["string"],category:"standard",impl:e=>({check:r=>typeof r!="string"?!1:r===""?!0:r.length%4!==0?!1:(e?.urlSafe?Tr:yr).test(r),code:"FORMAT_BASE64",getErrorMessage:(r,n)=>{let s={path:n,value:r,code:"FORMAT_BASE64"};return e?.messageFactory?.(s)||`${n} must be a valid base64 encoded string`},messageFactory:r=>e?.messageFactory?.(r)||`${r.path} must be a valid base64 encoded string`,params:[e]})});var xr=/^[a-zA-Z][a-zA-Z0-9+.-]*:(?:\/\/)?[^\s]*$/;function br(e){if(!xr.test(e)||/[\x00-\x1F\x7F\s]/.test(e))return!1;try{return new URL(e),!0}catch{let t=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);if(!t)return!1;let[,o,r]=t;return!(!o||o.length===0||!r||r.length===0)}}var be=u({name:"stringIri",methodName:"iri",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IRI (RFC 3987)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:br(r),code:"FORMAT_IRI",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IRI"}),params:[e]}}});function Or(e){if(e==="")return!0;if(/[\x00-\x1F\x7F]/.test(e))return!1;let t=e.split(/[?#]/)[0];if(/\s/.test(t))return!1;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))try{return new URL(e),!0}catch{return/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/.test(e)}return e.startsWith("//")?e.length>2&&!e.slice(2).includes("//"):e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("?")||e.startsWith("#")?!0:!e.split(/[/?#]/)[0].includes(":")}var Oe=u({name:"stringIriReference",methodName:"iriReference",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid IRI-reference (RFC 3987)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Or(r),code:"FORMAT_IRI_REFERENCE",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_IRI_REFERENCE"}),params:[e]}}});function Er(e){let t=!1,o=0;for(;o<e.length;){let r=e[o];if(r==="{"){if(t)return!1;if(t=!0,o++,o<e.length){let i=e[o];"+#/;?&=,!@|".includes(i)&&o++}let n=!1,s=o;for(;o<e.length&&e[o]!=="}";){let i=e[o];if(/[a-zA-Z0-9_%]/.test(i))n=!0;else if(i==="."){if(o===s)return!1}else if(i===":"){o++;let a=0;for(;o<e.length&&/\d/.test(e[o])&&a<4;)o++,a++;if(a===0)return!1;continue}else if(i==="*"){if(o++,o<e.length&&e[o]!=="}"&&e[o]!==",")return!1;continue}else if(i===","){if(!n)return!1;n=!1,s=o+1}else return!1;o++}if(o>=e.length||!n)return!1;if(e[o]==="}")t=!1;else return!1}else if(r==="}"){if(!t)return!1;t=!1}else if(r==="{"||r==="}")return!1;o++}return!t}var Ee=u({name:"stringUriTemplate",methodName:"uriTemplate",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid URI Template (RFC 6570)",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Er(r),code:"FORMAT_URI_TEMPLATE",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_URI_TEMPLATE"}),params:[e]}}});function Mr(e){let t=e.match(/^(\d+)(.*)$/);if(!t)return!1;let[,o,r]=t;return o.length>1&&o[0]==="0"?!1:r===""||r==="#"?!0:r.startsWith("/")?/^(\/([^~]|(~[01]))*)*$/.test(r):!1}var Me=u({name:"stringRelativeJsonPointer",methodName:"relativeJsonPointer",allowedTypes:["string"],category:"standard",impl:e=>{let t=()=>"must be a valid Relative JSON Pointer",o=e?.messageFactory||(r=>`${r.path} ${t()}`);return{check:r=>typeof r!="string"?!1:Mr(r),code:"FORMAT_RELATIVE_JSON_POINTER",getErrorMessage:(r,n)=>o({path:n,value:r,code:"FORMAT_RELATIVE_JSON_POINTER"}),params:[e]}}});var Nr=/^[A-Za-z0-9+/]*={0,2}$/,Sr=/^[A-Z2-7]*={0,6}$/,Ar=/^[01\s]*$/;function Rr(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Pr(e){return!0}function Cr(e){let t=e.split(/\r?\n/);for(let o of t){if(o.length>76)return!1;let r=0;for(;r<o.length;)if(o[r]==="="){if(r===o.length-1)break;if(r+2<o.length){let n=o.substring(r+1,r+3);if(!/^[0-9A-Fa-f]{2}$/.test(n))return!1;r+=3}else return!1}else r++}return!0}function Ir(e,t){switch(t.toLowerCase()){case"base64":return e===""?!0:e.length%4!==0?!1:Nr.test(e);case"base32":return e===""?!0:e.length%8!==0?!1:Sr.test(e);case"binary":return Ar.test(e);case"7bit":return Rr(e);case"8bit":return Pr(e);case"quoted-printable":return Cr(e);default:return!0}}var Ne=u({name:"stringContentEncoding",methodName:"contentEncoding",allowedTypes:["string"],category:"standard",impl:(e,t)=>({check:n=>typeof n!="string"?!1:Ir(n,e),code:"CONTENT_ENCODING",getErrorMessage:(n,s)=>{let i={path:s,value:n,code:"CONTENT_ENCODING"};return t?.messageFactory?.(i)||`${s} must be valid ${e} encoded content`},messageFactory:n=>t?.messageFactory?.(n)||`${n.path} must be valid ${e} encoded content`,params:[e,t]})});function Fr(e,t){try{if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf-8");if(typeof atob<"u")return atob(e)}return e}catch{return null}}var j={"application/json":e=>{try{return JSON.parse(e),!0}catch{return!1}},"text/html":e=>/<\/?[a-z][\s\S]*>/i.test(e),"text/xml":e=>/^<\?xml[^>]*\?>|^<[a-zA-Z][\s\S]*>[\s\S]*<\/[a-zA-Z][\s\S]*>$/m.test(e.trim()),"text/plain":()=>!0,"text/css":e=>/[a-zA-Z-]+\s*:\s*[^;]+;?|\.[a-zA-Z-]+\s*\{|#[a-zA-Z-]+\s*\{|[a-zA-Z]+\s*\{/.test(e),"text/javascript":e=>/function\s+\w+\s*\(|const\s+\w+|let\s+\w+|var\s+\w+|=>\s*{|class\s+\w+/.test(e),"application/xml":e=>j["text/xml"](e),"application/pdf":e=>e.startsWith("%PDF"),"image/png":e=>{if(typeof Buffer<"u"){let t=Buffer.from(e,"binary");return t.length>=8&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71}return e.charCodeAt(0)===137&&e.charCodeAt(1)===80&&e.charCodeAt(2)===78&&e.charCodeAt(3)===71},"image/jpeg":e=>{if(typeof Buffer<"u"){let t=Buffer.from(e,"binary");return t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255}return e.charCodeAt(0)===255&&e.charCodeAt(1)===216&&e.charCodeAt(2)===255},"image/gif":e=>e.startsWith("GIF87a")||e.startsWith("GIF89a"),"image/svg+xml":e=>/<svg[^>]*>[\s\S]*<\/svg>/i.test(e)};function hr(e,t,o){let r=o?Fr(e,o):e;if(r===null)return!1;let n=j[t.toLowerCase()];return n?n(r):t.startsWith("text/")?!0:t.startsWith("application/")&&t.includes("json")?j["application/json"](r):t.startsWith("application/")&&t.includes("xml")?j["application/xml"](r):!0}var Se=u({name:"stringContentMediaType",methodName:"contentMediaType",allowedTypes:["string"],category:"standard",impl:(e,t)=>({check:n=>typeof n!="string"?!1:hr(n,e,t?.encoding),code:"CONTENT_MEDIA_TYPE",getErrorMessage:(n,s)=>{let i={path:s,value:n,code:"CONTENT_MEDIA_TYPE"};return t?.messageFactory?.(i)||`${s} must be valid ${e} content${t?.encoding?` (${t.encoding} encoded)`:""}`},messageFactory:n=>t?.messageFactory?.(n)||`${n.path} must be valid ${e} content${t?.encoding?` (${t.encoding} encoded)`:""}`,params:[e,t]})});var jr="numberMin",wr=["number"],Ae=u({name:"numberMin",methodName:"min",allowedTypes:wr,category:"standard",impl:(e,t)=>{let o=t?.code||jr,r=t?.exclusive||!1,n=t?.messageFactory||(s=>s.exclusive?`Value must be greater than ${s.min}, but got ${s.actual}`:`Value must be at least ${s.min}, but got ${s.actual}`);if(typeof e!="number"||isNaN(e))throw new Error(`Invalid minValue: ${e}`);return{check:s=>typeof s!="number"?!0:r?s>e:s>=e,code:o,getErrorMessage:(s,i)=>n({path:i,value:s,code:o,min:e,actual:s,exclusive:r}),params:[e,t]}}});var Lr="numberMax",_r=["number"],Re=u({name:"numberMax",methodName:"max",allowedTypes:_r,category:"standard",impl:(e,t)=>{let o=t?.code||Lr,r=t?.exclusive||!1,n=t?.messageFactory||(s=>s.exclusive?`Value must be less than ${s.max}, but got ${s.actual}`:`Value must be at most ${s.max}, but got ${s.actual}`);if(typeof e!="number"||isNaN(e))throw new Error(`Invalid maxValue: ${e}`);return{check:s=>typeof s!="number"?!0:r?s<e:s<=e,code:o,getErrorMessage:(s,i)=>n({path:i,value:s,code:o,max:e,actual:s,exclusive:r}),params:[e,t]}}});var Pe="number",Vr="numberInteger",$r=()=>"Value must be an integer",Dr=[Pe],Ce=u({name:"numberInteger",methodName:"integer",allowedTypes:Dr,category:"standard",impl:e=>{let t=e?.code||Vr,o=e?.messageFactory||(r=>$r());return{check:r=>typeof r!==Pe?!0:Number.isInteger(r),code:t,getErrorMessage:(r,n)=>o({path:n,value:r,code:t}),params:e?[e]:[]}}});var kr="not_multiple";function Ur(e){return e.divisor?`Value must be a multiple of ${e.divisor}`:"Value must be a multiple of the specified divisor"}var qr=["number"],Ie=u({name:"numberMultipleOf",methodName:"multipleOf",allowedTypes:qr,category:"standard",impl:(e,t)=>{if(typeof e!="number"||e===0)throw new Error(`Invalid divisor: ${e}. Must be a non-zero number.`);let o=t?.code||kr,r=t?.messageFactory||Ur;return{check:n=>typeof n!="number"?!0:n%e===0,code:o,getErrorMessage:(n,s)=>r({path:s,value:n,code:o,divisor:e}),params:[e,t]}}});var Br="arrayUnique",Jr=()=>"Array must contain unique values",zr=["array"],Fe=u({name:"arrayUnique",methodName:"unique",allowedTypes:zr,category:"standard",impl:e=>{let t=e?.code||Br,o=e?.messageFactory||(r=>Jr());return{check:r=>{if(!Array.isArray(r))return!0;let n=r.length;if(n<=10)for(let s=0;s<n;s++){let i=r[s];for(let a=s+1;a<n;a++)if(i===r[a])return!1}else{let s=new Set;for(let i=0;i<n;i++){let a=r[i];if(s.has(a))return!1;s.add(a)}}return!0},code:t,getErrorMessage:(r,n)=>o({path:n,value:r,code:t}),params:e?[e]:[]}}});var Zr="arrayMinLength",Wr=["array"],he=u({name:"arrayMinLength",methodName:"minLength",allowedTypes:Wr,category:"standard",impl:(e,t)=>{let o=t?.code||Zr,r=t?.messageFactory||(n=>`Array must have at least ${n.min} elements, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid minLength: ${e}`);return{check:n=>Array.isArray(n)?n.length>=e:!0,code:o,getErrorMessage:(n,s)=>{let i=Array.isArray(n)?n.length:0;return r({path:s,value:n,code:o,min:e,actual:i})},params:[e,t]}}});var Yr="arrayMaxLength",vr=["array"],je=u({name:"arrayMaxLength",methodName:"maxLength",allowedTypes:vr,category:"standard",impl:(e,t)=>{let o=t?.code||Yr,r=t?.messageFactory||(n=>`Array must have at most ${n.max} elements, but got ${n.actual}`);if(typeof e!="number"||e<0)throw new Error(`Invalid maxLength: ${e}`);return{check:n=>Array.isArray(n)?n.length<=e:!0,code:o,getErrorMessage:(n,s)=>{let i=Array.isArray(n)?n.length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var Gr=(e,t)=>{if(t.type)switch(t.type){case"string":if(typeof e!="string")return!1;break;case"number":if(typeof e!="number")return!1;break;case"boolean":if(typeof e!="boolean")return!1;break;case"array":if(!Array.isArray(e))return!1;break;case"object":if(!e||typeof e!="object"||Array.isArray(e))return!1;break;case"null":if(e!==null)return!1;break}return!(typeof e=="string"&&(t.minLength&&e.length<t.minLength||t.maxLength&&e.length>t.maxLength||t.pattern&&!new RegExp(t.pattern).test(e))||typeof e=="number"&&(t.minimum!==void 0&&e<t.minimum||t.maximum!==void 0&&e>t.maximum||t.multipleOf&&e%t.multipleOf!==0)||t.enum&&!t.enum.includes(e)||t.const!==void 0&&e!==t.const)},we=u({name:"arrayContains",methodName:"contains",allowedTypes:["array"],category:"standard",impl:e=>({check:t=>Array.isArray(t)?typeof e!="object"||e===null||Array.isArray(e)?t.includes(e):"validator"in e&&typeof e.validator=="function"?t.some(o=>e.validator(o)):typeof e=="object"&&e!==null?t.some(o=>Gr(o,e)):!1:!1,code:"ARRAY_CONTAINS",getErrorMessage:(t,o)=>typeof e=="object"&&e!==null&&"message"in e?e.message||`${o} must contain at least one matching item`:typeof e!="object"||e===null||Array.isArray(e)?`${o} must contain ${JSON.stringify(e)}`:`${o} must contain at least one item matching the schema`,params:[e]})});var Hr="objectMinProperties",Xr=["object"],Le=u({name:"objectMinProperties",methodName:"minProperties",allowedTypes:Xr,category:"standard",impl:(e,t)=>{let o=t?.code||Hr,r=t?.messageFactory||(n=>`Must have at least ${n.min} properties, but has ${n.actual}`);if(typeof e!="number"||isNaN(e)||e<0)throw new Error(`Invalid minValue: ${e}. Must be a non-negative number.`);return{check:n=>typeof n!="object"||n===null?!0:Object.keys(n).length>=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="object"&&n!==null?Object.keys(n).length:0;return r({path:s,value:n,code:o,min:e,actual:i})},params:[e,t]}}});var Kr="objectMaxProperties",Qr=["object"],_e=u({name:"objectMaxProperties",methodName:"maxProperties",allowedTypes:Qr,category:"standard",impl:(e,t)=>{let o=t?.code||Kr,r=t?.messageFactory||(n=>`Must have at most ${n.max} properties, but has ${n.actual}`);if(typeof e!="number"||isNaN(e)||e<0)throw new Error(`Invalid maxValue: ${e}. Must be a non-negative number.`);return{check:n=>typeof n!="object"||n===null?!0:Object.keys(n).length<=e,code:o,getErrorMessage:(n,s)=>{let i=typeof n=="object"&&n!==null?Object.keys(n).length:0;return r({path:s,value:n,code:o,max:e,actual:i})},params:[e,t]}}});var en="objectAdditionalProperties",tn=["object"],Ve=u({name:"objectAdditionalProperties",methodName:"additionalProperties",allowedTypes:tn,category:"standard",impl:(e,t)=>{let o=t?.code||en,r=t?.allowedProperties||[],n=e===!1||t?.strict===!0,s=typeof e=="object"?e:t?.additionalPropertiesSchema,i=t?.messageFactory||(a=>n?`Additional properties are not allowed: ${a.extraProperties.join(", ")}`:"Additional properties validation failed");return{check:a=>{if(typeof a!="object"||a===null)return!0;let f=Object.keys(a).filter(p=>!r.includes(p));if(n)return f.length===0;if(s)for(let p of f){let c=a[p];if(s.type){let d=s.type,g=typeof c;if(d==="string"&&g!=="string"||d==="number"&&g!=="number"||d==="boolean"&&g!=="boolean"||d==="object"&&(g!=="object"||c===null||Array.isArray(c))||d==="array"&&!Array.isArray(c))return!1}if(s.minLength&&typeof c=="string"&&c.length<s.minLength||s.maxLength&&typeof c=="string"&&c.length>s.maxLength||s.minimum!==void 0&&typeof c=="number"&&c<s.minimum||s.maximum!==void 0&&typeof c=="number"&&c>s.maximum)return!1}return!0},code:o,getErrorMessage:(a,l)=>{let p=(typeof a=="object"&&a!==null?Object.keys(a):[]).filter(d=>!r.includes(d));return i({path:l,value:a,code:o,extraProperties:p})},params:[e,t]}}});var $e=u({name:"objectPropertyNames",methodName:"propertyNames",allowedTypes:["object"],category:"standard",impl:e=>({check:t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;let o=Object.keys(t);for(let r of o)if(e instanceof RegExp){if(!e.test(r))return!1}else if(typeof e=="string"){if(!new RegExp(e).test(r))return!1}else if(typeof e=="object"&&e!==null&&"validator"in e){if(!e.validator(r))return!1}else return!1;return!0},code:"PROPERTY_NAMES",getErrorMessage:(t,o)=>{let r=Object.keys(t||{}).filter(s=>e instanceof RegExp?!e.test(s):typeof e=="string"?!new RegExp(e).test(s):typeof e=="object"&&e!==null&&"validator"in e?!e.validator(s):!0);if(typeof e=="object"&&e!==null&&"message"in e&&e.message)return e.message;let n=e instanceof RegExp?e.toString():typeof e=="string"?`/${e}/`:"the specified pattern";return`${o} has invalid property names: ${r.join(", ")}. Property names must match ${n}`},params:[e]})});var De=u({name:"objectPatternProperties",methodName:"patternProperties",allowedTypes:["object"],category:"standard",impl:e=>({check:t=>{if(!t||typeof t!="object"||Array.isArray(t))return!1;let o=Object.keys(t),r=Object.entries(e);for(let n of o){let s=t[n];for(let[i,a]of r)if(new RegExp(i).test(n)){let f=!1;if(typeof a=="function"?f=a(s):typeof a=="object"&&a!==null&&"validator"in a&&(f=a.validator(s)),!f)return!1;break}}return!0},code:"PATTERN_PROPERTIES",getErrorMessage:(t,o)=>{let r=Object.keys(t||{}),n=Object.entries(e),s=[];for(let i of r){let a=t[i];for(let[l,f]of n)if(new RegExp(l).test(i)){let c=!1,d;typeof f=="function"?c=f(a):typeof f=="object"&&f!==null&&"validator"in f&&(c=f.validator(a),d=f.message),c||(d?s.push(`${i}: ${d}`):s.push(`${i} (matching pattern ${l}) has invalid value`));break}}return s.length>0?`${o} has pattern property violations: ${s.join(", ")}`:`${o} has invalid pattern properties`},params:[e]})});var ke=u({name:"objectDependentRequired",methodName:"dependentRequired",allowedTypes:["object"],category:"standard",impl:e=>({check:(t,o)=>{let r=o!==void 0?o:t;if(!r||typeof r!="object"||Array.isArray(r))return!0;let n=Object.entries(e);for(let[s,i]of n)if(s in r&&r[s]!==void 0){let a=Array.isArray(i)?i:i.required;for(let l of a)if(!(l in r)||r[l]===void 0)return!1}return!0},code:"DEPENDENT_REQUIRED",getErrorMessage:(t,o,r)=>{let n=r!==void 0?r:t,s=Object.entries(e),i=[];for(let[l,f]of s)if(l in n&&n[l]!==void 0){let p=Array.isArray(f)?f:f.required,c=Array.isArray(f)?void 0:f.message,d=p.filter(g=>!(g in n)||n[g]===void 0);d.length>0&&(c?i.push(c):i.push(`When '${l}' is present, the following properties are required: ${d.join(", ")}`))}let a=o&&o!==""?`${o}: `:"";return i.length>0?`${a}${i.join("; ")}`:`${a}Dependent required validation failed`},params:[e]})});var rn=(e,t)=>{if(t.type&&t.type==="object"&&(!e||typeof e!="object"||Array.isArray(e)))return!1;if(t.required&&Array.isArray(t.required)){for(let o of t.required)if(!(o in e)||e[o]===void 0)return!1}if(t.properties){for(let[o,r]of Object.entries(t.properties))if(o in e){let n=r;if(n.type){let s=e[o];switch(n.type){case"string":if(typeof s!="string"||n.minLength&&s.length<n.minLength||n.maxLength&&s.length>n.maxLength||n.pattern&&!new RegExp(n.pattern).test(s))return!1;break;case"number":if(typeof s!="number"||n.minimum!==void 0&&s<n.minimum||n.maximum!==void 0&&s>n.maximum)return!1;break;case"boolean":if(typeof s!="boolean")return!1;break;case"array":if(!Array.isArray(s)||n.minItems&&s.length<n.minItems||n.maxItems&&s.length>n.maxItems)return!1;break;case"object":if(!s||typeof s!="object"||Array.isArray(s))return!1;break}}if(n.enum&&!n.enum.includes(e[o])||n.const!==void 0&&e[o]!==n.const)return!1}}return!0},Ue=u({name:"objectDependentSchemas",methodName:"dependentSchemas",allowedTypes:["object"],category:"standard",impl:e=>({check:(t,o)=>{let r=o!==void 0?o:t;if(!r||typeof r!="object"||Array.isArray(r))return!0;for(let[n,s]of Object.entries(e))if(n in r&&r[n]!==void 0){if("validator"in s&&typeof s.validator=="function"){if(!s.validator(r))return!1}else if(!rn(r,s))return!1}return!0},code:"DEPENDENT_SCHEMAS",getErrorMessage:(t,o,r)=>{let n=r!==void 0?r:t,s=[];for(let[a,l]of Object.entries(e))if(a in n&&n[a]!==void 0)if("validator"in l&&typeof l.validator=="function"){if(!l.validator(n)){let f=l.message||`Schema validation failed when '${a}' is present`;s.push(f)}}else{let f=l;if(f.required){let p=f.required.filter(c=>!(c in n)||n[c]===void 0);p.length>0&&s.push(`When '${a}' is present, the following properties are required: ${p.join(", ")}`)}s.length===0&&s.push(`Schema validation failed when '${a}' is present`)}let i=o&&o!==""?`${o}: `:"";return s.length>0?`${i}${s.join("; ")}`:`${i}Dependent schemas validation failed`},params:[e]})});var V=Object.freeze({valid:!0}),R=Object.freeze({valid:!1});function $(e,t=[],o){return{_validators:e,_transforms:t,validate:o||(r=>{for(let n=0;n<t.length;n++)if(!e[n].check(r,r))return R;return V})}}function D(e,t,o){return{check:t,name:e,inputType:o?.inputType,outputType:o?.outputType,metadata:o?{severity:o.severity||"error",async:o.async||!1}:void 0}}function qe(e,t,o,r){return{name:e,methodName:t,allowedTypes:o,category:"composable",createComposer(n,s){let i=[],a={add(f){return i.push(f),a},build(){return r(i,n,s)}},l=a;return l[t]=function(...f){return l.add(f)},l}}}function Be(e,t,o,r){let n=t.methodName,s=null,i=null;e[n]=function(...a){if(s||(s=t.createComposer(o,r)),s.add(a),e[n]=s[n],s){i=s.build();let l=e._executionPlan;if(!(l&&i&&typeof i.validate=="function")){if(i&&i._validators)for(let f of i._validators)l.addValidator(f.name,(p,c)=>{let d=f.check(p,p);return{valid:d,message:d?void 0:`Validation failed for ${f.name}`}})}}return e}}function Je(e,t,o,r){return{...qe(e,t,o,r),category:"composable-directly"}}function nn(e){switch(e){case"string":return{check:t=>t==null?!0:typeof t=="string",name:"stringType",messageFactory:()=>"Expected string",inputType:"string",outputType:"string",metadata:{severity:"error",async:!1}};case"number":return{check:t=>t==null?!0:typeof t=="number"&&!isNaN(t),name:"numberType",messageFactory:()=>"Expected number",inputType:"number",outputType:"number",metadata:{severity:"error",async:!1}};case"boolean":return{check:t=>t==null?!0:typeof t=="boolean",name:"booleanType",messageFactory:()=>"Expected boolean",inputType:"boolean",outputType:"boolean",metadata:{severity:"error",async:!1}};case"array":return{check:t=>t==null?!0:Array.isArray(t),name:"arrayType",messageFactory:()=>"Expected array",inputType:"array",outputType:"array",metadata:{severity:"error",async:!1}};case"object":return{check:t=>t==null?!0:typeof t=="object"&&t!==null&&!Array.isArray(t),name:"objectType",messageFactory:()=>"Expected object",inputType:"object",outputType:"object",metadata:{severity:"error",async:!1}};case"date":return{check:t=>t==null?!0:t instanceof Date,name:"dateType",messageFactory:()=>"Expected Date",inputType:"date",outputType:"date",metadata:{severity:"error",async:!1}};case"null":return{check:t=>t===null,name:"nullType",messageFactory:()=>"Expected null",inputType:"null",outputType:"null",metadata:{severity:"error",async:!1}};case"any":return{check:()=>!0,name:"anyType",messageFactory:()=>"",inputType:"any",outputType:"any",metadata:{severity:"error",async:!1}};default:return null}}function b(e,t,o,r){let n=r?.validators?[...r.validators]:[];if(!r&&e!=="union"){let a=nn(e);a&&n.push(a)}let s=r?.transforms?[...r.transforms]:[],i={_type:e,_fieldPath:t,_validators:n,_transforms:s,build(){return e==="union"&&n.length===0&&n.push({check:()=>!1,name:"unionGuard",messageFactory:()=>"No union type guards defined",inputType:"union",outputType:"union",metadata:{severity:"error",async:!1}}),{_validators:n,_transforms:s}}};return on(i,e,t,o,n,s),i.refineString=()=>b("string",t,o,{validators:n,transforms:s}),i.refineNumber=()=>b("number",t,o,{validators:n,transforms:s}),i.refineBoolean=()=>b("boolean",t,o,{validators:n,transforms:s}),i.refineArray=()=>b("array",t,o,{validators:n,transforms:s}),i.refineObject=()=>b("object",t,o,{validators:n,transforms:s}),i.refineTuple=()=>b("tuple",t,o,{validators:n,transforms:s}),i.refineUnion=()=>b("union",t,o,{validators:n,transforms:s}),i.refineDate=()=>b("date",t,o,{validators:n,transforms:s}),i.refineAny=()=>b("any",t,o,{validators:n,transforms:s}),i}function on(e,t,o,r,n,s){let i=Object.entries(r),a=i.length;for(let l=0;l<a;l++){let[,f]=i[l];if(!f||typeof f!="object")continue;if(f.category?.startsWith("composable")){if(f.allowedTypes&&!f.allowedTypes.includes(t))continue;Be(e,f,o,r);continue}if(typeof f.create!="function"||f.allowedTypes&&!f.allowedTypes.includes(t))continue;let{methodName:p,category:c="standard",name:d}=f,g=f.create();e[p]=function(...M){try{let E=g(...M);if(c==="transform"){let N=sn(E,M[0]);s.push(N)}else{let N=an(E,o),w=un(N,d||p,t,M,E);n.push(w)}}catch{}return e}}}function sn(e,t){return typeof e=="function"?t:e?.__isTransform?e.__transformFn:e?.__isCoerce?o=>e.coerce.coerceFn(o):e?.__isDefault?(o,r)=>e.default.applyDefault(o,r):e?.__isPreprocess?(o,r)=>e.preprocess.applyPreprocess(o,r):t||(o=>o)}function an(e,t){return typeof e=="function"?(o,r)=>e(o,{path:t,allValues:r}).valid:e?.check?(o,r)=>e.check(o,r):()=>!1}function un(e,t,o,r,n){let s={check:e,name:t,code:n?.code||t,pluginName:n?.pluginName||t,getErrorMessage:n?.getErrorMessage,messageFactory:r[r.length-1]?.messageFactory||n?.messageFactory||(()=>"Validation failed"),inputType:o,outputType:o,metadata:n?.metadata||{severity:"error",async:!1}};return n&&(n.shouldSkipAllValidation&&(s.shouldSkipAllValidation=n.shouldSkipAllValidation),n.shouldSkipValidation&&(s.shouldSkipValidation=n.shouldSkipValidation),n.shouldSkipFurtherValidation&&(s.shouldSkipFurtherValidation=n.shouldSkipFurtherValidation),n.skipForNull!==void 0&&(s.skipForNull=n.skipForNull),n.skipForUndefined!==void 0&&(s.skipForUndefined=n.skipForUndefined),n.__isRecursive&&(s.__isRecursive=n.__isRecursive),n.recursive&&(s.recursive=n.recursive)),s}function k(e,t){let o=b("string",e,t),r=b("number",e,t),n=b("boolean",e,t),s=b("array",e,t),i=b("object",e,t),a=b("union",e,t),l=b("tuple",e,t),f=b("date",e,t),p=b("any",e,t);return{string:o,number:r,boolean:n,date:f,array:s,tuple:l,union:a,object:i,any:p}}var ze=Array.isArray,Ze=Object.freeze({code:"TUPLE_NOT_ARRAY",message:"Value must be an array"}),U=Object.freeze({code:"TUPLE_LENGTH_MISMATCH",prefix:"Tuple must have exactly",suffix:"elements, got"}),q=Object.freeze({code:"TUPLE_TOO_SHORT",prefix:"Tuple must have at least",suffix:"elements, got"}),We=Je("tupleBuilder","builder",["tuple"],(e,t,o)=>{let r=e[0]||[];if(r.length===0)return $([D("tupleBuilder",()=>!1,{inputType:"tuple",outputType:"tuple"})]);let n=[],s,i=r.length,a=r[i-1],l=a&&typeof a=="object"&&typeof a!="function"&&(Object.prototype.hasOwnProperty.call(a,"rest")||Object.keys(a).length===0),f={};l?(n=r.slice(0,-1),f=a,s=f.rest):n=r;let p=n.length,c=!!s,d=new Array(p);for(let m=0;m<p;m++){let y=k(`${t}[${m}]`,o),T=n[m](y);T&&typeof T.build=="function"?d[m]=T.build():d[m]=null}let g=null;if(s){let m=k(`${t}[rest]`,o),y=s(m);y&&typeof y.build=="function"&&(g=y.build())}let M=m=>{if(m.length!==p)return!1;for(let y=0;y<p;y++){let T=d[y];if(T&&!T.validate(m[y]).valid)return!1}return!0},E=m=>{let y=m.length;if(y<p)return!1;for(let T=0;T<p;T++){let O=d[T];if(O&&!O.validate(m[T]).valid)return!1}if(g&&y>p){for(let T=p;T<y;T++)if(!g.validate(m[T]).valid)return!1}return!0},N=D("tupleBuilder",m=>ze(m)?c?E(m):M(m):!1,{inputType:"tuple",outputType:"tuple",severity:"error",async:!1});return $([N],[],m=>{if(!ze(m))return{...R,errors:[{path:t,message:f.messageFactory?.notArray?f.messageFactory.notArray(m):Ze.message,code:Ze.code}]};let y=m.length;if(!c&&y!==p)return{...R,errors:[{path:t,message:f.messageFactory?.lengthMismatch?f.messageFactory.lengthMismatch(p,y):`${U.prefix} ${p} ${U.suffix} ${y}`,code:U.code}]};if(c&&y<p)return{...R,errors:[{path:t,message:f.messageFactory?.tooShort?f.messageFactory.tooShort(p,y):`${q.prefix} ${p} ${q.suffix} ${y}`,code:q.code}]};let T=[];for(let O=0;O<p;O++){let S=d[O];if(S){let L=m[O],A=S.validate(L,m);if(!A.isValid()){let B=`${t}[${O}]`;if(A.errors&&A.errors.length>0)for(let ve of A.errors)T.push({...ve,path:B});else T.push({path:B,message:`Validation failed for element ${O}`,code:"ELEMENT_INVALID"})}}}if(g&&y>p)for(let O=p;O<y;O++){let S=g.validate(m[O]);if(!S.valid&&S.errors){let L=`${t}[${O}]`;for(let A of S.errors)T.push({...A,path:L})}}return T.length>0?{...R,errors:T}:V})});var Ye=u({name:"readOnlyWriteOnly",methodName:"readOnly",allowedTypes:["string","number","boolean","date","array","object"],category:"context",impl:(e={})=>({check:(t,o,r)=>!((r?.operation||"write")==="write"&&t!==void 0&&r?.isUpdate),code:"READ_ONLY",getErrorMessage:(t,o)=>e.errorMessage||`${o} is read-only and cannot be modified`,params:["readOnly",e]})}),gs=u({name:"writeOnly",methodName:"writeOnly",allowedTypes:["string","number","boolean","date","array","object"],category:"context",impl:(e={})=>({check:(t,o,r)=>!((r?.operation||"write")==="read"&&t!==void 0),code:"WRITE_ONLY",getErrorMessage:(t,o)=>e.errorMessage||`${o} is write-only and cannot be read`,params:["writeOnly",e]})});var ln=[X,K,Q,ee,te,re,ne,oe,se,ie,ae,ue,le,fe,pe,ce,de,me,ge,ye,Te,xe,be,Oe,Ee,Me,Ne,Se,Ae,Re,Ce,Ie,Fe,he,je,we,Le,_e,Ve,$e,De,ke,Ue,We,Ye],li={...F,name:"jsonSchemaFullFeature",extendBuilder:e=>{for(let t of ln)e.use(t);return e.use(F),e}};export{li as jsonSchemaFullFeaturePlugin};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ValidationOptions } from "../core/plugin/types";
|
|
2
|
+
/**
|
|
3
|
+
* @luq-plugin
|
|
4
|
+
* @name literal
|
|
5
|
+
* @category standard
|
|
6
|
+
* @description Validates that a value exactly matches a specific literal value
|
|
7
|
+
* @allowedTypes ["string", "number", "boolean", "null"]
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // String literal - exact value match
|
|
11
|
+
* const validator = Builder()
|
|
12
|
+
* .use(literalPlugin)
|
|
13
|
+
* .for<Config>()
|
|
14
|
+
* .v("type", (b) => b.string.literal("user"))
|
|
15
|
+
* .v("version", (b) => b.string.literal("v1"))
|
|
16
|
+
* .build();
|
|
17
|
+
*
|
|
18
|
+
* // Number and boolean literals
|
|
19
|
+
* builder.v("maxRetries", b => b.number.literal(3))
|
|
20
|
+
* builder.v("enabled", b => b.boolean.literal(true))
|
|
21
|
+
* ```
|
|
22
|
+
* @params
|
|
23
|
+
* - expected: string | number | boolean | null - The exact value to match
|
|
24
|
+
* - options?: { messageFactory?: (context: MessageContext) => string } - Optional configuration
|
|
25
|
+
* @returns Validation function that returns true only if value exactly matches expected
|
|
26
|
+
* @customError
|
|
27
|
+
* ```typescript
|
|
28
|
+
* .literal("active", {
|
|
29
|
+
* messageFactory: ({ path, value, params }) =>
|
|
30
|
+
* `${path} must be exactly "${params.expected}" (received: "${value}")`
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
* @since 0.1.0-alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare const literalPlugin: import("../index").TypedPlugin<"literal", "literal", <TValue extends string | number | boolean | null>(expectedValue: TValue, options?: ValidationOptions) => {
|
|
36
|
+
check: (value: any) => boolean;
|
|
37
|
+
code: string;
|
|
38
|
+
getErrorMessage: (value: any, path: string) => string;
|
|
39
|
+
params: (ValidationOptions<{}> | TValue)[];
|
|
40
|
+
}, readonly ["string", "number", "boolean", "null"], "validator", "standard">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(e,n)=>{for(var r in n)l(e,r,{get:n[r],enumerable:!0})},y=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of u(n))!d.call(e,o)&&o!==r&&l(e,o,{get:()=>n[o],enumerable:!(i=p(n,o))||i.enumerable});return e};var c=e=>y(l({},"__esModule",{value:!0}),e);var P={};g(P,{literalPlugin:()=>h});module.exports=c(P);var N=(e,n,r,i)=>{let t=(a=>(...s)=>{let m=a(...s);return m&&typeof m=="object"&&"check"in m?{...m,pluginName:i}:m})(r);switch(e){case"conditional":return(a,...s)=>t(a,...s);case"fieldReference":return(a,...s)=>t(a,...s);case"multiFieldReference":return t;case"transform":return a=>t(a);case"arrayElement":return(a,...s)=>t(a,...s);case"context":return a=>t(a);default:return t}};function T(e){let{name:n,methodName:r,allowedTypes:i,category:o,impl:t}=e;return{name:n,methodName:r,allowedTypes:i,category:o,create:()=>N(o,r,t,n)}}var f="literal",x=e=>`Value must be ${typeof e=="string"?`"${e}"`:String(e)}`,I=["string","number","boolean","null"],h=T({name:"literal",methodName:"literal",allowedTypes:I,category:"standard",impl:(e,n)=>{let r=n?.code||f,i=n?.messageFactory||(t=>x(t.expected??"null")),o=typeof e=="number"&&isNaN(e);return{check:t=>o?typeof t=="number"&&isNaN(t):t===e,code:r,getErrorMessage:(t,a)=>i({path:a,value:t,code:r,expected:e}),params:[e,n]}}});0&&(module.exports={literalPlugin});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=(n,a,o,i)=>{let e=(t=>(...r)=>{let m=t(...r);return m&&typeof m=="object"&&"check"in m?{...m,pluginName:i}:m})(o);switch(n){case"conditional":return(t,...r)=>e(t,...r);case"fieldReference":return(t,...r)=>e(t,...r);case"multiFieldReference":return e;case"transform":return t=>e(t);case"arrayElement":return(t,...r)=>e(t,...r);case"context":return t=>e(t);default:return e}};function l(n){let{name:a,methodName:o,allowedTypes:i,category:s,impl:e}=n;return{name:a,methodName:o,allowedTypes:i,category:s,create:()=>T(s,o,e,a)}}var p="literal",u=n=>`Value must be ${typeof n=="string"?`"${n}"`:String(n)}`,d=["string","number","boolean","null"],c=l({name:"literal",methodName:"literal",allowedTypes:d,category:"standard",impl:(n,a)=>{let o=a?.code||p,i=a?.messageFactory||(e=>u(e.expected??"null")),s=typeof n=="number"&&isNaN(n);return{check:e=>s?typeof e=="number"&&isNaN(e):e===n,code:o,getErrorMessage:(e,t)=>i({path:t,value:e,code:o,expected:n}),params:[n,a]}}});export{c as literalPlugin};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @luq-plugin
|
|
3
|
+
* @name nullable
|
|
4
|
+
* @category standard
|
|
5
|
+
* @description Allows a field to accept null as a valid value
|
|
6
|
+
* @allowedTypes ["string", "number", "boolean", "array", "object", "date", "union"]
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Basic usage - field can be null or valid string
|
|
10
|
+
* const validator = Builder()
|
|
11
|
+
* .use(nullablePlugin)
|
|
12
|
+
* .for<UserProfile>()
|
|
13
|
+
* .v("middleName", (b) => b.string.nullable().min(3))
|
|
14
|
+
* .v("avatar", (b) => b.string.nullable().url())
|
|
15
|
+
* .build();
|
|
16
|
+
*
|
|
17
|
+
* // With other validations - null bypasses all validators
|
|
18
|
+
* builder.v("score", b => b.number.nullable().min(0).max(100))
|
|
19
|
+
* ```
|
|
20
|
+
* @params
|
|
21
|
+
* No parameters - this is a modifier plugin
|
|
22
|
+
* @returns Validation function that returns true for null values and continues validation for non-null values
|
|
23
|
+
* @customError
|
|
24
|
+
* This plugin does not generate errors - it allows null values
|
|
25
|
+
* @since 0.1.0-alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare const nullablePlugin: import("../index").TypedPlugin<"nullable", "nullable", () => {
|
|
28
|
+
check: (value: any) => boolean;
|
|
29
|
+
code: string;
|
|
30
|
+
getErrorMessage: (value: any, path: string) => string;
|
|
31
|
+
params: any[];
|
|
32
|
+
isNullable: boolean;
|
|
33
|
+
skipForNull: boolean;
|
|
34
|
+
}, readonly ["string", "number", "boolean", "array", "object", "date", "union"], "validator", "standard">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var a in e)s(n,a,{get:e[a],enumerable:!0})},y=(n,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!d.call(n,r)&&r!==a&&s(n,r,{get:()=>e[r],enumerable:!(i=T(e,r))||i.enumerable});return n};var c=n=>y(s({},"__esModule",{value:!0}),n);var x={};g(x,{nullablePlugin:()=>h});module.exports=c(x);var f=(n,e,a,i)=>{let l=(t=>(...o)=>{let m=t(...o);return m&&typeof m=="object"&&"check"in m?{...m,pluginName:i}:m})(a);switch(n){case"conditional":return(t,...o)=>l(t,...o);case"fieldReference":return(t,...o)=>l(t,...o);case"multiFieldReference":return l;case"transform":return t=>l(t);case"arrayElement":return(t,...o)=>l(t,...o);case"context":return t=>l(t);default:return l}};function u(n){let{name:e,methodName:a,allowedTypes:i,category:r,impl:l}=n;return{name:e,methodName:a,allowedTypes:i,category:r,create:()=>f(r,a,l,e)}}var w=Object.freeze({valid:!0,__isNullable:!0}),N=["string","number","boolean","array","object","date","union"],h=u({name:"nullable",methodName:"nullable",allowedTypes:N,category:"standard",impl:()=>({check:n=>!0,code:"nullable",getErrorMessage:(n,e)=>n===void 0?`${e} cannot be undefined (use null for nullable fields)`:"Nullable validation error (should not happen)",params:[],isNullable:!0,skipForNull:!0})});0&&(module.exports={nullablePlugin});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=(a,r,o,i)=>{let n=(e=>(...t)=>{let l=e(...t);return l&&typeof l=="object"&&"check"in l?{...l,pluginName:i}:l})(o);switch(a){case"conditional":return(e,...t)=>n(e,...t);case"fieldReference":return(e,...t)=>n(e,...t);case"multiFieldReference":return n;case"transform":return e=>n(e);case"arrayElement":return(e,...t)=>n(e,...t);case"context":return e=>n(e);default:return n}};function s(a){let{name:r,methodName:o,allowedTypes:i,category:m,impl:n}=a;return{name:r,methodName:o,allowedTypes:i,category:m,create:()=>u(m,o,n,r)}}var g=Object.freeze({valid:!0,__isNullable:!0}),T=["string","number","boolean","array","object","date","union"],y=s({name:"nullable",methodName:"nullable",allowedTypes:T,category:"standard",impl:()=>({check:a=>!0,code:"nullable",getErrorMessage:(a,r)=>a===void 0?`${r} cannot be undefined (use null for nullable fields)`:"Nullable validation error (should not happen)",params:[],isNullable:!0,skipForNull:!0})});export{y as nullablePlugin};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ValidationOptions } from "../core/plugin/types";
|
|
2
|
+
/**
|
|
3
|
+
* @luq-plugin
|
|
4
|
+
* @name numberInteger
|
|
5
|
+
* @category standard
|
|
6
|
+
* @description Validates that a number is an integer (whole number without decimals)
|
|
7
|
+
* @allowedTypes ["number"]
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Basic usage - ensures number is an integer
|
|
11
|
+
* const validator = Builder()
|
|
12
|
+
* .use(numberIntegerPlugin)
|
|
13
|
+
* .for<OrderData>()
|
|
14
|
+
* .v("quantity", (b) => b.number.integer())
|
|
15
|
+
* .v("count", (b) => b.number.required().integer())
|
|
16
|
+
* .build();
|
|
17
|
+
*
|
|
18
|
+
* // Combined with range validation
|
|
19
|
+
* builder.v("score", b => b.number.integer().min(0).max(100))
|
|
20
|
+
*
|
|
21
|
+
* // For ID validation
|
|
22
|
+
* builder.v("userId", b => b.number.required().integer().positive())
|
|
23
|
+
* ```
|
|
24
|
+
* @params
|
|
25
|
+
* - options?: { messageFactory?: (context: MessageContext) => string } - Optional configuration
|
|
26
|
+
* @returns Validation function that returns true if number is an integer
|
|
27
|
+
* @customError
|
|
28
|
+
* ```typescript
|
|
29
|
+
* .integer({
|
|
30
|
+
* messageFactory: ({ path, value }) =>
|
|
31
|
+
* `${path} must be a whole number (received: ${value})`
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
* @since 0.1.0-alpha
|
|
35
|
+
*/
|
|
36
|
+
export declare const numberIntegerPlugin: import("../index").TypedPlugin<"numberInteger", "integer", (options?: ValidationOptions) => {
|
|
37
|
+
check: (value: any) => boolean;
|
|
38
|
+
code: string;
|
|
39
|
+
getErrorMessage: (value: any, path: string) => string;
|
|
40
|
+
params: ValidationOptions<{}>[];
|
|
41
|
+
}, readonly ["number"], "validator", "standard">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var y=(e,n)=>{for(var a in n)l(e,a,{get:n[a],enumerable:!0})},c=(e,n,a,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of g(n))!d.call(e,r)&&r!==a&&l(e,r,{get:()=>n[r],enumerable:!(t=p(n,r))||t.enumerable});return e};var f=e=>c(l({},"__esModule",{value:!0}),e);var C={};y(C,{numberIntegerPlugin:()=>P});module.exports=f(C);var N=(e,n,a,t)=>{let m=(o=>(...s)=>{let i=o(...s);return i&&typeof i=="object"&&"check"in i?{...i,pluginName:t}:i})(a);switch(e){case"conditional":return(o,...s)=>m(o,...s);case"fieldReference":return(o,...s)=>m(o,...s);case"multiFieldReference":return m;case"transform":return o=>m(o);case"arrayElement":return(o,...s)=>m(o,...s);case"context":return o=>m(o);default:return m}};function T(e){let{name:n,methodName:a,allowedTypes:t,category:r,impl:m}=e;return{name:n,methodName:a,allowedTypes:t,category:r,create:()=>N(r,a,m,n)}}var u="number",I="numberInteger",x=()=>"Value must be an integer",h=[u],P=T({name:"numberInteger",methodName:"integer",allowedTypes:h,category:"standard",impl:e=>{let n=e?.code||I,a=e?.messageFactory||(t=>x());return{check:t=>typeof t!==u?!0:Number.isInteger(t),code:n,getErrorMessage:(t,r)=>a({path:r,value:t,code:n}),params:e?[e]:[]}}});0&&(module.exports={numberIntegerPlugin});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=(a,o,m,t)=>{let n=(e=>(...r)=>{let i=e(...r);return i&&typeof i=="object"&&"check"in i?{...i,pluginName:t}:i})(m);switch(a){case"conditional":return(e,...r)=>n(e,...r);case"fieldReference":return(e,...r)=>n(e,...r);case"multiFieldReference":return n;case"transform":return e=>n(e);case"arrayElement":return(e,...r)=>n(e,...r);case"context":return e=>n(e);default:return n}};function l(a){let{name:o,methodName:m,allowedTypes:t,category:s,impl:n}=a;return{name:o,methodName:m,allowedTypes:t,category:s,create:()=>u(s,m,n,o)}}var T="number",p="numberInteger",g=()=>"Value must be an integer",d=[T],f=l({name:"numberInteger",methodName:"integer",allowedTypes:d,category:"standard",impl:a=>{let o=a?.code||p,m=a?.messageFactory||(t=>g());return{check:t=>typeof t!==T?!0:Number.isInteger(t),code:o,getErrorMessage:(t,s)=>m({path:s,value:t,code:o}),params:a?[a]:[]}}});export{f as numberIntegerPlugin};
|