'use strict';

var tslib_es6 = require('../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
var jsxRuntime = require('react/jsx-runtime');
var server = require('next-intl/server');
var utils = require('@windrun-huaiin/lib/utils');

function SiteX(_a) {
    return tslib_es6.__awaiter(this, void 0, void 0, function* () {
        var { locale, type, namespace, tKey, className } = _a, props = tslib_es6.__rest(_a, ["locale", "type", "namespace", "tKey", "className"]);
        // 默认命名空间和key
        let ns = namespace;
        let key = tKey;
        if (!ns) {
            ns = type === 'site' ? 'home' : 'footer';
        }
        if (!key) {
            key = type === 'site' ? 'title' : 'email';
        }
        const t = yield server.getTranslations({ locale, namespace: ns });
        const text = t(key, { defaultValue: type === 'site' ? 'Site----' : '----@example.com' });
        if (type === 'site') {
            return (jsxRuntime.jsx("strong", Object.assign({}, props, { className: utils.cn('font-extrabold text-sm', className), children: text })));
        }
        if (type === 'email') {
            return (jsxRuntime.jsx("a", Object.assign({}, props, { href: `mailto:${text}`, className: utils.cn('font-mono underline text-sm', className), children: text })));
        }
        return null;
    });
}

exports.SiteX = SiteX;
