import { i as version, r as handleError, t as build } from "./src-Bsolyx0i.mjs";
import process from "node:process";
import { loadConfig } from "@unocss/config";
import { toArray } from "@unocss/core";
import { cac } from "cac";

//#region src/cli-start.ts
async function startCli(cwd = process.cwd(), argv = process.argv, options = {}) {
	const cli = cac("unocss");
	cli.command("[...patterns]", "Glob patterns", { ignoreOptionDefaultValue: true }).option("-o, --out-file <file>", "Output file", { default: cwd }).option("--stdout", "Output to STDOUT", { default: false }).option("-c, --config [file]", "Config file").option("-w, --watch", "Watch for file changes").option("--write-transformed", "Update source files with transformed utilities", { default: false }).option("--preflights", "Enable preflights", { default: true }).option("-m, --minify", "Minify generated CSS", { default: false }).action(async (patterns, flags) => {
		var _config$cli;
		Object.assign(options, {
			cwd,
			...flags
		});
		if (patterns) options.patterns = patterns;
		const { config } = await loadConfig(cwd, options.config);
		const entries = toArray(((_config$cli = config.cli) === null || _config$cli === void 0 ? void 0 : _config$cli.entry) || options);
		await Promise.all(entries.map((entry) => build({
			...options,
			...entry
		})));
	});
	cli.help();
	cli.version(version);
	cli.parse(argv, { run: false });
	await cli.runMatchedCommand();
}

//#endregion
//#region src/cli.ts
startCli().catch(handleError);

//#endregion
export {  };