"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logo = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const components_1 = require("../../../../components/index.js");
const utils_1 = require("../../../../components/Media/Image/utils.js");
const RouterLink_1 = tslib_1.__importDefault(require("../../../../components/RouterLink/RouterLink.js"));
const utils_2 = require("../../../../utils/index.js");
const locationContext_1 = require("../../../context/locationContext/index.js");
const theme_1 = require("../../../context/theme/index.js");
const i18n_1 = require("./i18n/index.js");
const b = (0, utils_2.block)('logo');
const Logo = ({ alt = (0, i18n_1.i18n)('image-alt'), ...restProps }) => {
    const props = { ...restProps, alt };
    const { hostname, Link } = React.useContext(locationContext_1.LocationContext);
    const theme = (0, theme_1.useTheme)();
    const themedLogoProps = (0, utils_2.getThemedValue)(props, theme) || props;
    const imageData = (0, utils_1.getMediaImage)(themedLogoProps.icon || props.icon);
    imageData.alt = alt;
    const textData = themedLogoProps.text || props.text;
    const url = themedLogoProps.url || props.url || '/';
    const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
    const linkExtraProps = (0, utils_2.getLinkProps)(url, hostname);
    const content = ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [imageData && (0, jsx_runtime_1.jsx)(components_1.Image, { className: b('icon'), ...imageData }), (0, jsx_runtime_1.jsx)("span", { className: b('text'), children: textData })] }));
    return ((0, jsx_runtime_1.jsx)(RouterLink_1.default, { href: url, passHref: true, children: Link ? ((0, jsx_runtime_1.jsx)("span", { className: b(null, props.className), children: content })) : ((0, jsx_runtime_1.jsx)("a", { className: b(null, props.className), href: url, title: urlTitle, ...linkExtraProps, children: content })) }));
};
exports.Logo = Logo;
exports.default = exports.Logo;
//# sourceMappingURL=Logo.js.map
