/**
 * amis-ui v6.14.0-beta.1
 * Copyright 2018-2025 fex
 */

import { __extends, __rest, __assign, __decorate, __metadata } from 'tslib';
import React__default from 'react';
import { autobind, themeable } from 'amis-core';
import { Icon } from './icons.js';

var Link = /** @class */ (function (_super) {
    __extends(Link, _super);
    function Link(props) {
        return _super.call(this, props) || this;
    }
    Link.prototype.handleClick = function (e) {
        var _a = this.props, disabled = _a.disabled, onClick = _a.onClick;
        if (disabled) {
            e.preventDefault();
            e.stopPropagation();
            return;
        }
        onClick === null || onClick === void 0 ? void 0 : onClick(e);
    };
    Link.prototype.render = function () {
        var _a = this.props, className = _a.className, style = _a.style, href = _a.href, cx = _a.classnames, disabled = _a.disabled, htmlTarget = _a.htmlTarget, title = _a.title, icon = _a.icon, rightIcon = _a.rightIcon, children = _a.children; _a.classPrefix; _a.theme; var rest = __rest(_a, ["className", "style", "href", "classnames", "disabled", "htmlTarget", "title", "icon", "rightIcon", "children", "classPrefix", "theme"]);
        return (React__default.createElement("a", __assign({}, rest, { href: href, target: htmlTarget, className: cx("Link", {
                'is-disabled': disabled
            }, className), style: style, title: title, onClick: this.handleClick }),
            icon ? React__default.createElement(Icon, { cx: cx, icon: icon, className: "Link-icon" }) : null,
            children,
            rightIcon ? (React__default.createElement(Icon, { cx: cx, icon: rightIcon, className: "Link-icon" })) : null));
    };
    __decorate([
        autobind,
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object]),
        __metadata("design:returntype", void 0)
    ], Link.prototype, "handleClick", null);
    return Link;
}(React__default.Component));
var Link$1 = themeable(Link);

export { Link, Link$1 as default };
