/*
 * 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 1a2.998 2.998 0 0 1 1 5.825V10c0 .51.159.705.266.794.139.116.383.206.734.206h1.586l-.793-.793a1 1 0 0 1 1.414-1.414l2.5 2.5.064.071a1 1 0 0 1 .205.415l.014.083q.007.045.009.09v.096l-.006.052a1 1 0 0 1-.181.482l-.037.049-.068.076-2.5 2.5a1 1 0 0 1-1.414-1.414L6.586 13H5c-.649 0-1.405-.16-2.016-.669C2.341 11.795 2 10.991 2 10V6.825A2.998 2.998 0 0 1 3 1M8.793.793a1 1 0 1 1 1.414 1.414L9.414 3H11c.649 0 1.405.16 2.016.669.643.536.984 1.34.984 2.331v3.174A2.998 2.998 0 0 1 13 15a3 3 0 0 1-1-5.826V6c0-.51-.159-.705-.266-.794C11.595 5.09 11.351 5 11 5H9.414l.793.793a1 1 0 1 1-1.414 1.414l-2.5-2.5a1 1 0 0 1-.287-.607L6 4.048V3.95q.002-.045.009-.089l.014-.083a1 1 0 0 1 .204-.416l.065-.07zM13 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2M3 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M3 1a2.998 2.998 0 0 1 1 5.825V13c0 .846.21 1.297.457 1.543.246.246.697.457 1.543.457h4.586l-1.293-1.293a1 1 0 1 1 1.414-1.414l3 3 .064.071a1 1 0 0 1 .205.415l.014.083q.007.045.009.09v.096l-.005.045a1 1 0 0 1-.2.512l-.019.026-.068.076-3 3a1 1 0 0 1-1.414-1.414L10.586 17H6c-1.154 0-2.203-.29-2.957-1.043C2.289 15.203 2 14.154 2 13V6.825A2.998 2.998 0 0 1 3 1M9.293.293a1 1 0 1 1 1.414 1.414L9.414 3H14c1.154 0 2.203.29 2.957 1.043C17.711 4.797 18 5.846 18 7v6.174A2.998 2.998 0 0 1 17 19a3 3 0 0 1-1-5.826V7c0-.846-.21-1.297-.457-1.543C15.297 5.211 14.846 5 14 5H9.414l1.293 1.293a1 1 0 1 1-1.414 1.414l-3-3-.068-.076-.02-.027a1 1 0 0 1-.2-.504q-.001-.027-.004-.052v-.096q.002-.045.009-.09l.014-.083q.014-.057.035-.112a1 1 0 0 1 .17-.303l.064-.071zM17 15a1 1 0 1 0 0 2 1 1 0 0 0 0-2M3 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2"] as readonly string[];

export const GitRebase: 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="git-rebase" ref={ref} {...props}>
            {paths.map((d, i) => (
                <path key={i} d={d} fillRule="evenodd" />
            ))}
        </SVGIconContainer>
    );
});
GitRebase.displayName = `Blueprint6.Icon.GitRebase`;
export default GitRebase;
