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

function IconKeyComponent(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-key${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="M30 3c8.284 0 15 6.716 15 15 0 8.284-6.716 15-15 15a14.936 14.936 0 01-9.235-3.179l-4.425 5.273 3.127 2.624a1 1 0 01.123 1.408l-1.286 1.533a1 1 0 01-1.409.123l-3.126-2.624-5.062 6.032a1 1 0 01-1.409.123l-1.532-1.285a1 1 0 01-.123-1.409l12.213-14.555c.034-.04.07-.077.108-.111A14.927 14.927 0 0115 18c0-8.284 6.716-15 15-15zm0 4c-6.075 0-11 4.925-11 11s4.925 11 11 11 11-4.925 11-11S36.075 7 30 7z"/></svg>;
}

const IconKey = React.forwardRef(IconKeyComponent);
export default IconKey;
