var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

// src/engine/utils.ts
function defaultEngineDuplicate(engine, wasCalled = {
  value: false
}) {
  return async () => {
    const engineConstructor = engine.constructor;
    const [argsForNewInstance, newInstanceCallback] = await engineConstructor.new(engine.__argumentsUsed);
    const newInstance = newInstanceCallback();
    newInstance.__argumentsUsed = argsForNewInstance;
    newInstance.initializedModels = {
      ...engine.initializedModels
    };
    newInstance.__modelsOfEngine = {
      ...engine.__modelsOfEngine
    };
    newInstance.__modelsFilteredOutOfEngine = {
      ...engine.__modelsFilteredOutOfEngine
    };
    newInstance.__indirectlyRelatedModels = {
      ...engine.__indirectlyRelatedModels
    };
    wasCalled.value = true;
    return newInstance;
  };
}
__name(defaultEngineDuplicate, "defaultEngineDuplicate");
export {
  defaultEngineDuplicate
};
