'use strict';

var chunkUDZGL4UX_cjs = require('./chunk-UDZGL4UX.cjs');
var chunkGJADEAFP_cjs = require('./chunk-GJADEAFP.cjs');

// ../../node_modules/.pnpm/@standard-community+standard-openapi@0.2.9_@standard-community+standard-json@0.3.5_@sta_a8f2af4507f30d3c5e839067d4aa4952/node_modules/@standard-community/standard-openapi/dist/zod-DSgpEGAE.js
function getToOpenAPISchemaFn2() {
  return async (schema, context) => {
    if ("_zod" in schema) {
      return chunkUDZGL4UX_cjs.getToOpenAPISchemaFn()(schema, {
        components: context.components,
        options: { io: "input", ...context.options }
      });
    }
    try {
      const { createSchema } = await import('zod-openapi');
      const { schema: _schema, components } = createSchema(
        // @ts-expect-error
        schema,
        { schemaType: "input", ...context.options }
      );
      if (components) {
        context.components.schemas = {
          ...context.components.schemas,
          ...components
        };
      }
      return _schema;
    } catch {
      throw new Error(
        chunkGJADEAFP_cjs.errorMessageWrapper(`Missing dependencies "zod-openapi v4".`)
      );
    }
  };
}

module.exports = getToOpenAPISchemaFn2;
//# sourceMappingURL=zod-DSgpEGAE-Z7XWMQKD.cjs.map
//# sourceMappingURL=zod-DSgpEGAE-Z7XWMQKD.cjs.map