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

function IconSyncComponent(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-sync${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 48 48" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path fillRule="evenodd" clipRule="evenodd" d="M13.314 13.1974L14.7409 12.0686 12.2591 8.93159 10.6472 10.2068 10.565 10.289C3.47163 17.3823 3.15939 28.6889 9.62823 36.1532 12.4416 39.3995 16.3318 41.6371 20.5611 42.4119L21.2819 38.4774C18.3926 37.9481 15.6303 36.5676 13.3934 34.3307 7.5621 28.4993 7.53566 19.0614 13.314 13.1974zM27.4353 5.03271C31.0975 5.70362 34.6023 7.45635 37.4315 10.2855 44.8515 17.7055 44.8515 29.7356 37.4315 37.1555L36.0172 38.5698 33.1888 35.7413 34.6031 34.3271C40.4609 28.4693 40.4609 18.9718 34.6031 13.1139 32.3661 10.877 29.6039 9.49655 26.7145 8.96724L27.4353 5.03271z"/><path fillRule="evenodd" clipRule="evenodd" d="M36 36.7998C35.4477 36.7998 35 36.3521 35 35.7998V31.2998C35 30.7475 34.5523 30.2998 34 30.2998H32C31.4477 30.2998 31 30.7475 31 31.2998V38.7998C31 39.9044 31.8954 40.7998 33 40.7998H40.5C41.0523 40.7998 41.5 40.3521 41.5 39.7998V37.7998C41.5 37.2475 41.0523 36.7998 40.5 36.7998H36zM12.5 11C13.0523 11 13.5 11.4477 13.5 12V16.5C13.5 17.0523 13.9477 17.5 14.5 17.5H16.5C17.0523 17.5 17.5 17.0523 17.5 16.5L17.5 9.00003C17.5 7.89546 16.6046 7.00003 15.5 7.00003L8 7.00003C7.44771 7.00003 7 7.44774 7 8.00003L7 10C7 10.5523 7.44771 11 8 11L12.5 11z"/></svg>;
}

const IconSync = React.forwardRef(IconSyncComponent);
export default IconSync;
