/*
 * 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 = ["M15 0H1C.4 0 0 .5 0 1v12c0 .6.4 1 1 1h4.126A4 4 0 0 1 5 13a2 2 0 0 1-1.731-1H2v-2h1.264q.132-.23.319-.417L4.166 9H2V7h12v1.352c.623.705 1 1.632 1 2.648.364 0 .706.098 1 .269V1c0-.5-.4-1-1-1M6 6H2V4h4zm4 0H7V4h3zm4 0h-3V4h3zm-4.29 4.29-2-2A1 1 0 0 0 7 8c-.28 0-.53.11-.71.29l-2 2a1.003 1.003 0 0 0 1.42 1.42l.29-.3V13c0 1.66 1.34 3 3 3 .55 0 1-.45 1-1s-.45-1-1-1-1-.45-1-1v-1.59l.29.3a1.003 1.003 0 0 0 1.42-1.42m.58 3.42 2 2c.18.18.43.29.71.29s.53-.11.71-.29l2-2a1.003 1.003 0 0 0-1.42-1.42l-.29.3V11c0-1.66-1.34-3-3-3-.55 0-1 .45-1 1s.45 1 1 1 1 .45 1 1v1.59l-.29-.3a1.003 1.003 0 0 0-1.42 1.42"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M19 1H1c-.6 0-1 .5-1 1v16c0 .5.4 1 1 1h8a5 5 0 0 1-.9-2H8v-1c-.364 0-.706-.098-1-.269V17H2v-3h4c0-.362.095-.704.264-1H2v-3h5v2.166l1-1V10h4v1.166l.129.128c.164-.433.475-.795.871-1.025V10h5v1.999c.628.836 1 1.875 1 3.001.364 0 .706.098 1 .269V2c0-.5-.5-1-1-1M7 9H2V6h5zm5 0H8V6h4zm6 0h-5V6h5zm0 7.59V15c0-2.21-1.79-4-4-4-.55 0-1 .45-1 1s.45 1 1 1c1.1 0 2 .9 2 2v1.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 19 16c-.28 0-.53.11-.71.3zm-9-2.18V16c0 2.21 1.79 4 4 4 .55 0 1-.45 1-1s-.45-1-1-1c-1.1 0-2-.9-2-2v-1.59l.29.3a1.003 1.003 0 0 0 1.42-1.42l-2-2A1 1 0 0 0 10 11c-.28 0-.53.11-.71.29l-2 2A1.003 1.003 0 0 0 8 15c.28 0 .53-.11.71-.3z"] as readonly string[];

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