/*
 * Copyright 2024 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.
 */

import * as React from "react";
import type { SVGIconProps } from "../../svgIconProps";
import { IconSize } from "../../iconTypes";
import { SVGIconContainer } from "../../svgIconContainer";

/** Path data for the 16px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_16 = ["M3 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2m3 1q0 .07-.003.14c.255.081.538.209.832.41.406.28.8.676 1.171 1.225.37-.549.765-.945 1.171-1.224a3.1 3.1 0 0 1 .832-.411L10 4a3 3 0 1 1 .773 2.01 1.04 1.04 0 0 0-.47.19c-.291.2-.752.672-1.227 1.8.475 1.128.936 1.6 1.227 1.8.183.126.336.173.47.19a3 3 0 1 1-.77 1.87 3.1 3.1 0 0 1-.832-.41c-.406-.28-.8-.676-1.171-1.225-.37.549-.765.945-1.171 1.224-.294.202-.577.33-.832.411Q6 11.93 6 12a3 3 0 1 1-.773-2.01c.134-.017.287-.064.47-.19.291-.2.752-.672 1.227-1.8-.475-1.128-.936-1.6-1.227-1.8a1.04 1.04 0 0 0-.47-.19A3 3 0 1 1 6 4m6 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0m-9 7a1 1 0 1 0 0 2 1 1 0 0 0 0-2m9 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M17 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 2a3 3 0 0 1-2.73-1.754 4 4 0 0 0-.617.264c-.884.465-1.92 1.418-2.605 3.49.685 2.072 1.721 3.025 2.605 3.49q.315.164.617.264a3 3 0 1 1-.165 2.034 6.3 6.3 0 0 1-1.383-.528c-.983-.518-1.948-1.364-2.722-2.705-.774 1.34-1.739 2.187-2.722 2.705a6.3 6.3 0 0 1-1.383.528A3 3 0 0 1 0 15a3 3 0 0 1 5.73-1.246q.302-.1.617-.264c.884-.465 1.92-1.418 2.605-3.49-.685-2.072-1.721-3.025-2.605-3.49a4 4 0 0 0-.617-.264 3 3 0 1 1 .165-2.034c.433.11.904.276 1.383.528.983.518 1.948 1.364 2.722 2.705.774-1.34 1.739-2.187 2.722-2.705a6.3 6.3 0 0 1 1.383-.528A3 3 0 0 1 20 5a3 3 0 0 1-3 3M4 5a1 1 0 1 0-2 0 1 1 0 0 0 2 0m12 10a1 1 0 1 0 2 0 1 1 0 0 0-2 0M3 14a1 1 0 1 0 0 2 1 1 0 0 0 0-2"] as readonly string[];

export const ManyToMany: React.FC<SVGIconProps> = React.forwardRef<any, SVGIconProps>((props, ref) => {
    const isLarge = (props.size ?? IconSize.STANDARD) >= IconSize.LARGE;
    const paths = isLarge ? PATHS_20 : PATHS_16;
    return (
        <SVGIconContainer iconName="many-to-many" ref={ref} {...props}>
            {paths.map((d, i) => (
                <path key={i} d={d} fillRule="evenodd" />
            ))}
        </SVGIconContainer>
    );
});
ManyToMany.displayName = `Blueprint6.Icon.ManyToMany`;
export default ManyToMany;
