import React, { ForwardedRef, useContext } from 'react';
import { OriginIconProps } from '../type';
import { Context } from '../context';

function IconSelectedComponent(props: OriginIconProps, ref: ForwardedRef<SVGSVGElement>) {
    const { prefix: prefixFromContext } = useContext(Context);
    const { className = '', prefix: prefixFromProps, width = '1em', height = '1em', useCurrentColor = false, spin, ...rest } = props;

    const prefix = prefixFromProps || prefixFromContext || 'hiagent';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-selected${loadingKls} ${className}`} width={width} height={height} xmlns="http://www.w3.org/2000/svg" fill={useCurrentColor ? 'currentColor' : 'none'} viewBox="0 0 24 24" {...rest} ref={ref}><path fill={useCurrentColor ? 'currentColor' : '#1664FF'} d="M4 0h12a8 8 0 0 1 8 8v12H8a4 4 0 0 1-4-4V0Z"/><path fill={useCurrentColor ? 'currentColor' : '#fff'} fillRule="evenodd" d="M19.325 6.175a1.167 1.167 0 0 1 0 1.65l-5.5 5.5a1.167 1.167 0 0 1-1.65 0l-3-3a1.167 1.167 0 1 1 1.65-1.65L13 10.85l4.675-4.675a1.167 1.167 0 0 1 1.65 0Z" clipRule="evenodd"/><path fill={useCurrentColor ? 'currentColor' : '#1664FF'} fillRule="evenodd" d="M4 0H0v1h1a3 3 0 0 1 3 3V0Zm20 20v4h-1v-1a3 3 0 0 0-3-3h4Z" clipRule="evenodd"/></svg>;
}

const IconSelected = React.forwardRef(IconSelectedComponent);
export default IconSelected;
