const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
const require_jiti = require('../../../../../jiti@2.4.2/node_modules/jiti/lib/jiti.cjs');
const require_untyped_BTwOq8Jl = require('../shared/untyped.BTwOq8Jl.cjs');
const require_babel = require('./babel.cjs');
let defu = require("defu");

//#region ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
async function loadSchema(entryPath, options = {}) {
	let rawSchema = await require_jiti.createJiti(options.cwd || process.cwd(), (0, defu.defu)(options.jiti, {
		interopDefault: true,
		transformOptions: { babel: { plugins: [[require_babel.babelPluginUntyped, { experimentalFunctions: true }]] } }
	})).import(entryPath);
	const rawSchemaKeys = Object.keys(rawSchema);
	if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === "default") rawSchema = rawSchema.default;
	return await require_untyped_BTwOq8Jl.resolveSchema(rawSchema, options.defaults, { ignoreDefaults: options.ignoreDefaults });
}

//#endregion
exports.loadSchema = loadSchema;