import { __assign, __rest } from "tslib";
// @ts-nocheck
import './Link.css';
import React, { forwardRef, useRef } from 'react';
import mergeRefs from 'react-merge-refs';
import { cn } from '../../utils/bem';
export var cnLink = cn('Link');
export var Link = forwardRef(function (_a, ref) {
    var _b = _a.view, view = _b === void 0 ? 'primary' : _b, _c = _a.pseudo, pseudo = _c === void 0 ? false : _c, leftAddons = _a.leftAddons, rightAddons = _a.rightAddons, className = _a.className, dataTestId = _a.dataTestId, children = _a.children, _d = _a.colors, colors = _d === void 0 ? 'default' : _d, restProps = __rest(_a, ["view", "pseudo", "leftAddons", "rightAddons", "className", "dataTestId", "children", "colors"]);
    var linkRef = useRef(null);
    var componentProps = {
        className: cnLink({ view: view }, [className]),
        rel: restProps.target === '_blank' ? 'noreferrer noopener' : undefined
    };
    return (React.createElement("a", __assign({}, componentProps, restProps, { ref: mergeRefs([linkRef, ref]) }), leftAddons || rightAddons ? (React.createElement(React.Fragment, null,
        leftAddons && (React.createElement("span", { className: cnLink('LeftAddon') }, leftAddons)),
        children && (React.createElement("span", null,
            React.createElement("span", { className: cnLink('Text') }, children))),
        rightAddons && (React.createElement("span", { className: cnLink('RightAddon') }, rightAddons)))) : (React.createElement("span", { className: cnLink('Text') }, children))));
});
