/*
 * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

const UNMARKED_BACKGROUND_COLORS = ["#8F99A8"];
const UNMARKED_TEXT_COLOR = "#FFFFFF";
const UNMARKED_CLASSIFICATION_STRING = "UNMARKED";
export const EMPTY_ARRAY = [];
export function backgroundFromColors(backgroundColors) {
  return backgroundColors.length > 1 ? `linear-gradient(to right, ${backgroundColors.join(", ")})` : backgroundColors[0] ?? "transparent";
}
export function resolveBannerDisplay(banner) {
  return {
    classificationString: banner?.classificationString ?? UNMARKED_CLASSIFICATION_STRING,
    textColor: banner?.textColor ?? UNMARKED_TEXT_COLOR,
    backgroundColors: banner?.backgroundColors ?? UNMARKED_BACKGROUND_COLORS
  };
}
export function groupMarkingsByCategory(markingIds, categories, markings) {
  if (markingIds.length === 0 || categories === undefined || markings === undefined) {
    return [];
  }
  const selected = new Set(markingIds);
  const categoryNames = new Map(categories.map(c => [c.id, c.name]));
  const grouped = new Map();
  for (const marking of markings) {
    if (selected.has(marking.id)) {
      const name = categoryNames.get(marking.categoryId) ?? marking.categoryId;
      const list = grouped.get(name);
      if (list !== undefined) {
        list.push(marking.name);
      } else {
        grouped.set(name, [marking.name]);
      }
    }
  }
  return Array.from(grouped, ([categoryName, markingNames]) => ({
    categoryName,
    markingNames
  }));
}
export function resolveRequiredGroups(categoryGroups, requiredMarkingGroups) {
  const markingIdToName = new Map(categoryGroups.flatMap(g => g.markings).map(m => [m.id, m.name]));
  return requiredMarkingGroups.map(ids => ({
    markingNames: ids.map(id => markingIdToName.get(id) ?? id)
  }));
}
//# sourceMappingURL=cbacPickerUtils.js.map