/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
//#region ../css/dist/commands/css.helpers.mjs
/*! © 2026 Yahoo, Inc. UDS CSS v0.0.0-development */
const parseWorkersOption = (value) => {
	if (typeof value !== "string" || value === "auto") return;
	const num = Number(value);
	if (!Number.isInteger(num) || num < 1) return;
	return num;
};
const isTruthyFlag = (value) => value === true || value === "true";
const stringOption = (value) => typeof value === "string" ? value : void 0;
const entryOption = (value) => {
	if (typeof value === "string") return value;
	if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value;
};
const shouldShowHelp = (options) => isTruthyFlag(options.help) || isTruthyFlag(options.h);
const isInitCommand = (firstArg) => firstArg === "init";
const getCssInitOptions = (options) => ({
	force: isTruthyFlag(options.force),
	configPath: stringOption(options.config),
	entry: entryOption(options.entry),
	outputPath: stringOption(options.outFile)
});
const getCssRunOptions = (workspaceDir, options) => {
	return {
		workspaceDir,
		outFile: stringOption(options.outFile) ?? "dist/uds.css",
		themeConfigPath: stringOption(options.theme) ?? "uds.theme.ts",
		scope: stringOption(options.scope),
		entryOption: entryOption(options.entry),
		configOption: stringOption(options.config),
		watch: isTruthyFlag(options.watch) || isTruthyFlag(options.w),
		silent: isTruthyFlag(options.silent) || isTruthyFlag(options.s),
		verbose: isTruthyFlag(options.verbose) || isTruthyFlag(options.v),
		workers: parseWorkersOption(options.workers)
	};
};
//#endregion
exports.getCssInitOptions = getCssInitOptions;
exports.getCssRunOptions = getCssRunOptions;
exports.isInitCommand = isInitCommand;
exports.shouldShowHelp = shouldShowHelp;
