import { getToOpenAPISchemaFn } from './chunk-OM4GXHMV.js';
import { errorMessageWrapper } from './chunk-SMZZ3IKP.js';

// ../../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 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(
        errorMessageWrapper(`Missing dependencies "zod-openapi v4".`)
      );
    }
  };
}

export { getToOpenAPISchemaFn2 as default };
//# sourceMappingURL=zod-DSgpEGAE-EQIA3EQN.js.map
//# sourceMappingURL=zod-DSgpEGAE-EQIA3EQN.js.map