import axios from 'axios';
async function loadEmscriptenModuleMainThread(moduleRelativePathOrURL, baseUrl, queryParams) {
    let modulePrefix = 'unknown';
    if (typeof moduleRelativePathOrURL !== 'string') {
        modulePrefix = moduleRelativePathOrURL.href;
    }
    else if (moduleRelativePathOrURL.startsWith('http')) {
        modulePrefix = moduleRelativePathOrURL;
    }
    else {
        modulePrefix = typeof baseUrl !== 'undefined' ? `${baseUrl}/${moduleRelativePathOrURL}` : moduleRelativePathOrURL;
    }
    if (modulePrefix.endsWith('.js')) {
        modulePrefix = modulePrefix.substring(0, modulePrefix.length - 3);
    }
    if (modulePrefix.endsWith('.wasm')) {
        modulePrefix = modulePrefix.substring(0, modulePrefix.length - 5);
    }
    const wasmBinaryPath = `${modulePrefix}.wasm`;
    const response = await axios.get(wasmBinaryPath, { responseType: 'arraybuffer', params: queryParams });
    const wasmBinary = response.data;
    const fullModulePath = `${modulePrefix}.js`;
    const result = await import(/* webpackIgnore: true */ /* @vite-ignore */ fullModulePath);
    const instantiated = result.default({ wasmBinary });
    return instantiated;
}
export default loadEmscriptenModuleMainThread;
//# sourceMappingURL=load-emscripten-module-main-thread.js.map