"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
const require_smol_vfs = require('../../smol/vfs.js');
let node_path = require("node:path");
node_path = require_runtime.__toESM(node_path);
let node_process = require("node:process");
node_process = require_runtime.__toESM(node_process);

//#region src/external-tools/jre/from-vfs.ts
/**
* @file `jreFromVfs()` — extracts the JRE directory tree from the smol binary's
*   VFS and returns the resolved-shape pointing into the extracted directory.
*   Uses the post-alignment `getSmolVfs()` API (matches upstream `node:vfs`).
*   Returns `undefined` when:
*
*   - Not running on a smol binary with the aligned binding
*   - The binary has no SEA payload (`getSmolVfs() === undefined`)
*   - The `jre` key doesn't exist in the payload
*/
/**
* Relative VFS key for the bundled JRE. Passed as a bare suffix to
* `vfs.extract()` — the binding handles prefix concatenation.
*/
const JRE_VFS_KEY = "jre";
async function jreFromVfs() {
	const vfs = /* @__PURE__ */ require_smol_vfs.getSmolVfs();
	if (!vfs) return;
	/* c8 ignore start - smol Node binary only. */
	if (!vfs.has("jre")) return;
	const javaHome = await vfs.extract("jre");
	return {
		javaPath: node_path.default.join(javaHome, "bin", node_process.default.platform === "win32" ? "java.exe" : "java"),
		javaHome,
		source: "vfs"
	};
	/* c8 ignore stop */
}

//#endregion
exports.JRE_VFS_KEY = JRE_VFS_KEY;
exports.jreFromVfs = jreFromVfs;