"use client";
import { isOptionsGroup } from "./is-options-group.mjs";
//#region packages/@mantine/core/src/components/Combobox/OptionsDropdown/default-options-filter.ts
function defaultOptionsFilter({ options, search, limit }) {
	const parsedSearch = search.trim().toLowerCase();
	const result = [];
	for (let i = 0; i < options.length; i += 1) {
		const item = options[i];
		if (result.length === limit) return result;
		if (isOptionsGroup(item)) result.push({
			group: item.group,
			items: defaultOptionsFilter({
				options: item.items,
				search,
				limit: limit - result.length
			})
		});
		if (!isOptionsGroup(item)) {
			if (item.label.toLowerCase().includes(parsedSearch)) result.push(item);
		}
	}
	return result;
}
//#endregion
export { defaultOptionsFilter };

//# sourceMappingURL=default-options-filter.mjs.map