async function initDB() {
	// If the database is already available, don't do anything
	if (db) return;

	// If the database is already initializing, don't try to do it twice
	// Instead, let the call wait for the initPromise
	if (initializing) return withTimeout(initPromise);
	// This call is the first (to execute), don't let anybody else try
	// to initialize the database
	initializing = true;
	try {
		const useEh = await getPlatformFeatures().then((x) => x.wasmExceptions);

		const DUCKDB_CONFIG = useEh
			? {
					mainModule: (await import('@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url')).default,
					mainWorker: (await import('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js?worker'))
						.default
				}
			: {
					mainModule: (await import('@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm?url')).default,
					mainWorker: (await import('@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?worker'))
						.default
				};

		const logger = import.meta.env.VITE_EVIDENCE_DEBUG ? new ConsoleLogger() : new VoidLogger();
		const worker = new DUCKDB_CONFIG.mainWorker();

		// use an intermediate variable to prevent db from being a not-ready database
		const _db = new AsyncDuckDB(logger, worker);
		window[Symbol.for('EVIDENCE_QUERY_ENGINE')] = _db;

		await _db.instantiate(DUCKDB_CONFIG.mainModule);
		db = _db;

		await db.open({
			query: {
				castBigIntToDouble: true,
				castTimestampToDate: true,
				castDecimalToDouble: true,
				castDurationToTime64: true
			}
		});
		connection = await db.connect();

		// https://duckdb.org/2024/09/09/announcing-duckdb-110.html#breaking-sql-changes
		await connection.query('SET ieee_floating_point_ops = false;');
		// https://duckdb.org/2024/02/13/announcing-duckdb-0100.html#breaking-sql-changes
		await connection.query('SET old_implicit_casting = true;');

		resolveInit();
	} catch (e) {
		rejectInit(e);
		throw e;
	}
}
Initializes the database.

@returns {Promise<void>}