import { __rest, __assign } from '../../node_modules/tslib/tslib.es6.js';
import React, { forwardRef, useMemo } from 'react';
import { chakra, useMultiStyleConfig } from '@chakra-ui/react';

var Link = forwardRef(function (_a, ref) {
    var _b = _a.as, as = _b === void 0 ? chakra.a : _b, children = _a.children, _c = _a.isExternal, isExternal = _c === void 0 ? false : _c, rel = _a.rel, target = _a.target, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, _d = _a.variant, variant = _d === void 0 ? 'baseLink' : _d, _e = _a.fontWeight, fontWeight = _e === void 0 ? 'regular' : _e, rest = __rest(_a, ["as", "children", "isExternal", "rel", "target", "leftIcon", "rightIcon", "variant", "fontWeight"]);
    var styles = useMultiStyleConfig('Link', { variant: variant });
    var Component = useMemo(function () {
        return chakra(as, {
            baseStyle: styles.link,
        });
    }, [as, styles.link]);
    var textStyle = __assign(__assign({}, (leftIcon ? styles.leftIcon : {})), (rightIcon ? styles.rightIcon : {}));
    return (React.createElement(Component, __assign({ target: target || (isExternal ? '_blank' : undefined), rel: rel || (isExternal ? 'noopener noreferrer' : undefined), ref: ref, fontWeight: fontWeight }, rest),
        leftIcon,
        React.createElement(chakra.span, { __css: textStyle }, children),
        rightIcon));
});
Link.displayName = 'Link';

export { Link as default };
//# sourceMappingURL=index.js.map
