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

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

    const prefix = prefixFromProps || prefixFromContext || 'hiagent';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-Image${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 18 18" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path fillRule="evenodd" clipRule="evenodd" d="M4.33325 2.33325C3.22869 2.33325 2.33325 3.22869 2.33325 4.33325V13.6666C2.33325 14.7712 3.22869 15.6666 4.33325 15.6666H13.6666C14.7712 15.6666 15.6666 14.7712 15.6666 13.6666V4.33325C15.6666 3.22869 14.7712 2.33325 13.6666 2.33325H4.33325ZM7.66658 5.99992C7.66658 6.92039 6.92039 7.66658 5.99992 7.66658C5.07945 7.66658 4.33325 6.92039 4.33325 5.99992C4.33325 5.07945 5.07945 4.33325 5.99992 4.33325C6.92039 4.33325 7.66658 5.07945 7.66658 5.99992ZM12.138 8.80465C11.8777 8.54432 11.4555 8.54432 11.1952 8.80465L8.33325 11.6666L7.47133 10.8047C7.21097 10.5443 6.78886 10.5443 6.52851 10.8047L4.33325 12.9999V13.6666H6.33325H8.99992H13.6666V10.3333L12.138 8.80465Z"/></svg>;
}

const IconImage = React.forwardRef(IconImageComponent);
export default IconImage;
