/*
 * 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 = ["M7 4c3.31 0 6-.9 6-2s-2.69-2-6-2C3.68 0 1 .9 1 2s2.68 2 6 2m-6-.48V8c0 .55.67 1.049 1.755 1.411l1.828-1.828A2 2 0 0 1 6 7c.548 0 1.052.218 1.417.583l.59.59A2 2 0 0 1 8 8c0-.527.18-1.044.568-1.432S9.473 6 10 6a4.97 4.97 0 0 1 3 1.005V3.52C11.78 4.4 9.56 5 7 5s-4.78-.6-6-1.48m0 6c.327.236.725.451 1.182.64A2.003 2.003 0 0 0 4.1 12.997a5.02 5.02 0 0 0 1.867 2.973C3.148 15.806 1 14.983 1 14zM14 11c0-2.2-1.8-4-4-4-.6 0-1 .4-1 1s.4 1 1 1c1.1 0 2 .9 2 2v.59l-.29-.3a1.003 1.003 0 0 0-1.42 1.42l2 2c.18.18.43.29.71.29s.53-.11.71-.29l2-2A1.003 1.003 0 0 0 15 11c-.28 0-.53.11-.71.3l-.29.29zm-9.29.71a1.003 1.003 0 0 1-1.42-1.42l2-2C5.47 8.11 5.72 8 6 8s.53.11.71.29l2 2A1.003 1.003 0 0 1 8 12c-.28 0-.53-.11-.71-.3L7 11.41V12c0 1.1.9 2 2 2 .6 0 1 .4 1 1s-.4 1-1 1c-2.2 0-4-1.8-4-4v-.59z"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M1 4.1v5.4c0 1.293 3.145 2.358 7.179 2.487l.404-.404A2 2 0 0 1 10 11c.548 0 1.052.217 1.417.583l.272.272q.16-.017.318-.038c.037-.462.218-.906.56-1.25.389-.387.906-.567 1.433-.567a4.96 4.96 0 0 1 2.268.546c.47-.318.732-.672.732-1.046V4.1C15.51 5.23 12.49 6 9 6c-3.48 0-6.5-.77-8-1.9m0 7c1.24.934 3.516 1.622 6.233 1.832l-.65.65A2.003 2.003 0 0 0 8.1 16.998c.15.74.465 1.42.904 2.003H9c-4.42 0-8-1.12-8-2.5zM9 5c4.42 0 8-1.12 8-2.5S13.42 0 9 0 1 1.12 1 2.5 4.59 5 9 5m5 6c2.2 0 4 1.8 4 4v.59l.29-.29c.18-.19.43-.3.71-.3a1.003 1.003 0 0 1 .71 1.71l-2 2c-.18.18-.43.29-.71.29s-.53-.11-.71-.29l-2-2a1.003 1.003 0 0 1 1.42-1.42l.29.3V15c0-1.1-.9-2-2-2-.6 0-1-.4-1-1s.4-1 1-1m-6 5c.28 0 .53-.11.71-.29l.29-.3V16c0 2.2 1.8 4 4 4 .6 0 1-.4 1-1s-.4-1-1-1c-1.1 0-2-.9-2-2v-.59l.29.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71l-2-2A1 1 0 0 0 10 12c-.28 0-.53.11-.71.29l-2 2A1.003 1.003 0 0 0 8 16"] as readonly string[];

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