"use client";
const require_is_options_group = require("./is-options-group.cjs");
//#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 (require_is_options_group.isOptionsGroup(item)) result.push({
			group: item.group,
			items: defaultOptionsFilter({
				options: item.items,
				search,
				limit: limit - result.length
			})
		});
		if (!require_is_options_group.isOptionsGroup(item)) {
			if (item.label.toLowerCase().includes(parsedSearch)) result.push(item);
		}
	}
	return result;
}
//#endregion
exports.defaultOptionsFilter = defaultOptionsFilter;

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