'use strict';

var chunkSLZS6XBQ_cjs = require('./chunk-SLZS6XBQ.cjs');
var chunkUJUTNY7M_cjs = require('./chunk-UJUTNY7M.cjs');
var chunkAF3E2D32_cjs = require('./chunk-AF3E2D32.cjs');
var exists = require('@stryke/path/exists');
var filePathFns = require('@stryke/path/file-path-fns');
var joinPaths = require('@stryke/path/join-paths');

async function resolveType(context, entry) {
  const transpilePath = joinPaths.joinPaths(context.envPaths.temp, "transpiled", filePathFns.findFilePath(entry.file));
  const path = await chunkUJUTNY7M_cjs.resolvePath(context, entry.file);
  if (!path || !exists.existsSync(path)) {
    throw new Error(`Module not found: ${entry.file}. Please check the path and try again.`);
  }
  const result = await chunkSLZS6XBQ_cjs.bundle(context, path, transpilePath, {
    write: true
  }, {
    skipTransform: true
  });
  if (result.errors.length > 0) {
    throw new Error(`Failed to transpile ${entry.file}: ${result.errors.map((error) => error.text).join(", ")}`);
  }
  const resolved = await context.resolver.import(context.resolver.esmResolve(`${joinPaths.joinPaths(transpilePath, filePathFns.findFileName(entry.file).replace(filePathFns.findFileExtension(entry.file), ""))}.js`));
  let exportName = entry.name;
  if (!exportName) {
    exportName = "default";
  }
  const resolvedType = resolved[exportName] ?? resolved[`__\u03A9${exportName}`];
  if (!resolvedType) {
    throw new Error(`Unable to resolve type ${exportName} in ${entry.file}. Please check the path and try again.`);
  }
  return resolvedType;
}
chunkAF3E2D32_cjs.__name(resolveType, "resolveType");
async function reflectType(context, entry) {
  return (void 0)(await resolveType(context, entry));
}
chunkAF3E2D32_cjs.__name(reflectType, "reflectType");

exports.reflectType = reflectType;
exports.resolveType = resolveType;
//# sourceMappingURL=chunk-IYTJBWRE.cjs.map
//# sourceMappingURL=chunk-IYTJBWRE.cjs.map