"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_object = require('../../primordials/object.js');
const require_smol_manifest = require('../../smol/manifest.js');

//#region src/eco/manifest/analyze-lockfile.ts
/**
* @file `analyzeLockfile(lockfile)` — returns a `LockfileStats` summary (counts
*   by dep type, total packages, per-ecosystem breakdown). `maxDepth` +
*   `avgDepth` are reported as 0 — the JS-side `ParsedLockfile` shape doesn't
*   preserve a dep-tree, only the flat package list. Matches socket-btm's smol
*   behavior exactly.
*/
function jsAnalyzeLockfile(lockfile) {
	let prodDeps = 0;
	let devDeps = 0;
	let optionalDeps = 0;
	const pkgs = lockfile.packages;
	for (let i = 0, { length } = pkgs; i < length; i++) switch (pkgs[i].depType) {
		case "prod":
			prodDeps++;
			break;
		case "dev":
			devDeps++;
			break;
		case "optional":
			optionalDeps++;
			break;
	}
	return require_primordials_object.ObjectFreeze({
		__proto__: null,
		totalPackages: pkgs.length,
		prodDeps,
		devDeps,
		optionalDeps,
		byEcosystem: require_primordials_object.ObjectFreeze({
			__proto__: null,
			[lockfile.ecosystem]: pkgs.length
		}),
		maxDepth: 0,
		avgDepth: 0
	});
}
const _smol = /* @__PURE__ */ require_smol_manifest.getSmolManifest();
const analyzeLockfile = _smol ? _smol.analyzeLockfile : jsAnalyzeLockfile;

//#endregion
exports.analyzeLockfile = analyzeLockfile;
exports.jsAnalyzeLockfile = jsAnalyzeLockfile;