@elysiajs/openapi 1.4.10 → 1.4.12

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/dist/cjs/index.js CHANGED
@@ -250,7 +250,7 @@ var elysiaCSS = `.light-mode {
250
250
  background-image: var(--stripes), var(--rainbow);
251
251
  filter: opacity(4%) saturate(200%);
252
252
  }`;
253
- var ScalarRender = (info, config2) => `<!doctype html>
253
+ var ScalarRender = (info, config2, embedSpec) => `<!doctype html>
254
254
  <html>
255
255
  <head>
256
256
  <title>${info.title}</title>
@@ -278,7 +278,14 @@ var ScalarRender = (info, config2) => `<!doctype html>
278
278
  <body>
279
279
  <script
280
280
  id="api-reference"
281
- data-url="${config2.url}"
281
+ data-configuration='${JSON.stringify(
282
+ Object.assign(
283
+ config2,
284
+ {
285
+ content: embedSpec
286
+ }
287
+ )
288
+ )}'
282
289
  >
283
290
  </script>
284
291
  <script src="${config2.cdn}" crossorigin></script>
@@ -540,11 +547,11 @@ __export(kind_exports, {
540
547
  });
541
548
 
542
549
  // node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
543
- var TransformKind = Symbol.for("TypeBox.Transform");
544
- var ReadonlyKind = Symbol.for("TypeBox.Readonly");
545
- var OptionalKind = Symbol.for("TypeBox.Optional");
546
- var Hint = Symbol.for("TypeBox.Hint");
547
- var Kind = Symbol.for("TypeBox.Kind");
550
+ var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
551
+ var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
552
+ var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
553
+ var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
554
+ var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
548
555
 
549
556
  // node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
550
557
  function IsReadonly(value) {
@@ -2750,6 +2757,212 @@ openapi({
2750
2757
  })`
2751
2758
  };
2752
2759
  var warned = {};
