'use strict';

var chunkNI4NLRQH_cjs = require('./chunk-NI4NLRQH.cjs');
var chunkNSJWJXU4_cjs = require('./chunk-NSJWJXU4.cjs');
var ts = require('typescript');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var ts__default = /*#__PURE__*/_interopDefault(ts);

// src/vendor/type-compiler/index.ts
chunkNSJWJXU4_cjs.init_cjs_shims();

// ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_a435fd598596ef57e87e4cc551b9d92d/node_modules/@deepkit/type-compiler/dist/esm/index.js
chunkNSJWJXU4_cjs.init_cjs_shims();

// ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_a435fd598596ef57e87e4cc551b9d92d/node_modules/@deepkit/type-compiler/dist/esm/src/loader.js
chunkNSJWJXU4_cjs.init_cjs_shims();
var DeepkitLoader = class {
  static {
    chunkNSJWJXU4_cjs.__name(this, "DeepkitLoader");
  }
  constructor() {
    this.options = {
      allowJs: true,
      declaration: false
    };
    this.host = ts__default.default.createCompilerHost(this.options);
    this.program = ts__default.default.createProgram([], this.options, this.host);
    this.printer = ts__default.default.createPrinter({
      newLine: ts__default.default.NewLineKind.LineFeed
    });
    this.cache = new chunkNI4NLRQH_cjs.Cache();
    this.knownFiles = {};
    this.sourceFiles = {};
    const originReadFile = this.host.readFile;
    this.host.readFile = (fileName) => {
      if (this.knownFiles[fileName]) return this.knownFiles[fileName];
      return originReadFile.call(this.host, fileName);
    };
    this.host.writeFile = () => {
    };
    const originalGetSourceFile = this.host.getSourceFile;
    this.host.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
      if (this.sourceFiles[fileName]) return this.sourceFiles[fileName];
      return originalGetSourceFile.call(this.host, fileName, languageVersion, onError, shouldCreateNewSourceFile);
    };
  }
  transform(source, path) {
    this.knownFiles[path] = source;
    const sourceFile = ts__default.default.createSourceFile(path, source, ts__default.default.ScriptTarget.ESNext, true, path.endsWith(".tsx") ? ts__default.default.ScriptKind.TSX : ts__default.default.ScriptKind.TS);
    let newSource = source;
    ts__default.default.transform(sourceFile, [
      (context) => {
        const transformer2 = new chunkNI4NLRQH_cjs.ReflectionTransformer(context, this.cache).forHost(this.host).withReflection({
          reflection: "default",
          reflectionLevel: "normal"
        });
        return (node) => {
          const sourceFile2 = transformer2.transformSourceFile(node);
          newSource = this.printer.printNode(ts__default.default.EmitHint.SourceFile, sourceFile2, sourceFile2);
          return sourceFile2;
        };
      }
    ], this.options);
    return newSource;
  }
};

Object.defineProperty(exports, "Cache", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.Cache; }
});
Object.defineProperty(exports, "DeclarationTransformer", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.DeclarationTransformer; }
});
Object.defineProperty(exports, "ReflectionTransformer", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.ReflectionTransformer; }
});
Object.defineProperty(exports, "debugPackStruct", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.debugPackStruct; }
});
Object.defineProperty(exports, "declarationTransformer", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.declarationTransformer; }
});
Object.defineProperty(exports, "encodeOps", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.encodeOps; }
});
Object.defineProperty(exports, "packSize", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.packSize; }
});
Object.defineProperty(exports, "packSizeByte", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.packSizeByte; }
});
Object.defineProperty(exports, "transformer", {
  enumerable: true,
  get: function () { return chunkNI4NLRQH_cjs.transformer; }
});
exports.DeepkitLoader = DeepkitLoader;
//# sourceMappingURL=index.cjs.map
//# sourceMappingURL=index.cjs.map