var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { implementRuntimeComponent } from '@subscan/widget-runtime';
import { Type } from '@sinclair/typebox';
import { PRESET_PROPERTY_CATEGORY } from '@subscan/widget-shared';
import { css, cx } from '@emotion/css';
import { VERSION } from 'config/constants';
import { StyledFont14 } from 'ui/common';
var flexStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  display: inline-flex;\n  justify-content: center;\n  align-items: center;\n  * + span {\n    margin-left: 5px;\n  }\n"], ["\n  display: inline-flex;\n  justify-content: center;\n  align-items: center;\n  * + span {\n    margin-left: 5px;\n  }\n"])));
export default implementRuntimeComponent({
    version: VERSION.Core,
    metadata: {
        name: 'title',
        displayName: 'Title',
        description: 'Can be placed in front of modules and paragraphs as headings.',
        exampleProperties: {
            text: 'Subscan Title',
        },
        annotations: {
            category: PRESET_PROPERTY_CATEGORY.Basic,
        },
    },
    spec: {
        properties: Type.Object({
            text: Type.String({ title: 'Text' }),
        }),
        state: Type.Object({
            isHover: Type.Boolean(),
        }),
        methods: {},
        slots: {
            prefix: {
                slotProps: Type.Object({}),
            },
        },
        styleSlots: ['content'],
        events: ['onClick'],
    },
})(function (_a) {
    var text = _a.text, elementRef = _a.elementRef, customStyle = _a.customStyle, callbackMap = _a.callbackMap, slotsElements = _a.slotsElements, mergeState = _a.mergeState;
    var onMouseEnter = function () {
        mergeState({
            isHover: true,
        });
    };
    var onMouseLeave = function () {
        mergeState({
            isHover: false,
        });
    };
    var onClick = function () {
        var _a;
        (_a = callbackMap === null || callbackMap === void 0 ? void 0 : callbackMap.onClick) === null || _a === void 0 ? void 0 : _a.call(callbackMap);
    };
    return (_jsxs("div", __assign({ className: cx(css(customStyle === null || customStyle === void 0 ? void 0 : customStyle.content), flexStyle), ref: elementRef, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick }, { children: [slotsElements.prefix ? slotsElements.prefix({}) : null, _jsx(StyledFont14, __assign({ bold: true }, { children: text }))] })));
});
var templateObject_1;