2760
+ var mergeObjectSchemas = (schemas) => {
2761
+ if (schemas.length === 0)
2762
+ return {
2763
+ schema: void 0,
2764
+ notObjects: []
2765
+ };
2766
+ if (schemas.length === 1)
2767
+ return schemas[0].type === "object" ? {
2768
+ schema: schemas[0],
2769
+ notObjects: []
2770
+ } : {
2771
+ schema: void 0,
2772
+ notObjects: schemas
2773
+ };
2774
+ let newSchema;
2775
+ const notObjects = [];
2776
+ let additionalPropertiesIsTrue = false;
2777
+ let additionalPropertiesIsFalse = false;
2778
+ for (const schema of schemas) {
2779
+ if (!schema) continue;
2780
+ if (schema.type !== "object") {
2781
+ notObjects.push(schema);
2782
+ continue;
2783
+ }
2784
+ if ("additionalProperties" in schema) {
2785
+ if (schema.additionalProperties === true)
2786
+ additionalPropertiesIsTrue = true;
2787
+ else if (schema.additionalProperties === false)
2788
+ additionalPropertiesIsFalse = true;
2789
+ }
2790
+ if (!newSchema) {
2791
+ newSchema = schema;
2792
+ continue;
2793
+ }
2794
+ newSchema = {
2795
+ ...newSchema,
2796
+ ...schema,
2797
+ properties: {
2798
+ ...newSchema.properties,
2799
+ ...schema.properties
2800
+ },
2801
+ required: [
2802
+ ...newSchema?.required ?? [],
2803
+ ...schema.required ?? []
2804
+ ]
2805
+ };
2806
+ }
2807
+ if (newSchema) {
2808
+ if (newSchema.required)
2809
+ newSchema.required = [...new Set(newSchema.required)];
2810
+ if (additionalPropertiesIsFalse) newSchema.additionalProperties = false;
2811
+ else if (additionalPropertiesIsTrue)
2812
+ newSchema.additionalProperties = true;
2813
+ }
2814
+ return {
2815
+ schema: newSchema,
2816
+ notObjects
2817
+ };
2818
+ };
2819
+ var isTSchema = (value) => {
2820
+ if (!value || typeof value !== "object") return false;
2821
+ if (Kind in value) return true;
2822
+ const keys = Object.keys(value);
2823
+ if (keys.length > 0 && keys.every((k) => !isNaN(Number(k)))) {
2824
+ return false;
2825
+ }
2826
+ return false;
2827
+ };
2828
+ var normalizeSchemaReference = (schema) => {
2829
+ if (!schema) return void 0;
2830
+ if (typeof schema !== "string") return schema;
2831
+ return import_elysia.t.Ref(schema);
2832
+ };
2833
+ var mergeSchemaProperty = (existing, incoming, vendors) => {
2834
+ if (!existing) return incoming;
2835
+ if (!incoming) return existing;
2836
+ const existingSchema = normalizeSchemaReference(existing);
2837
+ let incomingSchema = normalizeSchemaReference(incoming);
2838
+ if (!existingSchema) return incoming;
2839
+ if (!incomingSchema) return existing;
2840
+ if (!isTSchema(incomingSchema) && incomingSchema["~standard"])
2841
+ incomingSchema = unwrapSchema(incomingSchema, vendors);
2842
+ if (!incomingSchema) return existing;
2843
+ const { schema: mergedSchema, notObjects } = mergeObjectSchemas([
2844
+ existingSchema,
2845
+ incomingSchema
2846
+ ]);
2847
+ if (notObjects.length > 0) {
2848
+ if (mergedSchema) return import_elysia.t.Intersect([mergedSchema, ...notObjects]);
2849
+ return notObjects.length === 1 ? notObjects[0] : import_elysia.t.Intersect(notObjects);
2850
+ }
2851
+ return mergedSchema;
2852
+ };
2853
+ var unwrapResponseSchema = (schema, vendors) => typeof schema === "string" ? normalizeSchemaReference(schema) : !schema ? void 0 : isTSchema(schema) ? schema : (
2854
+ // @ts-ignore
2855
+ schema["~standard"] ? unwrapSchema(schema, vendors, "output") : Object.fromEntries(
2856
+ Object.entries(schema).map(([status, schema2]) => [
2857
+ status,
2858
+ typeof schema2 === "string" ? normalizeSchemaReference(schema2) : isTSchema(schema2) ? schema2 : unwrapSchema(schema2, vendors, "output")
2859
+ ])
2860
+ )
2861
+ );
2862
+ var mergeResponseSchema = (_existing, _incoming, vendors) => {
2863
+ if (!_existing) return _incoming;
2864
+ if (!_incoming) return _existing;
2865
+ let existing = unwrapResponseSchema(_existing, vendors);
2866
+ let incoming = unwrapResponseSchema(_incoming, vendors);
2867
+ if (!existing && !incoming) return void 0;
2868
+ if (incoming && !existing) return incoming;
2869
+ if (existing && !incoming) return existing;
2870
+ if (isTSchema(existing) || existing?.["~standard"])
2871
+ existing = {
2872
+ 200: existing
2873
+ };
2874
+ if (isTSchema(incoming) || incoming?.["~standard"])
2875
+ incoming = {
2876
+ 200: incoming
2877
+ };
2878
+ const schema = {
2879
+ ...incoming
2880
+ };
2881
+ for (const status of Object.keys(existing ?? {})) {
2882
+ const existingSchema = existing[status];
2883
+ const incomingSchema = incoming[status];
2884
+ if (existingSchema && incomingSchema)
2885
+ schema[status] = mergeSchemaProperty(
2886
+ existingSchema,
2887
+ incomingSchema,
2888
+ vendors
2889
+ );
2890
+ else if (existingSchema) schema[status] = existingSchema;
2891
+ else if (incomingSchema) schema[status] = incomingSchema;
2892
+ }
2893
+ return schema;
2894
+ };
2895
+ var mergeStandaloneValidators = (hooks, vendors) => {
2896
+ const merged = { ...hooks };
2897
+ if (!hooks.standaloneValidator?.length) return merged;
2898
+ for (const validator of hooks.standaloneValidator) {
2899
+ if (validator.body)
2900
+ merged.body = mergeSchemaProperty(
2901
+ merged.body,
2902
+ validator.body,
2903
+ vendors
2904
+ );
2905
+ if (validator.headers)
2906
+ merged.headers = mergeSchemaProperty(
2907
+ merged.headers,
2908
+ validator.headers,
2909
+ vendors
2910
+ );
2911
+ if (validator.query)
2912
+ merged.query = mergeSchemaProperty(
2913
+ merged.query,
2914
+ validator.query,
2915
+ vendors
2916
+ );
2917
+ if (validator.params)
2918
+ merged.params = mergeSchemaProperty(
2919
+ merged.params,
2920
+ validator.params,
2921
+ vendors
2922
+ );
2923
+ if (validator.cookie)
2924
+ merged.cookie = mergeSchemaProperty(
2925
+ merged.cookie,
2926
+ validator.cookie,
2927
+ vendors
2928
+ );
2929
+ if (validator.response)
2930
+ merged.response = mergeResponseSchema(
2931
+ merged.response,
2932
+ validator.response,
2933
+ vendors
2934
+ );
2935
+ }
2936
+ if (typeof merged.body === "string")
2937
+ merged.body = normalizeSchemaReference(merged.body);
2938
+ if (typeof merged.headers === "string")
2939
+ merged.headers = normalizeSchemaReference(merged.headers);
2940
+ if (typeof merged.query === "string")
2941
+ merged.query = normalizeSchemaReference(merged.query);
2942
+ if (typeof merged.params === "string")
2943
+ merged.params = normalizeSchemaReference(merged.params);
2944
+ if (typeof merged.cookie === "string")
2945
+ merged.cookie = normalizeSchemaReference(merged.cookie);
2946
+ if (merged.response && typeof merged.response !== "string") {
2947
+ const response = merged.response;
2948
+ if ("type" in response || "$ref" in response) {
2949
+ if (typeof response === "string")
2950
+ merged.response = normalizeSchemaReference(response);
2951
+ } else {
2952
+ for (const [status, schema] of Object.entries(response))
2953
+ if (typeof schema === "string")
2954
+ response[status] = normalizeSchemaReference(schema);
2955
+ }
2956
+ }
2957
+ return merged;
2958
+ };
2959
+ var flattenRoutes = (routes, vendors) => routes.map((route) => {
2960
+ if (!route.hooks?.standaloneValidator?.length) return route;
2961
+ return {
2962
+ ...route,
2963
+ hooks: mergeStandaloneValidators(route.hooks, vendors)
2964
+ };
2965
+ });
2753
2966
  var unwrapReference = (schema, definitions) => {
2754
2967
  const ref = schema?.$ref;
2755
2968
  if (!ref) return schema;
@@ -2757,13 +2970,15 @@ var unwrapReference = (schema, definitions) => {
2757
2970
  if (ref && definitions[name]) schema = definitions[name];
2758
2971
  return enumToOpenApi(schema);
2759
2972
  };
2760
- var unwrapSchema = (schema, mapJsonSchema) => {
2973
+ var unwrapSchema = (schema, mapJsonSchema, io = "input") => {
2761
2974
  if (!schema) return;
2762
2975
  if (typeof schema === "string") schema = toRef(schema);
2763
2976
  if (Kind in schema) return enumToOpenApi(schema);
2764
2977
  if (Kind in schema || !schema?.["~standard"]) return;
2765
2978
  const vendor = schema["~standard"].vendor;
2766
2979
  try {
2980
+ if (schema["~standard"]?.jsonSchema?.[io])
2981
+ return schema["~standard"]?.jsonSchema?.[io]?.();
2767
2982
  if (mapJsonSchema?.[vendor] && typeof mapJsonSchema[vendor] === "function")
2768
2983
  return enumToOpenApi(mapJsonSchema[vendor](schema));
2769
2984
  switch (vendor) {
@@ -2858,7 +3073,6 @@ function toOpenAPISchema(app, exclude, references, vendors) {
2858
3073
  const excludePaths = Array.isArray(exclude?.paths) ? exclude.paths : typeof exclude?.paths !== "undefined" ? [exclude.paths] : [];
2859
3074
  const paths = /* @__PURE__ */ Object.create(null);
2860
3075
  const definitions = app.getGlobalDefinitions?.().type;
2861
- const routes = app.getGlobalRoutes();
2862
3076
  if (references) {
2863
3077
  if (!Array.isArray(references)) references = [references];
2864
3078
  for (let i = 0; i < references.length; i++) {
@@ -2866,6 +3080,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
2866
3080
  if (typeof reference === "function") references[i] = reference();
2867
3081
  }
2868
3082
  }
3083
+ const routes = flattenRoutes(app.getGlobalRoutes(), vendors);
2869
3084
  for (const route of routes) {
2870
3085
  if (route.hooks?.detail?.hide) continue;
2871
3086
  const method = route.method.toLowerCase();
@@ -3055,7 +3270,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
3055
3270
  if (typeof hooks.response === "object" && // TypeBox
3056
3271
  !hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
3057
3272
  for (let [status, schema] of Object.entries(hooks.response)) {
3058
- const response = unwrapSchema(schema, vendors);
3273
+ const response = unwrapSchema(schema, vendors, "output");
3059
3274
  if (!response) continue;
3060
3275
  const { type, description, $ref, ..._options } = unwrapReference(response, definitions);
3061
3276
  operation.responses[status] = {
@@ -3072,7 +3287,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
3072
3287
  };
3073
3288
  }
3074
3289
  } else {
3075
- const response = unwrapSchema(hooks.response, vendors);
3290
+ const response = unwrapSchema(hooks.response, vendors, "output");
3076
3291
  if (response) {
3077
3292
  const {
3078
3293
  type: _type,
@@ -3897,47 +4112,41 @@ function TypeBoxFromTypeBox(type) {
3897
4112
  return CloneType(type);
3898
4113
  }
3899
4114
 
3900
- // node_modules/valibot/dist/index.js
3901
- var store;
4115
+ // node_modules/valibot/dist/index.mjs
4116
+ var store$4;
3902
4117
  // @__NO_SIDE_EFFECTS__
3903
- function getGlobalConfig(config2) {
4118
+ function getGlobalConfig(config$1) {
3904
4119
  return {
3905
- lang: config2?.lang ?? store?.lang,
3906
- message: config2?.message,
3907
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
3908
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
4120
+ lang: config$1?.lang ?? store$4?.lang,
4121
+ message: config$1?.message,
4122
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
4123
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
3909
4124
  };
3910
4125
  }
3911
- var store2;
4126
+ var store$3;
3912
4127
  // @__NO_SIDE_EFFECTS__
3913
4128
  function getGlobalMessage(lang) {
3914
- return store2?.get(lang);
4129
+ return store$3?.get(lang);
3915
4130
  }
3916
- var store3;
4131
+ var store$2;
3917
4132
  // @__NO_SIDE_EFFECTS__
3918
4133
  function getSchemaMessage(lang) {
3919
- return store3?.get(lang);
4134
+ return store$2?.get(lang);
3920
4135
  }
3921
- var store4;
4136
+ var store$1;
3922
4137
  // @__NO_SIDE_EFFECTS__
3923
4138
  function getSpecificMessage(reference, lang) {
3924
- return store4?.get(reference)?.get(lang);
4139
+ return store$1?.get(reference)?.get(lang);
3925
4140
  }
3926
4141
  // @__NO_SIDE_EFFECTS__
3927
4142
  function _stringify(input) {
3928
4143
  const type = typeof input;
3929
- if (type === "string") {
3930
- return `"${input}"`;
3931
- }
3932
- if (type === "number" || type === "bigint" || type === "boolean") {
3933
- return `${input}`;
3934
- }
3935
- if (type === "object" || type === "function") {
3936
- return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
3937
- }
4144
+ if (type === "string") return `"${input}"`;
4145
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
4146
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
3938
4147
  return type;
3939
4148
  }
3940
- function _addIssue(context, label, dataset, config2, other) {
4149
+ function _addIssue(context, label, dataset, config$1, other) {
3941
4150
  const input = other && "input" in other ? other.input : dataset.value;
3942
4151
  const expected = other?.expected ?? context.expects ?? null;
3943
4152
  const received = other?.received ?? /* @__PURE__ */ _stringify(input);
@@ -3951,48 +4160,49 @@ function _addIssue(context, label, dataset, config2, other) {
3951
4160
  requirement: context.requirement,
3952
4161
  path: other?.path,
3953
4162
  issues: other?.issues,
3954
- lang: config2.lang,
3955
- abortEarly: config2.abortEarly,
3956
- abortPipeEarly: config2.abortPipeEarly
4163
+ lang: config$1.lang,
4164
+ abortEarly: config$1.abortEarly,
4165
+ abortPipeEarly: config$1.abortPipeEarly
3957
4166
  };
3958
4167
  const isSchema = context.kind === "schema";
3959
- const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue2.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue2.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue2.lang);
3960
- if (message2 !== void 0) {
3961
- issue2.message = typeof message2 === "function" ? (
3962
- // @ts-expect-error
3963
- message2(issue2)
3964
- ) : message2;
3965
- }
3966
- if (isSchema) {
3967
- dataset.typed = false;
3968
- }
3969
- if (dataset.issues) {
3970
- dataset.issues.push(issue2);
3971
- } else {
3972
- dataset.issues = [issue2];
3973
- }
4168
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue2.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue2.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue2.lang);
4169
+ if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
4170
+ if (isSchema) dataset.typed = false;
4171
+ if (dataset.issues) dataset.issues.push(issue2);
4172
+ else dataset.issues = [issue2];
3974
4173
  }
3975
4174
  // @__NO_SIDE_EFFECTS__
3976
4175
  function _getStandardProps(context) {
3977
4176
  return {
3978
4177
  version: 1,
3979
4178
  vendor: "valibot",
3980
- validate(value2) {
3981
- return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
4179
+ validate(value$1) {
4180
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
3982
4181
  }
3983
4182
  };
3984
4183
  }
3985
4184
  var NON_DIGIT_REGEX = /\D/gu;
3986
4185
  // @__NO_SIDE_EFFECTS__
3987
4186
  function _isLuhnAlgo(input) {
3988
- const number2 = input.replace(NON_DIGIT_REGEX, "");
3989
- let length2 = number2.length;
4187
+ const number$1 = input.replace(NON_DIGIT_REGEX, "");
4188
+ let length$1 = number$1.length;
3990
4189
  let bit = 1;
3991
4190
  let sum = 0;
3992
- while (length2) {
3993
- const value2 = +number2[--length2];
4191
+ while (length$1) {
4192
+ const value$1 = +number$1[--length$1];
3994
4193
  bit ^= 1;
3995
- sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value2] : value2;
4194
+ sum += bit ? [
4195
+ 0,
4196
+ 2,
4197
+ 4,
4198
+ 6,
4199
+ 8,
4200
+ 1,
4201
+ 3,
4202
+ 5,
4203
+ 7,
4204
+ 9
4205
+ ][value$1] : value$1;
3996
4206
  }
3997
4207
  return sum % 10 === 0;
3998
4208
  }
@@ -4002,14 +4212,8 @@ var CUID2_REGEX = /^[a-z][\da-z]*$/u;
4002
4212
  var DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;
4003
4213
  var DIGITS_REGEX = /^\d+$/u;
4004
4214
  var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
4005
- var EMOJI_REGEX = (
4006
- // eslint-disable-next-line redos-detector/no-unsafe-regex, regexp/no-dupe-disjunctions -- false positives
4007
- new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}))*)+$", "u")
4008
- );
4009
- var IPV4_REGEX = (
4010
- // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive
4011
- /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u
4012
- );
4215
+ var EMOJI_REGEX = new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$", "u");
4216
+ var IPV4_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u;
4013
4217
  var IPV6_REGEX = /^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
4014
4218
  var IP_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
4015
4219
  var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
@@ -4026,7 +4230,7 @@ var OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;
4026
4230
  var ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;
4027
4231
  var UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
4028
4232
  // @__NO_SIDE_EFFECTS__
4029
- function base64(message2) {
4233
+ function base64(message$1) {
4030
4234
  return {
4031
4235
  kind: "validation",
4032
4236
  type: "base64",
@@ -4034,17 +4238,15 @@ function base64(message2) {
4034
4238
  async: false,
4035
4239
  expects: null,
4036
4240
  requirement: BASE64_REGEX,
4037
- message: message2,
4038
- "~run"(dataset, config2) {
4039
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4040
- _addIssue(this, "Base64", dataset, config2);
4041
- }
4241
+ message: message$1,
4242
+ "~run"(dataset, config$1) {
4243
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);
4042
4244
  return dataset;
4043
4245
  }
4044
4246
  };
4045
4247
  }
4046
4248
  // @__NO_SIDE_EFFECTS__
4047
- function bic(message2) {
4249
+ function bic(message$1) {
4048
4250
  return {
4049
4251
  kind: "validation",
4050
4252
  type: "bic",
@@ -4052,11 +4254,9 @@ function bic(message2) {
4052
4254
  async: false,
4053
4255
  expects: null,
4054
4256
  requirement: BIC_REGEX,
4055
- message: message2,
4056
- "~run"(dataset, config2) {
4057
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4058
- _addIssue(this, "BIC", dataset, config2);
4059
- }
4257
+ message: message$1,
4258
+ "~run"(dataset, config$1) {
4259
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);
4060
4260
  return dataset;
4061
4261
  }
4062
4262
  };
@@ -4064,24 +4264,16 @@ function bic(message2) {
4064
4264
  var CREDIT_CARD_REGEX = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
4065
4265
  var SANITIZE_REGEX = /[- ]/gu;
4066
4266
  var PROVIDER_REGEX_LIST = [
4067
- // American Express
4068
4267
  /^3[47]\d{13}$/u,
4069
- // Diners Club
4070
4268
  /^3(?:0[0-5]|[68]\d)\d{11,13}$/u,
4071
- // Discover
4072
4269
  /^6(?:011|5\d{2})\d{12,15}$/u,
4073
- // JCB
4074
4270
  /^(?:2131|1800|35\d{3})\d{11}$/u,
4075
- // Mastercard
4076
- // eslint-disable-next-line redos-detector/no-unsafe-regex
4077
4271
  /^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,
4078
- // UnionPay
4079
4272
  /^(?:6[27]\d{14,17}|81\d{14,17})$/u,
4080
- // Visa
4081
4273
  /^4\d{12}(?:\d{3,6})?$/u
4082
4274
  ];
4083
4275
  // @__NO_SIDE_EFFECTS__
4084
- function creditCard(message2) {
4276
+ function creditCard(message$1) {
4085
4277
  return {
4086
4278
  kind: "validation",
4087
4279
  type: "credit_card",
@@ -4090,22 +4282,17 @@ function creditCard(message2) {
4090
4282
  expects: null,
4091
4283
  requirement(input) {
4092
4284
  let sanitized;
4093
- return CREDIT_CARD_REGEX.test(input) && // Remove any hyphens and blanks
4094
- (sanitized = input.replace(SANITIZE_REGEX, "")) && // Check if it matches a provider
4095
- PROVIDER_REGEX_LIST.some((regex2) => regex2.test(sanitized)) && // Check if passes luhn algorithm
4096
- /* @__PURE__ */ _isLuhnAlgo(sanitized);
4285
+ return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);
4097
4286
  },
4098
- message: message2,
4099
- "~run"(dataset, config2) {
4100
- if (dataset.typed && !this.requirement(dataset.value)) {
4101
- _addIssue(this, "credit card", dataset, config2);
4102
- }
4287
+ message: message$1,
4288
+ "~run"(dataset, config$1) {
4289
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);
4103
4290
  return dataset;
4104
4291
  }
4105
4292
  };
4106
4293
  }
4107
4294
  // @__NO_SIDE_EFFECTS__
4108
- function cuid2(message2) {
4295
+ function cuid2(message$1) {
4109
4296
  return {
4110
4297
  kind: "validation",
4111
4298
  type: "cuid2",
@@ -4113,17 +4300,15 @@ function cuid2(message2) {
4113
4300
  async: false,
4114
4301
  expects: null,
4115
4302
  requirement: CUID2_REGEX,
4116
- message: message2,
4117
- "~run"(dataset, config2) {
4118
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4119
- _addIssue(this, "Cuid2", dataset, config2);
4120
- }
4303
+ message: message$1,
4304
+ "~run"(dataset, config$1) {
4305
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);
4121
4306
  return dataset;
4122
4307
  }
4123
4308
  };
4124
4309
  }
4125
4310
  // @__NO_SIDE_EFFECTS__
4126
- function decimal(message2) {
4311
+ function decimal(message$1) {
4127
4312
  return {
4128
4313
  kind: "validation",
4129
4314
  type: "decimal",
@@ -4131,17 +4316,15 @@ function decimal(message2) {
4131
4316
  async: false,
4132
4317
  expects: null,
4133
4318
  requirement: DECIMAL_REGEX,
4134
- message: message2,
4135
- "~run"(dataset, config2) {
4136
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4137
- _addIssue(this, "decimal", dataset, config2);
4138
- }
4319
+ message: message$1,
4320
+ "~run"(dataset, config$1) {
4321
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);
4139
4322
  return dataset;
4140
4323
  }
4141
4324
  };
4142
4325
  }
4143
4326
  // @__NO_SIDE_EFFECTS__
4144
- function digits(message2) {
4327
+ function digits(message$1) {
4145
4328
  return {
4146
4329
  kind: "validation",
4147
4330
  type: "digits",
@@ -4149,17 +4332,15 @@ function digits(message2) {
4149
4332
  async: false,
4150
4333
  expects: null,
4151
4334
  requirement: DIGITS_REGEX,
4152
- message: message2,
4153
- "~run"(dataset, config2) {
4154
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4155
- _addIssue(this, "digits", dataset, config2);
4156
- }
4335
+ message: message$1,
4336
+ "~run"(dataset, config$1) {
4337
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);
4157
4338
  return dataset;
4158
4339
  }
4159
4340
  };
4160
4341
  }
4161
4342
  // @__NO_SIDE_EFFECTS__
4162
- function email(message2) {
4343
+ function email(message$1) {
4163
4344
  return {
4164
4345
  kind: "validation",
4165
4346
  type: "email",
@@ -4167,17 +4348,15 @@ function email(message2) {
4167
4348
  expects: null,
4168
4349
  async: false,
4169
4350
  requirement: EMAIL_REGEX,
4170
- message: message2,
4171
- "~run"(dataset, config2) {
4172
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4173
- _addIssue(this, "email", dataset, config2);
4174
- }
4351
+ message: message$1,
4352
+ "~run"(dataset, config$1) {
4353
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
4175
4354
  return dataset;
4176
4355
  }
4177
4356
  };
4178
4357
  }
4179
4358
  // @__NO_SIDE_EFFECTS__
4180
- function emoji(message2) {
4359
+ function emoji(message$1) {
4181
4360
  return {
4182
4361
  kind: "validation",
4183
4362
  type: "emoji",
@@ -4185,17 +4364,15 @@ function emoji(message2) {
4185
4364
  async: false,
4186
4365
  expects: null,
4187
4366
  requirement: EMOJI_REGEX,
4188
- message: message2,
4189
- "~run"(dataset, config2) {
4190
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4191
- _addIssue(this, "emoji", dataset, config2);
4192
- }
4367
+ message: message$1,
4368
+ "~run"(dataset, config$1) {
4369
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);
4193
4370
  return dataset;
4194
4371
  }
4195
4372
  };
4196
4373
  }
4197
4374
  // @__NO_SIDE_EFFECTS__
4198
- function ip(message2) {
4375
+ function ip(message$1) {
4199
4376
  return {
4200
4377
  kind: "validation",
4201
4378
  type: "ip",
@@ -4203,17 +4380,15 @@ function ip(message2) {
4203
4380
  async: false,
4204
4381
  expects: null,
4205
4382
  requirement: IP_REGEX,
4206
- message: message2,
4207
- "~run"(dataset, config2) {
4208
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4209
- _addIssue(this, "IP", dataset, config2);
4210
- }
4383
+ message: message$1,
4384
+ "~run"(dataset, config$1) {
4385
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IP", dataset, config$1);
4211
4386
  return dataset;
4212
4387
  }
4213
4388
  };
4214
4389
  }
4215
4390
  // @__NO_SIDE_EFFECTS__
4216
- function ipv4(message2) {
4391
+ function ipv4(message$1) {
4217
4392
  return {
4218
4393
  kind: "validation",
4219
4394
  type: "ipv4",
@@ -4221,17 +4396,15 @@ function ipv4(message2) {
4221
4396
  async: false,
4222
4397
  expects: null,
4223
4398
  requirement: IPV4_REGEX,
4224
- message: message2,
4225
- "~run"(dataset, config2) {
4226
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4227
- _addIssue(this, "IPv4", dataset, config2);
4228
- }
4399
+ message: message$1,
4400
+ "~run"(dataset, config$1) {
4401
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv4", dataset, config$1);
4229
4402
  return dataset;
4230
4403
  }
4231
4404
  };
4232
4405
  }
4233
4406
  // @__NO_SIDE_EFFECTS__
4234
- function ipv6(message2) {
4407
+ function ipv6(message$1) {
4235
4408
  return {
4236
4409
  kind: "validation",
4237
4410
  type: "ipv6",
@@ -4239,17 +4412,15 @@ function ipv6(message2) {
4239
4412
  async: false,
4240
4413
  expects: null,
4241
4414
  requirement: IPV6_REGEX,
4242
- message: message2,
4243
- "~run"(dataset, config2) {
4244
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4245
- _addIssue(this, "IPv6", dataset, config2);
4246
- }
4415
+ message: message$1,
4416
+ "~run"(dataset, config$1) {
4417
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv6", dataset, config$1);
4247
4418
  return dataset;
4248
4419
  }
4249
4420
  };
4250
4421
  }
4251
4422
  // @__NO_SIDE_EFFECTS__
4252
- function isoDate(message2) {
4423
+ function isoDate(message$1) {
4253
4424
  return {
4254
4425
  kind: "validation",
4255
4426
  type: "iso_date",
@@ -4257,17 +4428,15 @@ function isoDate(message2) {
4257
4428
  async: false,
4258
4429
  expects: null,
4259
4430
  requirement: ISO_DATE_REGEX,
4260
- message: message2,
4261
- "~run"(dataset, config2) {
4262
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4263
- _addIssue(this, "date", dataset, config2);
4264
- }
4431
+ message: message$1,
4432
+ "~run"(dataset, config$1) {
4433
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
4265
4434
  return dataset;
4266
4435
  }
4267
4436
  };
4268
4437
  }
4269
4438
  // @__NO_SIDE_EFFECTS__
4270
- function isoDateTime(message2) {
4439
+ function isoDateTime(message$1) {
4271
4440
  return {
4272
4441
  kind: "validation",
4273
4442
  type: "iso_date_time",
@@ -4275,17 +4444,15 @@ function isoDateTime(message2) {
4275
4444
  async: false,
4276
4445
  expects: null,
4277
4446
  requirement: ISO_DATE_TIME_REGEX,
4278
- message: message2,
4279
- "~run"(dataset, config2) {
4280
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4281
- _addIssue(this, "date-time", dataset, config2);
4282
- }
4447
+ message: message$1,
4448
+ "~run"(dataset, config$1) {
4449
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date-time", dataset, config$1);
4283
4450
  return dataset;
4284
4451
  }
4285
4452
  };
4286
4453
  }
4287
4454
  // @__NO_SIDE_EFFECTS__
4288
- function isoTime(message2) {
4455
+ function isoTime(message$1) {
4289
4456
  return {
4290
4457
  kind: "validation",
4291
4458
  type: "iso_time",
@@ -4293,17 +4460,15 @@ function isoTime(message2) {
4293
4460
  async: false,
4294
4461
  expects: null,
4295
4462
  requirement: ISO_TIME_REGEX,
4296
- message: message2,
4297
- "~run"(dataset, config2) {
4298
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4299
- _addIssue(this, "time", dataset, config2);
4300
- }
4463
+ message: message$1,
4464
+ "~run"(dataset, config$1) {
4465
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time", dataset, config$1);
4301
4466
  return dataset;
4302
4467
  }
4303
4468
  };
4304
4469
  }
4305
4470
  // @__NO_SIDE_EFFECTS__
4306
- function isoTimeSecond(message2) {
4471
+ function isoTimeSecond(message$1) {
4307
4472
  return {
4308
4473
  kind: "validation",
4309
4474
  type: "iso_time_second",
@@ -4311,17 +4476,15 @@ function isoTimeSecond(message2) {
4311
4476
  async: false,
4312
4477
  expects: null,
4313
4478
  requirement: ISO_TIME_SECOND_REGEX,
4314
- message: message2,
4315
- "~run"(dataset, config2) {
4316
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4317
- _addIssue(this, "time-second", dataset, config2);
4318
- }
4479
+ message: message$1,
4480
+ "~run"(dataset, config$1) {
4481
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time-second", dataset, config$1);
4319
4482
  return dataset;
4320
4483
  }
4321
4484
  };
4322
4485
  }
4323
4486
  // @__NO_SIDE_EFFECTS__
4324
- function isoTimestamp(message2) {
4487
+ function isoTimestamp(message$1) {
4325
4488
  return {
4326
4489
  kind: "validation",
4327
4490
  type: "iso_timestamp",
@@ -4329,17 +4492,15 @@ function isoTimestamp(message2) {
4329
4492
  async: false,
4330
4493
  expects: null,
4331
4494
  requirement: ISO_TIMESTAMP_REGEX,
4332
- message: message2,
4333
- "~run"(dataset, config2) {
4334
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4335
- _addIssue(this, "timestamp", dataset, config2);
4336
- }
4495
+ message: message$1,
4496
+ "~run"(dataset, config$1) {
4497
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
4337
4498
  return dataset;
4338
4499
  }
4339
4500
  };
4340
4501
  }
4341
4502
  // @__NO_SIDE_EFFECTS__
4342
- function isoWeek(message2) {
4503
+ function isoWeek(message$1) {
4343
4504
  return {
4344
4505
  kind: "validation",
4345
4506
  type: "iso_week",
@@ -4347,17 +4508,15 @@ function isoWeek(message2) {
4347
4508
  async: false,
4348
4509
  expects: null,
4349
4510
  requirement: ISO_WEEK_REGEX,
4350
- message: message2,
4351
- "~run"(dataset, config2) {
4352
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4353
- _addIssue(this, "week", dataset, config2);
4354
- }
4511
+ message: message$1,
4512
+ "~run"(dataset, config$1) {
4513
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "week", dataset, config$1);
4355
4514
  return dataset;
4356
4515
  }
4357
4516
  };
4358
4517
  }
4359
4518
  // @__NO_SIDE_EFFECTS__
4360
- function mac(message2) {
4519
+ function mac(message$1) {
4361
4520
  return {
4362
4521
  kind: "validation",
4363
4522
  type: "mac",
@@ -4365,17 +4524,15 @@ function mac(message2) {
4365
4524
  async: false,
4366
4525
  expects: null,
4367
4526
  requirement: MAC_REGEX,
4368
- message: message2,
4369
- "~run"(dataset, config2) {
4370
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4371
- _addIssue(this, "MAC", dataset, config2);
4372
- }
4527
+ message: message$1,
4528
+ "~run"(dataset, config$1) {
4529
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "MAC", dataset, config$1);
4373
4530
  return dataset;
4374
4531
  }
4375
4532
  };
4376
4533
  }
4377
4534
  // @__NO_SIDE_EFFECTS__
4378
- function mac48(message2) {
4535
+ function mac48(message$1) {
4379
4536
  return {
4380
4537
  kind: "validation",
4381
4538
  type: "mac48",
@@ -4383,17 +4540,15 @@ function mac48(message2) {
4383
4540
  async: false,
4384
4541
  expects: null,
4385
4542
  requirement: MAC48_REGEX,
4386
- message: message2,
4387
- "~run"(dataset, config2) {
4388
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4389
- _addIssue(this, "48-bit MAC", dataset, config2);
4390
- }
4543
+ message: message$1,
4544
+ "~run"(dataset, config$1) {
4545
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "48-bit MAC", dataset, config$1);
4391
4546
  return dataset;
4392
4547
  }
4393
4548
  };
4394
4549
  }
4395
4550
  // @__NO_SIDE_EFFECTS__
4396
- function mac64(message2) {
4551
+ function mac64(message$1) {
4397
4552
  return {
4398
4553
  kind: "validation",
4399
4554
  type: "mac64",
@@ -4401,17 +4556,15 @@ function mac64(message2) {
4401
4556
  async: false,
4402
4557
  expects: null,
4403
4558
  requirement: MAC64_REGEX,
4404
- message: message2,
4405
- "~run"(dataset, config2) {
4406
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4407
- _addIssue(this, "64-bit MAC", dataset, config2);
4408
- }
4559
+ message: message$1,
4560
+ "~run"(dataset, config$1) {
4561
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "64-bit MAC", dataset, config$1);
4409
4562
  return dataset;
4410
4563
  }
4411
4564
  };
4412
4565
  }
4413
4566
  // @__NO_SIDE_EFFECTS__
4414
- function nanoid(message2) {
4567
+ function nanoid(message$1) {
4415
4568
  return {
4416
4569
  kind: "validation",
4417
4570
  type: "nanoid",
@@ -4419,17 +4572,15 @@ function nanoid(message2) {
4419
4572
  async: false,
4420
4573
  expects: null,
4421
4574
  requirement: NANO_ID_REGEX,
4422
- message: message2,
4423
- "~run"(dataset, config2) {
4424
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4425
- _addIssue(this, "Nano ID", dataset, config2);
4426
- }
4575
+ message: message$1,
4576
+ "~run"(dataset, config$1) {
4577
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Nano ID", dataset, config$1);
4427
4578
  return dataset;
4428
4579
  }
4429
4580
  };
4430
4581
  }
4431
4582
  // @__NO_SIDE_EFFECTS__
4432
- function octal(message2) {
4583
+ function octal(message$1) {
4433
4584
  return {
4434
4585
  kind: "validation",
4435
4586
  type: "octal",
@@ -4437,17 +4588,15 @@ function octal(message2) {
4437
4588
  async: false,
4438
4589
  expects: null,
4439
4590
  requirement: OCTAL_REGEX,
4440
- message: message2,
4441
- "~run"(dataset, config2) {
4442
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4443
- _addIssue(this, "octal", dataset, config2);
4444
- }
4591
+ message: message$1,
4592
+ "~run"(dataset, config$1) {
4593
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "octal", dataset, config$1);
4445
4594
  return dataset;
4446
4595
  }
4447
4596
  };
4448
4597
  }
4449
4598
  // @__NO_SIDE_EFFECTS__
4450
- function ulid(message2) {
4599
+ function ulid(message$1) {
4451
4600
  return {
4452
4601
  kind: "validation",
4453
4602
  type: "ulid",
@@ -4455,17 +4604,15 @@ function ulid(message2) {
4455
4604
  async: false,
4456
4605
  expects: null,
4457
4606
  requirement: ULID_REGEX,
4458
- message: message2,
4459
- "~run"(dataset, config2) {
4460
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4461
- _addIssue(this, "ULID", dataset, config2);
4462
- }
4607
+ message: message$1,
4608
+ "~run"(dataset, config$1) {
4609
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "ULID", dataset, config$1);
4463
4610
  return dataset;
4464
4611
  }
4465
4612
  };
4466
4613
  }
4467
4614
  // @__NO_SIDE_EFFECTS__
4468
- function url(message2) {
4615
+ function url(message$1) {
4469
4616
  return {
4470
4617
  kind: "validation",
4471
4618
  type: "url",
@@ -4480,17 +4627,15 @@ function url(message2) {
4480
4627
  return false;
4481
4628
  }
4482
4629
  },
4483
- message: message2,
4484
- "~run"(dataset, config2) {
4485
- if (dataset.typed && !this.requirement(dataset.value)) {
4486
- _addIssue(this, "URL", dataset, config2);
4487
- }
4630
+ message: message$1,
4631
+ "~run"(dataset, config$1) {
4632
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
4488
4633
  return dataset;
4489
4634
  }
4490
4635
  };
4491
4636
  }
4492
4637
  // @__NO_SIDE_EFFECTS__
4493
- function uuid(message2) {
4638
+ function uuid(message$1) {
4494
4639
  return {
4495
4640
  kind: "validation",
4496
4641
  type: "uuid",
@@ -4498,64 +4643,55 @@ function uuid(message2) {
4498
4643
  async: false,
4499
4644
  expects: null,
4500
4645
  requirement: UUID_REGEX,
4501
- message: message2,
4502
- "~run"(dataset, config2) {
4503
- if (dataset.typed && !this.requirement.test(dataset.value)) {
4504
- _addIssue(this, "UUID", dataset, config2);
4505
- }
4646
+ message: message$1,
4647
+ "~run"(dataset, config$1) {
4648
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "UUID", dataset, config$1);
4506
4649
  return dataset;
4507
4650
  }
4508
4651
  };
4509
4652
  }
4510
4653
  // @__NO_SIDE_EFFECTS__
4511
- function string(message2) {
4654
+ function string(message$1) {
4512
4655
  return {
4513
4656
  kind: "schema",
4514
4657
  type: "string",
4515
4658
  reference: string,
4516
4659
  expects: "string",
4517
4660
  async: false,
4518
- message: message2,
4661
+ message: message$1,
4519
4662
  get "~standard"() {
4520
4663
  return /* @__PURE__ */ _getStandardProps(this);
4521
4664
  },
4522
- "~run"(dataset, config2) {
4523
- if (typeof dataset.value === "string") {
4524
- dataset.typed = true;
4525
- } else {
4526
- _addIssue(this, "type", dataset, config2);
4527
- }
4665
+ "~run"(dataset, config$1) {
4666
+ if (typeof dataset.value === "string") dataset.typed = true;
4667
+ else _addIssue(this, "type", dataset, config$1);
4528
4668
  return dataset;
4529
4669
  }
4530
4670
  };
4531
4671
  }
4532
4672
  // @__NO_SIDE_EFFECTS__
4533
- function pipe(...pipe22) {
4673
+ function pipe(...pipe$1) {
4534
4674
  return {
4535
- ...pipe22[0],
4536
- pipe: pipe22,
4675
+ ...pipe$1[0],
4676
+ pipe: pipe$1,
4537
4677
  get "~standard"() {
4538
4678
  return /* @__PURE__ */ _getStandardProps(this);
4539
4679
  },
4540
- "~run"(dataset, config2) {
4541
- for (const item of pipe22) {
4542
- if (item.kind !== "metadata") {
4543
- if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
4544
- dataset.typed = false;
4545
- break;
4546
- }
4547
- if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
4548
- dataset = item["~run"](dataset, config2);
4549
- }
4680
+ "~run"(dataset, config$1) {
4681
+ for (const item of pipe$1) if (item.kind !== "metadata") {
4682
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
4683
+ dataset.typed = false;
4684
+ break;
4550
4685
  }
4686
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
4551
4687
  }
4552
4688
  return dataset;
4553
4689
  }
4554
4690
  };
4555
4691
  }
4556
4692
  // @__NO_SIDE_EFFECTS__
4557
- function safeParse(schema, input, config2) {
4558
- const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
4693
+ function safeParse(schema, input, config$1) {
4694
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
4559
4695
  return {
4560
4696
  typed: dataset.typed,
4561
4697
  success: !dataset.issues,
@@ -4860,30 +4996,39 @@ var NEVER = Object.freeze({
4860
4996
  // @__NO_SIDE_EFFECTS__
4861
4997
  function $constructor(name, initializer3, params) {
4862
4998
  function init(inst, def) {
4863
- var _a;
4864
- Object.defineProperty(inst, "_zod", {
4865
- value: inst._zod ?? {},
4866
- enumerable: false
4867
- });
4868
- (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
4999
+ if (!inst._zod) {
5000
+ Object.defineProperty(inst, "_zod", {
5001
+ value: {
5002
+ def,
5003
+ constr: _,
5004
+ traits: /* @__PURE__ */ new Set()
5005
+ },
5006
+ enumerable: false
5007
+ });
5008
+ }
5009
+ if (inst._zod.traits.has(name)) {
5010
+ return;
5011
+ }
4869
5012
  inst._zod.traits.add(name);
4870
5013
  initializer3(inst, def);
4871
- for (const k in _.prototype) {
4872
- if (!(k in inst))
4873
- Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
5014
+ const proto = _.prototype;
5015
+ const keys = Object.keys(proto);
5016
+ for (let i = 0; i < keys.length; i++) {
5017
+ const k = keys[i];
5018
+ if (!(k in inst)) {
5019
+ inst[k] = proto[k].bind(inst);
5020
+ }
4874
5021
  }
4875
- inst._zod.constr = _;
4876
- inst._zod.def = def;
4877
5022
  }
4878
5023
  const Parent = params?.Parent ?? Object;
4879
5024
  class Definition extends Parent {
4880
5025
  }
4881
5026
  Object.defineProperty(Definition, "name", { value: name });
4882
5027
  function _(def) {
4883
- var _a;
5028
+ var _a2;
4884
5029
  const inst = params?.Parent ? new Definition() : this;
4885
5030
  init(inst, def);
4886
- (_a = inst._zod).deferred ?? (_a.deferred = []);
5031
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
4887
5032
  for (const fn of inst._zod.deferred) {
4888
5033
  fn();
4889
5034
  }
@@ -4900,7 +5045,6 @@ function $constructor(name, initializer3, params) {
4900
5045
  Object.defineProperty(_, "name", { value: name });
4901
5046
  return _;
4902
5047
  }
4903
- var $brand = Symbol("zod_brand");
4904
5048
  var $ZodAsyncError = class extends Error {
4905
5049
  constructor() {
4906
5050
  super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
@@ -4977,6 +5121,7 @@ __export(util_exports, {
4977
5121
  required: () => required,
4978
5122
  safeExtend: () => safeExtend,
4979
5123
  shallowClone: () => shallowClone,
5124
+ slugify: () => slugify,
4980
5125
  stringifyPrimitive: () => stringifyPrimitive,
4981
5126
  uint8ArrayToBase64: () => uint8ArrayToBase64,
4982
5127
  uint8ArrayToBase64url: () => uint8ArrayToBase64url,
@@ -4992,7 +5137,7 @@ function assertNotEqual(val) {
4992
5137
  function assertIs(_arg) {
4993
5138
  }
4994
5139
  function assertNever(_x) {
4995
- throw new Error();
5140
+ throw new Error("Unexpected value in exhaustive check");
4996
5141
  }
4997
5142
  function assert(_) {
4998
5143
  }
@@ -5045,7 +5190,7 @@ function floatSafeRemainder(val, step) {
5045
5190
  const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
5046
5191
  return valInt % stepInt / 10 ** decCount;
5047
5192
  }
5048
- var EVALUATING = Symbol("evaluating");
5193
+ var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
5049
5194
  function defineLazy(object, key, getter) {
5050
5195
  let value = void 0;
5051
5196
  Object.defineProperty(object, key, {
@@ -5117,6 +5262,9 @@ function randomString(length = 10) {
5117
5262
  function esc(str) {
5118
5263
  return JSON.stringify(str);
5119
5264
  }
5265
+ function slugify(input) {
5266
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
5267
+ }
5120
5268
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
5121
5269
  };
5122
5270
  function isObject(data) {
@@ -5140,6 +5288,8 @@ function isPlainObject(o) {
5140
5288
  const ctor = o.constructor;
5141
5289
  if (ctor === void 0)
5142
5290
  return true;
5291
+ if (typeof ctor !== "function")
5292
+ return true;
5143
5293
  const prot = ctor.prototype;
5144
5294
  if (isObject(prot) === false)
5145
5295
  return false;
@@ -5456,8 +5606,8 @@ function aborted(x, startIndex = 0) {
5456
5606
  }
5457
5607
  function prefixIssues(path, issues) {
5458
5608
  return issues.map((iss) => {
5459
- var _a;
5460
- (_a = iss).path ?? (_a.path = []);
5609
+ var _a2;
5610
+ (_a2 = iss).path ?? (_a2.path = []);
5461
5611
  iss.path.unshift(path);
5462
5612
  return iss;
5463
5613
  });
@@ -5585,10 +5735,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
5585
5735
  }
5586
5736
  return { formErrors, fieldErrors };
5587
5737
  }
5588
- function formatError(error, _mapper) {
5589
- const mapper = _mapper || function(issue2) {
5590
- return issue2.message;
5591
- };
5738
+ function formatError(error, mapper = (issue2) => issue2.message) {
5592
5739
  const fieldErrors = { _errors: [] };
5593
5740
  const processError = (error2) => {
5594
5741
  for (const issue2 of error2.issues) {
@@ -5725,7 +5872,6 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
5725
5872
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
5726
5873
  var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
5727
5874
  var base64url = /^[A-Za-z0-9_-]*$/;
5728
- var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
5729
5875
  var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
5730
5876
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
5731
5877
  var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
@@ -5762,10 +5908,10 @@ var uppercase = /^[^a-z]*$/;
5762
5908
 
5763
5909
  // node_modules/zod/v4/core/checks.js
5764
5910
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
5765
- var _a;
5911
+ var _a2;
5766
5912
  inst._zod ?? (inst._zod = {});
5767
5913
  inst._zod.def = def;
5768
- (_a = inst._zod).onattach ?? (_a.onattach = []);
5914
+ (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
5769
5915
  });
5770
5916
  var numericOriginMap = {
5771
5917
  number: "number",
@@ -5831,8 +5977,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
5831
5977
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
5832
5978
  $ZodCheck.init(inst, def);
5833
5979
  inst._zod.onattach.push((inst2) => {
5834
- var _a;
5835
- (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
5980
+ var _a2;
5981
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
5836
5982
  });
5837
5983
  inst._zod.check = (payload) => {
5838
5984
  if (typeof payload.value !== typeof def.value)
@@ -5926,9 +6072,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
5926
6072
  };
5927
6073
  });
5928
6074
  var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
5929
- var _a;
6075
+ var _a2;
5930
6076
  $ZodCheck.init(inst, def);
5931
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
6077
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
5932
6078
  const val = payload.value;
5933
6079
  return !nullish(val) && val.length !== void 0;
5934
6080
  });
@@ -5955,9 +6101,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
5955
6101
  };
5956
6102
  });
5957
6103
  var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
5958
- var _a;
6104
+ var _a2;
5959
6105
  $ZodCheck.init(inst, def);
5960
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
6106
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
5961
6107
  const val = payload.value;
5962
6108
  return !nullish(val) && val.length !== void 0;
5963
6109
  });
@@ -5984,9 +6130,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
5984
6130
  };
5985
6131
  });
5986
6132
  var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
5987
- var _a;
6133
+ var _a2;
5988
6134
  $ZodCheck.init(inst, def);
5989
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
6135
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
5990
6136
  const val = payload.value;
5991
6137
  return !nullish(val) && val.length !== void 0;
5992
6138
  });
@@ -6015,7 +6161,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
6015
6161
  };
6016
6162
  });
6017
6163
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
6018
- var _a, _b;
6164
+ var _a2, _b;
6019
6165
  $ZodCheck.init(inst, def);
6020
6166
  inst._zod.onattach.push((inst2) => {
6021
6167
  const bag = inst2._zod.bag;
@@ -6026,7 +6172,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
6026
6172
  }
6027
6173
  });
6028
6174
  if (def.pattern)
6029
- (_a = inst._zod).check ?? (_a.check = (payload) => {
6175
+ (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
6030
6176
  def.pattern.lastIndex = 0;
6031
6177
  if (def.pattern.test(payload.value))
6032
6178
  return;
@@ -6185,13 +6331,13 @@ var Doc = class {
6185
6331
  // node_modules/zod/v4/core/versions.js
6186
6332
  var version = {
6187
6333
  major: 4,
6188
- minor: 1,
6189
- patch: 8
6334
+ minor: 2,
6335
+ patch: 1
6190
6336
  };
6191
6337
 
6192
6338
  // node_modules/zod/v4/core/schemas.js
6193
6339
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
6194
- var _a;
6340
+ var _a2;
6195
6341
  inst ?? (inst = {});
6196
6342
  inst._zod.def = def;
6197
6343
  inst._zod.bag = inst._zod.bag || {};
@@ -6206,7 +6352,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
6206
6352
  }
6207
6353
  }
6208
6354
  if (checks.length === 0) {
6209
- (_a = inst._zod).deferred ?? (_a.deferred = []);
6355
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
6210
6356
  inst._zod.deferred?.push(() => {
6211
6357
  inst._zod.run = inst._zod.parse;
6212
6358
  });
@@ -6364,7 +6510,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
6364
6510
  code: "invalid_format",
6365
6511
  format: "url",
6366
6512
  note: "Invalid hostname",
6367
- pattern: hostname.source,
6513
+ pattern: def.hostname.source,
6368
6514
  input: payload.value,
6369
6515
  inst,
6370
6516
  continue: !def.abort
@@ -6449,18 +6595,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
6449
6595
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
6450
6596
  def.pattern ?? (def.pattern = ipv42);
6451
6597
  $ZodStringFormat.init(inst, def);
6452
- inst._zod.onattach.push((inst2) => {
6453
- const bag = inst2._zod.bag;
6454
- bag.format = `ipv4`;
6455
- });
6598
+ inst._zod.bag.format = `ipv4`;
6456
6599
  });
6457
6600
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
6458
6601
  def.pattern ?? (def.pattern = ipv62);
6459
6602
  $ZodStringFormat.init(inst, def);
6460
- inst._zod.onattach.push((inst2) => {
6461
- const bag = inst2._zod.bag;
6462
- bag.format = `ipv6`;
6463
- });
6603
+ inst._zod.bag.format = `ipv6`;
6464
6604
  inst._zod.check = (payload) => {
6465
6605
  try {
6466
6606
  new URL(`http://[${payload.value}]`);
@@ -6522,9 +6662,7 @@ function isValidBase64(data) {
6522
6662
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
6523
6663
  def.pattern ?? (def.pattern = base642);
6524
6664
  $ZodStringFormat.init(inst, def);
6525
- inst._zod.onattach.push((inst2) => {
6526
- inst2._zod.bag.contentEncoding = "base64";
6527
- });
6665
+ inst._zod.bag.contentEncoding = "base64";
6528
6666
  inst._zod.check = (payload) => {
6529
6667
  if (isValidBase64(payload.value))
6530
6668
  return;
@@ -6547,9 +6685,7 @@ function isValidBase64URL(data) {
6547
6685
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
6548
6686
  def.pattern ?? (def.pattern = base64url);
6549
6687
  $ZodStringFormat.init(inst, def);
6550
- inst._zod.onattach.push((inst2) => {
6551
- inst2._zod.bag.contentEncoding = "base64url";
6552
- });
6688
+ inst._zod.bag.contentEncoding = "base64url";
6553
6689
  inst._zod.check = (payload) => {
6554
6690
  if (isValidBase64URL(payload.value))
6555
6691
  return;
@@ -6624,7 +6760,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
6624
6760
  return payload;
6625
6761
  };
6626
6762
  });
6627
- var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
6763
+ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
6628
6764
  $ZodCheckNumberFormat.init(inst, def);
6629
6765
  $ZodNumber.init(inst, def);
6630
6766
  });
@@ -6851,7 +6987,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
6851
6987
  const keySet = def.keySet;
6852
6988
  const _catchall = def.catchall._zod;
6853
6989
  const t2 = _catchall.def.type;
6854
- for (const key of Object.keys(input)) {
6990
+ for (const key in input) {
6855
6991
  if (keySet.has(key))
6856
6992
  continue;
6857
6993
  if (t2 === "never") {
@@ -6881,6 +7017,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
6881
7017
  }
6882
7018
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
6883
7019
  $ZodType.init(inst, def);
7020
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
7021
+ if (!desc?.get) {
7022
+ const sh = def.shape;
7023
+ Object.defineProperty(def, "shape", {
7024
+ get: () => {
7025
+ const newSh = { ...sh };
7026
+ Object.defineProperty(def, "shape", {
7027
+ value: newSh
7028
+ });
7029
+ return newSh;
7030
+ }
7031
+ });
7032
+ }
6884
7033
  const _normalized = cached(() => normalizeDef(def));
6885
7034
  defineLazy(inst._zod, "propValues", () => {
6886
7035
  const shape = def.shape;
@@ -7071,6 +7220,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
7071
7220
  };
7072
7221
  });
7073
7222
  var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
7223
+ def.inclusive = false;
7074
7224
  $ZodUnion.init(inst, def);
7075
7225
  const _super = inst._zod.parse;
7076
7226
  defineLazy(inst._zod, "propValues", () => {
@@ -7213,7 +7363,6 @@ function handleIntersectionResults(result, left, right) {
7213
7363
  var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7214
7364
  $ZodType.init(inst, def);
7215
7365
  const items = def.items;
7216
- const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
7217
7366
  inst._zod.parse = (payload, ctx) => {
7218
7367
  const input = payload.value;
7219
7368
  if (!Array.isArray(input)) {
@@ -7227,6 +7376,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7227
7376
  }
7228
7377
  payload.value = [];
7229
7378
  const proms = [];
7379
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
7380
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
7230
7381
  if (!def.rest) {
7231
7382
  const tooBig = input.length > items.length;
7232
7383
  const tooSmall = input.length < optStart - 1;
@@ -7297,11 +7448,13 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7297
7448
  return payload;
7298
7449
  }
7299
7450
  const proms = [];
7300
- if (def.keyType._zod.values) {
7301
- const values = def.keyType._zod.values;
7451
+ const values = def.keyType._zod.values;
7452
+ if (values) {
7302
7453
  payload.value = {};
7454
+ const recordKeys = /* @__PURE__ */ new Set();
7303
7455
  for (const key of values) {
7304
7456
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
7457
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
7305
7458
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
7306
7459
  if (result instanceof Promise) {
7307
7460
  proms.push(result.then((result2) => {
@@ -7320,7 +7473,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7320
7473
  }
7321
7474
  let unrecognized;
7322
7475
  for (const key in input) {
7323
- if (!values.has(key)) {
7476
+ if (!recordKeys.has(key)) {
7324
7477
  unrecognized = unrecognized ?? [];
7325
7478
  unrecognized.push(key);
7326
7479
  }
@@ -7343,15 +7496,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7343
7496
  throw new Error("Async schemas not supported in object keys currently");
7344
7497
  }
7345
7498
  if (keyResult.issues.length) {
7346
- payload.issues.push({
7347
- code: "invalid_key",
7348
- origin: "record",
7349
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
7350
- input: key,
7351
- path: [key],
7352
- inst
7353
- });
7354
- payload.value[keyResult.value] = keyResult.value;
7499
+ if (def.mode === "loose") {
7500
+ payload.value[key] = input[key];
7501
+ } else {
7502
+ payload.issues.push({
7503
+ code: "invalid_key",
7504
+ origin: "record",
7505
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
7506
+ input: key,
7507
+ path: [key],
7508
+ inst
7509
+ });
7510
+ }
7355
7511
  continue;
7356
7512
  }
7357
7513
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
@@ -7401,11 +7557,12 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
7401
7557
  if (def.values.length === 0) {
7402
7558
  throw new Error("Cannot create literal schema with no valid values");
7403
7559
  }
7404
- inst._zod.values = new Set(def.values);
7560
+ const values = new Set(def.values);
7561
+ inst._zod.values = values;
7405
7562
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
7406
7563
  inst._zod.parse = (payload, _ctx) => {
7407
7564
  const input = payload.value;
7408
- if (inst._zod.values.has(input)) {
7565
+ if (values.has(input)) {
7409
7566
  return payload;
7410
7567
  }
7411
7568
  payload.issues.push({
@@ -7621,8 +7778,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
7621
7778
  $ZodType.init(inst, def);
7622
7779
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
7623
7780
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7624
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
7625
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
7781
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
7782
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
7626
7783
  inst._zod.parse = (payload, ctx) => {
7627
7784
  if (ctx.direction === "backward") {
7628
7785
  return def.innerType._zod.run(payload, ctx);
@@ -7679,21 +7836,20 @@ function handleRefineResult(result, payload, input, inst) {
7679
7836
  }
7680
7837
 
7681
7838
  // node_modules/zod/v4/core/registries.js
7682
- var $output = Symbol("ZodOutput");
7683
- var $input = Symbol("ZodInput");
7839
+ var _a;
7684
7840
  var $ZodRegistry = class {
7685
7841
  constructor() {
7686
7842
  this._map = /* @__PURE__ */ new WeakMap();
7687
7843
  this._idmap = /* @__PURE__ */ new Map();
7688
7844
  }
7689
7845
  add(schema, ..._meta) {
7690
- const meta = _meta[0];
7691
- this._map.set(schema, meta);
7692
- if (meta && typeof meta === "object" && "id" in meta) {
7693
- if (this._idmap.has(meta.id)) {
7694
- throw new Error(`ID ${meta.id} already exists in the registry`);
7846
+ const meta2 = _meta[0];
7847
+ this._map.set(schema, meta2);
7848
+ if (meta2 && typeof meta2 === "object" && "id" in meta2) {
7849
+ if (this._idmap.has(meta2.id)) {
7850
+ throw new Error(`ID ${meta2.id} already exists in the registry`);
7695
7851
  }
7696
- this._idmap.set(meta.id, schema);
7852
+ this._idmap.set(meta2.id, schema);
7697
7853
  }
7698
7854
  return this;
7699
7855
  }
@@ -7703,9 +7859,9 @@ var $ZodRegistry = class {
7703
7859
  return this;
7704
7860
  }
7705
7861
  remove(schema) {
7706
- const meta = this._map.get(schema);
7707
- if (meta && typeof meta === "object" && "id" in meta) {
7708
- this._idmap.delete(meta.id);
7862
+ const meta2 = this._map.get(schema);
7863
+ if (meta2 && typeof meta2 === "object" && "id" in meta2) {
7864
+ this._idmap.delete(meta2.id);
7709
7865
  }
7710
7866
  this._map.delete(schema);
7711
7867
  return this;
@@ -7727,7 +7883,8 @@ var $ZodRegistry = class {
7727
7883
  function registry() {
7728
7884
  return new $ZodRegistry();
7729
7885
  }
7730
- var globalRegistry = /* @__PURE__ */ registry();
7886
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
7887
+ var globalRegistry = globalThis.__zod_globalRegistry;
7731
7888
 
7732
7889
  // node_modules/zod/v4/core/api.js
7733
7890
  function _string(Class2, params) {
@@ -8118,6 +8275,9 @@ function _toLowerCase() {
8118
8275
  function _toUpperCase() {
8119
8276
  return _overwrite((input) => input.toUpperCase());
8120
8277
  }
8278
+ function _slugify() {
8279
+ return _overwrite((input) => slugify(input));
8280
+ }
8121
8281
  function _array(Class2, element, params) {
8122
8282
  return new Class2({
8123
8283
  type: "array",
@@ -8166,6 +8326,701 @@ function _check(fn, params) {
8166
8326
  return ch;
8167
8327
  }
8168
8328
 
8329
+ // node_modules/zod/v4/core/to-json-schema.js
8330
+ function initializeContext(params) {
8331
+ let target = params?.target ?? "draft-2020-12";
8332
+ if (target === "draft-4")
8333
+ target = "draft-04";
8334
+ if (target === "draft-7")
8335
+ target = "draft-07";
8336
+ return {
8337
+ processors: params.processors ?? {},
8338
+ metadataRegistry: params?.metadata ?? globalRegistry,
8339
+ target,
8340
+ unrepresentable: params?.unrepresentable ?? "throw",
8341
+ override: params?.override ?? (() => {
8342
+ }),
8343
+ io: params?.io ?? "output",
8344
+ counter: 0,
8345
+ seen: /* @__PURE__ */ new Map(),
8346
+ cycles: params?.cycles ?? "ref",
8347
+ reused: params?.reused ?? "inline",
8348
+ external: params?.external ?? void 0
8349
+ };
8350
+ }
8351
+ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
8352
+ var _a2;
8353
+ const def = schema._zod.def;
8354
+ const seen = ctx.seen.get(schema);
8355
+ if (seen) {
8356
+ seen.count++;
8357
+ const isCycle = _params.schemaPath.includes(schema);
8358
+ if (isCycle) {
8359
+ seen.cycle = _params.path;
8360
+ }
8361
+ return seen.schema;
8362
+ }
8363
+ const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
8364
+ ctx.seen.set(schema, result);
8365
+ const overrideSchema = schema._zod.toJSONSchema?.();
8366
+ if (overrideSchema) {
8367
+ result.schema = overrideSchema;
8368
+ } else {
8369
+ const params = {
8370
+ ..._params,
8371
+ schemaPath: [..._params.schemaPath, schema],
8372
+ path: _params.path
8373
+ };
8374
+ const parent = schema._zod.parent;
8375
+ if (parent) {
8376
+ result.ref = parent;
8377
+ process2(parent, ctx, params);
8378
+ ctx.seen.get(parent).isParent = true;
8379
+ } else if (schema._zod.processJSONSchema) {
8380
+ schema._zod.processJSONSchema(ctx, result.schema, params);
8381
+ } else {
8382
+ const _json = result.schema;
8383
+ const processor = ctx.processors[def.type];
8384
+ if (!processor) {
8385
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
8386
+ }
8387
+ processor(schema, ctx, _json, params);
8388
+ }
8389
+ }
8390
+ const meta2 = ctx.metadataRegistry.get(schema);
8391
+ if (meta2)
8392
+ Object.assign(result.schema, meta2);
8393
+ if (ctx.io === "input" && isTransforming(schema)) {
8394
+ delete result.schema.examples;
8395
+ delete result.schema.default;
8396
+ }
8397
+ if (ctx.io === "input" && result.schema._prefault)
8398
+ (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
8399
+ delete result.schema._prefault;
8400
+ const _result = ctx.seen.get(schema);
8401
+ return _result.schema;
8402
+ }
8403
+ function extractDefs(ctx, schema) {
8404
+ const root = ctx.seen.get(schema);
8405
+ if (!root)
8406
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
8407
+ const makeURI = (entry) => {
8408
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
8409
+ if (ctx.external) {
8410
+ const externalId = ctx.external.registry.get(entry[0])?.id;
8411
+ const uriGenerator = ctx.external.uri ?? ((id2) => id2);
8412
+ if (externalId) {
8413
+ return { ref: uriGenerator(externalId) };
8414
+ }
8415
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
8416
+ entry[1].defId = id;
8417
+ return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
8418
+ }
8419
+ if (entry[1] === root) {
8420
+ return { ref: "#" };
8421
+ }
8422
+ const uriPrefix = `#`;
8423
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
8424
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
8425
+ return { defId, ref: defUriPrefix + defId };
8426
+ };
8427
+ const extractToDef = (entry) => {
8428
+ if (entry[1].schema.$ref) {
8429
+ return;
8430
+ }
8431
+ const seen = entry[1];
8432
+ const { ref, defId } = makeURI(entry);
8433
+ seen.def = { ...seen.schema };
8434
+ if (defId)
8435
+ seen.defId = defId;
8436
+ const schema2 = seen.schema;
8437
+ for (const key in schema2) {
8438
+ delete schema2[key];
8439
+ }
8440
+ schema2.$ref = ref;
8441
+ };
8442
+ if (ctx.cycles === "throw") {
8443
+ for (const entry of ctx.seen.entries()) {
8444
+ const seen = entry[1];
8445
+ if (seen.cycle) {
8446
+ throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
8447
+
8448
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
8449
+ }
8450
+ }
8451
+ }
8452
+ for (const entry of ctx.seen.entries()) {
8453
+ const seen = entry[1];
8454
+ if (schema === entry[0]) {
8455
+ extractToDef(entry);
8456
+ continue;
8457
+ }
8458
+ if (ctx.external) {
8459
+ const ext = ctx.external.registry.get(entry[0])?.id;
8460
+ if (schema !== entry[0] && ext) {
8461
+ extractToDef(entry);
8462
+ continue;
8463
+ }
8464
+ }
8465
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
8466
+ if (id) {
8467
+ extractToDef(entry);
8468
+ continue;
8469
+ }
8470
+ if (seen.cycle) {
8471
+ extractToDef(entry);
8472
+ continue;
8473
+ }
8474
+ if (seen.count > 1) {
8475
+ if (ctx.reused === "ref") {
8476
+ extractToDef(entry);
8477
+ continue;
8478
+ }
8479
+ }
8480
+ }
8481
+ }
8482
+ function finalize(ctx, schema) {
8483
+ const root = ctx.seen.get(schema);
8484
+ if (!root)
8485
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
8486
+ const flattenRef = (zodSchema) => {
8487
+ const seen = ctx.seen.get(zodSchema);
8488
+ const schema2 = seen.def ?? seen.schema;
8489
+ const _cached = { ...schema2 };
8490
+ if (seen.ref === null) {
8491
+ return;
8492
+ }
8493
+ const ref = seen.ref;
8494
+ seen.ref = null;
8495
+ if (ref) {
8496
+ flattenRef(ref);
8497
+ const refSchema = ctx.seen.get(ref).schema;
8498
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
8499
+ schema2.allOf = schema2.allOf ?? [];
8500
+ schema2.allOf.push(refSchema);
8501
+ } else {
8502
+ Object.assign(schema2, refSchema);
8503
+ Object.assign(schema2, _cached);
8504
+ }
8505
+ }
8506
+ if (!seen.isParent)
8507
+ ctx.override({
8508
+ zodSchema,
8509
+ jsonSchema: schema2,
8510
+ path: seen.path ?? []
8511
+ });
8512
+ };
8513
+ for (const entry of [...ctx.seen.entries()].reverse()) {
8514
+ flattenRef(entry[0]);
8515
+ }
8516
+ const result = {};
8517
+ if (ctx.target === "draft-2020-12") {
8518
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
8519
+ } else if (ctx.target === "draft-07") {
8520
+ result.$schema = "http://json-schema.org/draft-07/schema#";
8521
+ } else if (ctx.target === "draft-04") {
8522
+ result.$schema = "http://json-schema.org/draft-04/schema#";
8523
+ } else if (ctx.target === "openapi-3.0") {
8524
+ } else {
8525
+ }
8526
+ if (ctx.external?.uri) {
8527
+ const id = ctx.external.registry.get(schema)?.id;
8528
+ if (!id)
8529
+ throw new Error("Schema is missing an `id` property");
8530
+ result.$id = ctx.external.uri(id);
8531
+ }
8532
+ Object.assign(result, root.def ?? root.schema);
8533
+ const defs = ctx.external?.defs ?? {};
8534
+ for (const entry of ctx.seen.entries()) {
8535
+ const seen = entry[1];
8536
+ if (seen.def && seen.defId) {
8537
+ defs[seen.defId] = seen.def;
8538
+ }
8539
+ }
8540
+ if (ctx.external) {
8541
+ } else {
8542
+ if (Object.keys(defs).length > 0) {
8543
+ if (ctx.target === "draft-2020-12") {
8544
+ result.$defs = defs;
8545
+ } else {
8546
+ result.definitions = defs;
8547
+ }
8548
+ }
8549
+ }
8550
+ try {
8551
+ const finalized = JSON.parse(JSON.stringify(result));
8552
+ Object.defineProperty(finalized, "~standard", {
8553
+ value: {
8554
+ ...schema["~standard"],
8555
+ jsonSchema: {
8556
+ input: createStandardJSONSchemaMethod(schema, "input"),
8557
+ output: createStandardJSONSchemaMethod(schema, "output")
8558
+ }
8559
+ },
8560
+ enumerable: false,
8561
+ writable: false
8562
+ });
8563
+ return finalized;
8564
+ } catch (_err) {
8565
+ throw new Error("Error converting schema to JSON.");
8566
+ }
8567
+ }
8568
+ function isTransforming(_schema, _ctx) {
8569
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
8570
+ if (ctx.seen.has(_schema))
8571
+ return false;
8572
+ ctx.seen.add(_schema);
8573
+ const def = _schema._zod.def;
8574
+ if (def.type === "transform")
8575
+ return true;
8576
+ if (def.type === "array")
8577
+ return isTransforming(def.element, ctx);
8578
+ if (def.type === "set")
8579
+ return isTransforming(def.valueType, ctx);
8580
+ if (def.type === "lazy")
8581
+ return isTransforming(def.getter(), ctx);
8582
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
8583
+ return isTransforming(def.innerType, ctx);
8584
+ }
8585
+ if (def.type === "intersection") {
8586
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
8587
+ }
8588
+ if (def.type === "record" || def.type === "map") {
8589
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
8590
+ }
8591
+ if (def.type === "pipe") {
8592
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
8593
+ }
8594
+ if (def.type === "object") {
8595
+ for (const key in def.shape) {
8596
+ if (isTransforming(def.shape[key], ctx))
8597
+ return true;
8598
+ }
8599
+ return false;
8600
+ }
8601
+ if (def.type === "union") {
8602
+ for (const option of def.options) {
8603
+ if (isTransforming(option, ctx))
8604
+ return true;
8605
+ }
8606
+ return false;
8607
+ }
8608
+ if (def.type === "tuple") {
8609
+ for (const item of def.items) {
8610
+ if (isTransforming(item, ctx))
8611
+ return true;
8612
+ }
8613
+ if (def.rest && isTransforming(def.rest, ctx))
8614
+ return true;
8615
+ return false;
8616
+ }
8617
+ return false;
8618
+ }
8619
+ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
8620
+ const ctx = initializeContext({ ...params, processors });
8621
+ process2(schema, ctx);
8622
+ extractDefs(ctx, schema);
8623
+ return finalize(ctx, schema);
8624
+ };
8625
+ var createStandardJSONSchemaMethod = (schema, io) => (params) => {
8626
+ const { libraryOptions, target } = params ?? {};
8627
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
8628
+ process2(schema, ctx);
8629
+ extractDefs(ctx, schema);
8630
+ return finalize(ctx, schema);
8631
+ };
8632
+
8633
+ // node_modules/zod/v4/core/json-schema-processors.js
8634
+ var formatMap = {
8635
+ guid: "uuid",
8636
+ url: "uri",
8637
+ datetime: "date-time",
8638
+ json_string: "json-string",
8639
+ regex: ""
8640
+ // do not set
8641
+ };
8642
+ var stringProcessor = (schema, ctx, _json, _params) => {
8643
+ const json = _json;
8644
+ json.type = "string";
8645
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
8646
+ if (typeof minimum === "number")
8647
+ json.minLength = minimum;
8648
+ if (typeof maximum === "number")
8649
+ json.maxLength = maximum;
8650
+ if (format) {
8651
+ json.format = formatMap[format] ?? format;
8652
+ if (json.format === "")
8653
+ delete json.format;
8654
+ }
8655
+ if (contentEncoding)
8656
+ json.contentEncoding = contentEncoding;
8657
+ if (patterns && patterns.size > 0) {
8658
+ const regexes = [...patterns];
8659
+ if (regexes.length === 1)
8660
+ json.pattern = regexes[0].source;
8661
+ else if (regexes.length > 1) {
8662
+ json.allOf = [
8663
+ ...regexes.map((regex) => ({
8664
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
8665
+ pattern: regex.source
8666
+ }))
8667
+ ];
8668
+ }
8669
+ }
8670
+ };
8671
+ var numberProcessor = (schema, ctx, _json, _params) => {
8672
+ const json = _json;
8673
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
8674
+ if (typeof format === "string" && format.includes("int"))
8675
+ json.type = "integer";
8676
+ else
8677
+ json.type = "number";
8678
+ if (typeof exclusiveMinimum === "number") {
8679
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
8680
+ json.minimum = exclusiveMinimum;
8681
+ json.exclusiveMinimum = true;
8682
+ } else {
8683
+ json.exclusiveMinimum = exclusiveMinimum;
8684
+ }
8685
+ }
8686
+ if (typeof minimum === "number") {
8687
+ json.minimum = minimum;
8688
+ if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
8689
+ if (exclusiveMinimum >= minimum)
8690
+ delete json.minimum;
8691
+ else
8692
+ delete json.exclusiveMinimum;
8693
+ }
8694
+ }
8695
+ if (typeof exclusiveMaximum === "number") {
8696
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
8697
+ json.maximum = exclusiveMaximum;
8698
+ json.exclusiveMaximum = true;
8699
+ } else {
8700
+ json.exclusiveMaximum = exclusiveMaximum;
8701
+ }
8702
+ }
8703
+ if (typeof maximum === "number") {
8704
+ json.maximum = maximum;
8705
+ if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
8706
+ if (exclusiveMaximum <= maximum)
8707
+ delete json.maximum;
8708
+ else
8709
+ delete json.exclusiveMaximum;
8710
+ }
8711
+ }
8712
+ if (typeof multipleOf === "number")
8713
+ json.multipleOf = multipleOf;
8714
+ };
8715
+ var booleanProcessor = (_schema, _ctx, json, _params) => {
8716
+ json.type = "boolean";
8717
+ };
8718
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
8719
+ if (ctx.unrepresentable === "throw") {
8720
+ throw new Error("BigInt cannot be represented in JSON Schema");
8721
+ }
8722
+ };
8723
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
8724
+ if (ctx.unrepresentable === "throw") {
8725
+ throw new Error("Symbols cannot be represented in JSON Schema");
8726
+ }
8727
+ };
8728
+ var nullProcessor = (_schema, ctx, json, _params) => {
8729
+ if (ctx.target === "openapi-3.0") {
8730
+ json.type = "string";
8731
+ json.nullable = true;
8732
+ json.enum = [null];
8733
+ } else {
8734
+ json.type = "null";
8735
+ }
8736
+ };
8737
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
8738
+ if (ctx.unrepresentable === "throw") {
8739
+ throw new Error("Undefined cannot be represented in JSON Schema");
8740
+ }
8741
+ };
8742
+ var voidProcessor = (_schema, ctx, _json, _params) => {
8743
+ if (ctx.unrepresentable === "throw") {
8744
+ throw new Error("Void cannot be represented in JSON Schema");
8745
+ }
8746
+ };
8747
+ var neverProcessor = (_schema, _ctx, json, _params) => {
8748
+ json.not = {};
8749
+ };
8750
+ var anyProcessor = (_schema, _ctx, _json, _params) => {
8751
+ };
8752
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {
8753
+ };
8754
+ var dateProcessor = (_schema, ctx, _json, _params) => {
8755
+ if (ctx.unrepresentable === "throw") {
8756
+ throw new Error("Date cannot be represented in JSON Schema");
8757
+ }
8758
+ };
8759
+ var enumProcessor = (schema, _ctx, json, _params) => {
8760
+ const def = schema._zod.def;
8761
+ const values = getEnumValues(def.entries);
8762
+ if (values.every((v) => typeof v === "number"))
8763
+ json.type = "number";
8764
+ if (values.every((v) => typeof v === "string"))
8765
+ json.type = "string";
8766
+ json.enum = values;
8767
+ };
8768
+ var literalProcessor = (schema, ctx, json, _params) => {
8769
+ const def = schema._zod.def;
8770
+ const vals = [];
8771
+ for (const val of def.values) {
8772
+ if (val === void 0) {
8773
+ if (ctx.unrepresentable === "throw") {
8774
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
8775
+ } else {
8776
+ }
8777
+ } else if (typeof val === "bigint") {
8778
+ if (ctx.unrepresentable === "throw") {
8779
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
8780
+ } else {
8781
+ vals.push(Number(val));
8782
+ }
8783
+ } else {
8784
+ vals.push(val);
8785
+ }
8786
+ }
8787
+ if (vals.length === 0) {
8788
+ } else if (vals.length === 1) {
8789
+ const val = vals[0];
8790
+ json.type = val === null ? "null" : typeof val;
8791
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
8792
+ json.enum = [val];
8793
+ } else {
8794
+ json.const = val;
8795
+ }
8796
+ } else {
8797
+ if (vals.every((v) => typeof v === "number"))
8798
+ json.type = "number";
8799
+ if (vals.every((v) => typeof v === "string"))
8800
+ json.type = "string";
8801
+ if (vals.every((v) => typeof v === "boolean"))
8802
+ json.type = "boolean";
8803
+ if (vals.every((v) => v === null))
8804
+ json.type = "null";
8805
+ json.enum = vals;
8806
+ }
8807
+ };
8808
+ var customProcessor = (_schema, ctx, _json, _params) => {
8809
+ if (ctx.unrepresentable === "throw") {
8810
+ throw new Error("Custom types cannot be represented in JSON Schema");
8811
+ }
8812
+ };
8813
+ var transformProcessor = (_schema, ctx, _json, _params) => {
8814
+ if (ctx.unrepresentable === "throw") {
8815
+ throw new Error("Transforms cannot be represented in JSON Schema");
8816
+ }
8817
+ };
8818
+ var arrayProcessor = (schema, ctx, _json, params) => {
8819
+ const json = _json;
8820
+ const def = schema._zod.def;
8821
+ const { minimum, maximum } = schema._zod.bag;
8822
+ if (typeof minimum === "number")
8823
+ json.minItems = minimum;
8824
+ if (typeof maximum === "number")
8825
+ json.maxItems = maximum;
8826
+ json.type = "array";
8827
+ json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
8828
+ };
8829
+ var objectProcessor = (schema, ctx, _json, params) => {
8830
+ const json = _json;
8831
+ const def = schema._zod.def;
8832
+ json.type = "object";
8833
+ json.properties = {};
8834
+ const shape = def.shape;
8835
+ for (const key in shape) {
8836
+ json.properties[key] = process2(shape[key], ctx, {
8837
+ ...params,
8838
+ path: [...params.path, "properties", key]
8839
+ });
8840
+ }
8841
+ const allKeys = new Set(Object.keys(shape));
8842
+ const requiredKeys = new Set([...allKeys].filter((key) => {
8843
+ const v = def.shape[key]._zod;
8844
+ if (ctx.io === "input") {
8845
+ return v.optin === void 0;
8846
+ } else {
8847
+ return v.optout === void 0;
8848
+ }
8849
+ }));
8850
+ if (requiredKeys.size > 0) {
8851
+ json.required = Array.from(requiredKeys);
8852
+ }
8853
+ if (def.catchall?._zod.def.type === "never") {
8854
+ json.additionalProperties = false;
8855
+ } else if (!def.catchall) {
8856
+ if (ctx.io === "output")
8857
+ json.additionalProperties = false;
8858
+ } else if (def.catchall) {
8859
+ json.additionalProperties = process2(def.catchall, ctx, {
8860
+ ...params,
8861
+ path: [...params.path, "additionalProperties"]
8862
+ });
8863
+ }
8864
+ };
8865
+ var unionProcessor = (schema, ctx, json, params) => {
8866
+ const def = schema._zod.def;
8867
+ const isExclusive = def.inclusive === false;
8868
+ const options = def.options.map((x, i) => process2(x, ctx, {
8869
+ ...params,
8870
+ path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
8871
+ }));
8872
+ if (isExclusive) {
8873
+ json.oneOf = options;
8874
+ } else {
8875
+ json.anyOf = options;
8876
+ }
8877
+ };
8878
+ var intersectionProcessor = (schema, ctx, json, params) => {
8879
+ const def = schema._zod.def;
8880
+ const a = process2(def.left, ctx, {
8881
+ ...params,
8882
+ path: [...params.path, "allOf", 0]
8883
+ });
8884
+ const b = process2(def.right, ctx, {
8885
+ ...params,
8886
+ path: [...params.path, "allOf", 1]
8887
+ });
8888
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
8889
+ const allOf = [
8890
+ ...isSimpleIntersection(a) ? a.allOf : [a],
8891
+ ...isSimpleIntersection(b) ? b.allOf : [b]
8892
+ ];
8893
+ json.allOf = allOf;
8894
+ };
8895
+ var tupleProcessor = (schema, ctx, _json, params) => {
8896
+ const json = _json;
8897
+ const def = schema._zod.def;
8898
+ json.type = "array";
8899
+ const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
8900
+ const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
8901
+ const prefixItems = def.items.map((x, i) => process2(x, ctx, {
8902
+ ...params,
8903
+ path: [...params.path, prefixPath, i]
8904
+ }));
8905
+ const rest = def.rest ? process2(def.rest, ctx, {
8906
+ ...params,
8907
+ path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
8908
+ }) : null;
8909
+ if (ctx.target === "draft-2020-12") {
8910
+ json.prefixItems = prefixItems;
8911
+ if (rest) {
8912
+ json.items = rest;
8913
+ }
8914
+ } else if (ctx.target === "openapi-3.0") {
8915
+ json.items = {
8916
+ anyOf: prefixItems
8917
+ };
8918
+ if (rest) {
8919
+ json.items.anyOf.push(rest);
8920
+ }
8921
+ json.minItems = prefixItems.length;
8922
+ if (!rest) {
8923
+ json.maxItems = prefixItems.length;
8924
+ }
8925
+ } else {
8926
+ json.items = prefixItems;
8927
+ if (rest) {
8928
+ json.additionalItems = rest;
8929
+ }
8930
+ }
8931
+ const { minimum, maximum } = schema._zod.bag;
8932
+ if (typeof minimum === "number")
8933
+ json.minItems = minimum;
8934
+ if (typeof maximum === "number")
8935
+ json.maxItems = maximum;
8936
+ };
8937
+ var recordProcessor = (schema, ctx, _json, params) => {
8938
+ const json = _json;
8939
+ const def = schema._zod.def;
8940
+ json.type = "object";
8941
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
8942
+ json.propertyNames = process2(def.keyType, ctx, {
8943
+ ...params,
8944
+ path: [...params.path, "propertyNames"]
8945
+ });
8946
+ }
8947
+ json.additionalProperties = process2(def.valueType, ctx, {
8948
+ ...params,
8949
+ path: [...params.path, "additionalProperties"]
8950
+ });
8951
+ };
8952
+ var nullableProcessor = (schema, ctx, json, params) => {
8953
+ const def = schema._zod.def;
8954
+ const inner = process2(def.innerType, ctx, params);
8955
+ const seen = ctx.seen.get(schema);
8956
+ if (ctx.target === "openapi-3.0") {
8957
+ seen.ref = def.innerType;
8958
+ json.nullable = true;
8959
+ } else {
8960
+ json.anyOf = [inner, { type: "null" }];
8961
+ }
8962
+ };
8963
+ var nonoptionalProcessor = (schema, ctx, _json, params) => {
8964
+ const def = schema._zod.def;
8965
+ process2(def.innerType, ctx, params);
8966
+ const seen = ctx.seen.get(schema);
8967
+ seen.ref = def.innerType;
8968
+ };
8969
+ var defaultProcessor = (schema, ctx, json, params) => {
8970
+ const def = schema._zod.def;
8971
+ process2(def.innerType, ctx, params);
8972
+ const seen = ctx.seen.get(schema);
8973
+ seen.ref = def.innerType;
8974
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
8975
+ };
8976
+ var prefaultProcessor = (schema, ctx, json, params) => {
8977
+ const def = schema._zod.def;
8978
+ process2(def.innerType, ctx, params);
8979
+ const seen = ctx.seen.get(schema);
8980
+ seen.ref = def.innerType;
8981
+ if (ctx.io === "input")
8982
+ json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
8983
+ };
8984
+ var catchProcessor = (schema, ctx, json, params) => {
8985
+ const def = schema._zod.def;
8986
+ process2(def.innerType, ctx, params);
8987
+ const seen = ctx.seen.get(schema);
8988
+ seen.ref = def.innerType;
8989
+ let catchValue;
8990
+ try {
8991
+ catchValue = def.catchValue(void 0);
8992
+ } catch {
8993
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
8994
+ }
8995
+ json.default = catchValue;
8996
+ };
8997
+ var pipeProcessor = (schema, ctx, _json, params) => {
8998
+ const def = schema._zod.def;
8999
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
9000
+ process2(innerType, ctx, params);
9001
+ const seen = ctx.seen.get(schema);
9002
+ seen.ref = innerType;
9003
+ };
9004
+ var readonlyProcessor = (schema, ctx, json, params) => {
9005
+ const def = schema._zod.def;
9006
+ process2(def.innerType, ctx, params);
9007
+ const seen = ctx.seen.get(schema);
9008
+ seen.ref = def.innerType;
9009
+ json.readOnly = true;
9010
+ };
9011
+ var promiseProcessor = (schema, ctx, _json, params) => {
9012
+ const def = schema._zod.def;
9013
+ process2(def.innerType, ctx, params);
9014
+ const seen = ctx.seen.get(schema);
9015
+ seen.ref = def.innerType;
9016
+ };
9017
+ var optionalProcessor = (schema, ctx, _json, params) => {
9018
+ const def = schema._zod.def;
9019
+ process2(def.innerType, ctx, params);
9020
+ const seen = ctx.seen.get(schema);
9021
+ seen.ref = def.innerType;
9022
+ };
9023
+
8169
9024
  // node_modules/zod/v4/classic/iso.js
8170
9025
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
8171
9026
  $ZodISODateTime.init(inst, def);
@@ -8253,25 +9108,28 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
8253
9108
  // node_modules/zod/v4/classic/schemas.js
8254
9109
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
8255
9110
  $ZodType.init(inst, def);
9111
+ Object.assign(inst["~standard"], {
9112
+ jsonSchema: {
9113
+ input: createStandardJSONSchemaMethod(inst, "input"),
9114
+ output: createStandardJSONSchemaMethod(inst, "output")
9115
+ }
9116
+ });
9117
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
8256
9118
  inst.def = def;
8257
9119
  inst.type = def.type;
8258
9120
  Object.defineProperty(inst, "_def", { value: def });
8259
9121
  inst.check = (...checks) => {
8260
- return inst.clone(
8261
- {
8262
- ...def,
8263
- checks: [
8264
- ...def.checks ?? [],
8265
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
8266
- ]
8267
- }
8268
- // { parent: true }
8269
- );
9122
+ return inst.clone(util_exports.mergeDefs(def, {
9123
+ checks: [
9124
+ ...def.checks ?? [],
9125
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
9126
+ ]
9127
+ }));
8270
9128
  };
8271
9129
  inst.clone = (def2, params) => clone(inst, def2, params);
8272
9130
  inst.brand = () => inst;
8273
- inst.register = ((reg, meta) => {
8274
- reg.add(inst, meta);
9131
+ inst.register = ((reg, meta2) => {
9132
+ reg.add(inst, meta2);
8275
9133
  return inst;
8276
9134
  });
8277
9135
  inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
@@ -8329,6 +9187,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
8329
9187
  var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
8330
9188
  $ZodString.init(inst, def);
8331
9189
  ZodType.init(inst, def);
9190
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
8332
9191
  const bag = inst._zod.bag;
8333
9192
  inst.format = bag.format ?? null;
8334
9193
  inst.minLength = bag.minimum ?? null;
@@ -8347,6 +9206,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
8347
9206
  inst.normalize = (...args) => inst.check(_normalize(...args));
8348
9207
  inst.toLowerCase = () => inst.check(_toLowerCase());
8349
9208
  inst.toUpperCase = () => inst.check(_toUpperCase());
9209
+ inst.slugify = () => inst.check(_slugify());
8350
9210
  });
8351
9211
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
8352
9212
  $ZodString.init(inst, def);
@@ -8465,6 +9325,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
8465
9325
  var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
8466
9326
  $ZodNumber.init(inst, def);
8467
9327
  ZodType.init(inst, def);
9328
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
8468
9329
  inst.gt = (value, params) => inst.check(_gt(value, params));
8469
9330
  inst.gte = (value, params) => inst.check(_gte(value, params));
8470
9331
  inst.min = (value, params) => inst.check(_gte(value, params));
@@ -8497,10 +9358,12 @@ function int(params) {
8497
9358
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
8498
9359
  $ZodBoolean.init(inst, def);
8499
9360
  ZodType.init(inst, def);
9361
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
8500
9362
  });
8501
9363
  var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
8502
9364
  $ZodBigInt.init(inst, def);
8503
9365
  ZodType.init(inst, def);
9366
+ inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
8504
9367
  inst.gte = (value, params) => inst.check(_gte(value, params));
8505
9368
  inst.min = (value, params) => inst.check(_gte(value, params));
8506
9369
  inst.gt = (value, params) => inst.check(_gt(value, params));
@@ -8522,22 +9385,27 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
8522
9385
  var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
8523
9386
  $ZodSymbol.init(inst, def);
8524
9387
  ZodType.init(inst, def);
9388
+ inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
8525
9389
  });
8526
9390
  var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
8527
9391
  $ZodUndefined.init(inst, def);
8528
9392
  ZodType.init(inst, def);
9393
+ inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
8529
9394
  });
8530
9395
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
8531
9396
  $ZodNull.init(inst, def);
8532
9397
  ZodType.init(inst, def);
9398
+ inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
8533
9399
  });
8534
9400
  var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
8535
9401
  $ZodAny.init(inst, def);
8536
9402
  ZodType.init(inst, def);
9403
+ inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
8537
9404
  });
8538
9405
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
8539
9406
  $ZodUnknown.init(inst, def);
8540
9407
  ZodType.init(inst, def);
9408
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
8541
9409
  });
8542
9410
  function unknown() {
8543
9411
  return _unknown(ZodUnknown);
@@ -8545,6 +9413,7 @@ function unknown() {
8545
9413
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
8546
9414
  $ZodNever.init(inst, def);
8547
9415
  ZodType.init(inst, def);
9416
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
8548
9417
  });
8549
9418
  function never(params) {
8550
9419
  return _never(ZodNever, params);
@@ -8552,10 +9421,12 @@ function never(params) {
8552
9421
  var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
8553
9422
  $ZodVoid.init(inst, def);
8554
9423
  ZodType.init(inst, def);
9424
+ inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
8555
9425
  });
8556
9426
  var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
8557
9427
  $ZodDate.init(inst, def);
8558
9428
  ZodType.init(inst, def);
9429
+ inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
8559
9430
  inst.min = (value, params) => inst.check(_gte(value, params));
8560
9431
  inst.max = (value, params) => inst.check(_lte(value, params));
8561
9432
  const c = inst._zod.bag;
@@ -8565,6 +9436,7 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
8565
9436
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
8566
9437
  $ZodArray.init(inst, def);
8567
9438
  ZodType.init(inst, def);
9439
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
8568
9440
  inst.element = def.element;
8569
9441
  inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
8570
9442
  inst.nonempty = (params) => inst.check(_minLength(1, params));
@@ -8578,7 +9450,10 @@ function array(element, params) {
8578
9450
  var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
8579
9451
  $ZodObjectJIT.init(inst, def);
8580
9452
  ZodType.init(inst, def);
8581
- util_exports.defineLazy(inst, "shape", () => def.shape);
9453
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
9454
+ util_exports.defineLazy(inst, "shape", () => {
9455
+ return def.shape;
9456
+ });
8582
9457
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
8583
9458
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
8584
9459
  inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -8600,6 +9475,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
8600
9475
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
8601
9476
  $ZodUnion.init(inst, def);
8602
9477
  ZodType.init(inst, def);
9478
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
8603
9479
  inst.options = def.options;
8604
9480
  });
8605
9481
  function union(options, params) {
@@ -8616,6 +9492,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
8616
9492
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
8617
9493
  $ZodIntersection.init(inst, def);
8618
9494
  ZodType.init(inst, def);
9495
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
8619
9496
  });
8620
9497
  function intersection(left, right) {
8621
9498
  return new ZodIntersection({
@@ -8627,6 +9504,7 @@ function intersection(left, right) {
8627
9504
  var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
8628
9505
  $ZodTuple.init(inst, def);
8629
9506
  ZodType.init(inst, def);
9507
+ inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
8630
9508
  inst.rest = (rest) => inst.clone({
8631
9509
  ...inst._zod.def,
8632
9510
  rest
@@ -8635,12 +9513,14 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
8635
9513
  var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
8636
9514
  $ZodRecord.init(inst, def);
8637
9515
  ZodType.init(inst, def);
9516
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
8638
9517
  inst.keyType = def.keyType;
8639
9518
  inst.valueType = def.valueType;
8640
9519
  });
8641
9520
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
8642
9521
  $ZodEnum.init(inst, def);
8643
9522
  ZodType.init(inst, def);
9523
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
8644
9524
  inst.enum = def.entries;
8645
9525
  inst.options = Object.values(def.entries);
8646
9526
  const keys = new Set(Object.keys(def.entries));
@@ -8686,6 +9566,7 @@ function _enum(values, params) {
8686
9566
  var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
8687
9567
  $ZodLiteral.init(inst, def);
8688
9568
  ZodType.init(inst, def);
9569
+ inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
8689
9570
  inst.values = new Set(def.values);
8690
9571
  Object.defineProperty(inst, "value", {
8691
9572
  get() {
@@ -8699,6 +9580,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
8699
9580
  var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
8700
9581
  $ZodTransform.init(inst, def);
8701
9582
  ZodType.init(inst, def);
9583
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
8702
9584
  inst._zod.parse = (payload, _ctx) => {
8703
9585
  if (_ctx.direction === "backward") {
8704
9586
  throw new $ZodEncodeError(inst.constructor.name);
@@ -8736,6 +9618,7 @@ function transform(fn) {
8736
9618
  var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
8737
9619
  $ZodOptional.init(inst, def);
8738
9620
  ZodType.init(inst, def);
9621
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
8739
9622
  inst.unwrap = () => inst._zod.def.innerType;
8740
9623
  });
8741
9624
  function optional(innerType) {
@@ -8747,6 +9630,7 @@ function optional(innerType) {
8747
9630
  var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
8748
9631
  $ZodNullable.init(inst, def);
8749
9632
  ZodType.init(inst, def);
9633
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
8750
9634
  inst.unwrap = () => inst._zod.def.innerType;
8751
9635
  });
8752
9636
  function nullable(innerType) {
@@ -8758,6 +9642,7 @@ function nullable(innerType) {
8758
9642
  var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
8759
9643
  $ZodDefault.init(inst, def);
8760
9644
  ZodType.init(inst, def);
9645
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
8761
9646
  inst.unwrap = () => inst._zod.def.innerType;
8762
9647
  inst.removeDefault = inst.unwrap;
8763
9648
  });
@@ -8773,6 +9658,7 @@ function _default(innerType, defaultValue) {
8773
9658
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
8774
9659
  $ZodPrefault.init(inst, def);
8775
9660
  ZodType.init(inst, def);
9661
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
8776
9662
  inst.unwrap = () => inst._zod.def.innerType;
8777
9663
  });
8778
9664
  function prefault(innerType, defaultValue) {
@@ -8787,6 +9673,7 @@ function prefault(innerType, defaultValue) {
8787
9673
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
8788
9674
  $ZodNonOptional.init(inst, def);
8789
9675
  ZodType.init(inst, def);
9676
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
8790
9677
  inst.unwrap = () => inst._zod.def.innerType;
8791
9678
  });
8792
9679
  function nonoptional(innerType, params) {
@@ -8799,6 +9686,7 @@ function nonoptional(innerType, params) {
8799
9686
  var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
8800
9687
  $ZodCatch.init(inst, def);
8801
9688
  ZodType.init(inst, def);
9689
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
8802
9690
  inst.unwrap = () => inst._zod.def.innerType;
8803
9691
  inst.removeCatch = inst.unwrap;
8804
9692
  });
@@ -8812,6 +9700,7 @@ function _catch(innerType, catchValue) {
8812
9700
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
8813
9701
  $ZodPipe.init(inst, def);
8814
9702
  ZodType.init(inst, def);
9703
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
8815
9704
  inst.in = def.in;
8816
9705
  inst.out = def.out;
8817
9706
  });
@@ -8826,6 +9715,7 @@ function pipe2(in_, out) {
8826
9715
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
8827
9716
  $ZodReadonly.init(inst, def);
8828
9717
  ZodType.init(inst, def);
9718
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
8829
9719
  inst.unwrap = () => inst._zod.def.innerType;
8830
9720
  });
8831
9721
  function readonly(innerType) {
@@ -8837,11 +9727,13 @@ function readonly(innerType) {
8837
9727
  var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
8838
9728
  $ZodPromise.init(inst, def);
8839
9729
  ZodType.init(inst, def);
9730
+ inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
8840
9731
  inst.unwrap = () => inst._zod.def.innerType;
8841
9732
  });
8842
9733
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
8843
9734
  $ZodCustom.init(inst, def);
8844
9735
  ZodType.init(inst, def);
9736
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
8845
9737
  });
8846
9738
  function refine(fn, _params = {}) {
8847
9739
  return _refine(ZodCustom, fn, _params);
@@ -9273,7 +10165,8 @@ var openapi = ({
9273
10165
  swagger,
9274
10166
  scalar,
9275
10167
  references,
9276
- mapJsonSchema
10168
+ mapJsonSchema,
10169
+ embedSpec
9277
10170
  } = {}) => {
9278
10171
  if (!enabled) return new import_elysia2.Elysia({ name: "@elysiajs/openapi" });
9279
10172
  const info = {
@@ -9285,7 +10178,37 @@ var openapi = ({
9285
10178
  const relativePath = specPath.startsWith("/") ? specPath.slice(1) : specPath;
9286
10179
  let totalRoutes = 0;
9287
10180
  let cachedSchema;
9288
- const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" }).use((app2) => {
10181
+ const toFullSchema = ({
10182
+ paths,
10183
+ components: { schemas }
10184
+ }) => {
10185
+ return cachedSchema = {
10186
+ openapi: "3.0.3",
10187
+ ...documentation,
10188
+ tags: !exclude?.tags ? documentation.tags : documentation.tags?.filter(
10189
+ (tag) => !exclude.tags?.includes(tag.name)
10190
+ ),
10191
+ info: {
10192
+ title: "Elysia Documentation",
10193
+ description: "Development documentation",
10194
+ version: "0.0.0",
10195
+ ...documentation.info
10196
+ },
10197
+ paths: {
10198
+ ...paths,
10199
+ ...documentation.paths
10200
+ },
10201
+ components: {
10202
+ ...documentation.components,
10203
+ schemas: {
10204
+ ...schemas,
10205
+ ...documentation.components?.schemas
10206
+ }
10207
+ }
10208
+ };
10209
+ };
10210
+ const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" });
10211
+ app.use((app2) => {
9289
10212
  if (provider === null) return app2;
9290
10213
  const page = () => new Response(
9291
10214
  provider === "swagger-ui" ? SwaggerUIRender(info, {
@@ -9294,57 +10217,50 @@ var openapi = ({
9294
10217
  version: "latest",
9295
10218
  autoDarkMode: true,
9296
10219
  ...swagger
9297
- }) : ScalarRender(info, {
9298
- url: relativePath,
9299
- version: "latest",
9300
- cdn: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${scalar?.version ?? "latest"}/dist/browser/standalone.min.js`,
9301
- ...scalar,
9302
- _integration: "elysiajs"
9303
- }),
10220
+ }) : ScalarRender(
10221
+ info,
10222
+ {
10223
+ url: relativePath,
10224
+ version: "latest",
10225
+ cdn: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${scalar?.version ?? "latest"}/dist/browser/standalone.min.js`,
10226
+ ...scalar,
10227
+ _integration: "elysiajs"
10228
+ },
10229
+ embedSpec ? JSON.stringify(
10230
+ totalRoutes === app2.routes.length ? cachedSchema : toFullSchema(
10231
+ toOpenAPISchema(
10232
+ app2,
10233
+ exclude,
10234
+ references,
10235
+ mapJsonSchema
10236
+ )
10237
+ )
10238
+ ) : void 0
10239
+ ),
9304
10240
  {
9305
10241
  headers: {
9306
10242
  "content-type": "text/html; charset=utf8"
9307
10243
  }
9308
10244
  }
9309
10245
  );
9310
- return app2.get(path, isCloudflareWorker() ? page : page(), {
9311
- detail: {
9312
- hide: true
10246
+ return app2.get(
10247
+ path,
10248
+ embedSpec || isCloudflareWorker() ? page : page(),
10249
+ {
10250
+ detail: {
10251
+ hide: true
10252
+ }
9313
10253
  }
9314
- });
10254
+ );
9315
10255
  }).get(
9316
10256
  specPath,
9317
10257
  function openAPISchema() {
9318
- if (totalRoutes === app.routes.length) return cachedSchema;
10258
+ if (totalRoutes === app.routes.length && cachedSchema)
10259
+ return cachedSchema;
9319
10260
  totalRoutes = app.routes.length;
9320
- const {
9321
- paths,
9322
- components: { schemas }
9323
- } = toOpenAPISchema(app, exclude, references, mapJsonSchema);
9324
- return cachedSchema = {
9325
- openapi: "3.0.3",
9326
- ...documentation,
9327
- tags: !exclude?.tags ? documentation.tags : documentation.tags?.filter(
9328
- (tag) => !exclude.tags?.includes(tag.name)
9329
- ),
9330
- info: {
9331
- title: "Elysia Documentation",
9332
- description: "Development documentation",
9333
- version: "0.0.0",
9334
- ...documentation.info
9335
- },
9336
- paths: {
9337
- ...paths,
9338
- ...documentation.paths
9339
- },
9340
- components: {
9341
- ...documentation.components,
9342
- schemas: {
9343
- ...schemas,
9344
- ...documentation.components?.schemas
9345
- }
9346
- }
9347
- };
10261
+ return toFullSchema(
10262
+ toOpenAPISchema(app, exclude, references, mapJsonSchema)
10263
+ );
9348
10264
  },
9349
10265
  {
9350
10266
  error({ error }) {