import { inspectList } from "./helpers.js";

//#region ../../node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js
function inspectMapEntry([key, value], options) {
	options.truncate -= 4;
	key = options.inspect(key, options);
	options.truncate -= key.length;
	value = options.inspect(value, options);
	return `${key} => ${value}`;
}
function mapToEntries(map) {
	const entries = [];
	map.forEach((value, key) => {
		entries.push([key, value]);
	});
	return entries;
}
function inspectMap(map, options) {
	if (map.size === 0) return "Map{}";
	options.truncate -= 7;
	return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
}

//#endregion
export { inspectMap as default };