/*
 * 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 = ["m13.154 5.944.016-.014c.18-.14.36-.28.57-.42l.63-.45c.21-.16.41-.33.61-.51s.37-.38.52-.59.28-.45.37-.7.13-.54.13-.85c0-.25-.04-.51-.12-.79-.07-.29-.2-.55-.39-.79a2.2 2.2 0 0 0-.73-.6C14.47.08 14.1 0 13.65 0c-.4 0-.76.08-1.07.23-.31.16-.58.37-.79.62-.22.27-.38.59-.49.96s-.16.77-.16 1.2h1.19c.01-.27.03-.53.08-.77.04-.24.11-.45.21-.62.09-.18.22-.32.38-.42s.35-.15.59-.15c.26 0 .47.05.63.14.15.09.28.21.37.35q.135.21.18.45c.03.16.05.31.05.45-.01.31-.08.58-.22.82-.14.23-.32.45-.53.65-.22.21-.46.39-.71.57q-.39.27-.75.54c-.5.36-.89.78-1.17 1.27S11.01 7.35 11 8h4.99V6.86h-3.55c.05-.17.14-.33.27-.49.126-.145.28-.281.444-.426M6.2 4.4a1 1 0 0 1 1.6 1.2L5.25 9l2.55 3.4a1 1 0 0 1-1.6 1.2L4 10.667 1.8 13.6a1 1 0 0 1-1.6-1.2L2.75 9 .2 5.6a1 1 0 0 1 1.6-1.2L4 7.333z"] as readonly string[];

/** Path data for the 20px grid; matches {@link generate-icon-paths.mjs} / `<Icon />` from core. */
const PATHS_20 = ["M16.024 7.96c.16-.19.34-.38.56-.55.21-.18.449-.36.709-.53.25-.18.5-.36.749-.56.25-.2.49-.41.73-.63.229-.22.439-.47.629-.74.18-.27.33-.56.44-.88S20 3.4 20 3c0-.32-.05-.65-.14-1s-.25-.68-.47-.97a2.5 2.5 0 0 0-.869-.74c-.36-.2-.809-.29-1.348-.29-.49 0-.93.1-1.299.29-.37.18-.69.44-.949.78-.26.33-.45.73-.58 1.2-.13.46-.2.96-.2 1.5h1.43c.01-.35.04-.67.09-.97s.14-.56.25-.78.259-.39.449-.52.43-.19.709-.19q.465 0 .75.18c.189.12.339.26.449.43s.18.36.22.56q.06.3.06.57c-.01.38-.1.72-.26 1.02-.15.3-.37.57-.63.83-.26.25-.54.49-.849.71-.31.22-.61.45-.889.68-.6.45-1.059.98-1.408 1.58-.35.61-.52 1.32-.53 2.13h5.984V8.57h-4.276c.06-.21.17-.42.33-.61M.224 6.63a1 1 0 1 1 1.563-1.248L5 9.4l3.213-4.017A1 1 0 1 1 9.776 6.63L6.28 11l3.495 4.369a1 1 0 1 1-1.563 1.249L5 12.6l-3.213 4.016A1 1 0 1 1 .224 15.37L3.72 11z"] as readonly string[];

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