"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("react/jsx-runtime");
require("clsx");
require("react");
const isOptionsGroup = require("../Combobox/OptionsDropdown/is-options-group.cjs");
function filterPickedTags({ data, value }) {
  const normalizedValue = value.map((item) => item.trim().toLowerCase());
  const filtered = data.reduce((acc, item) => {
    if (isOptionsGroup.isOptionsGroup(item)) {
      acc.push({
        group: item.group,
        items: item.items.filter(
          (option) => normalizedValue.indexOf(option.label.toLowerCase().trim()) === -1
        )
      });
    } else if (normalizedValue.indexOf(item.label.toLowerCase().trim()) === -1) {
      acc.push(item);
    }
    return acc;
  }, []);
  return filtered;
}
exports.filterPickedTags = filterPickedTags;
