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

function IconLinkComponent(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 || 'hkgai';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-Link${loadingKls} ${className}`} width={width} height={height} viewBox="0 0 24 24" fill={useCurrentColor ? 'currentColor' : '#000'} xmlns="http://www.w3.org/2000/svg" {...rest} ref={ref}><path d="M22.5 8.27134C22.4624 9.57695 21.9256 10.8184 21 11.7401L17.7422 14.9998C17.2678 15.4769 16.7034 15.8551 16.0817 16.1126C15.4601 16.37 14.7935 16.5016 14.1207 16.4998H14.116C13.4316 16.4993 12.7543 16.3617 12.1241 16.095C11.4938 15.8284 10.9234 15.4381 10.4465 14.9473C9.96958 14.4565 9.59587 13.8751 9.34744 13.2375C9.099 12.5998 8.98088 11.9188 9.00005 11.2348C9.00564 11.0359 9.09002 10.8473 9.23463 10.7106C9.37924 10.5739 9.57223 10.5003 9.77114 10.5059C9.97005 10.5115 10.1586 10.5958 10.2953 10.7405C10.432 10.8851 10.5056 11.0781 10.5 11.277C10.4864 11.7606 10.5698 12.2422 10.7454 12.693C10.921 13.1439 11.1852 13.5551 11.5224 13.9021C11.8596 14.2492 12.2629 14.5251 12.7085 14.7136C13.1541 14.9022 13.633 14.9995 14.1169 14.9998C14.5926 15.001 15.0638 14.9079 15.5032 14.7259C15.9427 14.5439 16.3417 14.2766 16.6772 13.9395L19.935 10.6817C20.6072 10.001 20.9828 9.08213 20.9798 8.12556C20.9768 7.169 20.5955 6.25246 19.9191 5.57606C19.2427 4.89967 18.3261 4.51834 17.3696 4.51535C16.413 4.51236 15.4941 4.88794 14.8135 5.56009L13.7822 6.59134C13.6404 6.72605 13.4516 6.80005 13.2561 6.79754C13.0605 6.79504 12.8736 6.71624 12.7353 6.57793C12.597 6.43963 12.5182 6.25278 12.5157 6.05721C12.5132 5.86163 12.5872 5.67282 12.7219 5.53103L13.7532 4.49978C14.2289 4.02383 14.7938 3.64629 15.4155 3.3887C16.0373 3.13111 16.7036 2.99854 17.3766 2.99854C18.0496 2.99854 18.716 3.13111 19.3377 3.3887C19.9594 3.64629 20.5243 4.02383 21 4.49978C21.4928 4.9938 21.88 5.58293 22.1378 6.23133C22.3957 6.87972 22.5189 7.5738 22.5 8.27134ZM10.2188 17.4054L9.18755 18.4367C8.85119 18.7752 8.45089 19.0436 8.0099 19.2261C7.56892 19.4086 7.09605 19.5016 6.6188 19.4998C5.90283 19.4992 5.2031 19.2864 4.60801 18.8883C4.01293 18.4902 3.54919 17.9247 3.2754 17.2631C3.00161 16.6016 2.93006 15.8737 3.06977 15.1715C3.20948 14.4693 3.5542 13.8243 4.06036 13.3179L7.31255 10.0601C7.82478 9.54515 8.48002 9.19613 9.19316 9.05836C9.9063 8.92059 10.6444 9.00043 11.3116 9.28752C11.9788 9.57461 12.5442 10.0557 12.9345 10.6683C13.3247 11.2808 13.5218 11.9966 13.5 12.7226C13.4945 12.9215 13.5681 13.1145 13.7048 13.2591C13.8415 13.4037 14.03 13.4881 14.229 13.4937C14.4279 13.4993 14.6209 13.4256 14.7655 13.2889C14.9101 13.1522 14.9945 12.9637 15 12.7648C15.0181 12.0683 14.8944 11.3755 14.6365 10.7283C14.3787 10.0811 13.992 9.49303 13.5 8.99978C12.5393 8.03943 11.2364 7.49994 9.87801 7.49994C8.51958 7.49994 7.21675 8.03943 6.25598 8.99978L3.00005 12.2576C2.28401 12.9733 1.79622 13.8853 1.59831 14.8782C1.4004 15.871 1.50125 16.9003 1.88813 17.8359C2.275 18.7715 2.93053 19.5714 3.77188 20.1345C4.61323 20.6977 5.60263 20.9988 6.61505 20.9998C7.28805 21.0017 7.95475 20.8701 8.57656 20.6127C9.19837 20.3552 9.76292 19.9769 10.2375 19.4998L11.2688 18.4685C11.3902 18.3256 11.4536 18.1423 11.4465 17.9549C11.4395 17.7675 11.3624 17.5895 11.2307 17.4561C11.0989 17.3227 10.9219 17.2435 10.7346 17.2341C10.5473 17.2247 10.3633 17.2858 10.2188 17.4054Z"/></svg>;
}

const IconLink = React.forwardRef(IconLinkComponent);
export default IconLink;
