/*
 * 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 0a1 1 0 0 1 .993.883L16 1v14a1 1 0 0 1-.883.993L15 16h-3a1 1 0 0 1-.117-1.993L12 14h2V2h-2a1 1 0 0 1-.993-.883L11 1a1 1 0 0 1 .883-.993L12 0zM4 0a1 1 0 0 1 .117 1.993L4 2H2v12h2a1 1 0 0 1 .993.883L5 15a1 1 0 0 1-.883.993L4 16H1a1 1 0 0 1-.993-.883L0 15V1A1 1 0 0 1 .883.007L1 0zm1.61 5q.771 0 1.343.637.573.637.573 1.716 0 1.257-.773 2.252-.772.995-2.437 1.609v-.465l.233-.095a3.1 3.1 0 0 0 1.274-1.017q.55-.757.55-1.577a.5.5 0 0 0-.057-.26q-.027-.056-.074-.056-.046 0-.149.075-.297.214-.744.214-.54 0-.944-.433A1.45 1.45 0 0 1 4 6.572q0-.633.465-1.102Q4.931 5 5.61 5m4.474 0q.772 0 1.344.637T12 7.353q0 1.257-.772 2.252T8.79 11.214v-.465l.233-.095a3.1 3.1 0 0 0 1.274-1.017q.549-.757.549-1.577a.5.5 0 0 0-.056-.26q-.029-.056-.075-.056-.045 0-.149.075-.297.214-.744.214-.54 0-.944-.433a1.45 1.45 0 0 1-.405-1.028q0-.633.466-1.102T10.084 5"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M19 0a1 1 0 0 1 .993.883L20 1v18a1 1 0 0 1-.883.993L19 20h-4a1 1 0 0 1-.117-1.993L15 18h3V2h-3a1 1 0 0 1-.993-.883L14 1a1 1 0 0 1 .883-.993L15 0zM5 0a1 1 0 0 1 .117 1.993L5 2H2v16h3a1 1 0 0 1 .993.883L6 19a1 1 0 0 1-.883.993L5 20H1a1 1 0 0 1-.993-.883L0 19V1A1 1 0 0 1 .883.007L1 0zm2.012 6q.965 0 1.68.797.715.796.715 2.145a4.47 4.47 0 0 1-.965 2.814Q7.476 13 5.395 13.767v-.581l.26-.104a3.87 3.87 0 0 0 1.624-1.285q.686-.949.686-1.971 0-.221-.07-.326-.035-.07-.093-.07t-.186.093q-.372.268-.93.268-.675 0-1.18-.541A1.82 1.82 0 0 1 5 7.965q0-.79.581-1.378A1.93 1.93 0 0 1 7.011 6m5.593 0q.965 0 1.68.797.715.796.715 2.145a4.47 4.47 0 0 1-.965 2.814q-.966 1.245-3.047 2.011v-.581l.26-.104a3.87 3.87 0 0 0 1.624-1.285q.686-.949.686-1.971 0-.221-.07-.326-.034-.07-.093-.07-.057 0-.186.093-.372.268-.93.268-.675 0-1.18-.541a1.82 1.82 0 0 1-.506-1.285q0-.79.581-1.378A1.93 1.93 0 0 1 12.604 6"] as readonly string[];

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